gralloc: Fix ITU formats for camera
Make sure ITU formats are applied exclusively for camera buffers.
Camera HW_TEXTURE buffers go to GPU and should be marked as 601 FR.
Earlier, this was OR'd with video encoder due to which it
incorrectly got marked as 709.
Change-Id: Icaf3692b581b7861229e613dd632123d21dda2cf
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index 1f757bc..1b3e934 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -109,11 +109,17 @@
#ifndef MDSS_TARGET
flags |= private_handle_t::PRIV_FLAGS_ITU_R_601_FR;
#else
- if (usage & (GRALLOC_USAGE_HW_TEXTURE |
- GRALLOC_USAGE_HW_VIDEO_ENCODER))
+ // 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;
- else if (usage & GRALLOC_USAGE_HW_CAMERA_ZSL)
+ else
flags |= private_handle_t::PRIV_FLAGS_ITU_R_601_FR;
+ }
#endif
} else {
flags |= private_handle_t::PRIV_FLAGS_ITU_R_601;