[libcamera-devel] [PATCH v2 08/12] libcamera: pipeline: raspberrypi: Set sensor flip based on rotation

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Jul 6 13:21:20 CEST 2020


Hi Naush,

On Mon, Jul 06, 2020 at 09:31:31AM +0100, Naushir Patuck wrote:
> On Sat, 4 Jul 2020 at 01:52, Laurent Pinchart wrote:
> >
> > Instead of receiving sensor orientation configuration from the IPA,
> > retrieve it from the CameraSensor Rotation property, and configure the
> > HFLIP and VFLIP controls accordingly.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > ---
> >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > index 74bee6895dcd..fda6831e6a7e 100644
> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > @@ -16,6 +16,7 @@
> >  #include <libcamera/formats.h>
> >  #include <libcamera/ipa/raspberrypi.h>
> >  #include <libcamera/logging.h>
> > +#include <libcamera/property_ids.h>
> >  #include <libcamera/request.h>
> >  #include <libcamera/stream.h>
> >
> > @@ -1174,6 +1175,13 @@ int RPiCameraData::configureIPA()
> >         ipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,
> >                         nullptr);
> >
> > +       /* Configure the H/V flip controls based on the sensor rotation. */
> > +       ControlList ctrls(unicam_[Unicam::Image].dev()->controls());
> > +       int32_t rotation = sensor_->properties().get(properties::Rotation);
> > +       ctrls.set(V4L2_CID_HFLIP, static_cast<int32_t>(!!rotation));
> > +       ctrls.set(V4L2_CID_VFLIP, static_cast<int32_t>(!!rotation));
> 
> Are you missing a ">> 1" or similar in the above code?  Otherwise,
> both H/V FLIP will be always set to the same value.

That's because the RPi IPA currently handles 0° and 180° rotations only,
without separate control of h/v flip. We need to add h/v flip controls,
and they will then be combined here in the pipeline handler.

> > +       unicam_[Unicam::Image].dev()->setControls(&ctrls);
> > +
> >         return 0;
> >  }
> >
> > @@ -1202,10 +1210,6 @@ void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData
> >                                               { V4L2_CID_EXPOSURE, action.data[1] } });
> >                         sensorMetadata_ = action.data[2];
> >                 }
> > -
> > -               /* Set the sensor orientation here as well. */
> > -               ControlList controls = action.controls[0];
> > -               unicam_[Unicam::Image].dev()->setControls(&controls);
> >                 return;
> >         }
> >

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list