ipa: raspberrypi: Rationalise parameters to ipa::start()

Separate out the in and out parameters in ipa::start() as they are not
the same. This function now takes in a ControlList and returns out a
struct StartConfig which holds a ControlList and drop frame count for
the pipeline handler to action.

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>
This commit is contained in:
Naushir Patuck 2021-03-23 14:36:09 +00:00 committed by Laurent Pinchart
parent 8ccddecc94
commit b876c64613
3 changed files with 14 additions and 21 deletions

View file

@ -39,14 +39,14 @@ struct ConfigOutput {
ControlList controls; ControlList controls;
}; };
struct StartControls { struct StartConfig {
ControlList controls; ControlList controls;
int32 dropFrameCount; int32 dropFrameCount;
}; };
interface IPARPiInterface { interface IPARPiInterface {
init(IPASettings settings) => (int32 ret, SensorConfig sensorConfig); init(IPASettings settings) => (int32 ret, SensorConfig sensorConfig);
start(StartControls controls) => (StartControls result); start(ControlList controls) => (StartConfig startConfig);
stop(); stop();
/** /**

View file

@ -79,8 +79,7 @@ public:
} }
int init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) override; int init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) override;
void start(const ipa::RPi::StartControls &data, void start(const ControlList &controls, ipa::RPi::StartConfig *startConfig) override;
ipa::RPi::StartControls *result) override;
void stop() override {} void stop() override {}
int configure(const CameraSensorInfo &sensorInfo, int configure(const CameraSensorInfo &sensorInfo,
@ -192,15 +191,14 @@ int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConf
return 0; return 0;
} }
void IPARPi::start(const ipa::RPi::StartControls &data, void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConfig)
ipa::RPi::StartControls *result)
{ {
RPiController::Metadata metadata; RPiController::Metadata metadata;
ASSERT(result); ASSERT(startConfig);
if (!data.controls.empty()) { if (!controls.empty()) {
/* We have been given some controls to action before start. */ /* We have been given some controls to action before start. */
queueRequest(data.controls); queueRequest(controls);
} }
controller_.SwitchMode(mode_, &metadata); controller_.SwitchMode(mode_, &metadata);
@ -215,7 +213,7 @@ void IPARPi::start(const ipa::RPi::StartControls &data,
if (agcStatus.shutter_time != 0.0 && agcStatus.analogue_gain != 0.0) { if (agcStatus.shutter_time != 0.0 && agcStatus.analogue_gain != 0.0) {
ControlList ctrls(sensorCtrls_); ControlList ctrls(sensorCtrls_);
applyAGC(&agcStatus, ctrls); applyAGC(&agcStatus, ctrls);
result->controls = std::move(ctrls); startConfig->controls = std::move(ctrls);
} }
/* /*
@ -262,7 +260,7 @@ void IPARPi::start(const ipa::RPi::StartControls &data,
mistrustCount_ = helper_->MistrustFramesModeSwitch(); mistrustCount_ = helper_->MistrustFramesModeSwitch();
} }
result->dropFrameCount = dropFrame; startConfig->dropFrameCount = dropFrame;
firstStart_ = false; firstStart_ = false;
} }

View file

@ -815,20 +815,15 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)
data->applyScalerCrop(*controls); data->applyScalerCrop(*controls);
/* Start the IPA. */ /* Start the IPA. */
ipa::RPi::StartControls ipaData; ipa::RPi::StartConfig startConfig;
ipa::RPi::StartControls result; data->ipa_->start(controls ? *controls : ControlList{}, &startConfig);
if (controls)
ipaData.controls = *controls;
data->ipa_->start(ipaData, &result);
/* Apply any gain/exposure settings that the IPA may have passed back. */ /* Apply any gain/exposure settings that the IPA may have passed back. */
if (!result.controls.empty()) { if (!startConfig.controls.empty())
ControlList &ctrls = result.controls; data->unicam_[Unicam::Image].dev()->setControls(&startConfig.controls);
data->unicam_[Unicam::Image].dev()->setControls(&ctrls);
}
/* Configure the number of dropped frames required on startup. */ /* Configure the number of dropped frames required on startup. */
data->dropFrameCount_ = result.dropFrameCount; data->dropFrameCount_ = startConfig.dropFrameCount;
/* We need to set the dropFrameCount_ before queueing buffers. */ /* We need to set the dropFrameCount_ before queueing buffers. */
ret = queueAllBuffers(camera); ret = queueAllBuffers(camera);