summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/raspberrypi
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-06-29 00:04:23 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-17 02:13:45 +0300
commit89682ea1c433f84f004ba4fe852ce56458e593a2 (patch)
tree0cf5d1cf451a27eb9e315f731a8b91584aaf8f01 /src/libcamera/pipeline/raspberrypi
parent40ed8b3b75aa518226bbe35f6216797d4832341e (diff)
ipa: raspberrypi: Pass sensor config back from configure()
The Raspberry Pi IPA uses the custom RPI_IPA_ACTION_SET_SENSOR_CONFIG frame action to send the sensor staggered write configuration to the pipeline handler when the IPA is configured. Replace this ad-hoc mechanism by passing the corresponding data back from the IPA to the pipeline handler through the configure() response. This allows synchronous handling of the response on the pipeline handler side. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Diffstat (limited to 'src/libcamera/pipeline/raspberrypi')
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp53
1 files changed, 30 insertions, 23 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index dfcc7506..c309ba42 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -821,7 +821,7 @@ int PipelineHandlerRPi::start(Camera *camera)
/*
* Write the last set of gain and exposure values to the camera before
* starting. First check that the staggered ctrl has been initialised
- * by the IPA action.
+ * by configure().
*/
ASSERT(data->staggeredCtrl_);
data->staggeredCtrl_.reset();
@@ -1169,15 +1169,36 @@ int RPiCameraData::configureIPA()
}
/* Ready the IPA - it must know about the sensor resolution. */
+ IPAOperationData result;
+
ipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,
- nullptr);
+ &result);
+
+ if (result.operation & RPI_IPA_CONFIG_STAGGERED_WRITE) {
+ /*
+ * Setup our staggered control writer with the sensor default
+ * gain and exposure delays.
+ */
+ if (!staggeredCtrl_) {
+ staggeredCtrl_.init(unicam_[Unicam::Image].dev(),
+ { { V4L2_CID_ANALOGUE_GAIN, result.data[0] },
+ { V4L2_CID_EXPOSURE, result.data[1] } });
+ sensorMetadata_ = result.data[2];
+ }
- /* 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);
+ /* 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);
+ }
+
+ if (result.operation & RPI_IPA_CONFIG_SENSOR) {
+ const ControlList &ctrls = result.controls[0];
+ if (!staggeredCtrl_.set(ctrls))
+ LOG(RPI, Error) << "V4L2 staggered set failed";
+ }
return 0;
}
@@ -1190,26 +1211,12 @@ void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData
*/
switch (action.operation) {
case RPI_IPA_ACTION_V4L2_SET_STAGGERED: {
- ControlList controls = action.controls[0];
+ const ControlList &controls = action.controls[0];
if (!staggeredCtrl_.set(controls))
LOG(RPI, Error) << "V4L2 staggered set failed";
goto done;
}
- case RPI_IPA_ACTION_SET_SENSOR_CONFIG: {
- /*
- * Setup our staggered control writer with the sensor default
- * gain and exposure delays.
- */
- if (!staggeredCtrl_) {
- staggeredCtrl_.init(unicam_[Unicam::Image].dev(),
- { { V4L2_CID_ANALOGUE_GAIN, action.data[0] },
- { V4L2_CID_EXPOSURE, action.data[1] } });
- sensorMetadata_ = action.data[2];
- }
- goto done;
- }
-
case RPI_IPA_ACTION_V4L2_SET_ISP: {
ControlList controls = action.controls[0];
isp_[Isp::Input].dev()->setControls(&controls);