From d27aaae4d25f50581525d49df73c2201fbeabefe Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Tue, 28 Nov 2017 00:28:14 +0100 Subject: [PATCH] radv: Add external fence support. Reviewed-by: Dave Airlie --- src/amd/vulkan/radv_device.c | 20 ++++++++++++++++++++ src/amd/vulkan/radv_extensions.py | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 94562fda875..a4ec912ff2c 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -3793,3 +3793,23 @@ VkResult radv_GetFenceFdKHR(VkDevice _device, return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR); return VK_SUCCESS; } + +void radv_GetPhysicalDeviceExternalFencePropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, + VkExternalFencePropertiesKHR* pExternalFenceProperties) +{ + RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice); + + if (pdevice->rad_info.has_syncobj_wait && + pExternalFenceInfo->handleType == VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR) { + pExternalFenceProperties->exportFromImportedHandleTypes = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; + pExternalFenceProperties->compatibleHandleTypes = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; + pExternalFenceProperties->externalFenceFeatures = VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR | + VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR; + } else { + pExternalFenceProperties->exportFromImportedHandleTypes = 0; + pExternalFenceProperties->compatibleHandleTypes = 0; + pExternalFenceProperties->externalFenceFeatures = 0; + } +} diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 3188735ea78..9af941fab35 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -53,6 +53,8 @@ EXTENSIONS = [ Extension('VK_KHR_bind_memory2', 1, True), Extension('VK_KHR_dedicated_allocation', 1, True), Extension('VK_KHR_descriptor_update_template', 1, True), + Extension('VK_KHR_external_fence', 1, 'device->rad_info.has_syncobj_wait'), + Extension('VK_KHR_external_fence_capabilities', 1, True), Extension('VK_KHR_external_fence_fd', 1, 'device->rad_info.has_syncobj_wait'), Extension('VK_KHR_external_memory', 1, True), Extension('VK_KHR_external_memory_capabilities', 1, True), -- 2.30.2