From f0c52fee25aef828cb01ff6fdd2d53d6062efd83 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Mon, 18 Aug 2025 15:22:21 -0700 Subject: [PATCH] venus: misc sync2 emulation fixes Venus renderer side has strict entry points sanitization based on the app requested app api version + physical device api version. So on the driver, we should follow the same for legacy client apps. Meanwhile, VK_PIPELINE_STAGE_NONE can't be used when we hit the sync2 emulation path, so we swap it with VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT placeholder for the 2nd sync scope there. Fixes: 07cee75c39c ("venus: layer vkQueueSubmit2 over vkQueueSubmit w/o sync2") Part-of: --- src/virtio/vulkan/vn_device.c | 5 ++--- src/virtio/vulkan/vn_queue.c | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c index 6852cdd5c2a..a5ffe2bc4bb 100644 --- a/src/virtio/vulkan/vn_device.c +++ b/src/virtio/vulkan/vn_device.c @@ -504,9 +504,8 @@ vn_device_init(struct vn_device *dev, */ vn_device_update_shader_cache_id(dev); - dev->has_sync2 = - physical_dev->base.vk.properties.apiVersion >= VK_API_VERSION_1_3 || - dev->base.vk.enabled_extensions.KHR_synchronization2; + dev->has_sync2 = physical_dev->renderer_version >= VK_API_VERSION_1_3 || + dev->base.vk.enabled_extensions.KHR_synchronization2; return VK_SUCCESS; diff --git a/src/virtio/vulkan/vn_queue.c b/src/virtio/vulkan/vn_queue.c index 992d249eb7c..b231fbfa457 100644 --- a/src/virtio/vulkan/vn_queue.c +++ b/src/virtio/vulkan/vn_queue.c @@ -1135,7 +1135,9 @@ vn_queue_submit_2_to_1(struct vn_device *dev, bool has_wait_timeline_sem = false; for (uint32_t i = 0; i < submit->waitSemaphoreInfoCount; i++) { _wait_sem_handles[i] = submit->pWaitSemaphoreInfos[i].semaphore; - _wait_stages[i] = submit->pWaitSemaphoreInfos[i].stageMask; + _wait_stages[i] = submit->pWaitSemaphoreInfos[i].stageMask + ? submit->pWaitSemaphoreInfos[i].stageMask + : VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; VK_FROM_HANDLE(vn_semaphore, sem, _wait_sem_handles[i]); has_wait_timeline_sem |= sem->type == VK_SEMAPHORE_TYPE_TIMELINE;