From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil@xs4all.nl>,
Umang Jain <umang.jain@ideasonboard.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: v4l2-subdev: Support enable/disable_streams for single-pad subdevs
Date: Wed, 3 Apr 2024 12:25:44 +0300 [thread overview]
Message-ID: <a77160ef-7586-4b9b-8013-daf0872c4ab8@ideasonboard.com> (raw)
In-Reply-To: <Zgv0k01IQOFaMdSZ@kekkonen.localdomain>
On 02/04/2024 15:05, Sakari Ailus wrote:
> On Wed, Mar 27, 2024 at 03:39:31PM +0200, Tomi Valkeinen wrote:
>> On 27/03/2024 15:32, Sakari Ailus wrote:
>>> Heissulivei,
>>>
>>> On Wed, Mar 27, 2024 at 01:06:42PM +0200, Tomi Valkeinen wrote:
>>>> On 27/03/2024 12:46, Sakari Ailus wrote:
>>>>> Heippa,
>>>>>
>>>>> On Mon, Mar 25, 2024 at 07:56:46PM +0200, Tomi Valkeinen wrote:
>>>>>> On 25/03/2024 19:52, Sakari Ailus wrote:
>>>>>>> Moi,
>>>>>>>
>>>>>>> On Mon, Mar 25, 2024 at 03:43:01PM +0200, Tomi Valkeinen wrote:
>>>>>>>> On 25/03/2024 15:02, Sakari Ailus wrote:
>>>>>>>>> Moi,
>>>>>>>>>
>>>>>>>>> Thanks for the patch.
>>>>>>>>>
>>>>>>>>> On Mon, Mar 25, 2024 at 02:50:55PM +0200, Laurent Pinchart wrote:
>>>>>>>>>> Hi Tomi,
>>>>>>>>>>
>>>>>>>>>> On Mon, Mar 25, 2024 at 02:43:23PM +0200, Tomi Valkeinen wrote:
>>>>>>>>>>> Currently a subdevice with a single pad, e.g. a sensor subdevice, must
>>>>>>>>>>> use the v4l2_subdev_video_ops.s_stream op, instead of
>>>>>>>>>>> v4l2_subdev_pad_ops.enable/disable_streams. This is because the
>>>>>>>>>>> enable/disable_streams machinery requires a routing table which a subdev
>>>>>>>>>>> cannot have with a single pad.
>>>>>>>>>>>
>>>>>>>>>>> Implement enable/disable_streams support for these single-pad subdevices
>>>>>>>>>>> by assuming an implicit stream 0 when the subdevice has only one pad.
>>>>>>>>>>>
>>>>>>>>>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
>>>>>>>>>>> ---
>>>>>>>>>>> Even though I did send this patch, I'm not sure if this is necessary.
>>>>>>>>>>> s_stream works fine for the subdevs with a single pad. With the upcoming
>>>>>>>>>>> internal pads, adding an internal pad to the subdev will create a
>>>>>>>>>>> routing table, and enable/disable_streams would get "fixed" that way.
>>>>>>>>>
>>>>>>>>> I'd like to get rid of a redundant way to control streaming.
>>>>>>>>
>>>>>>>> We can't get rid of it anyway, can we? We're not going to convert old
>>>>>>>> drivers to streams.
>>>>>>>
>>>>>>> I'd expect to do that but it'd take a long time. That being said, I think
>>>>>>> we need to consider devices without pads (VCMs) so it may well be this
>>>>>>> would remain after all.
>>>>>>>
>>>>>>>>
>>>>>>>> For new drivers, yes, we shouldn't use s_stream. But is the answer for new
>>>>>>>> sensor drivers this patch, or requiring an internal pad?
>>>>>>>
>>>>>>> For new drivers I'd like to see an internal pad in fact.
>>>>>>> {enable,disable}_streams is still internal to the kernel.
>>>>>>
>>>>>> So, you think this patch should be dropped?
>>>>>
>>>>> No, no. Not all sub-device drivers with pads are camera sensor drivers. :-)
>>>>
>>>> Hmm, alright. So we want to support enable/disable_streams for sub-devices
>>>> with multiple source pads but no routing (so probably no sink pads)?
>>>
>>> That should be allowed indeed, in order to move from s_stream() to
>>> {enable,disable}_streams().
>>>
>>>>
>>>>>>>>>>> So perhaps the question is, do we want to support single-pad subdevs in
>>>>>>>>>>> the future, in which case something like this patch is necessary, or
>>>>>>>>>>> will all modern source subdev drivers have internal pads, in which
>>>>>>>>>>> case this is not needed...
>>>>>>>>>>
>>>>>>>>>> I think the latter would be best. I however can't guarantee we won't
>>>>>>>>>> have valid use cases for (enable|disable)_streams on single-pad subdevs
>>>>>>>>>> though, so you patch could still be interesting.
>>>>>>>>>
>>>>>>>>> Instead of the number of pads, could we use instead the
>>>>>>>>> V4L2_SUBDEV_FL_STREAMS flag or whether g_routing op is supported to
>>>>>>>>> determine the need for this?
>>>>>>>>
>>>>>>>> Maybe, but are they better? Do you see some issue with checking for the
>>>>>>>> number of pads? I considered a few options, but then thought that the most
>>>>>>>> safest test for this case is 1) one pad 2) enable/disable_streams
>>>>>>>> implemented.
>>>>>>>
>>>>>>> I think I'd actually prefer {enable,disable}_streams in fact.
>>>>>>
>>>>>> Hmm, sorry, now I'm confused =). What do you mean with that?
>>>>>
>>>>> I'd use V4L2_SUBDEV_FL_STREAMS flag instead of the number of pads. The
>>>>> number of pads is less related to routing.
>>>>
>>>> Well, with one pad you cannot have routing =).
>>>>
>>>> In this patch I used sd->enabled_streams to track the enabled streams, but
>>>> if we need to support multiple pads, I'll have to invent something new for
>>>> that.
>>>
>>> What exactly do you think needs to be changed? This is just about starting
>>> and stopping streaming using a different sent of callbacks, right?
>>
>> The helpers track which streams are enabled, so we need some place to store
>> the enabled streams.
>>
>> For V4L2_SUBDEV_FL_STREAMS we have that in state->stream_configs for each
>> stream. For the one-source-pad case we have a subdev wide
>> sd->enabled_streams to store that. But we don't have any place at the moment
>> to store if a pad is enabled.
>
> If there are is no support for routing, isn't streaming either enabled or
> disabled on all of them?
Hmm, no, I don't see why that would be the case. If a subdev has two
source pads, and it gets an enable_streams() call on the first source
pad, why would the second source pad be enabled too?
Tomi
next prev parent reply other threads:[~2024-04-03 9:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-25 12:43 Tomi Valkeinen
2024-03-25 12:50 ` Laurent Pinchart
2024-03-25 13:02 ` Sakari Ailus
2024-03-25 13:43 ` Tomi Valkeinen
2024-03-25 17:52 ` Sakari Ailus
2024-03-25 17:56 ` Tomi Valkeinen
2024-03-27 10:46 ` Sakari Ailus
2024-03-27 11:06 ` Tomi Valkeinen
2024-03-27 13:32 ` Sakari Ailus
2024-03-27 13:39 ` Tomi Valkeinen
2024-04-02 12:05 ` Sakari Ailus
2024-04-03 9:25 ` Tomi Valkeinen [this message]
2024-04-03 9:29 ` Sakari Ailus
2024-03-27 6:10 ` Umang Jain
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=a77160ef-7586-4b9b-8013-daf0872c4ab8@ideasonboard.com \
--to=tomi.valkeinen@ideasonboard.com \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=umang.jain@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
all inboxes | Powered by JetHome®