wsi/x11: Don't allow signal_present_id to rewind.
authorHans-Kristian Arntzen <post@arntzen-software.no>
Tue, 12 Sep 2023 12:31:14 +0000 (14:31 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 12 Sep 2023 19:46:56 +0000 (19:46 +0000)
If present ID is 0, we should consider it to be ignored.
Avoids a theoretical problem when using IMMEDIATE mode with present ID
where some images don't set present ID.

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 0b0a0a3..cba1d1c 100644 (file)
@@ -1146,7 +1146,8 @@ static void x11_notify_pending_present(struct x11_swapchain *swapchain,
    /* It is possible that an IDLE is observed before PRESENT_COMPLETE when
     * not flipping. In this case, reading image->present_id might be a race
     * in the FIFO management thread. */
-   image->signal_present_id = image->present_id;
+   if (image->present_id)
+      image->signal_present_id = image->present_id;
 }
 
 static void x11_swapchain_notify_error(struct x11_swapchain *swapchain, VkResult result)