{"id":19601,"url":"https://patchwork.libcamera.org/api/patches/19601/?format=json","web_url":"https://patchwork.libcamera.org/patch/19601/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240301212121.9072-11-laurent.pinchart@ideasonboard.com>","date":"2024-03-01T21:20:59","name":"[PATCH/RFC,10/32,DNI] include: linux: Update kernel headers to metadata API","commit_ref":null,"pull_url":null,"state":"rfc","archived":false,"hash":"548067517cef37f10fb80579303af87d5b2c8179","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19601/mbox/","series":[{"id":4197,"url":"https://patchwork.libcamera.org/api/series/4197/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4197","date":"2024-03-01T21:20:49","name":"libcamera: Support the upstream Unicam driver","version":1,"mbox":"https://patchwork.libcamera.org/series/4197/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19601/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19601/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 24604BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  1 Mar 2024 21:21:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D25E36291F;\n\tFri,  1 Mar 2024 22:21:36 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 956A962879\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Mar 2024 22:21:34 +0100 (CET)","from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 12D14673;\n\tFri,  1 Mar 2024 22:21:20 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gmdaRpry\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1709328080;\n\tbh=m7f/wpZb+ozgiwkel6l9WYr9kJ2ejvTC3ZSHgVLv8dg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gmdaRpryszep9Awoj5UJK95daGSzAB3Iuu/yRB+zw7rdXAq/fw96wb+ROW8Y87VaF\n\tBLj/pb+Dxioivcz9o2vwQQCi/hBMeAGnqonXemC8CyB6ZjhBQNXL+6f/iID/s2073d\n\tAkvD1QtmdHcGlw5ooopOJqRWHpuyUc0B75R4fAgI=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH/RFC 10/32] [DNI] include: linux: Update kernel headers to\n\tmetadata API","Date":"Fri,  1 Mar 2024 23:20:59 +0200","Message-ID":"<20240301212121.9072-11-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240301212121.9072-1-laurent.pinchart@ideasonboard.com>","References":"<20240301212121.9072-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"Sakari Ailus <sakari.ailus@iki.fi>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Update kernel headers to the rpi/v6.8/unicam/dev branch at commit\n506b705e8bce. This pulls in the new V4L2 metadata API that is under\ndevelopment, and should not be merged in libcamera until the API\nstabilizes.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/linux/README             |  2 +-\n include/linux/media-bus-format.h | 13 +++++++++++++\n include/linux/media.h            |  1 +\n include/linux/v4l2-controls.h    | 16 ++++++++++++----\n include/linux/v4l2-mediabus.h    | 18 ++++++++++++------\n include/linux/v4l2-subdev.h      | 23 +++++++++++++++++------\n include/linux/videodev2.h        | 29 ++++++++++++++++++++++++++++-\n 7 files changed, 84 insertions(+), 18 deletions(-)","diff":"diff --git a/include/linux/README b/include/linux/README\nindex 101e49970af2..4ce1273d32c2 100644\n--- a/include/linux/README\n+++ b/include/linux/README\n@@ -1,4 +1,4 @@\n # SPDX-License-Identifier: CC0-1.0\n \n-Files in this directory are imported from v6.7 of the Linux kernel. Do not\n+Files in this directory are imported from v6.7-391-g2113eb19631f of the Linux kernel. Do not\n modify them manually.\ndiff --git a/include/linux/media-bus-format.h b/include/linux/media-bus-format.h\nindex f05f747e444d..13e68c2ccb61 100644\n--- a/include/linux/media-bus-format.h\n+++ b/include/linux/media-bus-format.h\n@@ -174,4 +174,17 @@\n  */\n #define MEDIA_BUS_FMT_METADATA_FIXED\t\t0x7001\n \n+/* Generic line based metadata formats for serial buses. Next is 0x8008. */\n+#define MEDIA_BUS_FMT_META_8\t\t\t0x8001\n+#define MEDIA_BUS_FMT_META_10\t\t\t0x8002\n+#define MEDIA_BUS_FMT_META_12\t\t\t0x8003\n+#define MEDIA_BUS_FMT_META_14\t\t\t0x8004\n+#define MEDIA_BUS_FMT_META_16\t\t\t0x8005\n+#define MEDIA_BUS_FMT_META_20\t\t\t0x8006\n+#define MEDIA_BUS_FMT_META_24\t\t\t0x8007\n+\n+/* Specific metadata formats. Next is 0x9003. */\n+#define MEDIA_BUS_FMT_CCS_EMBEDDED\t\t0x9001\n+#define MEDIA_BUS_FMT_OV2740_EMBEDDED\t\t0x9002\n+\n #endif /* __LINUX_MEDIA_BUS_FORMAT_H */\ndiff --git a/include/linux/media.h b/include/linux/media.h\nindex b5a77bbf4062..4a733b9beb27 100644\n--- a/include/linux/media.h\n+++ b/include/linux/media.h\n@@ -206,6 +206,7 @@ struct media_entity_desc {\n #define MEDIA_PAD_FL_SINK\t\t\t(1U << 0)\n #define MEDIA_PAD_FL_SOURCE\t\t\t(1U << 1)\n #define MEDIA_PAD_FL_MUST_CONNECT\t\t(1U << 2)\n+#define MEDIA_PAD_FL_INTERNAL\t\t\t(1U << 3)\n \n struct media_pad_desc {\n \t__u32 entity;\t\t/* entity ID */\ndiff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h\nindex b9f6481092c7..90ae4bcfbab4 100644\n--- a/include/linux/v4l2-controls.h\n+++ b/include/linux/v4l2-controls.h\n@@ -177,10 +177,6 @@ enum v4l2_colorfx {\n  * We reserve 128 controls for this driver.\n  */\n #define V4L2_CID_USER_CCS_BASE\t\t\t(V4L2_CID_USER_BASE + 0x10f0)\n-\n-/* The base for the bcm2835-isp driver controls.\n- * We reserve 16 controls for this driver. */\n-#define V4L2_CID_USER_BCM2835_ISP_BASE\t\t(V4L2_CID_USER_BASE + 0x10e0)\n /*\n  * The base for Allegro driver controls.\n  * We reserve 16 controls for this driver.\n@@ -211,6 +207,18 @@ enum v4l2_colorfx {\n  */\n #define V4L2_CID_USER_NPCM_BASE\t\t\t(V4L2_CID_USER_BASE + 0x11b0)\n \n+/*\n+ * The base for THine THP7312 driver controls.\n+ * We reserve 32 controls for this driver.\n+ */\n+#define V4L2_CID_USER_THP7312_BASE\t\t(V4L2_CID_USER_BASE + 0x11c0)\n+\n+/*\n+ * The base for the bcm2835-isp driver controls.\n+ * We reserve 16 controls for this driver.\n+ */\n+#define V4L2_CID_USER_BCM2835_ISP_BASE\t\t(V4L2_CID_USER_BASE + 0x11d0)\n+\n /* MPEG-class control IDs */\n /* The MPEG controls are applicable to all codec controls\n  * and the 'MPEG' part of the define is historical */\ndiff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h\nindex 2c318de10485..0651b09dee68 100644\n--- a/include/linux/v4l2-mediabus.h\n+++ b/include/linux/v4l2-mediabus.h\n@@ -19,12 +19,18 @@\n  * @width:\timage width\n  * @height:\timage height\n  * @code:\tdata format code (from enum v4l2_mbus_pixelcode)\n- * @field:\tused interlacing type (from enum v4l2_field)\n- * @colorspace:\tcolorspace of the data (from enum v4l2_colorspace)\n- * @ycbcr_enc:\tYCbCr encoding of the data (from enum v4l2_ycbcr_encoding)\n- * @hsv_enc:\tHSV encoding of the data (from enum v4l2_hsv_encoding)\n- * @quantization: quantization of the data (from enum v4l2_quantization)\n- * @xfer_func:  transfer function of the data (from enum v4l2_xfer_func)\n+ * @field:\tused interlacing type (from enum v4l2_field), zero on metadata\n+ *\t\tmbus codes\n+ * @colorspace:\tcolorspace of the data (from enum v4l2_colorspace), zero on\n+ *\t\tmetadata mbus codes\n+ * @ycbcr_enc:\tYCbCr encoding of the data (from enum v4l2_ycbcr_encoding), zero\n+ *\t\ton metadata mbus codes\n+ * @hsv_enc:\tHSV encoding of the data (from enum v4l2_hsv_encoding), zero on\n+ *\t\tmetadata mbus codes\n+ * @quantization: quantization of the data (from enum v4l2_quantization), zero\n+ *\t\ton metadata mbus codes\n+ * @xfer_func:  transfer function of the data (from enum v4l2_xfer_func), zero\n+ *\t\ton metadata mbus codes\n  * @flags:\tflags (V4L2_MBUS_FRAMEFMT_*)\n  * @reserved:  reserved bytes that can be later used\n  */\ndiff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h\nindex b383c2fe0cf3..3b72a5956822 100644\n--- a/include/linux/v4l2-subdev.h\n+++ b/include/linux/v4l2-subdev.h\n@@ -116,13 +116,15 @@ struct v4l2_subdev_frame_size_enum {\n  * @pad: pad number, as reported by the media API\n  * @interval: frame interval in seconds\n  * @stream: stream number, defined in subdev routing\n+ * @which: interval type (from enum v4l2_subdev_format_whence)\n  * @reserved: drivers and applications must zero this array\n  */\n struct v4l2_subdev_frame_interval {\n \t__u32 pad;\n \tstruct v4l2_fract interval;\n \t__u32 stream;\n-\t__u32 reserved[8];\n+\t__u32 which;\n+\t__u32 reserved[7];\n };\n \n /**\n@@ -133,7 +135,7 @@ struct v4l2_subdev_frame_interval {\n  * @width: frame width in pixels\n  * @height: frame height in pixels\n  * @interval: frame interval in seconds\n- * @which: format type (from enum v4l2_subdev_format_whence)\n+ * @which: interval type (from enum v4l2_subdev_format_whence)\n  * @stream: stream number, defined in subdev routing\n  * @reserved: drivers and applications must zero this array\n  */\n@@ -222,15 +224,17 @@ struct v4l2_subdev_route {\n  * struct v4l2_subdev_routing - Subdev routing information\n  *\n  * @which: configuration type (from enum v4l2_subdev_format_whence)\n- * @num_routes: the total number of routes in the routes array\n+ * @len_routes: the length of the routes array, in routes\n  * @routes: pointer to the routes array\n+ * @num_routes: the total number of routes in the routes array\n  * @reserved: drivers and applications must zero this array\n  */\n struct v4l2_subdev_routing {\n \t__u32 which;\n-\t__u32 num_routes;\n+\t__u32 len_routes;\n \t__u64 routes;\n-\t__u32 reserved[6];\n+\t__u32 num_routes;\n+\t__u32 reserved[11];\n };\n \n /*\n@@ -239,7 +243,14 @@ struct v4l2_subdev_routing {\n  * set (which is the default), the 'stream' fields will be forced to 0 by the\n  * kernel.\n  */\n- #define V4L2_SUBDEV_CLIENT_CAP_STREAMS\t\t(1ULL << 0)\n+#define V4L2_SUBDEV_CLIENT_CAP_STREAMS\t\t\t(1ULL << 0)\n+\n+/*\n+ * The client is aware of the struct v4l2_subdev_frame_interval which field. If\n+ * this is not set (which is the default), the which field is forced to\n+ * V4L2_SUBDEV_FORMAT_ACTIVE by the kernel.\n+ */\n+#define V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH\t(1ULL << 1)\n \n /**\n  * struct v4l2_subdev_client_capability - Capabilities of the client accessing\ndiff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\nindex 7e556911c9e1..33e0ea95e0fa 100644\n--- a/include/linux/videodev2.h\n+++ b/include/linux/videodev2.h\n@@ -572,6 +572,8 @@ struct v4l2_pix_format {\n #define V4L2_PIX_FMT_Y10BPACK    v4l2_fourcc('Y', '1', '0', 'B') /* 10  Greyscale bit-packed */\n #define V4L2_PIX_FMT_Y10P    v4l2_fourcc('Y', '1', '0', 'P') /* 10  Greyscale, MIPI RAW10 packed */\n #define V4L2_PIX_FMT_IPU3_Y10\t\tv4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */\n+#define V4L2_PIX_FMT_Y12P    v4l2_fourcc('Y', '1', '2', 'P') /* 12  Greyscale, MIPI RAW12 packed */\n+#define V4L2_PIX_FMT_Y14P    v4l2_fourcc('Y', '1', '4', 'P') /* 14  Greyscale, MIPI RAW14 packed */\n \n /* Palette formats */\n #define V4L2_PIX_FMT_PAL8    v4l2_fourcc('P', 'A', 'L', '8') /*  8  8-bit palette */\n@@ -814,6 +816,14 @@ struct v4l2_pix_format {\n #define V4L2_META_FMT_RK_ISP1_PARAMS\tv4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */\n #define V4L2_META_FMT_RK_ISP1_STAT_3A\tv4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */\n \n+#define V4L2_META_FMT_GENERIC_8\t\tv4l2_fourcc('M', 'E', 'T', '8') /* Generic 8-bit metadata */\n+#define V4L2_META_FMT_GENERIC_CSI2_10\tv4l2_fourcc('M', 'C', '1', 'A') /* 10-bit CSI-2 packed 8-bit metadata */\n+#define V4L2_META_FMT_GENERIC_CSI2_12\tv4l2_fourcc('M', 'C', '1', 'C') /* 12-bit CSI-2 packed 8-bit metadata */\n+#define V4L2_META_FMT_GENERIC_CSI2_14\tv4l2_fourcc('M', 'C', '1', 'E') /* 14-bit CSI-2 packed 8-bit metadata */\n+#define V4L2_META_FMT_GENERIC_CSI2_16\tv4l2_fourcc('M', 'C', '1', 'G') /* 16-bit CSI-2 packed 8-bit metadata */\n+#define V4L2_META_FMT_GENERIC_CSI2_20\tv4l2_fourcc('M', 'C', '1', 'K') /* 20-bit CSI-2 packed 8-bit metadata */\n+#define V4L2_META_FMT_GENERIC_CSI2_24\tv4l2_fourcc('M', 'C', '1', 'O') /* 24-bit CSI-2 packed 8-bit metadata */\n+\n /* priv field value to indicates that subsequent fields are valid. */\n #define V4L2_PIX_FMT_PRIV_MAGIC\t\t0xfeedcafe\n \n@@ -844,6 +854,7 @@ struct v4l2_fmtdesc {\n #define V4L2_FMT_FLAG_CSC_YCBCR_ENC\t\t0x0080\n #define V4L2_FMT_FLAG_CSC_HSV_ENC\t\tV4L2_FMT_FLAG_CSC_YCBCR_ENC\n #define V4L2_FMT_FLAG_CSC_QUANTIZATION\t\t0x0100\n+#define V4L2_FMT_FLAG_META_LINE_BASED\t\t0x0200\n \n \t/* Frame Size and frame rate enumeration */\n /*\n@@ -993,6 +1004,7 @@ struct v4l2_requestbuffers {\n #define V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS\t\t(1 << 4)\n #define V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF\t(1 << 5)\n #define V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS\t\t(1 << 6)\n+#define V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFERS\t\t(1 << 7)\n \n /**\n  * struct v4l2_plane - plane info for multi-planar buffers\n@@ -1787,6 +1799,8 @@ struct v4l2_ext_control {\n \t\tstruct v4l2_ctrl_av1_tile_group_entry *p_av1_tile_group_entry;\n \t\tstruct v4l2_ctrl_av1_frame *p_av1_frame;\n \t\tstruct v4l2_ctrl_av1_film_grain *p_av1_film_grain;\n+\t\tstruct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info;\n+\t\tstruct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display;\n \t\tvoid *ptr;\n \t};\n } __attribute__ ((packed));\n@@ -2358,10 +2372,19 @@ struct v4l2_sdr_format {\n  * struct v4l2_meta_format - metadata format definition\n  * @dataformat:\t\tlittle endian four character code (fourcc)\n  * @buffersize:\t\tmaximum size in bytes required for data\n+ * @width:\t\tnumber of data units of data per line (valid for line\n+ *\t\t\tbased formats only, see format documentation)\n+ * @height:\t\tnumber of lines of data per buffer (valid for line based\n+ *\t\t\tformats only)\n+ * @bytesperline:\toffset between the beginnings of two adjacent lines in\n+ *\t\t\tbytes (valid for line based formats only)\n  */\n struct v4l2_meta_format {\n \t__u32\t\t\t\tdataformat;\n \t__u32\t\t\t\tbuffersize;\n+\t__u32\t\t\t\twidth;\n+\t__u32\t\t\t\theight;\n+\t__u32\t\t\t\tbytesperline;\n } __attribute__ ((packed));\n \n /**\n@@ -2547,6 +2570,9 @@ struct v4l2_dbg_chip_info {\n  * @flags:\tadditional buffer management attributes (ignored unless the\n  *\t\tqueue has V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS capability\n  *\t\tand configured for MMAP streaming I/O).\n+ * @max_num_buffers: if V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFERS capability flag is set\n+ *\t\tthis field indicate the maximum possible number of buffers\n+ *\t\tfor this queue.\n  * @reserved:\tfuture extensions\n  */\n struct v4l2_create_buffers {\n@@ -2556,7 +2582,8 @@ struct v4l2_create_buffers {\n \tstruct v4l2_format\tformat;\n \t__u32\t\t\tcapabilities;\n \t__u32\t\t\tflags;\n-\t__u32\t\t\treserved[6];\n+\t__u32\t\t\tmax_num_buffers;\n+\t__u32\t\t\treserved[5];\n };\n \n /*\n","prefixes":["PATCH/RFC","10/32","DNI"]}