[RFC,v2,0/1] Add queueControls mechanism
mbox series

Message ID 20260312160009.18654-1-david.plowman@raspberrypi.com
Headers show
Series
  • Add queueControls mechanism
Related show

Message

David Plowman March 12, 2026, 3:10 p.m. UTC
Hi everyone

Here's a version of Barnabas's previous patch (hence "v2") that added
a separate applyControls function, to bypass the request queue. If you
recall, I was a fan of this one.

I've re-worked it only slightly, replacing the single pending
ControlList with a queue, which is the functionality that was
important to us. To make that explicit, I've renamed "applyControls"
to "queueControls" everywhere.

I've also tried, in passing, to answer some of the hanging questions:

* Like requests, I've not allowed controls to be queued before the
  camera is running. Don't feel strongly either way, really.

* I've allowed queueing empty ControlLists. Doing this allows you to
  get "another frame like the last one".

* I clear out all pending controls when the camera stops. If an
  application needs to be sure they have been applied, it should wait
  (which kind of leads us on to PFC, but not a subject for this
  patch!). Or if it doesn't want to wait, it should re-apply any
  in-question values when it re-starts the camera.

* I'm using the fallback only when the PH explicitly doesn't support
  queueControlsDevice. Really, if it's supported it's got to work
  every time, even if that only means putting it in a queue in the
  PH. Having some ControlLists go into the PH here, and then to have
  it fail and put others into the pending queue, just feels entirely
  confusing!

* In the fallback case I'm copying the ControlList so that we can
  recover if the request fails to queue. Firstly, I don't think this
  is too horrible, and anyway, it's a fallback. If anyone cares about
  this they should implement queueControlsDevice.

TBH, I'm a bit unconvinced by the whole fallback thing. We (RPi)
always queue up lots of requests as soon as we can, and to my
understanding they all go through to our PH pretty much straight away,
which kind of nullifies the whole point. But maybe other PHs behave
differently? Always happy to be corrected on any misconceptions!

Thanks
David

David Plowman (1):
  libcamera: Add independent queue for ControlLists

 include/libcamera/camera.h                    |  1 +
 include/libcamera/internal/camera.h           |  1 +
 include/libcamera/internal/pipeline_handler.h |  7 ++
 src/libcamera/camera.cpp                      | 61 +++++++++++++++
 src/libcamera/pipeline_handler.cpp            | 76 +++++++++++++++++++
 5 files changed, 146 insertions(+)