From 08495d2596acf1d4b7fbc779e0666473b1da83e5 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 10 Aug 2024 13:27:05 +0200 Subject: [PATCH] backend/drm: don't set vsync present flag if page flip was async --- backend/drm/drm.c | 7 +++++-- include/backend/drm/drm.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 154aa99d..90d24305 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -610,6 +610,7 @@ static bool drm_commit(struct wlr_drm_backend *drm, if (page_flip == NULL) { return false; } + page_flip->async = (flags & DRM_MODE_PAGE_FLIP_ASYNC); } bool ok = drm->iface->commit(drm, state, page_flip, flags, test_only); @@ -2047,8 +2048,10 @@ static void handle_page_flip(int fd, unsigned seq, drm_fb_move(&layer->current_fb, &layer->queued_fb); } - uint32_t present_flags = WLR_OUTPUT_PRESENT_VSYNC | - WLR_OUTPUT_PRESENT_HW_CLOCK | WLR_OUTPUT_PRESENT_HW_COMPLETION; + uint32_t present_flags = WLR_OUTPUT_PRESENT_HW_CLOCK | WLR_OUTPUT_PRESENT_HW_COMPLETION; + if (!page_flip->async) { + present_flags |= WLR_OUTPUT_PRESENT_VSYNC; + } /* Don't report ZERO_COPY in multi-gpu situations, because we had to copy * data between the GPUs, even if we were using the direct scanout * interface. diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 18f48742..33b729aa 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -165,6 +165,8 @@ struct wlr_drm_page_flip { struct wl_list link; // wlr_drm_connector.page_flips struct wlr_drm_page_flip_connector *connectors; size_t connectors_len; + // True if DRM_MODE_PAGE_FLIP_ASYNC was set + bool async; }; struct wlr_drm_page_flip_connector {