From 1447e00abb41ecf0a1272db4b8583ec911e75cdc Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 12 Jul 2024 00:03:03 -0700 Subject: [PATCH] backend/drm: retry drm commit when async commit fails Asynchronous commits can fail due to property changes, but only if they change in value. However, since the commit failed, the compositor will continue to retry, failing each time. Fall back to synchronous commit on async error, which should kickstart the properties changes. Typically, this is cursor plane FB_ID changes whenever the compositor or game changes the cursor image, and without this fallback, it will continue to queue the FB_ID change, breaking commits until async is disabled, such as by task switching away from the async hinted app. The existing kernel- side no-op check will not work if the initial property change never goes through. This breaks the cycle. Signed-off-by: Christopher Snowhill --- backend/drm/drm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 5756f2897..282340ee3 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -914,6 +914,12 @@ static bool drm_connector_commit_state(struct wlr_drm_connector *conn, ok = drm_commit(drm, &pending_dev, flags, test_only); + if (!ok && flags & DRM_MODE_PAGE_FLIP_ASYNC) { + // try again if some props change caused a failure here + flags &= ~DRM_MODE_PAGE_FLIP_ASYNC; + ok = drm_commit(drm, &pending_dev, flags, test_only); + } + out: drm_connector_state_finish(&pending); return ok;