From: Gurchetan Singh Date: Wed, 5 Jun 2019 16:51:07 +0000 (-0700) Subject: anv: allow NV12 <--> AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 inter-op X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=110f139f98f1786f592ebe05385a7be04fdc5bf4;p=mesa.git anv: allow NV12 <--> AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 inter-op AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 is an implementation defined flexible YUV format.  Most of the times, it's NV12 or YV12. On Intel, NV12 is preferred since it can be used by the display engine.   This API adds a dependency between gralloc and buffer consumers, unfortunately. Right now, the code seems to work for i915 gralloc, but not cros_gralloc. Add a preprocessor flag to fix this. TEST=android.graphics.cts.MediaVulkanGpuTest#testMediaImportAndRendering Reviewed-by: Tapani Pälli --- diff --git a/src/intel/vulkan/vk_format_info.h b/src/intel/vulkan/vk_format_info.h index 2e126645763..1369f54ee38 100644 --- a/src/intel/vulkan/vk_format_info.h +++ b/src/intel/vulkan/vk_format_info.h @@ -47,6 +47,7 @@ vk_format_from_android(unsigned android_format) return VK_FORMAT_R16G16B16A16_SFLOAT; case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: return VK_FORMAT_A2B10G10R10_UNORM_PACK32; + case AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420: case HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL: return VK_FORMAT_G8_B8R8_2PLANE_420_UNORM; case AHARDWAREBUFFER_FORMAT_BLOB: @@ -70,7 +71,11 @@ android_format_from_vk(unsigned vk_format) case VK_FORMAT_A2B10G10R10_UNORM_PACK32: return AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM; case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM: +#ifdef HAVE_CROS_GRALLOC + return AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420; +#else return HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL; +#endif default: return AHARDWAREBUFFER_FORMAT_BLOB; }