From 6a4e9b55e4ada27064390485ee9043d4a5ac115e Mon Sep 17 00:00:00 2001 From: Chris Spencer Date: Wed, 23 Aug 2023 12:02:25 +0100 Subject: [PATCH] anv: Don't reject Android image format if external props not supplied MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit anv_GetPhysicalDeviceImageFormatProperties2 returns 'not supported' if an Android hardware buffer external memory handle type is specified, but no external image format properties output struct is supplied. This struct is optional, so we should populate it if present, but return successfully either way. This fixes an error when using ANV with hwui, which otherwise prevents the system from booting.[1] [1] https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/libs/hwui/renderthread/VulkanSurface.cpp;l=271;drc=ad3fb95aa2fe0be59d3e991ddc883592ab5542bc Signed-off-by: Chris Spencer Reviewed-by: Tapani Pälli Part-of: --- src/intel/vulkan/anv_formats.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index e0f5c68..966bc9c 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -1734,11 +1734,13 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2( * requires support for VK_IMAGE_TILING_OPTIMAL. Android systems * communicate the image's memory layout through backdoor channels. */ - if (ahw_supported && external_props) { - external_props->externalMemoryProperties = android_image_props; - if (anv_ahb_format_for_vk_format(base_info->format)) { - external_props->externalMemoryProperties.externalMemoryFeatures |= - VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + if (ahw_supported) { + if (external_props) { + external_props->externalMemoryProperties = android_image_props; + if (anv_ahb_format_for_vk_format(base_info->format)) { + external_props->externalMemoryProperties.externalMemoryFeatures |= + VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT; + } } break; } -- 2.7.4