[RFC,v1,0/7] libcamera: camera: Add `applyControls()`
mbox series

Message ID 20250924124713.3361707-1-barnabas.pocze@ideasonboard.com
Headers show
Series
  • libcamera: camera: Add `applyControls()`
Related show

Message

Barnabás Pőcze Sept. 24, 2025, 12:47 p.m. UTC
This is a proof-of-concept implementation of the `Camera::applyControls()`
mechanism for fast(er) control application.

At the moment controls can be set at two specific points:
  * when the camera is started,
  * for a given request.

However, sometimes it is desirable to apply controls "as fast as possible"
regardless of how many requests are queued. This could be implemented by
making available the minimum number of requests that need to be queued at
any given time, and letting the application implement its own queue.
Such a queue, however, is essentially already implemented in libcamera:
`Camera::Private::waitingRequests_`, so this patch set makes use of that.

The implementation is in the second to last patch. It adds a new virtual function
for pipeline handlers to implement, this function should apply the given controls
"immediately". If that is not implemented, then a fallback mechanism is used, which
merges the control list into the control list of the request that is submitted to
the pipeline handler next. There are a number of questions regarding the exact
implementation, marked as TODO items in the code, please check those as well.
In addition, there is also the question of (async) success/failure reporting.

The last change implements it for the UVC pipeline handler.

Barnabás Pőcze (7):
  libcamera: base: bound_method: Strip qualifiers in argument pack
  libcamera: base: bound_method: Forward when invoking
  libcamera: controls: Add rvalue `ControlList::merge()`
  libcamera: controls: ControlList: Add `erase()`
  libcamera: camera: Make `waitingRequests_` an `std::deque`
  libcamera: camera: Add `applyControls()`
  libcamera: pipeline: uvcvideo: Implement `applyControlsDevice()`

 include/libcamera/base/bound_method.h         |   8 +-
 include/libcamera/camera.h                    |   1 +
 include/libcamera/controls.h                  |   4 +
 include/libcamera/internal/camera.h           |   3 +-
 include/libcamera/internal/pipeline_handler.h |   7 ++
 src/libcamera/camera.cpp                      |  53 ++++++++
 src/libcamera/controls.cpp                    |  59 ++++++++-
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |   5 +
 src/libcamera/pipeline_handler.cpp            | 118 +++++++++++++++++-
 9 files changed, 245 insertions(+), 13 deletions(-)

--
2.51.0