summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/raspberrypi.cpp
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/ipa/raspberrypi/raspberrypi.cpp
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/ipa/raspberrypi/raspberrypi.cpp')
-rw-r--r--src/ipa/raspberrypi/raspberrypi.cpp62
1 files changed, 28 insertions, 34 deletions
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 7904225a..a5b4b311 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -79,7 +79,7 @@ public:
munmap(lsTable_, ipa::RPi::MaxLsGridSize);
}
- int init(const IPASettings &settings) override;
+ int init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) override;
void start(const ipa::RPi::StartControls &data,
ipa::RPi::StartControls *result) override;
void stop() override {}
@@ -164,9 +164,35 @@ private:
double maxFrameDuration_;
};
-int IPARPi::init(const IPASettings &settings)
+int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig)
{
tuningFile_ = settings.configurationFile;
+
+ /*
+ * Load the "helper" for this sensor. This tells us all the device specific stuff
+ * that the kernel driver doesn't. We only do this the first time; we don't need
+ * to re-parse the metadata after a simple mode-switch for no reason.
+ */
+ helper_ = std::unique_ptr<RPiController::CamHelper>(RPiController::CamHelper::Create(settings.sensorModel));
+ if (!helper_) {
+ LOG(IPARPI, Error) << "Could not create camera helper for "
+ << settings.sensorModel;
+ return -EINVAL;
+ }
+
+ /*
+ * Pass out the sensor config to the pipeline handler in order
+ * to setup the staggered writer class.
+ */
+ int gainDelay, exposureDelay, vblankDelay, sensorMetadata;
+ helper_->GetDelays(exposureDelay, gainDelay, vblankDelay);
+ sensorMetadata = helper_->SensorEmbeddedDataPresent();
+
+ sensorConfig->gainDelay = gainDelay;
+ sensorConfig->exposureDelay = exposureDelay;
+ sensorConfig->vblankDelay = vblankDelay;
+ sensorConfig->sensorMetadata = sensorMetadata;
+
return 0;
}
@@ -301,8 +327,6 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo,
return -1;
}
- result->params = 0;
-
sensorCtrls_ = entityControls.at(0);
ispCtrls_ = entityControls.at(1);
@@ -319,36 +343,6 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo,
/* Setup a metadata ControlList to output metadata. */
libcameraMetadata_ = ControlList(controls::controls);
- /*
- * Load the "helper" for this sensor. This tells us all the device specific stuff
- * that the kernel driver doesn't. We only do this the first time; we don't need
- * to re-parse the metadata after a simple mode-switch for no reason.
- */
- std::string cameraName(sensorInfo.model);
- if (!helper_) {
- helper_ = std::unique_ptr<RPiController::CamHelper>(RPiController::CamHelper::Create(cameraName));
-
- if (!helper_) {
- LOG(IPARPI, Error) << "Could not create camera helper for "
- << cameraName;
- return -1;
- }
-
- /*
- * Pass out the sensor config to the pipeline handler in order
- * to setup the staggered writer class.
- */
- int gainDelay, exposureDelay, vblankDelay, sensorMetadata;
- helper_->GetDelays(exposureDelay, gainDelay, vblankDelay);
- sensorMetadata = helper_->SensorEmbeddedDataPresent();
-
- result->params |= ipa::RPi::ConfigSensorParams;
- result->sensorConfig.gainDelay = gainDelay;
- result->sensorConfig.exposureDelay = exposureDelay;
- result->sensorConfig.vblankDelay = vblankDelay;
- result->sensorConfig.sensorMetadata = sensorMetadata;
- }
-
/* Re-assemble camera mode using the sensor info. */
setMode(sensorInfo);