From: Hans de Goede <hdegoede@redhat.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Ricardo Ribalda <ribalda@chromium.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
Yunke Cao <yunkec@chromium.org>,
Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [PATCH v2 0/6] media: uvcvideo: Implement the Privacy GPIO as a subdevice
Date: Mon, 25 Nov 2024 14:44:03 +0100 [thread overview]
Message-ID: <33e7dbc8-0d29-4905-a28c-e562151a837a@redhat.com> (raw)
In-Reply-To: <20241125125834.GC32280@pendragon.ideasonboard.com>
Hi,
On 25-Nov-24 1:58 PM, Laurent Pinchart wrote:
> On Mon, Nov 25, 2024 at 01:39:05PM +0100, Hans de Goede wrote:
>> Hi Ricardo,
>>
>> On 10-Nov-24 5:07 PM, Ricardo Ribalda wrote:
>>> On Sun, 10 Nov 2024 at 16:14, Laurent Pinchart
>>> <laurent.pinchart@ideasonboard.com> wrote:
>>
>> <snip>
>>
>>>>>> Here is what I have in mind for this:
>>>>>>
>>>>>> 1. Assume that the results of trying a specific fmt do not change over time.
>>>>>>
>>>>>> 2. Only allow userspace to request fmts which match one of the enum-fmts ->
>>>>>> enum-frame-sizes -> enum-frame-rates tripplet results
>>>>>> (constrain what userspace requests to these)
>>>>>>
>>>>>> 3. Run the equivalent of tryfmt on all possible combinations (so the usaul
>>>>>> 3 levels nested loop for this) on probe() and cache the results
>>>>>>
>>>>>> 4. Make try_fmt / set_fmt not poweron the device but instead constrain
>>>>>> the requested fmt to one from our cached fmts
>>>>>>
>>>>>> 5. On stream-on do the actual power-on + set-fmt + verify that we get
>>>>>> what we expect based on the cache, and otherwise return -EIO.
>>>>>
>>>>> Can we start powering up the device during try/set fmt and then
>>>>> implement the format caching as an improvement?
>>>>
>>>> This sounds worth trying. We'll need to test it on a wide range of
>>>> devices though, both internal and external.
>>>
>>> For what is worth, we have been running something similar to
>>> https://lore.kernel.org/linux-media/20220920-resend-powersave-v5-2-692e6df6c1e2@chromium.org/
>>> in ChromeOS and it has worked fine....
>>>
>>> But I am pretty sure that it has issues with async controls :S
>>
>> Interesting that is actually a lot more aggressive (as in doing a
>> usb_autopm_put_interface() often) then what I expected when you said:
>>
>> "Can we start powering up the device during try/set fmt"
>>
>> As I mentioned in my other emails what I think would worth nicely
>> is delay the initial usb_autopm_get_interface() till we need it
>> and then just leave the camera on till /dev/video# gets closed.
>>
>> That idea is based on dividing apps in 2 groups:
>>
>> 1. Apps just temporarily opening /dev/video# nodes for discovery,
>> where we ideally would not power-up the camera.
>>
>> 2. Apps (could even be the same app) opening /dev/video# for
>> a longer time because it actually want to use the camera
>> at the moment of opening and which close the /dev/video# node
>> when done with the camera.
>>
>> Your code seems to also covers a 3th group of apps:
>>
>> 3. Apps opening /dev/video# for a long time, while not using
>> it all the time.
>>
>> Although it would be nice to also cover those, IMHO those are
>> not well behaved apps and I'm not sure if we need to cover those.
>
> Is that right ? Isn't it better for an application to keep the device
> open to avoid open delays or even open failures when it wants to use the
> device ?
Keeping devices open has advantages and disadvantages. E.g. keeping
/dev/input/event# nodes open will also typically lead to e.g.
touchscreens staying powered on.
Generally speaking it is not unheard of to expect userspace to
behave in a certain way for things like this for power-consumption
reasons.
I guess the question is how far do we want to go inside the uvc
driver to avoid userspace needing to close the /dev/video# nodes
when unused.
Ricardo's patch from here:
https://lore.kernel.org/linux-media/20220920-resend-powersave-v5-2-692e6df6c1e2@chromium.org/
goes all the way and if I understand Ricardo correctly this is
already in use in ChromeOS ?
So we could also go with this. Maybe put it behind a Kconfig option
for a while ?
AFAICT the only thing which needs to be figured out there is async
controls.
I think we can simply set a long autosuspend delay on devices with
async controls to deal with that ?
I have a Logitech QuickCam Orbit (non AF) UVC camera which has
pan + tilt controls and AFAICT these work fine with v4l2-ctl
which immediately closes the /dev/video# node after the set-ctrl
command. But I'm not sure if I have tested this without the camera
streaming at the time. Anyways that is at least one camera I can test.
Regards,
Hans
next prev parent reply other threads:[~2024-11-25 13:44 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 20:25 [PATCH v2 0/6] media: uvcvideo: Implement the Privacy GPIO as a subdevice Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 1/6] media: uvcvideo: Factor out gpio functions to its own file Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 2/6] media: uvcvideo: Re-implement privacy GPIO as a separate subdevice Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 3/6] Revert "media: uvcvideo: Allow entity-defined get_info and get_cur" Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 4/6] media: uvcvideo: Create ancillary link for GPIO subdevice Ricardo Ribalda
2024-11-10 10:05 ` Sakari Ailus
2024-11-08 20:25 ` [PATCH v2 5/6] media: v4l2-core: Add new MEDIA_ENT_F_GPIO Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 6/6] media: uvcvideo: Use MEDIA_ENT_F_GPIO for the GPIO entity Ricardo Ribalda
2024-11-09 14:04 ` [PATCH v2 0/6] media: uvcvideo: Implement the Privacy GPIO as a subdevice Mauro Carvalho Chehab
2024-11-09 14:57 ` Ricardo Ribalda
2024-11-09 15:37 ` Hans de Goede
2024-11-09 16:29 ` Ricardo Ribalda
2024-11-10 10:02 ` Mauro Carvalho Chehab
2024-11-10 10:29 ` Hans Verkuil
2024-11-10 10:37 ` Ricardo Ribalda
2024-11-10 10:47 ` Hans Verkuil
2024-11-10 12:48 ` Mauro Carvalho Chehab
2024-11-10 10:32 ` Ricardo Ribalda
2024-11-10 10:59 ` Ricardo Ribalda
2024-11-10 12:46 ` Mauro Carvalho Chehab
2024-11-10 16:01 ` Ricardo Ribalda
2024-11-10 15:14 ` Laurent Pinchart
2024-11-10 16:04 ` Ricardo Ribalda
2024-11-25 12:31 ` Hans de Goede
2024-11-25 12:56 ` Laurent Pinchart
2024-11-25 13:35 ` Hans de Goede
2024-11-10 16:07 ` Ricardo Ribalda
2024-11-25 12:39 ` Hans de Goede
2024-11-25 12:58 ` Laurent Pinchart
2024-11-25 13:44 ` Hans de Goede [this message]
2024-11-25 13:50 ` Ricardo Ribalda
2024-11-11 12:03 ` Hans de Goede
2024-11-25 12:25 ` Hans de Goede
2024-11-25 12:49 ` Laurent Pinchart
2024-11-25 13:29 ` Hans de Goede
2024-11-26 17:22 ` Laurent Pinchart
2024-11-25 13:39 ` Ricardo Ribalda
2024-11-25 14:02 ` Hans de Goede
2024-11-26 16:22 ` Ricardo Ribalda
2024-11-26 17:18 ` Laurent Pinchart
2024-11-26 17:29 ` Ricardo Ribalda
2024-11-10 15:08 ` Laurent Pinchart
2024-11-11 12:59 ` Hans de Goede
2024-11-11 14:35 ` Hans de Goede
2024-11-12 17:31 ` Ricardo Ribalda
2024-11-13 15:19 ` Hans de Goede
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=33e7dbc8-0d29-4905-a28c-e562151a837a@redhat.com \
--to=hdegoede@redhat.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=ribalda@chromium.org \
--cc=sakari.ailus@linux.intel.com \
--cc=yunkec@chromium.org \
/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