From c496dc1120442fcdca909dc8ff13c8acc4d2fb85 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 14 Jun 2021 16:39:54 -0700 Subject: [PATCH] venus: fix compatibility with older host drivers Unlike on Android, KHR_swapchain may be advertised even when the host driver does not support EXT_image_drm_format_modifier and EXT_queue_family_foreign. Do not request those extensions when they are not supported. Signed-off-by: Chia-I Wu Reviewed-by: Yiwei Zhang Part-of: --- src/virtio/vulkan/vn_device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c index 93038f0..4aa3628 100644 --- a/src/virtio/vulkan/vn_device.c +++ b/src/virtio/vulkan/vn_device.c @@ -3222,7 +3222,11 @@ vn_device_fix_create_info(const struct vn_device *dev, 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) { + /* KHR_swapchain may be advertised without the renderer support for + * EXT_image_drm_format_modifier + */ + if (!app_exts->EXT_image_drm_format_modifier && + physical_dev->renderer_extensions.EXT_image_drm_format_modifier) { extra_exts[extra_count++] = VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME; @@ -3233,7 +3237,11 @@ vn_device_fix_create_info(const struct vn_device *dev, } } - if (!app_exts->EXT_queue_family_foreign) { + /* XXX KHR_swapchain may be advertised without the renderer support for + * EXT_queue_family_foreign + */ + if (!app_exts->EXT_queue_family_foreign && + physical_dev->renderer_extensions.EXT_queue_family_foreign) { extra_exts[extra_count++] = VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME; } -- 2.7.4