Snap for 6803753 from aa65a6a67cd41390d4e8a0f87e20d3191db2994d to rvc-qpr1-release
Change-Id: Ib246366db199f3b9e046056dfc0e0b19eb738590
diff --git a/cros_gralloc/gralloc4/CrosGralloc4Mapper.cc b/cros_gralloc/gralloc4/CrosGralloc4Mapper.cc
index 47e24ac..2a3f4c0 100644
--- a/cros_gralloc/gralloc4/CrosGralloc4Mapper.cc
+++ b/cros_gralloc/gralloc4/CrosGralloc4Mapper.cc
@@ -467,7 +467,12 @@
PixelFormat pixelFormat = static_cast<PixelFormat>(crosHandle->droid_format);
status = android::gralloc4::encodePixelFormatRequested(pixelFormat, &encodedMetadata);
} else if (metadataType == android::gralloc4::MetadataType_PixelFormatFourCC) {
- status = android::gralloc4::encodePixelFormatFourCC(crosHandle->format, &encodedMetadata);
+ uint32_t format = crosHandle->format;
+ // Map internal fourcc codes back to standard fourcc codes.
+ if (format == DRM_FORMAT_YVU420_ANDROID) {
+ format = DRM_FORMAT_YVU420;
+ }
+ status = android::gralloc4::encodePixelFormatFourCC(format, &encodedMetadata);
} else if (metadataType == android::gralloc4::MetadataType_PixelFormatModifier) {
status = android::gralloc4::encodePixelFormatModifier(crosHandle->format_modifier,
&encodedMetadata);