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 <joshua@froggi.es>
This commit is contained in:
Joshua Ashton 2023-10-11 14:04:20 +01:00
parent 9c8f205131
commit 00dba3992c
3 changed files with 8 additions and 10 deletions

View file

@ -1695,8 +1695,7 @@ VkResult
wsi_create_buffer_blit_context(const struct wsi_swapchain *chain, wsi_create_buffer_blit_context(const struct wsi_swapchain *chain,
const struct wsi_image_info *info, const struct wsi_image_info *info,
struct wsi_image *image, struct wsi_image *image,
VkExternalMemoryHandleTypeFlags handle_types, VkExternalMemoryHandleTypeFlags handle_types)
bool implicit_sync)
{ {
assert(chain->blit.type == WSI_SWAPCHAIN_BUFFER_BLIT); 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 = { struct wsi_memory_allocate_info memory_wsi_info = {
.sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA, .sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA,
.pNext = NULL, .pNext = NULL,
.implicit_sync = implicit_sync, .implicit_sync = !info->explicit_sync,
}; };
VkMemoryDedicatedAllocateInfo buf_mem_dedicated_info = { VkMemoryDedicatedAllocateInfo buf_mem_dedicated_info = {
.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_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; VkResult result;
result = wsi_create_buffer_blit_context(chain, info, image, 0, result = wsi_create_buffer_blit_context(chain, info, image, 0);
false /* implicit_sync */);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
return result; return result;
@ -2124,6 +2122,7 @@ wsi_configure_cpu_image(const struct wsi_swapchain *chain,
1 /* size_align */, 1 /* size_align */,
info); info);
info->explicit_sync = true;
info->select_blit_dst_memory_type = wsi_select_host_memory_type; info->select_blit_dst_memory_type = wsi_select_host_memory_type;
info->select_image_memory_type = wsi_select_device_memory_type; info->select_image_memory_type = wsi_select_device_memory_type;
info->create_mem = wsi_create_cpu_buffer_image_mem; info->create_mem = wsi_create_cpu_buffer_image_mem;

View file

@ -482,7 +482,7 @@ wsi_create_native_image_mem(const struct wsi_swapchain *chain,
const struct wsi_memory_allocate_info memory_wsi_info = { const struct wsi_memory_allocate_info memory_wsi_info = {
.sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA, .sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA,
.pNext = NULL, .pNext = NULL,
.implicit_sync = true, .implicit_sync = !info->explicit_sync,
}; };
const VkExportMemoryAllocateInfo memory_export_info = { const VkExportMemoryAllocateInfo memory_export_info = {
.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_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 = VkResult result =
wsi_create_buffer_blit_context(chain, info, image, wsi_create_buffer_blit_context(chain, info, image,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT);
true);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
return result; return result;

View file

@ -84,6 +84,7 @@ struct wsi_image_info {
VkImageFormatListCreateInfo format_list; VkImageFormatListCreateInfo format_list;
VkImageDrmFormatModifierListCreateInfoEXT drm_mod_list; VkImageDrmFormatModifierListCreateInfoEXT drm_mod_list;
bool explicit_sync;
bool prime_use_linear_modifier; bool prime_use_linear_modifier;
/* Not really part of VkImageCreateInfo but needed to figure out the /* 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, wsi_create_buffer_blit_context(const struct wsi_swapchain *chain,
const struct wsi_image_info *info, const struct wsi_image_info *info,
struct wsi_image *image, struct wsi_image *image,
VkExternalMemoryHandleTypeFlags handle_types, VkExternalMemoryHandleTypeFlags handle_types);
bool implicit_sync);
VkResult VkResult
wsi_finish_create_blit_context(const struct wsi_swapchain *chain, wsi_finish_create_blit_context(const struct wsi_swapchain *chain,