From 652f09a7a6665be2a04ff8ec4f741de435bd536f Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 21 Jun 2022 23:13:44 -0500 Subject: x11: avoid XPresent API calls when it's not needed This commit kind of mixes several related things together. The main thing is to avoid calling any XPresent functions or internal functions related to presentation when the feature is not auto-whitelisted or enabled by the user. Internally rework this so it all works off of a use_present bool (have_present is eliminated because having a non-zero present_code covers exactly the same thing) and make sure it updates on runtime. Finally, put some actual logging in here whenever XPresent is enabled/disabled. Fixes #10326. --- video/out/vulkan/context_xlib.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'video/out/vulkan/context_xlib.c') diff --git a/video/out/vulkan/context_xlib.c b/video/out/vulkan/context_xlib.c index 3392145e1a..3a4af11c1c 100644 --- a/video/out/vulkan/context_xlib.c +++ b/video/out/vulkan/context_xlib.c @@ -34,14 +34,17 @@ static bool xlib_check_visible(struct ra_ctx *ctx) static void xlib_vk_swap_buffers(struct ra_ctx *ctx) { - vo_x11_present(ctx->vo); - present_sync_swap(ctx->vo->x11->present); + if (ctx->vo->x11->use_present) { + vo_x11_present(ctx->vo); + present_sync_swap(ctx->vo->x11->present); + } } static void xlib_vk_get_vsync(struct ra_ctx *ctx, struct vo_vsync_info *info) { struct vo_x11_state *x11 = ctx->vo->x11; - present_sync_get_info(x11->present, info); + if (ctx->vo->x11->use_present) + present_sync_get_info(x11->present, info); } static void xlib_uninit(struct ra_ctx *ctx) -- cgit v1.2.3