From: Alain Volmat <alain.volmat@foss.st.com>
To: Hugues Fruchet <hugues.fruchet@foss.st.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>
Cc: <linux-media@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
"Alain Volmat" <alain.volmat@foss.st.com>
Subject: [PATCH 06/11] media: uapi: add STM32 DCMIPP ISP META formats
Date: Fri, 4 Dec 2026 12:11:37 +0100 [thread overview]
Message-ID: <20261204-stm32mp-dcmipp-isp-stat-ctrls-v1-6-e809f8c193e6@foss.st.com> (raw)
In-Reply-To: <20261204-stm32mp-dcmipp-isp-stat-ctrls-v1-0-e809f8c193e6@foss.st.com>
Add uAPI for STM32 DCMIPP ISP META formats (parameters / statistics)
V4L2_META_FMT_ST_DCMIPP_ISP_PARAMS
V4L2_META_FMT_ST_DCMIPP_ISP_STAT
Change-Id: I1baa9f2660e69c4fe7f27ef0828c4d756ba635ef
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
---
.../userspace-api/media/v4l/meta-formats.rst | 1 +
.../userspace-api/media/v4l/metafmt-st-dcmipp.rst | 74 ++++++++++++++++++++++
MAINTAINERS | 1 +
drivers/media/v4l2-core/v4l2-ioctl.c | 2 +
include/uapi/linux/videodev2.h | 4 ++
5 files changed, 82 insertions(+)
diff --git a/Documentation/userspace-api/media/v4l/meta-formats.rst b/Documentation/userspace-api/media/v4l/meta-formats.rst
index b5455229837e..19f9016076b4 100644
--- a/Documentation/userspace-api/media/v4l/meta-formats.rst
+++ b/Documentation/userspace-api/media/v4l/meta-formats.rst
@@ -22,6 +22,7 @@ These formats are used for the :ref:`metadata` interface only.
metafmt-pisp-fe
metafmt-rkisp1
metafmt-rppx1
+ metafmt-st-dcmipp
metafmt-uvc
metafmt-uvc-msxu-1-5
metafmt-vivid
diff --git a/Documentation/userspace-api/media/v4l/metafmt-st-dcmipp.rst b/Documentation/userspace-api/media/v4l/metafmt-st-dcmipp.rst
new file mode 100644
index 000000000000..5e4157cacf76
--- /dev/null
+++ b/Documentation/userspace-api/media/v4l/metafmt-st-dcmipp.rst
@@ -0,0 +1,74 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. _v4l2-meta-fmt-st-dcmipp-isp-params:
+.. _v4l2-meta-fmt-st-dcmipp-isp-stat:
+
+*****************************************************************************************
+V4L2_META_FMT_ST_DCMIPP_ISP_PARAMS ('STIP'), V4L2_META_FMT_ST_DCMIPP_ISP_STAT ('STIS')
+*****************************************************************************************
+
+Configuration Parameters
+========================
+
+The configuration parameters of the STM32 DCMIPP ISP are passed to the
+``dcmipp_main_isp_params_output`` metadata output video device, using the
+:c:type:`v4l2_meta_format` interface. Userspace must populate the type member
+with a value from :c:type:`stm32_dcmipp_params_block_type`.
+
+Parameters are applied once per frame and take effect on the frame following
+the one for which the buffer is returned (see the buffer sequence number).
+
+.. code-block:: c
+
+ struct v4l2_isp_buffer *params = (struct v4l2_isp_buffer *)buffer;
+ struct stm32_dcmipp_params_blc *blc;
+
+ params->version = V4L2_ISP_VERSION_V1;
+ params->data_size = 0;
+
+ blc = (struct stm32_dcmipp_params_blc *)params->data;
+ blc->header.type = STM32_DCMIPP_PARAMS_BLOCK_TYPE_BLC;
+ blc->header.flags = V4L2_ISP_PARAMS_FL_BLOCK_ENABLE;
+ blc->header.size = sizeof(*blc);
+ blc->blc_r = 16;
+ blc->blc_g = 16;
+ blc->blc_b = 16;
+
+ params->data_size += sizeof(*blc);
+
+Statistics
+==========
+
+The statistics are captured from the ``dcmipp_main_isp_stat_capture`` metadata
+capture video node using the :c:type:`v4l2_meta_format` interface.
+Blocks present within the metadata can be identified via the value
+:c:type:`stm32_dcmipp_stats_block_type`. Which blocks are present depends on the
+statistics profile selected through the ``STM32_DCMIPP_PARAMS_BLOCK_TYPE_STAT``
+parameters block.
+
+.. code-block:: c
+
+ const struct v4l2_isp_buffer *stats = (struct v4l2_isp_buffer *)buf;
+ size_t offset = 0;
+
+ while (offset < stats->data_size) {
+ const union stm32_dcmipp_stats_block *block =
+ (const void *)(stats->data + offset);
+
+ offset += block->header.size;
+
+ switch (block->header.type) {
+ case STM32_DCMIPP_STATS_BLOCK_TYPE_PRE:
+ case STM32_DCMIPP_STATS_BLOCK_TYPE_POST:
+ /* block->avr_bins */
+ break;
+ case STM32_DCMIPP_STATS_BLOCK_TYPE_BPR:
+ /* block->bpr */
+ break;
+ }
+ }
+
+STM32 DCMIPP uAPI data types
+============================
+
+.. kernel-doc:: include/uapi/linux/media/st/dcmipp_config.h
diff --git a/MAINTAINERS b/MAINTAINERS
index cbf3d071801e..f98287fb0843 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16951,6 +16951,7 @@ S: Supported
T: git git://linuxtv.org/media.git
F: Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
F: Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml
+F: Documentation/userspace-api/media/v4l/metafmt-st-dcmipp.rst
F: drivers/media/platform/st/stm32/stm32-dcmi.c
F: drivers/media/platform/st/stm32/stm32-dcmipp/*
F: include/uapi/linux/media/st/dcmipp_config.h
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 17ba1ae70735..479c58906a22 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1473,6 +1473,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_META_FMT_MALI_C55_STATS: descr = "ARM Mali-C55 ISP 3A Statistics"; break;
case V4L2_META_FMT_RPPX1_PARAMS: descr = "Dreamchip RPP-X1 ISP Parameters"; break;
case V4L2_META_FMT_RPPX1_STATS: descr = "Dreamchip RPP-X1 ISP Statistics"; break;
+ case V4L2_META_FMT_ST_DCMIPP_ISP_PARAMS: descr = "STM32 DCMIPP ISP Parameters"; break;
+ case V4L2_META_FMT_ST_DCMIPP_ISP_STAT: descr = "STM32 DCMIPP ISP Statistics"; break;
case V4L2_PIX_FMT_NV12_8L128: descr = "NV12 (8x128 Linear)"; break;
case V4L2_PIX_FMT_NV12M_8L128: descr = "NV12M (8x128 Linear)"; break;
case V4L2_PIX_FMT_NV12_10BE_8L128: descr = "10-bit NV12 (8x128 Linear, BE)"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 5373dba640fa..61af3fe86f8b 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -893,6 +893,10 @@ struct v4l2_pix_format {
#define V4L2_META_FMT_RPPX1_PARAMS v4l2_fourcc('D', 'R', '1', 'P') /* Dreamchip RPP-X1 Parameters */
#define V4L2_META_FMT_RPPX1_STATS v4l2_fourcc('D', 'R', '1', 'S') /* Dreamchip RPP-X1 Statistics */
+/* Vendor specific - used for STM32_DCMIPP camera sub-system */
+#define V4L2_META_FMT_ST_DCMIPP_ISP_PARAMS v4l2_fourcc('S', 'T', 'I', 'P') /* STM32 DCMIPP ISP Parameters */
+#define V4L2_META_FMT_ST_DCMIPP_ISP_STAT v4l2_fourcc('S', 'T', 'I', 'S') /* STM32 DCMIPP ISP Statistics */
+
#ifdef __KERNEL__
/*
* Line-based metadata formats. Remember to update v4l_fill_fmtdesc() when
--
2.34.1
next prev parent reply other threads:[~2026-12-04 11:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 11:11 [PATCH 00/11] media: stm32: dcmipp: addition of ISP params & statistics Alain Volmat
2026-12-04 11:11 ` [PATCH 01/11] media: stm32: dcmipp: add entity pointers into dcmipp-common.h Alain Volmat
2026-12-04 11:11 ` [PATCH 02/11] media: stm32: dcmipp: add enum to name ISP subdev pads Alain Volmat
2026-12-04 11:11 ` [PATCH 03/11] media: stm32: dcmipp: isp: keep a frame sequence counter at isp level Alain Volmat
2026-12-04 11:11 ` [PATCH 04/11] media: stm32: dcmipp: capture: use ISP frame sequence for main & aux pipes Alain Volmat
2026-12-04 11:11 ` [PATCH 05/11] media: uapi: st: dcmipp: add description of ISP stats & param buffers Alain Volmat
2026-12-04 11:11 ` Alain Volmat [this message]
2026-12-04 11:11 ` [PATCH 07/11] media: stm32: dcmipp: isp: expose active sink format & compose Alain Volmat
2026-12-04 11:11 ` [PATCH 08/11] media: stm32: dcmipp: addition of a statistics capture device Alain Volmat
2026-12-04 11:11 ` [PATCH 09/11] media: stm32: dcmipp: addition of isp param output device Alain Volmat
2026-12-04 11:11 ` [PATCH 10/11] media: stm32: dcmipp: isp: add 2 pads to be connected to isp-params & stats Alain Volmat
2026-12-04 11:11 ` [PATCH 11/11] media: stm32: dcmipp: core: add isp-params & stats devices Alain Volmat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204-stm32mp-dcmipp-isp-stat-ctrls-v1-6-e809f8c193e6@foss.st.com \
--to=alain.volmat@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=hugues.fruchet@foss.st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mchehab@kernel.org \
--cc=mcoquelin.stm32@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®