Commit 110f139f authored by Gurchetan Singh's avatar Gurchetan Singh 💬

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's avatarTapani Pälli <tapani.palli@intel.com>
parent 9d93d2a4
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment