ipa: raspberrypi: Use direct return value for configure()
Now that we support returning int directly in addition to other output parameters, improve the configure() function in the raspberrypi IPA interface. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
0612bef601
commit
45ebe9a209
3 changed files with 18 additions and 23 deletions
|
@ -77,7 +77,7 @@ interface IPARPiInterface {
|
||||||
map<uint32, IPAStream> streamConfig,
|
map<uint32, IPAStream> streamConfig,
|
||||||
map<uint32, ControlInfoMap> entityControls,
|
map<uint32, ControlInfoMap> entityControls,
|
||||||
ConfigInput ipaConfig)
|
ConfigInput ipaConfig)
|
||||||
=> (ConfigOutput results, int32 ret);
|
=> (int32 ret, ConfigOutput results);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn mapBuffers()
|
* \fn mapBuffers()
|
||||||
|
|
|
@ -84,11 +84,11 @@ public:
|
||||||
ipa::RPi::StartControls *result) override;
|
ipa::RPi::StartControls *result) override;
|
||||||
void stop() override {}
|
void stop() override {}
|
||||||
|
|
||||||
void configure(const CameraSensorInfo &sensorInfo,
|
int configure(const CameraSensorInfo &sensorInfo,
|
||||||
const std::map<unsigned int, IPAStream> &streamConfig,
|
const std::map<unsigned int, IPAStream> &streamConfig,
|
||||||
const std::map<unsigned int, ControlInfoMap> &entityControls,
|
const std::map<unsigned int, ControlInfoMap> &entityControls,
|
||||||
const ipa::RPi::ConfigInput &data,
|
const ipa::RPi::ConfigInput &data,
|
||||||
ipa::RPi::ConfigOutput *response, int32_t *ret) override;
|
ipa::RPi::ConfigOutput *response) override;
|
||||||
void mapBuffers(const std::vector<IPABuffer> &buffers) override;
|
void mapBuffers(const std::vector<IPABuffer> &buffers) override;
|
||||||
void unmapBuffers(const std::vector<unsigned int> &ids) override;
|
void unmapBuffers(const std::vector<unsigned int> &ids) override;
|
||||||
void signalStatReady(const uint32_t bufferId) override;
|
void signalStatReady(const uint32_t bufferId) override;
|
||||||
|
@ -290,16 +290,15 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo)
|
||||||
mode_.max_frame_length = sensorInfo.maxFrameLength;
|
mode_.max_frame_length = sensorInfo.maxFrameLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPARPi::configure(const CameraSensorInfo &sensorInfo,
|
int IPARPi::configure(const CameraSensorInfo &sensorInfo,
|
||||||
[[maybe_unused]] const std::map<unsigned int, IPAStream> &streamConfig,
|
[[maybe_unused]] const std::map<unsigned int, IPAStream> &streamConfig,
|
||||||
const std::map<unsigned int, ControlInfoMap> &entityControls,
|
const std::map<unsigned int, ControlInfoMap> &entityControls,
|
||||||
const ipa::RPi::ConfigInput &ipaConfig,
|
const ipa::RPi::ConfigInput &ipaConfig,
|
||||||
ipa::RPi::ConfigOutput *result, int32_t *ret)
|
ipa::RPi::ConfigOutput *result)
|
||||||
{
|
{
|
||||||
if (entityControls.size() != 2) {
|
if (entityControls.size() != 2) {
|
||||||
LOG(IPARPI, Error) << "No ISP or sensor controls found.";
|
LOG(IPARPI, Error) << "No ISP or sensor controls found.";
|
||||||
*ret = -1;
|
return -1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result->params = 0;
|
result->params = 0;
|
||||||
|
@ -309,14 +308,12 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,
|
||||||
|
|
||||||
if (!validateSensorControls()) {
|
if (!validateSensorControls()) {
|
||||||
LOG(IPARPI, Error) << "Sensor control validation failed.";
|
LOG(IPARPI, Error) << "Sensor control validation failed.";
|
||||||
*ret = -1;
|
return -1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validateIspControls()) {
|
if (!validateIspControls()) {
|
||||||
LOG(IPARPI, Error) << "ISP control validation failed.";
|
LOG(IPARPI, Error) << "ISP control validation failed.";
|
||||||
*ret = -1;
|
return -1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup a metadata ControlList to output metadata. */
|
/* Setup a metadata ControlList to output metadata. */
|
||||||
|
@ -334,8 +331,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,
|
||||||
if (!helper_) {
|
if (!helper_) {
|
||||||
LOG(IPARPI, Error) << "Could not create camera helper for "
|
LOG(IPARPI, Error) << "Could not create camera helper for "
|
||||||
<< cameraName;
|
<< cameraName;
|
||||||
*ret = -1;
|
return -1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -403,7 +399,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,
|
||||||
|
|
||||||
lastMode_ = mode_;
|
lastMode_ = mode_;
|
||||||
|
|
||||||
*ret = 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPARPi::mapBuffers(const std::vector<IPABuffer> &buffers)
|
void IPARPi::mapBuffers(const std::vector<IPABuffer> &buffers)
|
||||||
|
|
|
@ -1250,9 +1250,8 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)
|
||||||
/* Ready the IPA - it must know about the sensor resolution. */
|
/* Ready the IPA - it must know about the sensor resolution. */
|
||||||
ipa::RPi::ConfigOutput result;
|
ipa::RPi::ConfigOutput result;
|
||||||
|
|
||||||
ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig,
|
ret = ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig,
|
||||||
&result, &ret);
|
&result);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG(RPI, Error) << "IPA configuration failed!";
|
LOG(RPI, Error) << "IPA configuration failed!";
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue