From 18feb32df0a20c852331748e572f783c082c68ed Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 30 Mar 2021 22:52:43 -0500 Subject: [PATCH] anv/android: Use VkFormat for externalFormat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_android.c | 2 +- src/intel/vulkan/anv_formats.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_android.c b/src/intel/vulkan/anv_android.c index 204c4a1fca9..0394488fe43 100644 --- a/src/intel/vulkan/anv_android.c +++ b/src/intel/vulkan/anv_android.c @@ -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. diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 3beb21b271c..efe85db2b93 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -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 *