Commit graph

560 commits

Author SHA1 Message Date
Vlad Zahorodnii
7a3fa88f02 Drop flag to indicate if swap buffers is blocking
We want the new compositing timing algorithm to be invariant regarding
whether glXSwapBuffers() or eglSwapBuffers() block.
2021-01-06 16:59:29 +00:00
Vlad Zahorodnii
2152598cc4 Drop the swap profiler
In hindsight, we want to swap buffers after finishing a compositing
cycle, therefore there is no need for the swap profiler.
2021-01-06 16:59:29 +00:00
Vlad Zahorodnii
0ceff5fd24 Swap buffers after finishing a compositing cycle
The compositing timing algorithm assumes that glXSwapBuffers() and
eglSwapBuffers() block. While this was true long time ago with NVIDIA
drivers, nowadays, it's not the case. The NVIDIA driver queues
several buffers in advance and if the application runs out of them,
it will block. With Mesa driver, swapping buffer was never blocking.

This change makes the render backends swap buffers right after ending
a compositing cycle. This may potentially block, but it shouldn't be
an issue with modern drivers. In case it gets proven, we can move
glXSwapBuffers() and eglSwapBuffers() in a separate thread.

Note that this change breaks the compositing timing algorithm, but
it's already sort of broken with Mesa drivers.
2021-01-06 16:59:29 +00:00
Vlad Zahorodnii
7e5c16989e Drop hwcomposer backend
Plasma Mobile announced that they plan to drop support for Halium
devices, see the announcement blog post [1] for the reasons that led to
such a decision.

But just to summarize, here are some of the key points from the post:

 * Some of our team members no longer have access to reference LG Nexus
   5X device anymore
 * After KDE Neon switched to using Ubuntu 20.04 we no longer are
   updating the rootfs for halium devices
 * After several important architecture changes in upstream KWin, the
   hwcomposer backend might be broken and we have no way of verifying it

If the community members are interested in reviving the hwcomposer
backend,

  * it pretty much needs rewrite/re-thinking given differences of hwc1
    and hwc2 API for hwcomposer part of it, see also [2]
  * It also needs removal of Android 5 based libhardware API as we don't
    think code can be kept sane with 3 different levels of ifdefs
  * This backend needs better way of fixing difference between
    CAF/non-CAF devices then just recompiling with different headers,
    maybe env vars?
  * This backend does not support various things like transformation/
    rotation etc, and is not exactly feature complete as the DRM backend

[1] https://www.plasma-mobile.org/2020/12/14/plasma-mobile-technical-debt.html
[2] 83f563c339
2021-01-05 17:38:36 +00:00
Vlad Zahorodnii
6adfe3064f Drop Platform::createScreens()
Since the Screens class is a convenience wrapper around AbstractOutput
objects that come from the Platform, it should not be platform-specific.

By dropping createScreens(), output-related code becomes simpler.
2020-12-21 09:20:16 +00:00
Vlad Zahorodnii
935a6d7e21 platforms/x11: Drop XRandrScreens::displaySize()
The default implementation of Screens::displaySize() returns the
bounding rectangle of all available outputs.

In case the Xrandr extension is unavailable, there will be a fake
output whose dimensions are the same as the dimensions of all screens
combined.
2020-12-21 09:20:16 +00:00
Vlad Zahorodnii
2567d0c935 platforms/x11: Init outputs during platform initialization 2020-12-21 09:20:16 +00:00
Vlad Zahorodnii
8a606e47c4 platforms/x11: Introduce X11PlaceholderOutput
It is useful in case the Xrandr extension is unavailable or no outputs
are connected.
2020-12-21 09:20:16 +00:00
Vlad Zahorodnii
79ca5ccd26 Merge OutputScreens into Screens
Since all platforms have been ported to AbstractOutput, OutputScreens
can be merged into Screens. This simplifies the class hierarchy.
2020-12-17 13:36:30 +00:00
Vlad Zahorodnii
a2c765800b Drop Screens::supportsTransformations
It's used nowhere.
2020-12-17 07:36:50 +00:00
Xaver Hugl
2da1b3211e Fix login modeset 2020-12-15 20:20:10 +00:00
Vlad Zahorodnii
ecac025a2a Port wayland code away from factory methods in KWaylandServer::Display 2020-12-14 13:05:47 +00:00
Vlad Zahorodnii
6b2e6cfd53 Prevent EGL headers from including Xlib headers
One of the annoying things about EGL headers is that they include
platform headers by default, e.g. on X11, it's Xlib.h, etc.

