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: 07cee75c39 ("venus: layer vkQueueSubmit2 over vkQueueSubmit w/o sync2")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36830>
This commit is contained in:
Yiwei Zhang 2025-08-18 15:22:21 -07:00 committed by Marge Bot
parent 8ee7b41841
commit f0c52fee25
2 changed files with 5 additions and 4 deletions

View file

@ -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;

View file

@ -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;