venus: add extension check for ANDROID_native_buffer

We only do it on Android for now, to keep the driver working with older
renderers on X11.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>
This commit is contained in:
Chia-I Wu 2021-04-30 12:52:52 -07:00 committed by Marge Bot
parent 203e64eadd
commit 9171b981bf
2 changed files with 24 additions and 17 deletions

View File

@ -1436,23 +1436,34 @@ vn_physical_device_get_native_extensions(
const struct vn_physical_device *physical_dev,
struct vk_device_extension_table *exts)
{
*exts = (struct vk_device_extension_table){
#ifdef VN_USE_WSI_PLATFORM
.KHR_incremental_present = true,
.KHR_swapchain = true,
.KHR_swapchain_mutable_format = true,
#endif
#ifdef ANDROID
.ANDROID_native_buffer = true,
#endif
};
const struct vn_instance *instance = physical_dev->instance;
const struct vn_renderer_info *renderer_info = &instance->renderer_info;
const struct vk_device_extension_table *renderer_exts =
&physical_dev->renderer_extensions;
memset(exts, 0, sizeof(*exts));
/* see vn_physical_device_init_external_memory */
if (physical_dev->renderer_extensions.EXT_external_memory_dma_buf &&
physical_dev->instance->renderer_info.has_dmabuf_import) {
if (renderer_exts->EXT_external_memory_dma_buf &&
renderer_info->has_dmabuf_import) {
exts->KHR_external_memory_fd = true;
exts->EXT_external_memory_dma_buf = true;
}
/* 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

View File

@ -103,11 +103,7 @@ vn_image_android_wsi_init(struct vn_device *dev,
img->sharing_mode == VK_SHARING_MODE_EXCLUSIVE
? 0
: VK_QUEUE_FAMILY_IGNORED;
const uint32_t external_index =
(dev->base.base.enabled_extensions.EXT_queue_family_foreign ||
dev->physical_device->renderer_extensions.EXT_queue_family_foreign)
? VK_QUEUE_FAMILY_FOREIGN_EXT
: VK_QUEUE_FAMILY_EXTERNAL;
const uint32_t external_index = VK_QUEUE_FAMILY_FOREIGN_EXT;
const uint32_t count = dev->physical_device->queue_family_count;
struct vn_image_ownership_cmds *local_cmds =