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 /libgralloc | |
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 'libgralloc')
-rw-r--r-- | libgralloc/mapper.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp index 15bb71a5..132c768a 100644 --- a/libgralloc/mapper.cpp +++ b/libgralloc/mapper.cpp @@ -412,7 +412,30 @@ int gralloc_perform(struct gralloc_module_t const* module, return res; } MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; - if(metadata && metadata->operation & UPDATE_COLOR_SPACE) { + if (!metadata) { + break; +#ifdef USE_COLOR_METADATA + } else if (metadata->operation & COLOR_METADATA) { + ColorMetaData *colorMetadata = &metadata->color; + res = 0; + 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: + res = -EINVAL; + break; + } +#endif + } else if(metadata->operation & UPDATE_COLOR_SPACE) { *color_space = metadata->colorSpace; res = 0; } |