venus: VkExternalImageFormatProperties is optional

It's optional even if VkPhysicalDeviceExternalImageFormatInfo is there.

Fixes: 108f386a61 ("venus: initial support for VkPhysicalDevice commands")

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/14503>
(cherry picked from commit 17b753459e)
This commit is contained in:
Yiwei Zhang 2022-01-11 22:01:22 +00:00 committed by Eric Engestrom
parent 709fd542be
commit fc8bc2d307
2 changed files with 19 additions and 13 deletions

View file

@ -4954,7 +4954,7 @@
"description": "venus: VkExternalImageFormatProperties is optional",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "108f386a612054e1617515af6e7ae7f87a9da5ba"
},

View file

@ -2196,8 +2196,25 @@ vn_GetPhysicalDeviceImageFormatProperties2(
if (result != VK_SUCCESS || !external_info)
return vn_result(physical_dev->instance, result);
if (external_info->handleType ==
VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) {
VkAndroidHardwareBufferUsageANDROID *ahb_usage =
vk_find_struct(pImageFormatProperties->pNext,
ANDROID_HARDWARE_BUFFER_USAGE_ANDROID);
if (ahb_usage) {
ahb_usage->androidHardwareBufferUsage = vn_android_get_ahb_usage(
pImageFormatInfo->usage, pImageFormatInfo->flags);
}
/* AHBs with mipmap usage will ignore this property */
pImageFormatProperties->imageFormatProperties.maxMipLevels = 1;
}
VkExternalImageFormatProperties *img_props = vk_find_struct(
pImageFormatProperties->pNext, EXTERNAL_IMAGE_FORMAT_PROPERTIES);
if (!img_props)
return VK_SUCCESS;
VkExternalMemoryProperties *mem_props =
&img_props->externalMemoryProperties;
@ -2217,17 +2234,6 @@ vn_GetPhysicalDeviceImageFormatProperties2(
VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID;
mem_props->compatibleHandleTypes =
VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID;
VkAndroidHardwareBufferUsageANDROID *ahb_usage =
vk_find_struct(pImageFormatProperties->pNext,
ANDROID_HARDWARE_BUFFER_USAGE_ANDROID);
if (ahb_usage) {
ahb_usage->androidHardwareBufferUsage = vn_android_get_ahb_usage(
pImageFormatInfo->usage, pImageFormatInfo->flags);
}
/* AHBs with mipmap usage will ignore this property */
pImageFormatProperties->imageFormatProperties.maxMipLevels = 1;
} else {
mem_props->compatibleHandleTypes = supported_handle_types;
mem_props->exportFromImportedHandleTypes =
@ -2236,7 +2242,7 @@ vn_GetPhysicalDeviceImageFormatProperties2(
: 0;
}
return vn_result(physical_dev->instance, result);
return VK_SUCCESS;
}
void