From d2238bf722d9a83156077473a5f5632b751d803a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 26 May 2022 14:45:15 +0200 Subject: render/vulkan: import semaphore to DMA-BUF instead of blocking Right now the Vulkan renderer blocks until the frame is complete after rendering. This is necessary because Vulkan doesn't interoperate well with implicit sync we use everywhere else. Use the new kernel API to import a sync_file into a DMA-BUF to avoid blocking. --- include/render/vulkan.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/render') diff --git a/include/render/vulkan.h b/include/render/vulkan.h index d21a7ca0..93e492cf 100644 --- a/include/render/vulkan.h +++ b/include/render/vulkan.h @@ -38,6 +38,8 @@ struct wlr_vk_device { int drm_fd; + bool implicit_sync_interop; + // we only ever need one queue for rendering and transfer commands uint32_t queue_family; VkQueue queue; @@ -46,6 +48,7 @@ struct wlr_vk_device { PFN_vkGetMemoryFdPropertiesKHR getMemoryFdPropertiesKHR; PFN_vkWaitSemaphoresKHR waitSemaphoresKHR; PFN_vkGetSemaphoreCounterValueKHR getSemaphoreCounterValueKHR; + PFN_vkGetSemaphoreFdKHR getSemaphoreFdKHR; } api; uint32_t format_prop_count; @@ -152,6 +155,9 @@ struct wlr_vk_command_buffer { struct wl_list destroy_textures; // wlr_vk_texture.destroy_link // Staging shared buffers to release after the command buffer completes struct wl_list stage_buffers; // wlr_vk_shared_buffer.link + + // For DMA-BUF implicit sync interop, may be NULL + VkSemaphore binary_semaphore; }; #define VULKAN_COMMAND_BUFFERS_CAP 64 -- cgit v1.2.3