From cbe34158f3a364ff87bce948c787e0383e0b0c54 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 22 Apr 2020 20:17:31 +0100 Subject: [PATCH] core: create a xsync fence always xrender-sync-fence might be enabled after init because of driver detection. Instead of creating it on demand, just always create it as this is simpler. Signed-off-by: Yuxuan Shui --- src/picom.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/picom.c b/src/picom.c index 4a31db5..cff2707 100644 --- a/src/picom.c +++ b/src/picom.c @@ -1872,23 +1872,24 @@ static session_t *session_init(int argc, char **argv, Display *dpy, } ps->sync_fence = XCB_NONE; - if (!ps->xsync_exists && ps->o.xrender_sync_fence) { - log_error("XSync extension not found. No XSync fence sync is " - "possible. (xrender-sync-fence can't be enabled)"); - ps->o.xrender_sync_fence = false; - } - - if (ps->o.xrender_sync_fence) { + if (ps->xsync_exists) { ps->sync_fence = x_new_id(ps->c); e = xcb_request_check( ps->c, xcb_sync_create_fence(ps->c, ps->root, ps->sync_fence, 0)); if (e) { - log_error_x_error(e, "Failed to create a XSync fence. " - "xrender-sync-fence will be disabled"); - ps->o.xrender_sync_fence = false; + if (ps->o.xrender_sync_fence) { + log_error_x_error(e, "Failed to create a XSync fence. " + "xrender-sync-fence will be " + "disabled"); + ps->o.xrender_sync_fence = false; + } ps->sync_fence = XCB_NONE; free(e); } + } else if (ps->o.xrender_sync_fence) { + log_error("XSync extension not found. No XSync fence sync is " + "possible. (xrender-sync-fence can't be enabled)"); + ps->o.xrender_sync_fence = false; } // Query X RandR