anv: Don't reject Android image format if external props not supplied

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 <spencercw@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24844>
This commit is contained in:
Chris Spencer
2023-08-23 12:02:25 +01:00
committed by Marge Bot
parent 5ceba97c2e
commit 6a4e9b55e4
+7 -5
View File
@@ -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;
}