Merge 1cc7c9cb25c810e49e05e192b31224ccd9431fc8 on remote branch
Change-Id: I580659c2bacc8999c62a198e17ec2b42e2f3fd92
diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp
index 44aefb9..98fca33 100644
--- a/gralloc/gr_buf_mgr.cpp
+++ b/gralloc/gr_buf_mgr.cpp
@@ -88,6 +88,7 @@
using aidl::android::hardware::graphics::common::StandardMetadataType;
using aidl::android::hardware::graphics::common::XyColor;
using ::android::hardware::graphics::common::V1_2::PixelFormat;
+using IMapper_4_0_Error = ::android::hardware::graphics::mapper::V4_0::Error;
static BufferInfo GetBufferInfo(const BufferDescriptor &descriptor) {
return BufferInfo(descriptor.GetWidth(), descriptor.GetHeight(), descriptor.GetFormat(),
@@ -580,15 +581,19 @@
}
break;
case static_cast<int32_t>(HAL_PIXEL_FORMAT_YCbCr_420_P010):
+ case static_cast<int32_t>(HAL_PIXEL_FORMAT_YCbCr_420_P010_VENUS):
if (comp.type.value == android::gralloc4::PlaneLayoutComponentType_Y.value ||
- comp.type.value == android::gralloc4::PlaneLayoutComponentType_CB.value ||
- comp.type.value == android::gralloc4::PlaneLayoutComponentType_CR.value) {
- comp.offsetInBits = 0;
+ comp.type.value == android::gralloc4::PlaneLayoutComponentType_CB.value) {
+ comp.offsetInBits = 6;
+ comp.sizeInBits = 10;
+ } else if (comp.type.value == android::gralloc4::PlaneLayoutComponentType_CR.value) {
+ comp.offsetInBits = 22;
comp.sizeInBits = 10;
} else {
return Error::BAD_VALUE;
}
break;
+
case static_cast<int32_t>(HAL_PIXEL_FORMAT_RAW16):
if (comp.type.value == android::gralloc4::PlaneLayoutComponentType_RAW.value) {
comp.offsetInBits = 0;
@@ -1490,7 +1495,9 @@
return Error::UNSUPPORTED;
case (int64_t)StandardMetadataType::DATASPACE:
Dataspace dataspace;
- android::gralloc4::decodeDataspace(in, &dataspace);
+ if (android::gralloc4::decodeDataspace(in, &dataspace)) {
+ return Error::UNSUPPORTED;
+ }
dataspaceToColorMetadata(dataspace, &metadata->color);
break;
case (int64_t)StandardMetadataType::BLEND_MODE:
@@ -1500,7 +1507,9 @@
break;
case (int64_t)StandardMetadataType::SMPTE2086: {
std::optional<Smpte2086> mastering_display_values;
- android::gralloc4::decodeSmpte2086(in, &mastering_display_values);
+ if (android::gralloc4::decodeSmpte2086(in, &mastering_display_values)) {
+ return Error::UNSUPPORTED;
+ }
if (mastering_display_values != std::nullopt) {
metadata->color.masteringDisplayInfo.colorVolumeSEIEnabled = true;
@@ -1539,7 +1548,9 @@
}
case (int64_t)StandardMetadataType::CTA861_3: {
std::optional<Cta861_3> content_light_level;
- android::gralloc4::decodeCta861_3(in, &content_light_level);
+ if (android::gralloc4::decodeCta861_3(in, &content_light_level)) {
+ return Error::UNSUPPORTED;
+ }
if (content_light_level != std::nullopt) {
metadata->color.contentLightLevel.lightLevelSEIEnabled = true;
metadata->color.contentLightLevel.maxContentLightLevel =
@@ -1557,7 +1568,9 @@
}
case (int64_t)StandardMetadataType::SMPTE2094_40: {
std::optional<std::vector<uint8_t>> dynamic_metadata_payload;
- android::gralloc4::decodeSmpte2094_40(in, &dynamic_metadata_payload);
+ if (android::gralloc4::decodeSmpte2094_40(in, &dynamic_metadata_payload)) {
+ return Error::UNSUPPORTED;
+ }
if (dynamic_metadata_payload != std::nullopt) {
if (dynamic_metadata_payload->size() > HDR_DYNAMIC_META_DATA_SZ)
return Error::BAD_VALUE;
@@ -1578,9 +1591,13 @@
}
case (int64_t)StandardMetadataType::CROP: {
std::vector<Rect> in_crop;
- android::gralloc4::decodeCrop(in, &in_crop);
- if (in_crop.size() != 1)
+ if (android::gralloc4::decodeCrop(in, &in_crop)) {
return Error::UNSUPPORTED;
+ }
+
+ if (in_crop.size() != 1) {
+ return Error::UNSUPPORTED;
+ }
metadata->crop.left = in_crop[0].left;
metadata->crop.top = in_crop[0].top;
@@ -1589,49 +1606,75 @@
break;
}
case QTI_VT_TIMESTAMP:
- android::gralloc4::decodeUint64(qtigralloc::MetadataType_VTTimestamp, in,
- &metadata->vtTimeStamp);
+ if (android::gralloc4::decodeUint64(qtigralloc::MetadataType_VTTimestamp, in,
+ &metadata->vtTimeStamp)) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_COLOR_METADATA:
ColorMetaData color;
- qtigralloc::decodeColorMetadata(in, &color);
+ if (qtigralloc::decodeColorMetadata(in, &color) != IMapper_4_0_Error::NONE) {
+ return Error::UNSUPPORTED;
+ }
metadata->color = color;
break;
case QTI_PP_PARAM_INTERLACED:
- android::gralloc4::decodeInt32(qtigralloc::MetadataType_PPParamInterlaced, in,
- &metadata->interlaced);
+ if (android::gralloc4::decodeInt32(qtigralloc::MetadataType_PPParamInterlaced, in,
+ &metadata->interlaced)) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_VIDEO_PERF_MODE:
- android::gralloc4::decodeUint32(qtigralloc::MetadataType_VideoPerfMode, in,
- &metadata->isVideoPerfMode);
+ if (android::gralloc4::decodeUint32(qtigralloc::MetadataType_VideoPerfMode, in,
+ &metadata->isVideoPerfMode)) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_GRAPHICS_METADATA:
- qtigralloc::decodeGraphicsMetadata(in, &metadata->graphics_metadata);
+ if (qtigralloc::decodeGraphicsMetadata(in, &metadata->graphics_metadata) !=
+ IMapper_4_0_Error::NONE) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_UBWC_CR_STATS_INFO:
- qtigralloc::decodeUBWCStats(in, &metadata->ubwcCRStats[0]);
+ if (qtigralloc::decodeUBWCStats(in, &metadata->ubwcCRStats[0]) != IMapper_4_0_Error::NONE) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_REFRESH_RATE:
- android::gralloc4::decodeFloat(qtigralloc::MetadataType_RefreshRate, in,
- &metadata->refreshrate);
+ if (android::gralloc4::decodeFloat(qtigralloc::MetadataType_RefreshRate, in,
+ &metadata->refreshrate)) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_MAP_SECURE_BUFFER:
- android::gralloc4::decodeInt32(qtigralloc::MetadataType_MapSecureBuffer, in,
- &metadata->mapSecureBuffer);
+ if (android::gralloc4::decodeInt32(qtigralloc::MetadataType_MapSecureBuffer, in,
+ &metadata->mapSecureBuffer)) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_LINEAR_FORMAT:
- android::gralloc4::decodeUint32(qtigralloc::MetadataType_LinearFormat, in,
- &metadata->linearFormat);
+ if (android::gralloc4::decodeUint32(qtigralloc::MetadataType_LinearFormat, in,
+ &metadata->linearFormat)) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_SINGLE_BUFFER_MODE:
- android::gralloc4::decodeUint32(qtigralloc::MetadataType_SingleBufferMode, in,
- &metadata->isSingleBufferMode);
+ if (android::gralloc4::decodeUint32(qtigralloc::MetadataType_SingleBufferMode, in,
+ &metadata->isSingleBufferMode)) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_CVP_METADATA:
- qtigralloc::decodeCVPMetadata(in, &metadata->cvpMetadata);
+ if (qtigralloc::decodeCVPMetadata(in, &metadata->cvpMetadata) != IMapper_4_0_Error::NONE) {
+ return Error::UNSUPPORTED;
+ }
break;
case QTI_VIDEO_HISTOGRAM_STATS:
- qtigralloc::decodeVideoHistogramMetadata(in, &metadata->video_histogram_stats);
+ if (qtigralloc::decodeVideoHistogramMetadata(in, &metadata->video_histogram_stats) !=
+ IMapper_4_0_Error::NONE) {
+ return Error::UNSUPPORTED;
+ }
break;
default:
#ifdef METADATA_V2
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index 1ff6ef1..d735c66 100644
--- a/gralloc/gr_utils.cpp
+++ b/gralloc/gr_utils.cpp
@@ -1452,8 +1452,10 @@
GetYuvSubSamplingFactor(format, &h_subsampling, &v_subsampling);
plane_info[0].h_subsampling = 0;
plane_info[0].v_subsampling = 0;
+ plane_info[0].step = 2;
plane_info[1].h_subsampling = h_subsampling;
plane_info[1].v_subsampling = v_subsampling;
+ plane_info[1].step = 4;
break;
case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
@@ -1504,7 +1506,7 @@
plane_info[0].stride_bytes = static_cast<int32_t>(y_stride);
plane_info[0].scanlines = static_cast<int32_t>(y_height);
plane_info[0].size = static_cast<uint32_t>(y_size);
- plane_info[0].step = 1;
+ plane_info[0].step = 2;
plane_info[0].h_subsampling = 0;
plane_info[0].v_subsampling = 0;