All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com,
	Jacopo Mondi <jacopo+renesas@jmondi.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	niklas.soderlund+renesas@ragnatech.se
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: Re: [PATCH v6 00/24] v4l: subdev internal routing
Date: Thu, 29 Apr 2021 13:28:08 +0300	[thread overview]
Message-ID: <83d9ee08-0ff7-88b5-e633-4785a4220c9d@ideasonboard.com> (raw)
In-Reply-To: <20210427124523.990938-1-tomi.valkeinen@ideasonboard.com>

On 27/04/2021 15:44, Tomi Valkeinen wrote:
> Hi,
> 
> This is v6 of the series. Previous one can be found from:
> 
> https://lore.kernel.org/linux-media/20210415130450.421168-1-tomi.valkeinen@ideasonboard.com/
> 
> Changes to v5:
> - Dropped "v4l: mc: Add an S_ROUTING helper function for power state changes" as discussed
> - Added MEDIA_PAD_FL_MULTIPLEXED flag to indicate that a pad works in multiplexed mode
> - Documentation improvements
> - Renamed struct v4l2_mbus_frame_desc_entry_csi2 fields
> - Fixed setting routing->num_routes in G_ROUTING
> - Many smaller cosmetic changes as per comments
> 
> One bigger topic I didn't change is the in-kernel API for get/set routing.
> Currently the link validation needs to get the routing tables multiple times,
> each leading to memory allocations (and frees). A different API would allow the
> link validation to peek at the routing without any allocations, but I haven't
> solved that yet.
> 
> A simple solution would be to require a lock to be held when accessing the
> routing table, and making get_routing return a pointer to the driver's routing
> table. But this kind of API would be quite different than, say, get_fmt.
> 
> Another would be to keep the API, but have a state object during link
> validation, which would hold preallocated routing tables, so that link
> validation wouldn't need to allocate new ones for each get_routing call.
> 
> Anything we do here is a kernel internal change, so it's not super critical to
> solve it right away.

I decided to test the other approach: changing subdev format ioctls to 
work on a pad+stream tuple, instead of just on a pad. So essentially 
adding a 'stream' field (taking one u32 from the reserved area) to 
v4l2_subdev_format, v4l2_subdev_mbus_code_enum, and others. The current 
userspace sets the field to 0, to it makes sense even if with older 
userspace.

My branch is still quite messy, but this approach does give us some nice 
benefits:

- I was able to drop the whole "follow-the-stream-to-get-format" code. 
Link validation feels simpler.

- A sensor that provides pixel and metadata can be implemented in a 
single subdev, with a single source pad.

- It makes the configuration of subdevs self-contained.

- A subdev can do operations (like, say, scaling) with a stream, instead 
of having to split the subdev into multiple subdevs to get the 
non-multiplexed pads.

- I don't need the cal_streams_api parameter (introduced in another 
series for TI CAL driver), nor do I need the MEDIA_PAD_FL_MULTIPLEXED flag

- I can easily support a case where the subdev driver on one side of the 
link supports multiplexed streams and the other driver doesn't (as long 
as the multiplexed streams subdev's pad is configured for a single 
stream). Well, this would probably be possible with the previous 
approach also, but at last here it came kind of naturally.

Downsides:

- Need dynamic allocation for storing formats. It doesn't feel too bad, 
though, and it, of course, only affects the drivers that support routing 
and multiplexed streams. I do the reallocation in set_routing.

- TRY doesn't work, as there's no place to store the formats for 
streams. This needs the proposed change to pass subdev state, instead of 
just subdev pad state, to the various format ops.

- Possibly plenty of tooling changes to add support for streams

And I should perhaps add a subdev flag to indicate that a subdev 
supports multiple streams. This could at least be used in the ioctl 
handlers, rejecting stream field > 0 if the subdev does not support streams.

I'll continue working on this a bit to see how it goes, but I wanted to 
share this now to hear if there are any clear NACKs for the approach.

  Tomi

      parent reply	other threads:[~2021-04-29 10:28 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 12:44 [PATCH v6 00/24] v4l: subdev internal routing Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 01/24] media: entity: Use pad as a starting point for graph walk Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 02/24] media: entity: Use pads instead of entities in the media graph walk stack Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 03/24] media: entity: Walk the graph based on pads Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 04/24] v4l: mc: Start walk from a specific pad in use count calculation Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 05/24] media: entity: Add iterator helper for entity pads Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 06/24] media: entity: Move the pipeline from entity to pads Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 07/24] media: entity: Use pad as the starting point for a pipeline Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 08/24] media: entity: Add has_route entity operation Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 09/24] media: entity: Add media_entity_has_route() function Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 10/24] media: entity: Use routing information during graph traversal Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 11/24] media: entity: Skip link validation for pads to which there is no route to Tomi Valkeinen
2021-04-29  2:30   ` Laurent Pinchart
2021-04-27 12:45 ` [PATCH v6 12/24] media: entity: Add an iterator helper for connected pads Tomi Valkeinen
2021-04-29  2:18   ` Laurent Pinchart
2021-05-04  6:53     ` Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 13/24] media: entity: Add only connected pads to the pipeline Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 14/24] media: entity: Add debug information in graph walk route check Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 15/24] v4l: Add bus type to frame descriptors Tomi Valkeinen
2021-04-29  2:46   ` Laurent Pinchart
2021-04-27 12:45 ` [PATCH v6 16/24] v4l: Add CSI-2 bus configuration " Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 17/24] v4l: Add stream to frame descriptor Tomi Valkeinen
2021-04-29  2:50   ` Laurent Pinchart
2021-04-27 12:45 ` [PATCH v6 18/24] v4l: subdev: Add [GS]_ROUTING subdev ioctls and operations Tomi Valkeinen
2021-04-29  2:28   ` Laurent Pinchart
2021-04-29  6:15     ` Tomi Valkeinen
2021-05-04  7:04     ` Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 19/24] media: Documentation: Add GS_ROUTING documentation Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 20/24] v4l: subdev: routing kernel helper functions Tomi Valkeinen
2021-04-29  3:46   ` Laurent Pinchart
2021-04-27 12:45 ` [PATCH v6 21/24] v4l: subdev: add v4l2_subdev_get_format_dir() Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 22/24] media: uapi: add MEDIA_PAD_FL_MULTIPLEXED flag Tomi Valkeinen
2021-04-29  2:53   ` Laurent Pinchart
2021-04-27 12:45 ` [PATCH v6 23/24] v4l: subdev: Take routing information into account in link validation Tomi Valkeinen
2021-04-27 12:45 ` [PATCH v6 24/24] v4l: subdev: increase V4L2_FRAME_DESC_ENTRY_MAX to 8 Tomi Valkeinen
2021-04-29 10:28 ` Tomi Valkeinen [this message]

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=83d9ee08-0ff7-88b5-e633-4785a4220c9d@ideasonboard.com \
    --to=tomi.valkeinen@ideasonboard.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sakari.ailus@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.