venus: expose KHR_external_fence/sempahore_fd extensions

Re-purpose renderer has_external_sync to cover explicit sync emulation
in venus, so that we don't have to add a new flag to distinguish the
emulation path enablement for virtgpu and vtest.

This is to unblock zink implicit sync hanlding against venus for now,
and soon we should migrate to virtgpu fence passing.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25127>
This commit is contained in:
Yiwei Zhang
2023-09-08 11:55:48 -07:00
committed by Marge Bot
parent c9c2ba3839
commit 68a478870d
2 changed files with 19 additions and 23 deletions

View File

@@ -840,10 +840,10 @@ vn_physical_device_init_external_fence_handles(
physical_dev->external_fence_handles = 0;
#ifdef ANDROID
physical_dev->external_fence_handles =
VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT;
#endif
if (physical_dev->instance->renderer->info.has_external_sync) {
physical_dev->external_fence_handles =
VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT;
}
}
static void
@@ -891,10 +891,10 @@ vn_physical_device_init_external_semaphore_handles(
physical_dev->external_binary_semaphore_handles = 0;
physical_dev->external_timeline_semaphore_handles = 0;
#ifdef ANDROID
physical_dev->external_binary_semaphore_handles =
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
#endif
if (physical_dev->instance->renderer->info.has_external_sync) {
physical_dev->external_binary_semaphore_handles =
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
}
}
static inline bool
@@ -924,11 +924,17 @@ vn_physical_device_get_native_extensions(
{
memset(exts, 0, sizeof(*exts));
if (physical_dev->renderer_sync_fd.fence_exportable)
exts->KHR_external_fence_fd = true;
if (physical_dev->renderer_sync_fd.semaphore_importable &&
physical_dev->renderer_sync_fd.semaphore_exportable)
exts->KHR_external_semaphore_fd = true;
const bool can_external_mem =
vn_physical_device_get_external_memory_support(physical_dev);
#ifdef ANDROID
if (can_external_mem) {
#ifdef ANDROID
exts->ANDROID_external_memory_android_hardware_buffer = true;
/* For wsi, we require renderer:
@@ -944,21 +950,11 @@ vn_physical_device_get_native_extensions(
if (physical_dev->renderer_sync_fd.semaphore_importable &&
physical_dev->renderer_sync_fd.fence_exportable)
exts->ANDROID_native_buffer = true;
}
if (physical_dev->renderer_sync_fd.fence_exportable)
exts->KHR_external_fence_fd = true;
if (physical_dev->renderer_sync_fd.semaphore_importable &&
physical_dev->renderer_sync_fd.semaphore_exportable)
exts->KHR_external_semaphore_fd = true;
#else /* ANDROID */
if (can_external_mem) {
exts->KHR_external_memory_fd = true;
exts->EXT_external_memory_dma_buf = true;
}
#endif /* ANDROID */
}
#ifdef VN_USE_WSI_PLATFORM
if (can_external_mem &&

View File

@@ -1375,8 +1375,8 @@ virtgpu_init_renderer_info(struct virtgpu *gpu)
}
info->has_dma_buf_import = true;
/* TODO drm_syncobj */
info->has_external_sync = false;
/* TODO switch from emulation to drm_syncobj */
info->has_external_sync = true;
info->has_implicit_fencing = false;