linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, bingbu.cao@intel.com,
	hongju.wang@intel.com
Subject: Re: [RFC 3/7] media: uapi: v4l: Document source routes
Date: Fri, 2 Jun 2023 12:56:00 +0300	[thread overview]
Message-ID: <20230602095600.GH19463@pendragon.ideasonboard.com> (raw)
In-Reply-To: <b3b8d45f-1cc4-1aa7-6f75-de4841fd5981@ideasonboard.com>

Hello,

On Mon, May 08, 2023 at 07:35:04PM +0300, Tomi Valkeinen wrote:
> On 08/05/2023 19:26, Sakari Ailus wrote:
> > On Mon, May 08, 2023 at 01:33:24PM +0300, Tomi Valkeinen wrote:
> >> On 06/05/2023 00:52, Sakari Ailus wrote:
> >>> Document how internal pads are used on source routes.
> >>>
> >>> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> >>> ---
> >>>    .../userspace-api/media/v4l/dev-subdev.rst     | 18 ++++++++++++++++++
> >>>    .../media/v4l/vidioc-subdev-g-routing.rst      |  5 +++++
> >>>    include/uapi/linux/v4l2-subdev.h               |  6 +++++-
> >>>    3 files changed, 28 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/Documentation/userspace-api/media/v4l/dev-subdev.rst b/Documentation/userspace-api/media/v4l/dev-subdev.rst
> >>> index a4f1df7093e8..395e06d2f0f2 100644
> >>> --- a/Documentation/userspace-api/media/v4l/dev-subdev.rst
> >>> +++ b/Documentation/userspace-api/media/v4l/dev-subdev.rst
> >>> @@ -551,6 +551,24 @@ A stream at a specific point in the media pipeline is identified by the
> >>>    sub-device and a (pad, stream) pair. For sub-devices that do not support
> >>>    multiplexed streams the 'stream' field is always 0.
> >>> +.. _v4l2-subdev-source-routes:
> >>> +
> >>> +Source routes
> >>> +^^^^^^^^^^^^^
> >>> +
> >>> +Cases where a single sub-device pad is a source of multiple streams are special
> >>> +as there is no sink pad for such a route. In those cases, an internal pad is
> >>> +used as the sink pad. Such pads have the :ref:`MEDIA_PAD_FL_INTERNAL_SOURCE
> >>> +<MEDIA-PAD-FL-INTERNAL-SOURCE>` flag set.
> >>> +
> >>> +Internal pads have all the properties of a sink pad in such case, including
> >>> +formats and selections. The format in this case is the source format of the
> >>> +stream. An internal pad always has a single stream only (0).
> >>> +
> >>> +Generally source routes are not modifiable but they can be activated and
> >>> +inactivated using the :ref:`V4L2_SUBDEV_ROUTE_FL_ACTIVE
> >>> +<v4l2-subdev-routing-flags>` flag, depending on driver capabilities.
> >>> +
> >>
> >> I find the above chapter a bit difficult to read, but I think we need to
> >> conclude on the internal-pad vs internal-source-pad discussion first.
> >> However, one point/question:

Agreed, it's far from being clear :-( Even the first sentence, "Cases
where a single sub-device pad is a source of multiple streams are
special" is confusing, having a subdev source pad carrying multiple
streams isn't special, it is found in, for instance, FPD-Link or GMSL
receivers that transmit multiple streams from different cameras over a
single CSI-2 output. This may not be what Sakari meant here, but it can
be understood that way.

We need more than 3 paragraphs here, and we need a very clear example
with a diagram. I'd recommend using a camera sensor that produces image
data and embedded data for the example, as that's a common real-life use
case. The text should present the example, explain what the problem is,
and then explain how internal pads fix it. Then it can expand on the
features and usage of internal pads in a more generic way.

> >> You write that there's only one stream in an internal pad. I wonder if
> >> that's a good or a necessary limitation... Do you see that allowing multiple
> >> streams brings extra complexity? It's still up to each driver to decide how
> >> many streams they support (most would just support a single one), so each
> >> driver can easily enforce that limit.
> > 
> > Good question. As we don't seem to have a tangible reason to allow it, I'd
> > deny it until there's a use case.
> > 
> > Or did you have a use case in mind?
> > 
> > I thought indicating which streams will be bound together (i.e. either are
> > all disabled or enabled) could be one, but I'm not sure we need that at the
> > moment at least.
> 
> I don't have nothing concrete in mind. Maybe a TPG which also generates 
> some kind of metadata. But that could be implemented as two internal pads.
> 
> >> I'm fine with starting with only single-stream support, but if we later need
> >> to loosen that restriction, I wonder if it'll be difficult if we have
> >> specified that there can be only one stream. I.e. will the drivers and the
> >> userspace depend on that limit.
> > 
> > We can always allow what wasn't allowed previously so that's a non-issue,
> > really. But it needs to bring new functionality, otherwise there's no
> > reason to do that.
> 
> It's not always that easy. If the drivers and the userspace expect that 
> there's a single route with ID 0, and then with a new kernel there are 
> more streams or the single stream is ID 1, things could go wrong.

I agree with Tomi here. On the kernel side it should be fine (with an
unknown amount of pain), but I'd consider this as a userspace API
breakage. If the specifications indicates that only a single stream can
be used, applications may rely on that, and things could go wrong if new
streams are added.

We can restrict the kernel implementation to a single stream, but the
userspace API has to indicate that multiple streams can co-exist if we
want to allow that in the future.

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2023-06-02  9:56 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 21:52 [RFC 0/7] Generic line based metadata support, internal pads Sakari Ailus
2023-05-05 21:52 ` [RFC 1/7] media: mc: Add INTERNAL_SOURCE pad type flag Sakari Ailus
2023-05-08  9:52   ` Tomi Valkeinen
2023-05-08 12:04     ` Sakari Ailus
2023-05-08 12:07       ` Tomi Valkeinen
2023-05-08 12:28         ` Sakari Ailus
2023-06-02  9:18   ` Laurent Pinchart
2023-06-02 15:05     ` Sakari Ailus
2023-06-08  7:59   ` Hans Verkuil
2023-06-09 12:44     ` Sakari Ailus
2023-05-05 21:52 ` [RFC 2/7] media: v4l: subdev: Support INTERNAL_SOURCE pads in routing IOCTLs Sakari Ailus
2023-05-08 10:14   ` Tomi Valkeinen
2023-05-08 12:24     ` Sakari Ailus
2023-06-02  9:44       ` Laurent Pinchart
2023-06-02  9:46         ` Laurent Pinchart
2023-06-02 13:10           ` Sakari Ailus
2023-06-04 14:26             ` Laurent Pinchart
2023-06-05  8:06               ` Sakari Ailus
2023-06-05  8:23                 ` Laurent Pinchart
2023-06-08  8:06   ` Hans Verkuil
2023-05-05 21:52 ` [RFC 3/7] media: uapi: v4l: Document source routes Sakari Ailus
2023-05-08 10:33   ` Tomi Valkeinen
2023-05-08 16:26     ` Sakari Ailus
2023-05-08 16:35       ` Tomi Valkeinen
2023-05-08 17:41         ` Sakari Ailus
2023-06-02  9:56           ` Laurent Pinchart
2023-06-02  9:56         ` Laurent Pinchart [this message]
2023-06-09 12:55           ` Sakari Ailus
2023-06-08  8:20   ` Hans Verkuil
2023-05-05 21:52 ` [RFC 4/7] media: mc: Check pad flag validity Sakari Ailus
2023-06-02  9:58   ` Laurent Pinchart
2023-06-09 14:41     ` Sakari Ailus
2023-05-05 21:52 ` [RFC 5/7] media: uapi: Add generic serial metadata mbus formats Sakari Ailus
2023-06-02 10:36   ` Laurent Pinchart
2023-06-09 14:45     ` Sakari Ailus
2023-06-08  8:35   ` Hans Verkuil
2023-06-09 13:34     ` Sakari Ailus
2023-06-08  8:46   ` Hans Verkuil
2023-06-09 13:38     ` Sakari Ailus
2023-05-05 21:52 ` [RFC 6/7] media: uapi: Add generic 8-bit metadata format definitions Sakari Ailus
2023-06-08  8:54   ` Hans Verkuil
2023-06-09 14:27     ` Sakari Ailus
2023-05-05 21:52 ` [RFC 7/7] media: v4l: Support line-based metadata capture Sakari Ailus
2023-06-02 10:50   ` Laurent Pinchart
2023-06-09 13:46     ` Sakari Ailus
2023-06-02  7:54 ` [RFC 0/7] Generic line based metadata support, internal pads Naushir Patuck
2023-06-02  8:46   ` Sakari Ailus
2023-06-02  9:35     ` Naushir Patuck
2023-06-02 12:05       ` Sakari Ailus
2023-06-02  9:12   ` Laurent Pinchart
2023-06-02  9:43     ` Naushir Patuck
2023-06-09 13:20     ` Sakari Ailus
2023-06-09 13:59 ` Dave Stevenson
2023-06-09 14:41   ` Sakari Ailus
2023-08-03 22:36     ` Laurent Pinchart

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=20230602095600.GH19463@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=bingbu.cao@intel.com \
    --cc=hongju.wang@intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.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;
as well as URLs for NNTP newsgroup(s).