From 849e3552e8051d8fcc727e1f97be5e5e24210fc0 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Sun, 18 Jan 2026 23:55:33 -0800 Subject: [PATCH] venus: properly handle wsi implicit in-fence Vulkan is supposed to operate in explicit synchronization mode. However, for legacy compositors that only support implicit fencing, we have to extract the compositor implicit fence (release fence) and resolve it properly. Part-of: --- src/virtio/vulkan/vn_wsi.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/virtio/vulkan/vn_wsi.c b/src/virtio/vulkan/vn_wsi.c index b4ca930240d..45b4cd1e515 100644 --- a/src/virtio/vulkan/vn_wsi.c +++ b/src/virtio/vulkan/vn_wsi.c @@ -853,8 +853,25 @@ vn_AcquireNextImage2KHR(VkDevice device, if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) return vn_error(dev->instance, result); - /* XXX this relies on renderer side doing implicit fencing */ int sync_fd = -1; + if (!dev->renderer->info.has_implicit_fencing) { + VkDeviceMemory mem_handle = + wsi_common_get_memory(pAcquireInfo->swapchain, *pImageIndex); + struct vn_device_memory *mem = vn_device_memory_from_handle(mem_handle); + struct vn_image *img = mem->dedicated_img; + + if (img->wsi.is_prime_blit_src) + mem = img->wsi.blit_mem; + + /* Only image buffer blit is tracked (both cpu and prime), so we use if + * condition below for potential new blit path supported on non-Linux + * platforms. + */ + if (mem) { + sync_fd = + vn_renderer_bo_export_sync_file(dev->renderer, mem->base_bo); + } + } int sem_fd = -1, fence_fd = -1; if (sync_fd >= 0) {