mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 04/11] media: stm32: dcmipp: capture: use ISP frame sequence for main & aux pipes
Date: Fri, 4 Dec 2026 12:11:35 +0100	[thread overview]
Message-ID: <20261204-stm32mp-dcmipp-isp-stat-ctrls-v1-4-e809f8c193e6@foss.st.com> (raw)
In-Reply-To: <20261204-stm32mp-dcmipp-isp-stat-ctrls-v1-0-e809f8c193e6@foss.st.com>

When the pipe is fed by the ISP (always for the MAIN and depending on
the media graph for the AUX), the sequence number is based on the
frame counter coming from the ISP subdev. This will allow to have
frame sequence number matching with sequence number used also in the
ISP statistics / control buffers.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
---
 .../media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c   | 13 ++++++++++++-
 .../media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h    |  2 ++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c
index 4d35372c292b..2eb0e1997f78 100644
--- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c
+++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-capture.c
@@ -558,6 +558,11 @@ static int dcmipp_capture_start_streaming(struct vb2_queue *vq,
 		goto err_pm_put;
 	}
 
+	/* MAIN pipe is always fed by the ISP, AUX pipe only if linked to it */
+	vcap->isp_fed = vcap->pipe_id == 1 ||
+			(vcap->pipe_id == 2 && vcap->ved.dcmipp->isp &&
+			 dcmipp_isp_is_aux_output_enabled(vcap->ved.dcmipp->isp));
+
 	ret = v4l2_subdev_enable_streams(vcap->s_subdev,
 					 vcap->s_subdev_pad_nb, BIT_ULL(0));
 	if (ret)
@@ -854,7 +859,10 @@ static void dcmipp_buffer_done(struct dcmipp_capture_device *vcap,
 
 	vbuf = &buf->vb;
 
-	vbuf->sequence = vcap->sequence++;
+	if (vcap->isp_fed)
+		vbuf->sequence = vcap->active_sequence;
+	else
+		vbuf->sequence = vcap->sequence++;
 	vbuf->field = V4L2_FIELD_NONE;
 	vbuf->vb2_buf.timestamp = ktime_get_ns();
 	vb2_set_plane_payload(&vbuf->vb2_buf, 0, bytesused);
@@ -969,6 +977,9 @@ static irqreturn_t dcmipp_capture_irq_thread(int irq, void *arg)
 
 	if (vcap->cmsr2 & cmsr2_pxvsyncf) {
 		vcap->count.vsync++;
+
+		if (vcap->isp_fed)
+			vcap->active_sequence = vcap->ved.dcmipp->isp->frame_sequence;
 		if (vcap->state == DCMIPP_WAIT_FOR_BUFFER) {
 			vcap->count.underrun++;
 			goto out;
diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h
index 442d4c90e591..b40ed25dcf73 100644
--- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h
+++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h
@@ -223,6 +223,8 @@ struct dcmipp_capture_device {
 	/* mutex used as vdev and queue lock */
 	struct mutex lock;
 	u32 sequence;
+	bool isp_fed;
+	u32 active_sequence;
 	struct v4l2_subdev *s_subdev;
 	u32 s_subdev_pad_nb;
 

-- 
2.34.1


  parent reply	other threads:[~2026-12-04 11:11 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 ` Alain Volmat [this message]
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 ` [PATCH 06/11] media: uapi: add STM32 DCMIPP ISP META formats Alain Volmat
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-4-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®