summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/raspberrypi
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2021-03-23 14:36:05 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-23 18:43:58 +0200
commiteec070039dd215940151a5d0cc34752ae3dfada4 (patch)
tree3858b50f8930433908bc40f0787126a46ee9c406 /src/libcamera/pipeline/raspberrypi
parentff9f60ce3fef7be119c29d75da4011dcd4b9f4e6 (diff)
pipeline: ipa: raspberrypi: Open the CamHelper on ipa::init()
Move the opening of the CamHelper from ipa::configure() to ipa::init(). This allows the pipeline handler to get the sensor specific parameters in pipeline_handler::match() where the ipa is initialised. Having the sensor parameters available earlier will allow selective use of the embedded data node in a future change. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/raspberrypi')
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 2c8ae31a..ce199418 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -146,7 +146,7 @@ public:
void frameStarted(uint32_t sequence);
- int loadIPA();
+ int loadIPA(ipa::RPi::SensorConfig *sensorConfig);
int configureIPA(const CameraConfiguration *config);
void statsMetadataComplete(uint32_t bufferId, const ControlList &controls);
@@ -1030,11 +1030,24 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
if (data->sensor_->init())
return false;
- if (data->loadIPA()) {
+ ipa::RPi::SensorConfig sensorConfig;
+ if (data->loadIPA(&sensorConfig)) {
LOG(RPI, Error) << "Failed to load a suitable IPA library";
return false;
}
+ /*
+ * Setup our delayed control writer with the sensor default
+ * gain and exposure delays. Mark VBLANK for priority write.
+ */
+ std::unordered_map<uint32_t, DelayedControls::ControlParams> params = {
+ { V4L2_CID_ANALOGUE_GAIN, { sensorConfig.gainDelay, false } },
+ { V4L2_CID_EXPOSURE, { sensorConfig.exposureDelay, false } },
+ { V4L2_CID_VBLANK, { sensorConfig.vblankDelay, true } }
+ };
+ data->delayedCtrls_ = std::make_unique<DelayedControls>(data->unicam_[Unicam::Image].dev(), params);
+ data->sensorMetadata_ = sensorConfig.sensorMetadata;
+
/* Register the controls that the Raspberry Pi IPA can handle. */
data->controlInfo_ = RPi::Controls;
/* Initialize the camera properties. */
@@ -1214,7 +1227,7 @@ void RPiCameraData::frameStarted(uint32_t sequence)
delayedCtrls_->applyControls(sequence);
}
-int RPiCameraData::loadIPA()
+int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig)
{
ipa_ = IPAManager::createIPA<ipa::RPi::IPAProxyRPi>(pipe_, 1, 1);
@@ -1230,7 +1243,7 @@ int RPiCameraData::loadIPA()
IPASettings settings(ipa_->configurationFile(sensor_->model() + ".json"),
sensor_->model());
- return ipa_->init(settings);
+ return ipa_->init(settings, sensorConfig);
}
int RPiCameraData::configureIPA(const CameraConfiguration *config)
@@ -1293,21 +1306,6 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)
return -EPIPE;
}
- if (result.params & ipa::RPi::ConfigSensorParams) {
- /*
- * Setup our delayed control writer with the sensor default
- * gain and exposure delays. Mark VBLANK for priority write.
- */
- std::unordered_map<uint32_t, DelayedControls::ControlParams> params = {
- { V4L2_CID_ANALOGUE_GAIN, { result.sensorConfig.gainDelay, false } },
- { V4L2_CID_EXPOSURE, { result.sensorConfig.exposureDelay, false } },
- { V4L2_CID_VBLANK, { result.sensorConfig.vblankDelay, true } }
- };
-
- delayedCtrls_ = std::make_unique<DelayedControls>(unicam_[Unicam::Image].dev(), params);
- sensorMetadata_ = result.sensorConfig.sensorMetadata;
- }
-
if (!result.controls.empty()) {
ControlList &ctrls = result.controls;
unicam_[Unicam::Image].dev()->setControls(&ctrls);