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>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
This commit is contained in:
Joshua Ashton 2023-10-11 14:04:20 +01:00 committed by Marge Bot
parent eae948332a
commit c30c969c24
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,
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;

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 = {
.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;

View File

@ -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,