From 06c2af994bf5a9dd53f19d149823a0088e317c6b Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Thu, 21 Mar 2024 18:13:52 +0000 Subject: [PATCH] wsi: Track CPU side present ordering via a serial We will use this in our hueristics to pick the most optimal buffer in AcquireNextImageKHR Signed-off-by: Joshua Ashton --- src/vulkan/wsi/wsi_common.c | 1 + src/vulkan/wsi/wsi_common_private.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index 1ad8aa5561b..7d8231b82f6 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -1472,6 +1472,7 @@ wsi_common_queue_present(const struct wsi_device *wsi, /* The app can only submit images they have acquired. */ assert(image->acquired); image->acquired = false; + image->present_serial = ++swapchain->present_serial; #ifdef HAVE_LIBDRM if (has_signal_dma_buf) { diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h index 8caa882ec23..fdf7f63a666 100644 --- a/src/vulkan/wsi/wsi_common_private.h +++ b/src/vulkan/wsi/wsi_common_private.h @@ -134,6 +134,7 @@ struct wsi_image { * on the CPU side via acquire_next_image. */ bool acquired; + uint64_t present_serial; #ifndef _WIN32 uint64_t drm_modifier; @@ -164,6 +165,8 @@ struct wsi_swapchain { struct wsi_image_info image_info; uint32_t image_count; + + uint64_t present_serial; struct { enum wsi_swapchain_blit_type type;