From 4bf8f96b3e8f5ad0c6b1a2a59a68c061bd9e961b Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Mon, 25 Mar 2024 18:42:54 +0000 Subject: [PATCH] wsi: Get timeline semaphore exportable handle types We need to know this for explicit sync 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 | 13 ++++++++++++- src/vulkan/wsi/wsi_common.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index 7d8231b82f6..0cd58c79277 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -123,7 +123,7 @@ wsi_device_init(struct wsi_device *wsi, for (VkExternalSemaphoreHandleTypeFlags handle_type = 1; handle_type <= VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT; handle_type <<= 1) { - const VkPhysicalDeviceExternalSemaphoreInfo esi = { + VkPhysicalDeviceExternalSemaphoreInfo esi = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, .handleType = handle_type, }; @@ -135,6 +135,17 @@ wsi_device_init(struct wsi_device *wsi, if (esp.externalSemaphoreFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT) wsi->semaphore_export_handle_types |= handle_type; + + VkSemaphoreTypeCreateInfo timeline_tci = { + .sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO, + .semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE_KHR, + }; + esi.pNext = &timeline_tci; + GetPhysicalDeviceExternalSemaphoreProperties(pdevice, &esi, &esp); + + if (esp.externalSemaphoreFeatures & + VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT) + wsi->timeline_semaphore_export_handle_types |= handle_type; } const struct vk_device_extension_table *supported_extensions = diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h index 0306ea17cfd..e7ff9701f83 100644 --- a/src/vulkan/wsi/wsi_common.h +++ b/src/vulkan/wsi/wsi_common.h @@ -112,6 +112,7 @@ struct wsi_device { VkPhysicalDevicePCIBusInfoPropertiesEXT pci_bus_info; VkExternalSemaphoreHandleTypeFlags semaphore_export_handle_types; + VkExternalSemaphoreHandleTypeFlags timeline_semaphore_export_handle_types; bool has_import_memory_host; bool has_timeline_semaphore;