summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/raspberrypi
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-04 02:22:32 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-17 02:13:38 +0300
commit44aa793056f196bff386429d280d568c8a8313cc (patch)
tree697de7301a2cfad6ba9e8471777bef3c43553bbd /src/libcamera/pipeline/raspberrypi
parentc567ca70d06b167da461155d782ec077245b2a5c (diff)
libcamera: pipeline: raspberrypi: Set sensor flip based on rotation
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@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Diffstat (limited to 'src/libcamera/pipeline/raspberrypi')
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 4dc98315..12241590 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>
@@ -1173,6 +1174,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));
+ unicam_[Unicam::Image].dev()->setControls(&ctrls);
+
return 0;
}
@@ -1201,10 +1209,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);
goto done;
}