From 2c1fdefe3b95d10a690564b6ea42f460fa160088 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 9 Nov 2019 20:01:38 +0000 Subject: [PATCH] backend: enable xsync fence for nvidia users This was already done in the legacy backends, this commit adds the same thing to the new backends. Signed-off-by: Yuxuan Shui --- src/backend/backend.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/backend/backend.c b/src/backend/backend.c index a256c9c..a9535c8 100644 --- a/src/backend/backend.c +++ b/src/backend/backend.c @@ -53,6 +53,16 @@ region_t get_damage(session_t *ps, bool all_damage) { /// paint all windows void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) { + if (ps->o.xrender_sync_fence || (ps->drivers & DRIVER_NVIDIA)) { + if (ps->xsync_exists && !x_fence_sync(ps->c, ps->sync_fence)) { + log_error("x_fence_sync failed, xrender-sync-fence will be " + "disabled from now on."); + xcb_sync_destroy_fence(ps->c, ps->sync_fence); + ps->sync_fence = XCB_NONE; + ps->o.xrender_sync_fence = false; + ps->xsync_exists = false; + } + } // All painting will be limited to the damage, if _some_ of // the paints bleed out of the damage region, it will destroy // part of the image we want to reuse