From c30c969c2487cbd3461a5d688ecc8c255ba69632 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 11 Oct 2023 14:04:20 +0100 Subject: [PATCH] wsi: Add explicit_sync to wsi_image_info Will be used in future for specifying explicit sync for Vulkan WSI when supported. Additionally cleans up wsi_create_buffer_blit_context, etc.. Signed-off-by: Joshua Ashton Reviewed-by: Hans-Kristian Arntzen Reviewed-by: Erik Kurzinger Reviewed-by: Sebastian Wick Part-of: --- src/vulkan/wsi/wsi_common.c | 9 ++++----- src/vulkan/wsi/wsi_common_drm.c | 5 ++--- src/vulkan/wsi/wsi_common_private.h | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index bdf8b36194bff..bb71afa23c7bc 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -1695,8 +1695,7 @@ VkResult wsi_create_buffer_blit_context(const struct wsi_swapchain *chain, const struct wsi_image_info *info, struct wsi_image *image, - VkExternalMemoryHandleTypeFlags handle_types, - bool implicit_sync) + VkExternalMemoryHandleTypeFlags handle_types) { assert(chain->blit.type == WSI_SWAPCHAIN_BUFFER_BLIT); @@ -1727,7 +1726,7 @@ wsi_create_buffer_blit_context(const struct wsi_swapchain *chain, struct wsi_memory_allocate_info memory_wsi_info = { .sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA, .pNext = NULL, - .implicit_sync = implicit_sync, + .implicit_sync = !info->explicit_sync, }; VkMemoryDedicatedAllocateInfo buf_mem_dedicated_info = { .sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO, @@ -2073,8 +2072,7 @@ wsi_create_cpu_buffer_image_mem(const struct wsi_swapchain *chain, { VkResult result; - result = wsi_create_buffer_blit_context(chain, info, image, 0, - false /* implicit_sync */); + result = wsi_create_buffer_blit_context(chain, info, image, 0); if (result != VK_SUCCESS) return result; @@ -2124,6 +2122,7 @@ wsi_configure_cpu_image(const struct wsi_swapchain *chain, 1 /* size_align */, info); + info->explicit_sync = true; info->select_blit_dst_memory_type = wsi_select_host_memory_type; info->select_image_memory_type = wsi_select_device_memory_type; info->create_mem = wsi_create_cpu_buffer_image_mem; diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c index 81f597a0a1961..0de0b6be52297 100644 --- a/src/vulkan/wsi/wsi_common_drm.c +++ b/src/vulkan/wsi/wsi_common_drm.c @@ -482,7 +482,7 @@ wsi_create_native_image_mem(const struct wsi_swapchain *chain, const struct wsi_memory_allocate_info memory_wsi_info = { .sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA, .pNext = NULL, - .implicit_sync = true, + .implicit_sync = !info->explicit_sync, }; const VkExportMemoryAllocateInfo memory_export_info = { .sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO, @@ -570,8 +570,7 @@ wsi_create_prime_image_mem(const struct wsi_swapchain *chain, { VkResult result = wsi_create_buffer_blit_context(chain, info, image, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT, - true); + VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT); if (result != VK_SUCCESS) return result; diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h index 385c51fca9e3c..abe90266501a3 100644 --- a/src/vulkan/wsi/wsi_common_private.h +++ b/src/vulkan/wsi/wsi_common_private.h @@ -84,6 +84,7 @@ struct wsi_image_info { VkImageFormatListCreateInfo format_list; VkImageDrmFormatModifierListCreateInfoEXT drm_mod_list; + bool explicit_sync; bool prime_use_linear_modifier; /* Not really part of VkImageCreateInfo but needed to figure out the @@ -266,8 +267,7 @@ VkResult wsi_create_buffer_blit_context(const struct wsi_swapchain *chain, const struct wsi_image_info *info, struct wsi_image *image, - VkExternalMemoryHandleTypeFlags handle_types, - bool implicit_sync); + VkExternalMemoryHandleTypeFlags handle_types); VkResult wsi_finish_create_blit_context(const struct wsi_swapchain *chain,