[PATCH 2/4] include: linux: videodev2: Add generic line based pixel formats

Jacopo Mondi jacopo.mondi at ideasonboard.com
Wed Oct 23 13:11:21 CEST 2024


Add the definition for the generic line based pixelformats.

The formats has been added in upstream Linux by commit
1d9215233958 ("media: uapi: v4l: Add generic 8-bit metadata format
definitions") which got merged in Linux v6.10.

The formats however are not yet available to userspace, as they
have been made only available to the kernel by commit
d69c8429ea80 ("media: uapi: v4l: Don't expose generic metadata formats
to userspace") to let the line-based metadata support stabilize before
allowing applications to use it.

With the forthcoming completion of the line-based metadata upstreaming
manually add the generic line based pixel format to prepare libcamera
to support them.

Signed-off-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
---
 include/linux/videodev2.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 3829c0b60f52..1168f6ff40eb 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -840,6 +840,18 @@ struct v4l2_pix_format {
 /* The metadata format identifier for FE stats buffers. */
 #define V4L2_META_FMT_RPI_FE_STATS v4l2_fourcc('R', 'P', 'F', 'S')
 
+/*
+ * Line-based metadata formats. Remember to update v4l_fill_fmtdesc() when
+ * adding new ones!
+ */
+#define V4L2_META_FMT_GENERIC_8		v4l2_fourcc('M', 'E', 'T', '8') /* Generic 8-bit metadata */
+#define V4L2_META_FMT_GENERIC_CSI2_10	v4l2_fourcc('M', 'C', '1', 'A') /* 10-bit CSI-2 packed 8-bit metadata */
+#define V4L2_META_FMT_GENERIC_CSI2_12	v4l2_fourcc('M', 'C', '1', 'C') /* 12-bit CSI-2 packed 8-bit metadata */
+#define V4L2_META_FMT_GENERIC_CSI2_14	v4l2_fourcc('M', 'C', '1', 'E') /* 14-bit CSI-2 packed 8-bit metadata */
+#define V4L2_META_FMT_GENERIC_CSI2_16	v4l2_fourcc('M', 'C', '1', 'G') /* 16-bit CSI-2 packed 8-bit metadata */
+#define V4L2_META_FMT_GENERIC_CSI2_20	v4l2_fourcc('M', 'C', '1', 'K') /* 20-bit CSI-2 packed 8-bit metadata */
+#define V4L2_META_FMT_GENERIC_CSI2_24	v4l2_fourcc('M', 'C', '1', 'O') /* 24-bit CSI-2 packed 8-bit metadata */
+
 /* priv field value to indicates that subsequent fields are valid. */
 #define V4L2_PIX_FMT_PRIV_MAGIC		0xfeedcafe
 
-- 
2.47.0



More information about the libcamera-devel mailing list