anv/android: Use VkFormat for externalFormat

Using a pointer to an internal data structure works but it's a bit
sketchy.  Since every anv_format maps to a VkFormat, we may as well
just use the VkFormat.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19950>
This commit is contained in:
Jason Ekstrand
2021-03-30 22:52:43 -05:00
committed by Marge Bot
parent 9fc046a87d
commit 18feb32df0
2 changed files with 2 additions and 2 deletions

View File

@@ -201,9 +201,9 @@ get_ahw_buffer_format_properties2(
VkAndroidHardwareBufferFormatProperties2ANDROID *p = pProperties;
p->format = vk_format_from_android(desc.format, desc.usage);
p->externalFormat = p->format;
const struct anv_format *anv_format = anv_get_format(p->format);
p->externalFormat = (uint64_t) (uintptr_t) anv_format;
/* Default to OPTIMAL tiling but set to linear in case
* of AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER usage.

View File

@@ -1686,7 +1686,7 @@ VkResult anv_CreateSamplerYcbcrConversion(
if (ext_info && ext_info->externalFormat) {
assert(pCreateInfo->format == VK_FORMAT_UNDEFINED);
conversion->format = (struct anv_format *) (uintptr_t) ext_info->externalFormat;
conversion->format = anv_get_format(ext_info->externalFormat);
} else {
/* The Vulkan 1.1.95 spec says
*