wlroots-hyprland/backend
Simon Ser 324eeaa0cd backend/drm: disable all CRTCs after VT switch
When the user switches away from the VT where wlroots is running,
the new DRM master may mutate the KMS state in an arbitrary manner.
For instance, let's say wlroots uses the following connector/CRTC
mapping:

- CRTC 42 drives connector DP-1
- CRTC 43 drives connector DP-2

Then the new DRM master may swap the mapping like so:

- CRTC 42 drives connector DP-2
- CRTC 43 drives connector DP-1

wlroots needs to restore its own state when the user switches back.
Some state is attached to wlr_drm_crtc (e.g. current FB), so reading
back and adopting the CRTC/connector mapping left by the previous DRM
master would be complicated (this was the source of other bugs in the
past, see [1]).

With the previous logic, wlroots merely tries to restore the state
of each connector one after the other. This fails in the scenario
described above: the kernel refuses to use CRTC 42 for DP-1, because
that CRTC is already in-use for DP-2.

Unfortunately with the legacy uAPI it's not possible to restore the
state in one go. We need to support both legacy and atomic uAPIs, so
let's fix the bug for the legacy uAPI first, and then improve the
situation for the atomic uAPI as a second step [2].

We need to disable the CRTCs we're going to switch the connectors for.
This sounds complicated, so let's just disable all CRTCs to simplify.
This causes a black screen because of the on/off modesets, but makes
VT switch much more reliable, so I'll take it.

[1]: c6d8a11d2c
[2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3794

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3342
2023-01-18 18:38:21 +00:00
..
drm backend/drm: disable all CRTCs after VT switch 2023-01-18 18:38:21 +00:00
headless backend: use global output name counters 2022-10-13 13:12:43 +02:00
libinput build: unify naming for HAVE_* defines 2022-12-06 22:39:45 +00:00
multi backend: drop wlr_backend_get_session() 2022-11-15 21:16:25 +00:00
session backend/session: make optional 2022-11-25 16:15:29 +00:00
wayland backend/wayland: ensure buffers are released on shutdown 2022-12-06 20:14:44 +01:00
x11 backend/x11: fix delta_discrete value 2023-01-16 14:19:44 +03:00
backend.c backend/session: make optional 2022-11-25 16:15:29 +00:00
meson.build backend/session: make optional 2022-11-25 16:15:29 +00:00