merge in jb-mr2-release history after reset to jb-mr2-dev
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 @@
*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 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,
diff --git a/libcamera2/ExynosCameraHWInterface2.cpp b/libcamera2/ExynosCameraHWInterface2.cpp
index b372c8c..714edb7 100644
--- a/libcamera2/ExynosCameraHWInterface2.cpp
+++ b/libcamera2/ExynosCameraHWInterface2.cpp
@@ -1726,6 +1726,8 @@
*format_actual = HAL_PIXEL_FORMAT_EXYNOS_YV12;
*usage = GRALLOC_USAGE_SW_WRITE_OFTEN;
+ if (m_wideAspect)
+ *usage |= GRALLOC_USAGE_PRIVATE_CHROMA;
*max_buffers = 6;
newParameters.width = width;
@@ -1771,6 +1773,8 @@
*format_actual = HAL_PIXEL_FORMAT_YCbCr_420_SP; // NV12M
*usage = GRALLOC_USAGE_SW_WRITE_OFTEN;
+ if (m_wideAspect)
+ *usage |= GRALLOC_USAGE_PRIVATE_CHROMA;
*max_buffers = 6;
subParameters->type = SUBSTREAM_TYPE_RECORD;
@@ -1819,6 +1823,8 @@
*format_actual = HAL_PIXEL_FORMAT_YCbCr_422_I; // YUYV
*usage = GRALLOC_USAGE_SW_WRITE_OFTEN;
+ if (m_wideAspect)
+ *usage |= GRALLOC_USAGE_PRIVATE_CHROMA;
*max_buffers = 6;
newParameters.width = width;
@@ -1872,6 +1878,8 @@
*format_actual = HAL_PIXEL_FORMAT_YCbCr_422_I; // YUYV
*usage = GRALLOC_USAGE_SW_WRITE_OFTEN;
+ if (m_wideAspect)
+ *usage |= GRALLOC_USAGE_PRIVATE_CHROMA;
*max_buffers = 6;
newParameters.width = width;
@@ -1924,6 +1932,8 @@
*format_actual = HAL_PIXEL_FORMAT_BLOB;
*usage = GRALLOC_USAGE_SW_WRITE_OFTEN;
+ if (m_wideAspect)
+ *usage |= GRALLOC_USAGE_PRIVATE_CHROMA;
*max_buffers = 4;
subParameters->type = SUBSTREAM_TYPE_JPEG;
@@ -1960,6 +1970,8 @@
*format_actual = format;
*usage = GRALLOC_USAGE_SW_WRITE_OFTEN;
+ if (m_wideAspect)
+ *usage |= GRALLOC_USAGE_PRIVATE_CHROMA;
*max_buffers = 6;
subParameters->type = SUBSTREAM_TYPE_PRVCB;