The problem with Xlib.h is that it uses the define compiler directive to
declare constants and those constants have very generic names, e.g.
'None', which typically conflict with enums, etc.

In order to work around bad things coming from Xlib.h, we include
fixx11.h file that contains some workarounds to redefine some Xlib's
types.

There's a flag or rather two flags (EGL_NO_PLATFORM_SPECIFIC_TYPES and
EGL_NO_X11) that are cross-vendor and they can be used to prevent EGL
headers from including platform specific headers, such as Xlib.h [1]

The benefit of setting those two flags is that you can simply include
EGL/egl.h or epoxy/egl.h and the world won't explode due to Xlib.h

MESA_EGL_NO_X11_HEADERS is set to support older versions of Mesa.

[1] https://github.com/KhronosGroup/EGL-Registry/pull/111
2020-12-10 11:15:06 +02:00
Vlad Zahorodnii
8e060e7218 Prepare kwin for compiling with EGL_NO_PLATFORM_SPECIFIC_TYPES 2020-12-10 10:54:45 +02:00
Vlad Zahorodnii
5943eea4c9 Introduce Platform::{outputEnabled,outputDisabled} signals
These signals can be useful if you want to know what output exactly has
been disabled or enabled.

The outputEnabled signal is emitted after the outputAdded signal, and
the outputDisabled signal is emitted before the outputRemoved signal.
2020-12-09 17:44:00 +00:00
Vlad Zahorodnii
94201cbadd Remove unused signal in Platform 2020-12-09 16:54:15 +02:00
David Edmundson
1e2f2a28c7 Port to kwayland-server socket changes 2020-12-09 07:23:40 +00:00
Vlad Zahorodnii
279aef103e platforms/wayland: Print a warning message if buffer swap fails
If eglSwapBuffers() fails, frame scheduling will be broken. KWin can't
recover from that, but still, having a log message might be useful for
the debugging purposes.
2020-12-08 11:16:31 +00:00
Vlad Zahorodnii
592633eed7 Fix KWIN_BUILD_XRENDER_COMPOSITING build option 2020-12-08 11:23:12 +02:00
Vlad Zahorodnii
d99e6b5d2a platforms/x11: Move XRenderBackend to platformsupport directory
This change moves the XRender backend to platformsupport directory,
similar to the OpenGL and the QPainter backend. This allows to put
platform-specific logic in XRenderBackend.
2020-12-08 08:50:19 +00:00
Vlad Zahorodnii
e320f76fb0 platforms/virtual: Emit missing outputAdded signal 2020-12-03 22:06:07 +02:00
Vlad Zahorodnii
41a5362136 platforms/wayland: Add initial HiDPI support
This can be useful for test purposes and for people who have HiDPI monitors.
2020-12-03 15:59:54 +00:00
Vlad Zahorodnii
f1483b11af platforms/virtual: Emit outputAdded and outputRemoved
Otherwise things that rely on those two signals may introduce undefined
behavior in autotests.
2020-12-02 20:55:30 +02:00
Vlad Zahorodnii
9d5a1b0531 platforms/virtual: Remove redundant m_enabledOutputs
It's the same as VirtualBackend::m_outputs.
2020-12-02 20:52:01 +02:00
Vlad Zahorodnii
ebf4e082c1 platforms/hwcomposer: Emit outputAdded 2020-12-02 20:51:14 +02:00
Vlad Zahorodnii
64260000d6 platforms/fbdev: Emit outputAdded 2020-12-02 20:51:14 +02:00
Vlad Zahorodnii
2d5482b013 plugins/x11: Emit outputAdded and outputRemoved
Currently, these two signals are emitted primarily only on Wayland, but
in order to have consistent core API, it's better to emit them on X11 too.
2020-12-02 20:51:14 +02:00
Vlad Zahorodnii
389407805c platforms/drm: Properly clean up the shadow framebuffer object
In case hardware transforms can be used again, the shadow framebuffer
must be destroyed; otherwise rendered results will be distorted due to a
mismatch between the dimensions of the shadow framebuffer and the mode
size.
2020-12-02 16:05:08 +00:00
Vlad Zahorodnii
017528956b Move Scene::isPerScreenRenderingEnabled() to Platform
This way the Compositor can know if per screen rendering is enabled
before creating the Scene.
2020-12-02 15:32:30 +00:00
Vlad Zahorodnii
b94c876597 Fix crash in eglTerminate()
At the moment, the gbm_device for the primary device is destroyed before
the EGLDisplay is destroyed. This results in a crash in Mesa.

