venus: properly expose KHR_external_fence/sempahore_fd

Summary:
1. hide those extensions for vtest since there's no export support
2. do block waiting upon export without implicit fencing support

Fixes: 68a478870d ("venus: expose KHR_external_fence/sempahore_fd extensions")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25633>
This commit is contained in:
Yiwei Zhang 2023-10-16 17:18:46 -07:00 committed by Marge Bot
parent 4591c525ea
commit 3fdea1567d
2 changed files with 13 additions and 2 deletions

View file

@ -925,10 +925,12 @@ vn_physical_device_get_native_extensions(
{
memset(exts, 0, sizeof(*exts));
if (physical_dev->renderer_sync_fd.fence_exportable)
if (physical_dev->instance->renderer->info.has_external_sync &&
physical_dev->renderer_sync_fd.fence_exportable)
exts->KHR_external_fence_fd = true;
if (physical_dev->renderer_sync_fd.semaphore_importable &&
if (physical_dev->instance->renderer->info.has_external_sync &&
physical_dev->renderer_sync_fd.semaphore_importable &&
physical_dev->renderer_sync_fd.semaphore_exportable)
exts->KHR_external_semaphore_fd = true;

View file

@ -1669,6 +1669,11 @@ vn_GetFenceFdKHR(VkDevice device,
vn_sync_payload_release(dev, &fence->temporary);
fence->payload = &fence->permanent;
#ifdef VN_USE_WSI_PLATFORM
if (!dev->renderer->info.has_implicit_fencing)
sync_wait(fd, -1);
#endif
} else {
assert(payload->type == VN_SYNC_TYPE_IMPORTED_SYNC_FD);
@ -2126,6 +2131,10 @@ vn_GetSemaphoreFdKHR(VkDevice device,
if (result != VK_SUCCESS)
return vn_error(dev->instance, result);
#ifdef VN_USE_WSI_PLATFORM
if (!dev->renderer->info.has_implicit_fencing)
sync_wait(fd, -1);
#endif
} else {
assert(payload->type == VN_SYNC_TYPE_IMPORTED_SYNC_FD);