[libcamera-devel,0/6] Resolve invalid attempts to set sensor flip controls
mbox series

Message ID 20221110144556.7858-1-david.plowman@raspberrypi.com
Headers show
Series
  • Resolve invalid attempts to set sensor flip controls
Related show

Message

David Plowman Nov. 10, 2022, 2:45 p.m. UTC
Hi everyone

Here's a first proper attempt to submit some patches for what was
previously an "RFC". The first two patches are the original ones that
I posted, with some tidy-ups from Jacopo:

1. Add a BayerFormat::toMbusCode method.

2. Don't clear the sensor flip bits, instead query them and transform
Bayer formats to their "native" order.

Now there are some extra patches to restore pipeline handlers to their
previous behaviours. I've avoided adding or fixing any functionality
in them even where I had suspected there were some things that needed
addressing - those should all be subsequent pieces of work. So we
have:

3. I've added a V4L2Device::setTransform method. I think we're
expecting to push a bit more work to pipeline handlers so this
function is intended to help them.

You can call it in a "try" mode which tells you what transform (h/v
flips) you will get but without applying them. I expect validate()
methods might call this. And you can call it in a "do" mode which I
would expect configure() methods might use.

I haven't checked for things like the controls being read-only, or
having only one value or strange stuff like that... should I?

4. Fix the uvcvideo PH.

5. Fix the simple PH. Jacopo remarked previously that raw formats are
a theoretical possibility here, but given that it has no particular
handling of them currently, then the changes here make no difference
in that respect. So adding that would be a job for another patch.

6. Fix the rkisp1 PH.

I haven't touched the Raspberry Pi PH because I think it's fine. There
is possibly a small job of tidying it to use the new setTransform
method, but that's one for another time.

I haven't touched the IPU3 PH because I believe it to set the flips
correctly. I remarked previously that I suspected it wasn't
transforming Bayer orders appropriately but again, the changes here
make no difference there so that would be a fix for another patch too.

I hope that all makes sense. Do folks agree with this as a way
forward? Thoughts welcome!

Thanks
David

David Plowman (6):
  libcamera: bayer_format: Add toMbusCode method
  libcamera: camera_sensor: Do not clear camera flips when listing
    formats
  libcamera: v4l2_device: Add setTransform method to set a device's flip
    controls
  libcamera: pipeline: uvcvideo: Set device's flip controls correctly
  libcamera: pipeline: simple: Set device's flip controls correctly
  libcamera: pipeline: rkisp1: Set device's flip controls correctly

 include/libcamera/internal/bayer_format.h    |  1 +
 include/libcamera/internal/v4l2_device.h     |  3 ++
 src/libcamera/bayer_format.cpp               | 11 +++++
 src/libcamera/camera_sensor.cpp              | 49 ++++++++++++++++----
 src/libcamera/pipeline/rkisp1/rkisp1.cpp     |  3 ++
 src/libcamera/pipeline/simple/simple.cpp     |  3 ++
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp |  3 ++
 src/libcamera/v4l2_device.cpp                | 37 +++++++++++++++
 8 files changed, 100 insertions(+), 10 deletions(-)