wlroots-hyprland/backend/drm
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
..
atomic.c backend/drm: store pending FB in state 2022-12-07 17:45:59 +01:00
backend.c backend/drm: disable all CRTCs after VT switch 2023-01-18 18:38:21 +00:00
cvt.c backend/drm: add support for custom modes 2019-10-27 10:46:47 -04:00
drm.c backend/drm: check return value of get_drm_{connector,crtc}_props() 2022-12-16 10:30:14 +01:00
gen_pnpids.sh backend/drm: use pnp.ids to fetch EDID data 2022-11-09 00:25:18 +03:00
legacy.c backend/drm: store pending FB in state 2022-12-07 17:45:59 +01:00
meson.build backend/session: make optional 2022-11-25 16:15:29 +00:00
monitor.c backend/drm: add wlr_drm_backend_monitor 2021-12-13 14:55:16 +01:00
properties.c backend/drm: set "max bpc" to the max 2022-06-19 16:55:36 +00:00
renderer.c backend/drm: store pending FB in state 2022-12-07 17:45:59 +01:00
util.c backend/drm: add drm_connector_status_str() 2022-12-13 16:50:27 +00:00