mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
venus: advertise VK_ANDROID_external_memory_android_hardware_buffer
Besides advertising AHB support, for Android, we do not advertise KHR_external_memory_fd, EXT_external_memory_dma_buf or EXT_image_drm_format_modifier so that AHB remains the sole channel for external resource sharing. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10960>
This commit is contained in:
parent
47bf8be024
commit
7adb9c42e0
1 changed files with 20 additions and 11 deletions
|
|
@ -1451,24 +1451,24 @@ vn_physical_device_get_native_extensions(
|
|||
/* see vn_physical_device_init_external_memory */
|
||||
if (renderer_exts->EXT_external_memory_dma_buf &&
|
||||
renderer_info->has_dmabuf_import) {
|
||||
#ifdef ANDROID
|
||||
if (renderer_exts->EXT_image_drm_format_modifier &&
|
||||
renderer_exts->EXT_queue_family_foreign) {
|
||||
exts->ANDROID_external_memory_android_hardware_buffer = true;
|
||||
exts->ANDROID_native_buffer = true;
|
||||
}
|
||||
#else
|
||||
exts->KHR_external_memory_fd = true;
|
||||
exts->EXT_external_memory_dma_buf = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* TODO join Android to do proper checks */
|
||||
#ifdef VN_USE_WSI_PLATFORM
|
||||
exts->KHR_incremental_present = true;
|
||||
exts->KHR_swapchain = true;
|
||||
exts->KHR_swapchain_mutable_format = true;
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
if (renderer_exts->EXT_image_drm_format_modifier &&
|
||||
renderer_exts->EXT_queue_family_foreign &&
|
||||
exts->EXT_external_memory_dma_buf) {
|
||||
exts->ANDROID_native_buffer = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1527,7 +1527,9 @@ vn_physical_device_get_passthrough_extensions(
|
|||
.EXT_shader_viewport_index_layer = true,
|
||||
|
||||
/* EXT */
|
||||
#ifndef ANDROID
|
||||
.EXT_image_drm_format_modifier = true,
|
||||
#endif
|
||||
.EXT_queue_family_foreign = true,
|
||||
.EXT_transform_feedback = true,
|
||||
};
|
||||
|
|
@ -3181,9 +3183,10 @@ vn_device_fix_create_info(const struct vn_device *dev,
|
|||
uint32_t extra_count = 0;
|
||||
uint32_t block_count = 0;
|
||||
|
||||
/* fix for WSI */
|
||||
/* fix for WSI (treat AHB as WSI extension for simplicity) */
|
||||
const bool has_wsi =
|
||||
app_exts->KHR_swapchain || app_exts->ANDROID_native_buffer;
|
||||
app_exts->KHR_swapchain || app_exts->ANDROID_native_buffer ||
|
||||
app_exts->ANDROID_external_memory_android_hardware_buffer;
|
||||
if (has_wsi) {
|
||||
if (!app_exts->EXT_image_drm_format_modifier) {
|
||||
extra_exts[extra_count++] =
|
||||
|
|
@ -3208,8 +3211,14 @@ vn_device_fix_create_info(const struct vn_device *dev,
|
|||
VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME;
|
||||
block_exts[block_count++] =
|
||||
VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (app_exts->ANDROID_native_buffer)
|
||||
block_exts[block_count++] = VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME;
|
||||
|
||||
if (app_exts->ANDROID_external_memory_android_hardware_buffer) {
|
||||
block_exts[block_count++] =
|
||||
VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue