From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, bingbu.cao@linux.intel.com,
stanislaw.gruszka@linux.intel.com, tian.shu.qiu@intel.com,
tomi.valkeinen@ideasonboard.com
Subject: Re: [PATCH 03/13] media: ipu6: Enable and disable each stream at CSI-2 subdev source pad
Date: Thu, 19 Jun 2025 13:52:28 +0000 [thread overview]
Message-ID: <aFQWHBSPcCCTmtHq@kekkonen.localdomain> (raw)
In-Reply-To: <20250619131900.GB32166@pendragon.ideasonboard.com>
On Thu, Jun 19, 2025 at 04:19:00PM +0300, Laurent Pinchart wrote:
> On Thu, Jun 19, 2025 at 01:10:48PM +0000, Sakari Ailus wrote:
> > On Thu, Jun 19, 2025 at 03:48:55PM +0300, Laurent Pinchart wrote:
> > > On Thu, Jun 19, 2025 at 11:15:36AM +0300, Sakari Ailus wrote:
> > > > On UAPI, streaming is started a video device at a time. The IPU6 ISYS
> > > > driver only starts streaming on the source sub-device when all relevant
> > > > video devices have been set streaming. This also needs to be reflected in
> > > > the sub-device pads, hence set them all streaming, one at a time.
> > >
> > > Why ? What's wrong with enabling/disabling streams on each pad as the
> > > corresponding video device is started/stopped ?
> >
> > Streaming is started once all the related video nodes are set streaming,
> > otherwise there's a chance of losing data.
>
> Yes, but that's something that can be handled in the subdev, to only
> start the ISYS and its source when all the streams that are part of the
> pipeline have been started.
I agree, this is done in the CSI-2 receiver driver actually.
There's some work to do in cleaning up the IPU6 driver. The combination of
videobuf2 and streams isn't very driver-friendly currently. Things
generally need to happen in certain order and this may not be always veyr
convenient for drivers.
>
> > I've squashed this with the last patch after posting the set.
>
> Maybe it will become clearer when I review the rest of the series.
>
> > > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > > > ---
> > > > .../media/pci/intel/ipu6/ipu6-isys-video.c | 43 ++++++++++++-------
> > > > 1 file changed, 28 insertions(+), 15 deletions(-)
> > > >
> > > > diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c b/drivers/media/pci/intel/ipu6/ipu6-isys-video.c
> > > > index 24a2ef93474c..54006b5e2ccd 100644
> > > > --- a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c
> > > > +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-video.c
> > > > @@ -990,6 +990,7 @@ int ipu6_isys_video_set_streaming(struct ipu6_isys_video *av, int state,
> > > > struct device *dev = &av->isys->adev->auxdev.dev;
> > > > struct v4l2_subdev *sd;
> > > > struct media_pad *r_pad;
> > > > + unsigned int i;
> > > > u32 sink_pad, sink_stream;
> > > > u64 r_stream;
> > > > u64 stream_mask = 0;
> > > > @@ -1018,14 +1019,15 @@ int ipu6_isys_video_set_streaming(struct ipu6_isys_video *av, int state,
> > > > stop_streaming_firmware(av);
> > > >
> > > > /* stop sub-device which connects with video */
> > > > - dev_dbg(dev, "stream off entity %s pad:%d mask:0x%llx\n",
> > > > - sd->name, r_pad->index, stream_mask);
> > > > - ret = v4l2_subdev_disable_streams(sd, r_pad->index,
> > > > - stream_mask);
> > > > - if (ret) {
> > > > - dev_err(dev, "stream off %s failed with %d\n", sd->name,
> > > > - ret);
> > > > - return ret;
> > > > + for (i = CSI2_PAD_SRC; i < NR_OF_CSI2_SRC_PADS; i++) {
> > > > + if (!media_pad_pipeline(&sd->entity.pads[i]))
> > > > + continue;
> > > > + ret = v4l2_subdev_disable_streams(sd, i, 1U);
> > > > + if (ret) {
> > > > + dev_err(dev, "stream off %s failed with %d\n",
> > > > + sd->name, ret);
> > > > + return ret;
> > > > + }
> > > > }
> > > > close_streaming_firmware(av);
> > > > } else {
> > > > @@ -1036,13 +1038,15 @@ int ipu6_isys_video_set_streaming(struct ipu6_isys_video *av, int state,
> > > > }
> > > >
> > > > /* start sub-device which connects with video */
> > > > - dev_dbg(dev, "stream on %s pad %d mask 0x%llx\n", sd->name,
> > > > - r_pad->index, stream_mask);
> > > > - ret = v4l2_subdev_enable_streams(sd, r_pad->index, stream_mask);
> > > > - if (ret) {
> > > > - dev_err(dev, "stream on %s failed with %d\n", sd->name,
> > > > - ret);
> > > > - goto out_media_entity_stop_streaming_firmware;
> > > > + for (i = CSI2_PAD_SRC; i < NR_OF_CSI2_SRC_PADS; i++) {
> > > > + if (!media_pad_pipeline(&sd->entity.pads[i]))
> > > > + continue;
> > > > + ret = v4l2_subdev_enable_streams(sd, i, 1U);
> > > > + if (ret) {
> > > > + dev_err(dev, "stream on %s failed with %d\n",
> > > > + sd->name, ret);
> > > > + goto out_media_entity_stop_streaming_firmware;
> > > > + }
> > > > }
> > > > }
> > > >
> > > > @@ -1051,6 +1055,15 @@ int ipu6_isys_video_set_streaming(struct ipu6_isys_video *av, int state,
> > > > return 0;
> > > >
> > > > out_media_entity_stop_streaming_firmware:
> > > > + while (i-- > CSI2_PAD_SRC) {
> > > > + int ret2;
> > > > +
> > > > + if (!media_pad_pipeline(&sd->entity.pads[i]))
> > > > + continue;
> > > > + ret2 = v4l2_subdev_disable_streams(sd, i, 1U);
> > > > + dev_err(dev, "stream off %s failed with %d\n", sd->name, ret2);
> > > > + }
> > > > +
> > > > stop_streaming_firmware(av);
> > > >
> > > > return ret;
>
--
Regards,
Sakari Ailus
next prev parent reply other threads:[~2025-06-19 13:52 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 8:15 [PATCH 00/13] Streaming control for MC with metadata or streams otherwise Sakari Ailus
2025-06-19 8:15 ` [PATCH 01/13] media: ipu6: Use correct pads for xlate_streams() Sakari Ailus
2025-06-19 13:27 ` Laurent Pinchart
2025-06-19 13:55 ` Sakari Ailus
2025-06-19 14:15 ` Laurent Pinchart
2025-06-19 14:28 ` Sakari Ailus
2025-06-19 15:08 ` Laurent Pinchart
2025-06-19 8:15 ` [PATCH 02/13] media: ipu6: Set minimum height to 1 Sakari Ailus
2025-06-19 13:27 ` Laurent Pinchart
2025-06-19 8:15 ` [PATCH 03/13] media: ipu6: Enable and disable each stream at CSI-2 subdev source pad Sakari Ailus
2025-06-19 12:23 ` kernel test robot
2025-06-19 12:48 ` Laurent Pinchart
2025-06-19 13:10 ` Sakari Ailus
2025-06-19 13:19 ` Laurent Pinchart
2025-06-19 13:52 ` Sakari Ailus [this message]
2025-06-19 8:15 ` [PATCH 04/13] media: v4l2-subdev: Add a helper to figure out the pad streaming state Sakari Ailus
2025-06-19 13:37 ` Laurent Pinchart
2025-06-19 8:15 ` [PATCH 05/13] media: v4l: Make media_entity_to_video_device() NULL-safe Sakari Ailus
2025-06-19 15:20 ` Laurent Pinchart
2025-06-19 16:14 ` Sakari Ailus
2025-07-08 11:56 ` Laurent Pinchart
2025-07-08 12:02 ` Sakari Ailus
2025-07-08 16:17 ` Laurent Pinchart
2025-07-09 20:03 ` Sakari Ailus
2025-07-09 20:54 ` Laurent Pinchart
2025-07-10 6:57 ` Sakari Ailus
2025-06-19 8:15 ` [PATCH 06/13] media: v4l2-subdev: Mark both streams of a route enabled Sakari Ailus
2025-06-19 16:56 ` Laurent Pinchart
2025-06-19 18:34 ` Sakari Ailus
2025-06-19 22:18 ` Laurent Pinchart
2025-06-25 16:10 ` Sakari Ailus
2025-06-26 15:22 ` Tomi Valkeinen
2025-06-26 19:13 ` Laurent Pinchart
2025-06-26 15:17 ` Tomi Valkeinen
2025-06-27 6:09 ` Sakari Ailus
2025-06-30 0:47 ` Laurent Pinchart
2025-06-19 8:15 ` [PATCH 07/13] media: ipu6: Set up CSI-2 receiver at correct moment Sakari Ailus
2025-06-19 17:00 ` Laurent Pinchart
2025-06-19 17:20 ` Sakari Ailus
2025-06-19 8:15 ` [PATCH 08/13] media: v4l2-subdev: Print early in v4l2_subdev_{enable,disable}_streams() Sakari Ailus
2025-06-19 17:03 ` Laurent Pinchart
2025-06-25 16:12 ` Sakari Ailus
2025-06-19 8:15 ` [PATCH 09/13] media: v4l2-subdev: Collect streams on source pads only Sakari Ailus
2025-06-19 17:07 ` Laurent Pinchart
2025-06-25 16:14 ` Sakari Ailus
2025-06-19 8:15 ` [PATCH 10/13] media: v4l2-subdev: Add debug prints to v4l2_subdev_collect_streams() Sakari Ailus
2025-06-19 22:23 ` Laurent Pinchart
2025-06-25 16:28 ` Sakari Ailus
2025-06-19 8:15 ` [PATCH 11/13] media: v4l2-subdev: Introduce v4l2_subdev_find_route() Sakari Ailus
2025-06-20 8:14 ` Jacopo Mondi
2025-06-25 16:53 ` Sakari Ailus
2025-06-26 22:20 ` Laurent Pinchart
2025-07-15 14:09 ` Sakari Ailus
2025-06-19 8:15 ` [PATCH 12/13] media: v4l2-mc: Introduce v4l2_mc_pipeline_enabled() Sakari Ailus
2025-06-19 11:42 ` kernel test robot
2025-06-20 3:58 ` Dan Carpenter
2025-06-20 8:53 ` Jacopo Mondi
2025-06-21 8:10 ` Sakari Ailus
2025-07-15 10:49 ` Sakari Ailus
2025-07-15 11:25 ` Laurent Pinchart
2025-07-15 11:32 ` Sakari Ailus
2025-07-15 18:18 ` Laurent Pinchart
2025-06-26 23:07 ` Laurent Pinchart
2025-08-04 11:32 ` Sakari Ailus
2025-08-04 11:46 ` Laurent Pinchart
2025-06-19 8:15 ` [PATCH 13/13] media: ipu6: isys: Rework stream starting and stopping Sakari Ailus
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=aFQWHBSPcCCTmtHq@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=bingbu.cao@linux.intel.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=stanislaw.gruszka@linux.intel.com \
--cc=tian.shu.qiu@intel.com \
--cc=tomi.valkeinen@ideasonboard.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