linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	linux-media@vger.kernel.org, bingbu.cao@intel.com,
	hongju.wang@intel.com
Subject: Re: [RFC 2/7] media: v4l: subdev: Support INTERNAL_SOURCE pads in routing IOCTLs
Date: Mon, 5 Jun 2023 08:06:58 +0000	[thread overview]
Message-ID: <ZH2XokhNNc6Sql64@kekkonen.localdomain> (raw)
In-Reply-To: <20230604142626.GF7754@pendragon.ideasonboard.com>

Hi Laurent,

On Sun, Jun 04, 2023 at 05:26:26PM +0300, Laurent Pinchart wrote:
> Hi Sakari,
> 
> On Fri, Jun 02, 2023 at 01:10:40PM +0000, Sakari Ailus wrote:
> > On Fri, Jun 02, 2023 at 12:46:50PM +0300, Laurent Pinchart wrote:
> > > On Fri, Jun 02, 2023 at 12:44:12PM +0300, Laurent Pinchart wrote:
> > > > On Mon, May 08, 2023 at 03:24:10PM +0300, Sakari Ailus wrote:
> > > > > On Mon, May 08, 2023 at 01:14:07PM +0300, Tomi Valkeinen wrote:
> > > > > > On 06/05/2023 00:52, Sakari Ailus wrote:
> > > > > > > Take the new INTERNAL_SOURCE pad flag into account in validating routing
> > > > > > > IOCTL argument. Effectively this is a SINK pad in this respect. Due to the
> > > > > > > union there's no need to check for the particular name.
> > > > > > 
> > > > > > What union? The one you add in the next patch?
> > > > > 
> > > > > Oops. I think we can reorder the patches.
> > > > > 
> > > > > > As a concept the internal source pads sound good, and they work in practice
> > > > > > in my tests. But this union is what grates me a bit. We have a flag,
> > > > > > MEDIA_PAD_FL_INTERNAL_SOURCE, which tells which field of the union to use,
> > > > > > and then we go and do not use the new union field. Well, and also the
> > > > > > naming, as we normally have source and sink pads, but now we also have
> > > > > > internal source pads, which are actually identical to sink pads...
> > > > > 
> > > > > The union still should be used by the user space. We're testing flags here
> > > > > and those flags are the same independently of the INTERNAL_SOURCE flag.
> > > > > 
> > > > > I'm fine by not adding that union though, but for the user space I think
> > > > > it's better we have it: explaining that the sink_pad has a different
> > > > > meaning if that flag is set is harder than making it a union member.
> > > > > 
> > > > > > I understand the idea and reasoning, but the two points above do confuse me
> > > > > > and I'm sure would confuse others also.
> > > > > > 
> > > > > > I wonder if it would be less or more confusing to simplify this by just
> > > > > > adding a MEDIA_PAD_FL_INTERNAL, which could be applied to either a source or
> > > > > > a sink pad, and would prevent linking to it. The flag would indicate that
> > > > > > the stream from/to that pad is generated/consumed internally. (I don't know
> > > > > > when you would need an internal pad to consume data, but... who knows, the
> > > > > > need might pop up =).
> > > > > 
> > > > > This is another option. But I envision there will be more compatibility
> > > > > issues. Although... generally using such hardware requires knowledge of the
> > > > > device, and we haven't obviously had any support for devices needing this
> > > > > functionality in the tree. So in the end it might not matter much.
> > > > >
> > > > > > That would mean that an "internal sink pad" would generate a data stream,
> > > > > > i.e. it's a "source", but I think a normal sink pad is almost the same
> > > > > > anyway: when considering entity's internal routing, the normal sink pad is a
> > > > > > "source", and the same logic would apply with the internal pads too.
> > > > > > 
> > > > > > An internal sink pad that generates a stream is a bit more confusing than an
> > > > > > internal source pad, but I think that confusion is less than the rest of the
> > > > > > confusion in the code-side that comes with the internal source pads.
> > > > > 
> > > > > I prefer having the possible sources of the confusion in the framework than
> > > > > in the drivers. Therefore I think INTERNAL_SOURCE flag is a (slightly)
> > > > > better option.
> > > > > 
> > > > > I wonder what Llaurent thinks.
> > > > 
> > > > I like the idea of a MEDIA_PAD_FL_INTERNAL flag. That's actually how I
> > > > read patch 1/7, I didn't notice it used MEDIA_PAD_FL_INTERNAL*_SOURCE*
> > > > :-)
> > > > 
> > > > We could define MEDIA_PAD_FL_INTERNAL_SOURCE
> > > > 
> > > > #define MEDIA_PAD_FL_INTERNAL_SOURCE 	(MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_INTERNAL)
> > > 
> > > One option would be to find terms different from sink and source in this
> > > case. It would generate less confusion to map (e.g., not a really good
> > > name) MEDIA_PAD_FL_INTERNAL_PRODUCER to MEDIA_PAD_FL_SINK and to the
> > > sink_pad field than using MEDIA_PAD_FL_INTERNAL_SOURCE.
> > 
> > I don't think this helps as you'd still be accessing the sink pad related
> > fields that are there for another purpose.
> > 
> > Alternatively I'd have the (plain) INTERNAL flag and drop the union,
> > without masking or adding compound flags.
> > 
> > I can switch to that if you promise not to change your mind again. ;-)
> 
> I'll do my best :-) Could you show the impact (if any) it would have on
> drivers when accessing the routing fields ?

I don't think there's much of an impact for the drivers. It's mainly
affecting setting up pads for the entities. Tomi?

-- 
Sakari Ailus

  reply	other threads:[~2023-06-05  8:07 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 [this message]
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
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=ZH2XokhNNc6Sql64@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=hongju.wang@intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --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).