backend/drm: fetch current CRTC once on startup

Once we are DRM master, the CRTC cannot be changed behind our back
except during a VT switch.

After a VT switch, we try to restore whatever KMS state we had last
programmed. Reloading the current CRTC from KMS breaks this and
can result in a modeset without a FB.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3432
This commit is contained in:
Simon Ser 2022-10-18 17:15:01 +02:00 committed by Alexander Orzechowski
parent 4f920a206c
commit c6d8a11d2c

View File

@ -1363,14 +1363,14 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
snprintf(wlr_conn->name, sizeof(wlr_conn->name),
"%s-%"PRIu32, conn_name, drm_conn->connector_type_id);
wlr_conn->crtc = connector_get_current_crtc(wlr_conn, drm_conn);
wl_list_insert(drm->outputs.prev, &wlr_conn->link);
wlr_log(WLR_INFO, "Found connector '%s'", wlr_conn->name);
} else {
seen[index] = true;
}
wlr_conn->crtc = connector_get_current_crtc(wlr_conn, drm_conn);
// This can only happen *after* hotplug, since we haven't read the
// connector properties yet
if (wlr_conn->props.link_status != 0) {