wsi/x11: Fix potential deadlock in present ID.
authorHans-Kristian Arntzen <post@arntzen-software.no>
Tue, 12 Sep 2023 12:28:18 +0000 (14:28 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 12 Sep 2023 19:46:56 +0000 (19:46 +0000)
If we observe IDLE before COMPLETE, another queued image may have
presented with present ID 0 which would break the check fixed in this
commit. The original fix for present_id / signal_present_id split
forgot to take this into account.

Fixes: 32f7ff2c204b ("Fix present ID signal when IDLE comes before
COMPLETE").

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25178>

src/vulkan/wsi/wsi_common_x11.c

index 992a459..0b0a0a3 100644 (file)
@@ -1115,7 +1115,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(x11_swapchain, base.base, VkSwapchainKHR,
 static void x11_present_complete(struct x11_swapchain *swapchain,
                                  struct x11_image *image)
 {
-   if (image->present_id) {
+   if (image->signal_present_id) {
       pthread_mutex_lock(&swapchain->present_progress_mutex);
       if (image->signal_present_id > swapchain->present_id) {
          swapchain->present_id = image->signal_present_id;