display: Add color Metadata

- Add color aspects and HDR10 related static metadata
  which will be used in the existing metadata structure.
- Clients can use COLOR_METADATA to update the CSC
  information
- UPDATE_COLOR_SPACE is legacy and will be used when
  COLOR_METADATA is not set.
- Update gralloc to return color space when set from
  COLOR_METADATA
- Gaurd the usage with USE_COLOR_METADATA for cobalt.

Change-Id: I460accf6cd2bb7a305c7e93284955e566a5b7532
Crs-fixed: 1074172
This commit is contained in:
Arun Kumar K.R
2016-10-03 21:38:23 -07:00
committed by Gerrit - the friendly Code Review server
parent 8b3dddc082
commit b2771bff77
8 changed files with 260 additions and 4 deletions

View File

@@ -588,7 +588,27 @@ gralloc1_error_t BufferManager::Perform(int operation, va_list args) {
return GRALLOC1_ERROR_BAD_HANDLE;
}
MetaData_t *metadata = reinterpret_cast<MetaData_t *>(hnd->base_metadata);
if (metadata && metadata->operation & UPDATE_COLOR_SPACE) {
if (!metadata) {
return GRALLOC1_ERROR_BAD_HANDLE;
#ifdef USE_COLOR_METADATA
} else if (metadata->operation & COLOR_METADATA) {
ColorMetaData *colorMetadata = &metadata->color;
switch (colorMetadata->colorPrimaries) {
case ColorPrimaries_BT709_5:
*color_space = HAL_CSC_ITU_R_709;
break;
case ColorPrimaries_BT601_6_525:
*color_space = ((colorMetadata->range) ? HAL_CSC_ITU_R_601_FR : HAL_CSC_ITU_R_601);
break;
case ColorPrimaries_BT2020:
*color_space = (colorMetadata->range) ? HAL_CSC_ITU_R_2020_FR : HAL_CSC_ITU_R_2020;
break;
default:
ALOGE("Unknown Color Space = %d", colorMetadata->colorPrimaries);
break;
}
#endif
} else if (metadata->operation & UPDATE_COLOR_SPACE) {
*color_space = metadata->colorSpace;
}
} break;