display: Set and handle default csc as BT709
- Some clients don't set the csc for a layer and as a result
HWC will error out. Avoid this by setting the default csc as
BT709 in gralloc for RGB buffers.
- HWC will default to BT709 if clients have not set.
Change-Id: I6f2e0f5bf39d0e06450d50f9c7da6857aaff8b8f
Crs-fixed: 2218048
diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp
index 6b6ec87..42ac8ed 100644
--- a/gralloc/gr_buf_mgr.cpp
+++ b/gralloc/gr_buf_mgr.cpp
@@ -354,12 +354,10 @@
hnd->base = 0;
hnd->base_metadata = 0;
hnd->layer_count = layer_count;
+ // set default csc as 709, but for video(yuv) its 601L
+ ColorSpace_t colorSpace = (buffer_type == BUFFER_TYPE_VIDEO) ? ITU_R_601 : ITU_R_709;
+ setMetaData(hnd, UPDATE_COLOR_SPACE, reinterpret_cast<void *>(&colorSpace));
- if (buffer_type == BUFFER_TYPE_VIDEO) {
- // set default csc to 601L for only video buffers
- ColorSpace_t colorSpace = ITU_R_601;
- setMetaData(hnd, UPDATE_COLOR_SPACE, reinterpret_cast<void *>(&colorSpace));
- }
*handle = hnd;
RegisterHandleLocked(hnd, data.ion_handle, e_data.ion_handle);
ALOGD_IF(DEBUG, "Allocated buffer handle: %p id: %" PRIu64, hnd, hnd->id);