From 06f1fa77873867819b1a6c24ba3c9a088ec6360d Mon Sep 17 00:00:00 2001 From: Alex Ray Date: Mon, 15 Apr 2013 11:24:13 -0700 Subject: [PATCH] gralloc: add private flag to indicate chroma space Bug: 7985212 Change-Id: I1f1205040a72438246246775d57508af16ba1dbd --- gralloc/gralloc.cpp | 10 ++++++++++ include/gralloc_priv.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp index 2c12bda..cdfa70f 100644 --- a/gralloc/gralloc.cpp +++ b/gralloc/gralloc.cpp @@ -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: diff --git a/include/gralloc_priv.h b/include/gralloc_priv.h index 6dd1597..bf2940e 100644 --- a/include/gralloc_priv.h +++ b/include/gralloc_priv.h @@ -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, -- 2.20.1