From c6d8a11d2c438d514473b1cbe20e5550e7227472 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 18 Oct 2022 17:15:01 +0200 Subject: [PATCH] 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 --- backend/drm/drm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index aa34f1a4..32bb50c1 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -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) {