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: 899263ecfc ("wsi/x11: support explicit sync")
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tested-by: Adam Ivora
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36419>
(cherry picked from commit 064b9e5645)
This commit is contained in:
Faith Ekstrand 2025-07-28 14:12:30 -04:00 committed by Eric Engestrom
parent 62e8bc584c
commit 0bea56e932
2 changed files with 9 additions and 3 deletions

View file

@ -504,7 +504,7 @@
"description": "vulkan/wsi/x11: Handle VK_NOT_READY in AcquireNextImage()",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "899263ecfc8251ffff375d70b4c5d44f192112b0",
"notes": null

View file

@ -1793,10 +1793,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);