In order to fix the crash, this change ensures that the EGLDisplay is
destroyed before the gbm device.
2020-12-02 15:32:02 +00:00
Vlad Zahorodnii
afc77c82f3 platforms/x11: Set reasonable refresh rate for dummy output
A refresh rate of -1 may break compositing scheduling code that relies
on the refresh rate being valid.
2020-12-02 09:10:09 +00:00
Vlad Zahorodnii
e3e6b3de2d platforms/x11: Use correct logging category 2020-12-02 08:34:50 +00:00
Xaver Hugl
b460909212 Small refactor in the drm backends 2020-12-01 16:58:24 +00:00
Johnny Jazeix
8c3355bdc0 fix compilation in FreeBSD, errno is defined in errno.h 2020-11-29 19:31:49 +01:00
Xaver Hugl
9ab688067a Create egl backend for multiple backends and enable multi-gpu usage for the gbm backend 2020-11-28 17:53:41 +00:00
Vlad Zahorodnii
2a8395c7dd Trim trailing whitespace 2020-11-28 11:01:47 +00:00
Vlad Zahorodnii
6f83132bd1 Introduce Platform::{outputAdded, outputRemoved} signals
These new signals can be useful if you are interested only in when a
specific output gets added or removed.
2020-11-24 17:51:32 +02:00
Aleix Pol
4f484180cd Add emit to signal calls
To signify they're emitting.
2020-11-19 22:32:08 +01:00
Xaver Hugl
cb9ccdb0fd Don't check atomic property non_desktop when not using atomic mode setting 2020-11-17 08:10:51 +00:00
Vlad Zahorodnii
f26eeb9706 Use consistent naming for begin/end frame hooks
Currently, the OpenGLBackend and the QPainterBackend have hooks to
indicate the start and the end of compositing cycle, but in both cases,
the hooks have different names. This change fixes that inconsistency.
2020-11-12 09:14:57 +02:00
Vlad Zahorodnii
76303888ab Unify begin/end frame hooks in OpenGLBackend 2020-11-12 09:14:54 +02:00
Vlad Zahorodnii
755dd81e49 Refactor how per screen rendering is handled
In order to allow per screen rendering, we need the Compositor to be
able to drive rendering on each screen. Currently, it's not possible
because Scene::paint() paints all screen.

With this change, the Compositor will be able to ask the Scene to paint
only a screen with the specific id.
2020-11-11 22:03:45 +02:00
Vlad Zahorodnii
94b731c196 Prepare QPainter render backend for per screen rendering 2020-11-11 07:22:10 +00:00
Vlad Zahorodnii
edfb0a3fd9 Drop support for X11 overlay windows in QPainter render backend
It's unused.
2020-11-11 07:22:10 +00:00
Aleix Pol
d0939dee8b Prefer function pointer to slot string 2020-11-07 02:56:44 +01:00
Aleix Pol
69eb8789ba drm: Make sure the screens are turned on when we come from suspend
Listen to logind for resume notification and turn the outputs on when it
happens, much like we do when pressing a key.

This way laptops come back on when the lid opens.

BUG: 428424
2020-11-03 17:59:02 +00:00
Vlad Zahorodnii
d5203c79a0 Report partial updates on all outputs
Previously, we couldn't do it because repaints weren't tracked per each
output.
2020-10-30 20:47:05 +00:00
Vlad Zahorodnii
648dab44da platforms/drm: Don't intersect the final output damage twice 2020-10-30 09:41:37 +00:00
Vlad Zahorodnii
458ea6dc5e platforms/wayland: Enable buffer age for all outputs 2020-10-30 07:24:01 +00:00
Vlad Zahorodnii
ac203818b7 platforms/drm: Enable buffer age for all outputs 2020-10-30 07:24:01 +00:00