Commit graph

174 commits

Author SHA1 Message Date
Xaver Hugl
8528bbf800 backends/drm: ignore placholder outputs for the output config
They can only introduce intermediary state when a real output gets enabled
and are not relevant to the actual output config
2021-11-16 17:08:08 +01:00
Xaver Hugl
b6b0af727d backends/drm: don't take crtcs from dpms disabled outputs
Fixes a crash I have with dpms + suspend, which was caused by the udev
event for updating outputs being called before the output got enabled
again. When DrmGpu::updateOutputs got called it removed the crtc from
the inactive output and then disabled the output afterwards. Instead,
only remove crtcs if an output is really disabled.
This also allows to generalize the logic for lease outputs, and could
in the future allow for faster dpms on/off switching.
2021-11-16 17:05:31 +01:00
Xaver Hugl
47d5d50bdf backends/drm: don't assume we have a cursor plane
CCBUG: 445507
2021-11-16 16:16:30 +01:00
Vlad Zahorodnii
7228e9aefd Unify beginFrame() and endFrame() hooks for OpenGL and QPainter backends
This unifies frame hooks for OpenGL and QPainter render backends. There
are a couple of reasons why it's a good idea - it provides one mental
framework to start painting a frame, the Compositor will be able to
start and submit frames. The last one is very cool because it gives the
Compositor more power over compositing.

Besides unifying frame hooks, this cleans up a bit the arg naming mess
in endFrame(). As is, "damage" and "damagedRegion" are very confusing
names. "damage" arg has been renamed to "renderedRegion," because that's
what it is. The renderedRegion arg specifies the region that has been
repainted by the Scene. It's different from the damagedRegion as that
one specifies the surface damage, i.e. the difference between the
current and the next frame, while the renderedRegion may include a
region that had to be repainted to repair the back buffer. The main
reason why we need renderedRegion is the X11 platform. On Wayland, it's
unused.

In the future, we will need to extend this api with output layers.
2021-11-16 10:43:56 +00:00
Xaver Hugl
0afd0aa4be backends/drm: some simplifications for multi gpu
There is only one type of egl backend now, so the abstract backend can be
removed
2021-11-12 09:30:13 +01:00
Xaver Hugl
c68f7f13f3 backends/drm,wayland: require gbm
The ifdefs for have_gbm obfuscate the code unnecessarily - the drm backend
is not a great experience with qpainter, so in practice noone should ship
it without gbm anyways.
2021-11-12 08:25:15 +00:00
Vlad Zahorodnii
6d0cca5c7f Move all dirty region scene repaint scheduling to Scene
The Compositor contains nothing that can potentially get dirty and need
repainting.

As is, the advantages of this move aren't really noticeable, but it
makes sense with multiple scenes.

Backend parts are far from ideal, they can be improved later on as we
progress with the scene redesign.
2021-11-11 11:33:04 +02:00
Xaver Hugl
bad5752110 platforms/drm: kill the EglStreams backend
The proprietary NVidia driver now supports gbm, which vastly improves the
user experience. For older devices that will not get gbm support dropping
EglStreams will likely not have a big impact as it has several session breaking
issues anyways.

By removing the backend a lot of logic can be simplified, most notably multi-gpu.
2021-11-10 11:43:36 +00:00
Xaver Hugl
23d9341f6f platforms/drm: remove property blob handling from DrmProperty
It's no longer used
2021-11-09 22:15:31 +01:00
Xaver Hugl
3f62ea44dd platforms/drm: move gamma blob ownership to DrmPipeline::Gamma 2021-11-09 22:15:31 +01:00
Vlad Zahorodnii
02bb276ebf platforms/drm: Move ownership of mode blob to connector mode
The main motivation behind this change is to move management of drm
blobs out of property wrappers in specialized wrappers to simplify state
management with blobs.

Connector mode blobs are created on demand.
2021-11-09 22:15:31 +01:00
Xaver Hugl
1b5009ae2b platforms/drm: improve logging a bit
Only print the flags once for all pipelines and include changed unused objects
as well.
2021-11-09 22:15:31 +01:00
Xaver Hugl
7283c98f27 platforms/drm: disable unused resources on modesets
When we switch CRTCs it can happen that a CRTC would stay enabled yet has
no connectors anymore. In this case the kernel may reject our atomic commit,
which would cause the modeset to fail. To counteract that, properly disable
unused drm objects
2021-11-09 22:15:31 +01:00
Xaver Hugl
102fb3d5f2 platforms/drm: keep disconnected DrmConnectors around 2021-11-09 22:15:31 +01:00
Xaver Hugl
a07aae8282 platforms/drm: delay presentation for modesets
Currently KWin is combining modesets with presentation, which causes problems
when multiple monitors are used and crtcs need to be switched around, because
taking away a CRTC from another output causes the driver to disable the
other output. In order to avoid such problems, delay presentation until
all pipelines are ready to present and then do a modeset with a single atomic
commit. To process the resulting page flip events properly this commit also
ports KWin to page_flip_handler2 and changes how the pageFlipped and
notifyFrameFailed signals are processed.
2021-11-09 22:15:31 +01:00
Xaver Hugl
e2a0863843 platforms/drm: more dynamic crtc assignment
Hardware constraints limit the number of crtcs and which connector + crtc
combinations can work together. The current code is searching for working
combinations when a hotplug happens but that's not enough, it also needs
to happen when the user enables or disables outputs and when modesets are
done, and the configuration change needs to be applied with a single atomic
commit.

This commit removes the hard dependency of DrmPipeline on crtcs by moving
the pending state of outputs from the drm objects to DrmPipeline itself,
which ensures that it's independent from the set of drm objects currently
used. It also changes requests from KScreen to be applied truly atomically.
2021-11-09 22:15:31 +01:00
Vlad Zahorodnii
1d96b41bb4 build: Move software vsync helpers to libkwin
Compile software vsync helpers into libkwin for the consistency sake
with other helpers.
2021-11-09 18:15:32 +00:00
Aleix Pol
c1e9cc283d Implement Primary Displays on the wayland session
Adopts the kde_outputmanagement_v2 hooks for it
2021-11-09 16:55:39 +00:00
Vlad Zahorodnii
3485eb6200 cmake: Move base render backend classes to libkwin
This allows using base opengl backends in libkwin, which can be useful
later on for the purpose of moving the ownership of render backends from
the Scene class to the Compositor class.
2021-11-08 18:27:22 +00:00
Xaver Hugl
6ff4de2e05 port everything away from Q_FOREACH 2021-11-08 14:19:05 +00:00
Vlad Zahorodnii
3eb5fa18fb backends/x11: Remove unused KWaylandServer includes 2021-11-02 11:40:30 +02:00
Vlad Zahorodnii
2870e4295b backends/wayland: Remove unused KWaylandServer includes 2021-11-02 11:39:37 +02:00
Vlad Zahorodnii
d89501a079 Move platform backends to backends directory
This improves file organization in kwin by putting backends in a single
directory.

It also makes easier to discover kwin's low level components for new
contributors because the plugins directory may come as the last place to
look for. When one hears "plugin", the first thing that comes to mind is
regular plugins, not low level backends.
2021-11-02 09:02:41 +00:00
Vlad Zahorodnii
94de28bfbe Move input backends in their own directory 2021-11-01 16:27:16 +02:00