gralloc: add private flag to indicate chroma space
authorAlex Ray <aray@google.com>
Mon, 15 Apr 2013 18:24:13 +0000 (11:24 -0700)
committerAlex Ray <aray@google.com>
Wed, 17 Apr 2013 22:08:11 +0000 (15:08 -0700)
Bug: 7985212
Change-Id: I1f1205040a72438246246775d57508af16ba1dbd

gralloc/gralloc.cpp
include/gralloc_priv.h

index 2c12bdadcf3738e4951afc2a499f5459dd932444..cdfa70f1a3a981ce0f1143a34da955f3d3ca87c6 100644 (file)
@@ -300,6 +300,16 @@ static int gralloc_alloc_yuv(int ionfd, int w, int h, int format,
                                         *stride, luma_vstride);
         }
     }
+    // Set chroma & gamut fields
+    if (!err && *hnd) {
+        if (usage & GRALLOC_USAGE_PRIVATE_CHROMA) {
+            (*hnd)->chroma = HAL_PIXEL_CHROMA_BT601_8;
+            (*hnd)->gamut = HAL_PIXEL_GAMUT_NARROW_8;
+        } else {
+            (*hnd)->chroma = HAL_PIXEL_CHROMA_BT709_8;
+            (*hnd)->gamut = HAL_PIXEL_GAMUT_WIDE_8;
+        }
+    }
     return err;
 
 err2:
index 6dd1597379f18bc6c8c8e91686a078ebd91ca61a..bf2940eae624c304e6475b89e300306badcdb8fd 100644 (file)
@@ -65,6 +65,9 @@ struct private_handle_t {
     struct native_handle nativeHandle;
 #endif
 
+// set if using video encoding colorspace
+#define GRALLOC_USAGE_PRIVATE_CHROMA (GRALLOC_USAGE_PRIVATE_0)
+
     enum {
         PRIV_FLAGS_FRAMEBUFFER = 0x00000001,
         PRIV_FLAGS_USES_UMP    = 0x00000002,