radv: Add external fence support.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 27 Nov 2017 23:28:14 +0000 (00:28 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 18 Dec 2017 08:31:21 +0000 (09:31 +0100)
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_extensions.py

index 94562fda8757166877f5f50470416691b405ec03..a4ec912ff2c5bfaced57e5f08f3dc078f79232f7 100644 (file)
@@ -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;
+       }
+}
index 3188735ea78dd958483d421503cefe954d1b2dd8..9af941fab35650a4c677977d446fb30b75b12cc0 100644 (file)
@@ -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),