From 064b9e5645b76791bdd0c109358899c628ed672e Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 28 Jul 2025 14:12:30 -0400 Subject: [PATCH] vulkan/wsi/x11: Handle VK_NOT_READY in AcquireNextImage() This check assumed that we would always get `VK_TIMEOUT` from wsi_queue_pull() but the new explicit sync wait is smart enough to do that for us. Unfortunately, the X11 code weasn't smart enough to know that VK_NOT_READY (which is a positive return code) was also an early exit condition. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12971 Fixes: 899263ecfc82 ("wsi/x11: support explicit sync") Acked-by: Mike Blumenkrantz Tested-by: Adam Ivora Part-of: --- src/vulkan/wsi/wsi_common_x11.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 7e3db6d6317..2edb7bf2bf3 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -1798,10 +1798,16 @@ x11_acquire_next_image(struct wsi_swapchain *wsi_chain, } else { result = wsi_queue_pull(&chain->acquire_queue, image_index, timeout); + + /* x11_wait_for_explicit_sync_release_submission() is smart enough to do + * this for us but wsi_queue_pull() isn't. + */ + if (result == VK_TIMEOUT && info->timeout == 0) + result = VK_NOT_READY; } - if (result == VK_TIMEOUT) - return info->timeout ? VK_TIMEOUT : VK_NOT_READY; + if (result == VK_TIMEOUT || result == VK_NOT_READY) + return result; if (result < 0) { mtx_lock(&chain->thread_state_lock);