Module: Mesa
Branch: main
Commit: f29f656530a2b35574fbeb8623d9d141dec07d80
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f29f656530a2b35574fbeb8623d9d141dec07d80

Author: Philipp Zabel <[email protected]>
Date:   Wed Feb  8 13:36:54 2023 +0100

vulkan/wsi/wayland: fix acquire_next_image to report timeouts properly

The Vulkan Specification states about possible return values from
vkAcquireNextImageKHR:

 * VK_NOT_READY is returned if timeout is zero and no image was
   available.
 * VK_TIMEOUT is returned if timeout is greater than zero and less than
   UINT64_MAX, and no image beae available within the time allowed.

That is, if info->timeout is larger than zero, the function must return
VK_TIMEOUT instead of VK_NOT_READY if no image became available before
the timeout elapsed.

Signed-off-by: Philipp Zabel <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21190>

---

 src/vulkan/wsi/wsi_common_wayland.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index 7d42c812476..928ec216505 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -1497,7 +1497,7 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain 
*wsi_chain,
       struct timespec current_time;
       clock_gettime(CLOCK_MONOTONIC, &current_time);
       if (timespec_after(&current_time, &end_time))
-         return VK_NOT_READY;
+         return (info->timeout ? VK_TIMEOUT : VK_NOT_READY);
 
       /* Try to read events from the server. */
       ret = wl_display_prepare_read_queue(wsi_wl_surface->display->wl_display,

Reply via email to