From a4f54086c1934c2f0990120b8fee34ef3957760d Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 16 Feb 2024 15:29:47 +0100 Subject: [PATCH] backend/drm: move post-commit disable logic to drm_connector_apply_commit() After disabling a connector, we need to cleanup the connector to teardown the surfaces and unlock the FBs. Move this logic into drm_connector_apply_commit() so that it's applied when drm_commit() is called from somewhere else than drm_connector_commit_state(). --- backend/drm/drm.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 9ee76f4a..2d54df36 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -512,6 +512,15 @@ static void drm_connector_apply_commit(const struct wlr_drm_connector_state *sta if (state->base->committed & WLR_OUTPUT_STATE_MODE) { conn->refresh = calculate_refresh_rate(&state->mode); } + + if (!state->active) { + drm_plane_finish_surface(crtc->primary); + drm_plane_finish_surface(crtc->cursor); + drm_fb_clear(&conn->cursor_pending_fb); + + conn->cursor_enabled = false; + conn->crtc = NULL; + } } static void drm_connector_rollback_commit(const struct wlr_drm_connector_state *state) { @@ -855,18 +864,6 @@ static bool drm_connector_commit_state(struct wlr_drm_connector *conn, } ok = drm_commit(drm, &pending_dev, flags, test_only); - if (!ok) { - goto out; - } - - if (!test_only && !pending.active) { - drm_plane_finish_surface(conn->crtc->primary); - drm_plane_finish_surface(conn->crtc->cursor); - drm_fb_clear(&conn->cursor_pending_fb); - - conn->cursor_enabled = false; - conn->crtc = NULL; - } out: drm_connector_state_finish(&pending);