From db9fa4be04dffa5b89fef1dc01e0c24c7e5d7d3a Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Sat, 13 Aug 2022 06:55:38 +0000 Subject: [PATCH] venus: query renderer sync_fd props to fill the feature stubs This change enables the fixed code paths. Signed-off-by: Yiwei Zhang Part-of: --- src/virtio/vulkan/vn_physical_device.c | 32 ++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index 20137ee7e28..d100810861b 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -857,7 +857,21 @@ vn_physical_device_init_external_fence_handles( * either of them depending on the occasions, and support external fences * and idle waiting. */ - physical_dev->renderer_sync_fd_fence_features = 0; + if (physical_dev->renderer_extensions.KHR_external_fence_fd) { + const VkPhysicalDeviceExternalFenceInfo info = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO, + .handleType = VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT, + }; + VkExternalFenceProperties props = { + .sType = VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES, + }; + vn_call_vkGetPhysicalDeviceExternalFenceProperties( + physical_dev->instance, vn_physical_device_to_handle(physical_dev), + &info, &props); + + physical_dev->renderer_sync_fd_fence_features = + props.externalFenceFeatures; + } physical_dev->external_fence_handles = 0; @@ -891,7 +905,21 @@ vn_physical_device_init_external_semaphore_handles( * host-side VkSemaphore. That would allow the consumers to wait on the * host side rather than the guest side. */ - physical_dev->renderer_sync_fd_semaphore_features = 0; + if (physical_dev->renderer_extensions.KHR_external_semaphore_fd) { + const VkPhysicalDeviceExternalSemaphoreInfo info = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, + .handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT, + }; + VkExternalSemaphoreProperties props = { + .sType = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES, + }; + vn_call_vkGetPhysicalDeviceExternalSemaphoreProperties( + physical_dev->instance, vn_physical_device_to_handle(physical_dev), + &info, &props); + + physical_dev->renderer_sync_fd_semaphore_features = + props.externalSemaphoreFeatures; + } physical_dev->external_binary_semaphore_handles = 0; physical_dev->external_timeline_semaphore_handles = 0;