[Mesa-dev] [PATCH 11/15] anv: support VkExternalFormatANDROID in vkCreateSamplerYcbcrConversion

Tapani Pälli tapani.palli at intel.com
Tue Oct 30 05:26:04 UTC 2018


If external format is used, we store the external format identifier in
conversion to be used later when creating VkImageView.

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
 src/intel/vulkan/anv_formats.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 500ba5a1e09..1d3b1f67928 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -1150,6 +1150,17 @@ VkResult anv_CreateSamplerYcbcrConversion(
    ANV_FROM_HANDLE(anv_device, device, _device);
    struct anv_ycbcr_conversion *conversion;
 
+   struct anv_format *ext_format = NULL;
+#ifdef ANDROID
+   /* Search for VkExternalFormatANDROID here and resolve the format. */
+   const struct VkExternalFormatANDROID *ext_info =
+      vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_FORMAT_ANDROID);
+
+   uint64_t format = ext_info ? ext_info->externalFormat : 0;
+   if (format)
+      ext_format = (struct anv_format *) (uintptr_t) format;
+#endif
+
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO);
 
    conversion = vk_alloc2(&device->alloc, pAllocator, sizeof(*conversion), 8,
@@ -1170,6 +1181,10 @@ VkResult anv_CreateSamplerYcbcrConversion(
    conversion->chroma_offsets[1] = pCreateInfo->yChromaOffset;
    conversion->chroma_filter = pCreateInfo->chromaFilter;
 
+   /* Setup external format. */
+   if (ext_format)
+      conversion->format = ext_format;
+
    bool has_chroma_subsampled = false;
    for (uint32_t p = 0; p < conversion->format->n_planes; p++) {
       if (conversion->format->planes[p].has_chroma &&
-- 
2.17.2



More information about the mesa-dev mailing list