diff options
author | Arun Kumar K.R <akumarkr@codeaurora.org> | 2016-10-03 21:38:23 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-11-14 02:16:36 -0800 |
commit | b2771bff77d962ef662ee18217af8693bc760e0c (patch) | |
tree | 80689fb7f0fd16ca4a11cdf2423c6d89887cfb3e /libgralloc1 | |
parent | 8b3dddc082fffaa0906e625b8abccf4a7fe80767 (diff) | |
download | display-b2771bff77d962ef662ee18217af8693bc760e0c.tar.gz |
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
Diffstat (limited to 'libgralloc1')
-rw-r--r-- | libgralloc1/gr_buf_mgr.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libgralloc1/gr_buf_mgr.cpp b/libgralloc1/gr_buf_mgr.cpp index 6c363455..96505832 100644 --- a/libgralloc1/gr_buf_mgr.cpp +++ b/libgralloc1/gr_buf_mgr.cpp @@ -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; |