gralloc: Use only metadata for color space
Currently both handle metadata and handle flags are used to indicate
the color space. This change deprecates support for flags.
Also gralloc doesn't set a color space based on use case anymore,
since front-end requirements keep changing. The default is set to 601
and the onus of correctly specifying the color space now rests on
clients.
CRs-fixed: 919117
Change-Id: I4988830e22804517b393c60dbe641d3bd1d790ec
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index a0d7d8d..d595a5b 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -95,31 +95,11 @@
if (usage & GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY) {
flags |= private_handle_t::PRIV_FLAGS_EXTERNAL_ONLY;
}
+
if (usage & GRALLOC_USAGE_PRIVATE_INTERNAL_ONLY) {
flags |= private_handle_t::PRIV_FLAGS_INTERNAL_ONLY;
}
- ColorSpace_t colorSpace = ITU_R_601;
- flags |= private_handle_t::PRIV_FLAGS_ITU_R_601;
- if (bufferType == BUFFER_TYPE_VIDEO) {
- if (usage & GRALLOC_USAGE_HW_CAMERA_WRITE) {
- // Per the camera spec ITU 709 format should be set only for
- // video encoding.
- // It should be set to ITU 601 full range format for any other
- // camera buffer
- //
- if (usage & GRALLOC_USAGE_HW_CAMERA_MASK) {
- if (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) {
- flags |= private_handle_t::PRIV_FLAGS_ITU_R_709;
- colorSpace = ITU_R_709;
- } else {
- flags |= private_handle_t::PRIV_FLAGS_ITU_R_601_FR;
- colorSpace = ITU_R_601_FR;
- }
- }
- }
- }
-
if (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER ) {
flags |= private_handle_t::PRIV_FLAGS_VIDEO_ENCODER;
}
@@ -176,6 +156,7 @@
hnd->offset = data.offset;
hnd->base = (uint64_t)(data.base) + data.offset;
hnd->gpuaddr = 0;
+ ColorSpace_t colorSpace = ITU_R_601;
setMetaData(hnd, UPDATE_COLOR_SPACE, (void*) &colorSpace);
*pHandle = hnd;