| Message ID | 20251210133704.2711629-1-barnabas.pocze@ideasonboard.com |
|---|---|
| Headers | show |
| Series |
|
| Related | show |
Hi Barnabás On Wed, Dec 10, 2025 at 02:37:02PM +0100, Barnabás Pőcze wrote: > This patch set tries to add at least some kind of support for setting a frame > duration on uvc camera to address https://gitlab.freedesktop.org/camera/libcamera/-/issues/296 > > The mismatches in the kernel and libcamera interfaces are elaborated in the last patch. > > A couple points remain: > > (a) Since the frame interval cannot be set during streaming, could this indicate that a Is this a UVC limitation ? I mean, the protocol doesn't allow that ? > "startup control" concept would be useful in libcamera, where cameras could mark > certain controls in their `ControlInfoMap` to indicate that they can only be set > when passed to `Camera::start()`? I recall we had a similar discussion where startup controls have been introduced. I forgot what other controls this could be applied to honetly > > (B) I originally intended to advertise all available discrete options in the `ControlInfo`. > For example: > > $ v4l2-ctl --list-formats-ext > ioctl: VIDIOC_ENUM_FMT > Type: Video Capture > > [0]: 'YUYV' (YUYV 4:2:2) > Size: Discrete 640x480 > Interval: Discrete 0.033s (30.000 fps) > Interval: Discrete 0.040s (25.000 fps) > Interval: Discrete 0.050s (20.000 fps) > Interval: Discrete 0.067s (15.000 fps) > Interval: Discrete 0.100s (10.000 fps) > Interval: Discrete 0.200s (5.000 fps) > > would produce: > > ControlInfo { > .min = { 0.033s }, > .max = { 0.200s }, > .values = { > { 0.033s, 0.033s }, > { 0.040s, 0.040s }, > { 0.050s, 0.050s }, > { 0.067s, 0.067s }, > { 0.100s, 0.100s }, > { 0.200s, 0.200s }, > }, > } > > This would be done in order to satisfy two requirements: > * every item in `ControlInfo::values()` should be of the proper shape and type > to be directly applicable as the value of the control; > * the min/max for array like controls (except strings) should denote the min/max > for any single element in the array. > > Unfortunately, there is no constructor of `ControlInfo` that achieves this. > Would it be useful to add one? For this specific use case, my main concern is not about listing all possible values, but the fact that the list of supported intervals depend on the stream size and format, as it's ultimately about the available bus bandwidth I guess. I wouldn't go too far to support this specific use case without having considered how to address the API limitation reported in detail in the above mentioned gitlab issue. What do you think ? > > > Barnabás Pőcze (2): > libcamera: pipeline: uvcvideo: Report `FrameDuration` > libcamera: pipeline: uvcvideo: Handle `FrameDurationLimits` > > include/libcamera/internal/v4l2_videodevice.h | 5 + > src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 72 ++++++++ > src/libcamera/v4l2_videodevice.cpp | 171 ++++++++++++++++++ > 3 files changed, 248 insertions(+) > > -- > 2.52.0
Hi 2025. 12. 10. 16:15 keltezéssel, Jacopo Mondi írta: > Hi Barnabás > > On Wed, Dec 10, 2025 at 02:37:02PM +0100, Barnabás Pőcze wrote: >> This patch set tries to add at least some kind of support for setting a frame >> duration on uvc camera to address https://gitlab.freedesktop.org/camera/libcamera/-/issues/296 >> >> The mismatches in the kernel and libcamera interfaces are elaborated in the last patch. >> >> A couple points remain: >> >> (a) Since the frame interval cannot be set during streaming, could this indicate that a > > Is this a UVC limitation ? I mean, the protocol doesn't allow that ? As far as I'm aware yes. > >> "startup control" concept would be useful in libcamera, where cameras could mark >> certain controls in their `ControlInfoMap` to indicate that they can only be set >> when passed to `Camera::start()`? > > I recall we had a similar discussion where startup controls have been > introduced. > > I forgot what other controls this could be applied to honetly > >> >> (B) I originally intended to advertise all available discrete options in the `ControlInfo`. >> For example: >> >> $ v4l2-ctl --list-formats-ext >> ioctl: VIDIOC_ENUM_FMT >> Type: Video Capture >> >> [0]: 'YUYV' (YUYV 4:2:2) >> Size: Discrete 640x480 >> Interval: Discrete 0.033s (30.000 fps) >> Interval: Discrete 0.040s (25.000 fps) >> Interval: Discrete 0.050s (20.000 fps) >> Interval: Discrete 0.067s (15.000 fps) >> Interval: Discrete 0.100s (10.000 fps) >> Interval: Discrete 0.200s (5.000 fps) >> >> would produce: >> >> ControlInfo { >> .min = { 0.033s }, >> .max = { 0.200s }, >> .values = { >> { 0.033s, 0.033s }, >> { 0.040s, 0.040s }, >> { 0.050s, 0.050s }, >> { 0.067s, 0.067s }, >> { 0.100s, 0.100s }, >> { 0.200s, 0.200s }, >> }, >> } >> >> This would be done in order to satisfy two requirements: >> * every item in `ControlInfo::values()` should be of the proper shape and type >> to be directly applicable as the value of the control; >> * the min/max for array like controls (except strings) should denote the min/max >> for any single element in the array. >> >> Unfortunately, there is no constructor of `ControlInfo` that achieves this. >> Would it be useful to add one? > > For this specific use case, my main concern is not about listing all > possible values, but the fact that the list of supported intervals > depend on the stream size and format, as it's ultimately about the > available bus bandwidth I guess. > > I wouldn't go too far to support this specific use case without having > considered how to address the API limitation reported in detail in the > above mentioned gitlab issue. > > What do you think ? I believe the lack of this limits the usability somewhat since one cannot enumerate the discrete frame durations and instead of only gets a min/max, but it is certainly not required. > >> >> >> Barnabás Pőcze (2): >> libcamera: pipeline: uvcvideo: Report `FrameDuration` >> libcamera: pipeline: uvcvideo: Handle `FrameDurationLimits` >> >> include/libcamera/internal/v4l2_videodevice.h | 5 + >> src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 72 ++++++++ >> src/libcamera/v4l2_videodevice.cpp | 171 ++++++++++++++++++ >> 3 files changed, 248 insertions(+) >> >> -- >> 2.52.0
This patch set tries to add at least some kind of support for setting a frame duration on uvc camera to address https://gitlab.freedesktop.org/camera/libcamera/-/issues/296 The mismatches in the kernel and libcamera interfaces are elaborated in the last patch. A couple points remain: (a) Since the frame interval cannot be set during streaming, could this indicate that a "startup control" concept would be useful in libcamera, where cameras could mark certain controls in their `ControlInfoMap` to indicate that they can only be set when passed to `Camera::start()`? (B) I originally intended to advertise all available discrete options in the `ControlInfo`. For example: $ v4l2-ctl --list-formats-ext ioctl: VIDIOC_ENUM_FMT Type: Video Capture [0]: 'YUYV' (YUYV 4:2:2) Size: Discrete 640x480 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.040s (25.000 fps) Interval: Discrete 0.050s (20.000 fps) Interval: Discrete 0.067s (15.000 fps) Interval: Discrete 0.100s (10.000 fps) Interval: Discrete 0.200s (5.000 fps) would produce: ControlInfo { .min = { 0.033s }, .max = { 0.200s }, .values = { { 0.033s, 0.033s }, { 0.040s, 0.040s }, { 0.050s, 0.050s }, { 0.067s, 0.067s }, { 0.100s, 0.100s }, { 0.200s, 0.200s }, }, } This would be done in order to satisfy two requirements: * every item in `ControlInfo::values()` should be of the proper shape and type to be directly applicable as the value of the control; * the min/max for array like controls (except strings) should denote the min/max for any single element in the array. Unfortunately, there is no constructor of `ControlInfo` that achieves this. Would it be useful to add one? Barnabás Pőcze (2): libcamera: pipeline: uvcvideo: Report `FrameDuration` libcamera: pipeline: uvcvideo: Handle `FrameDurationLimits` include/libcamera/internal/v4l2_videodevice.h | 5 + src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 72 ++++++++ src/libcamera/v4l2_videodevice.cpp | 171 ++++++++++++++++++ 3 files changed, 248 insertions(+) -- 2.52.0