From 212fb25b267120c6cc8eead21a7eb016f2b58f2a Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Tue, 12 Apr 2022 14:46:39 -0700 Subject: [PATCH] vulkan/wsi/x11: Use atomic_int with sent_image_count Without this being atomically incremented and decremented, I observed this assert triggering in debug builds: src/vulkan/wsi/wsi_common_x11.c:x11_present_to_x11_dri3(): assert(chain->sent_image_count <= chain->base.image_count); I think this was happening since, src/vulkan/wsi/wsi_common_x11.c:x11_handle_dri3_present_event() which decrements chain->sent_image_count may be run in a separate thread. Fixes: d0bc1ad3776 ("vulkan/wsi/x11: add sent image counter") Signed-off-by: Jordan Justen Reviewed-by: Adam Jackson Part-of: --- src/vulkan/wsi/wsi_common_x11.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 563bf13f8c9..7dfb4c1b82d 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -29,6 +29,7 @@ #include #include "util/macros.h" +#include #include #include #include @@ -914,7 +915,7 @@ struct x11_swapchain { uint64_t send_sbc; uint64_t last_present_msc; uint32_t stamp; - int sent_image_count; + atomic_int sent_image_count; bool has_present_queue; bool has_acquire_queue;