summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>2021-03-09 07:38:28 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-11 02:13:28 +0200
commitf4fe8cf58820c171d6d355001ff4bdf17484275a (patch)
tree737b214e28253b19328c5a66ef3de90db0ecabb0 /src
parent3b338aa5e759609210079b8883e5a289fb0c1bc0 (diff)
ipa: rkisp1: Return error from IPA's configure method if it fails
The IPA of rkisp1 relies on some of the camera's controls. Therefore it can't work if those controls are not given. Return -EINVAL from 'configure' in that case. Also return error from the pipeline's 'configure' method if the IPA configure fails. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/ipa/rkisp1/rkisp1.cpp19
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp7
2 files changed, 15 insertions, 11 deletions
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index f11aeb40..7d37645b 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -38,9 +38,9 @@ public:
int start() override { return 0; }
void stop() override {}
- void configure(const CameraSensorInfo &info,
- const std::map<uint32_t, IPAStream> &streamConfig,
- const std::map<uint32_t, ControlInfoMap> &entityControls) override;
+ int configure(const CameraSensorInfo &info,
+ const std::map<uint32_t, IPAStream> &streamConfig,
+ const std::map<uint32_t, ControlInfoMap> &entityControls) override;
void mapBuffers(const std::vector<IPABuffer> &buffers) override;
void unmapBuffers(const std::vector<unsigned int> &ids) override;
void processEvent(const ipa::rkisp1::RkISP1Event &event) override;
@@ -75,25 +75,25 @@ private:
* assemble one. Make sure the reported sensor information are relevant
* before accessing them.
*/
-void IPARkISP1::configure([[maybe_unused]] const CameraSensorInfo &info,
- [[maybe_unused]] const std::map<uint32_t, IPAStream> &streamConfig,
- const std::map<uint32_t, ControlInfoMap> &entityControls)
+int IPARkISP1::configure([[maybe_unused]] const CameraSensorInfo &info,
+ [[maybe_unused]] const std::map<uint32_t, IPAStream> &streamConfig,
+ const std::map<uint32_t, ControlInfoMap> &entityControls)
{
if (entityControls.empty())
- return;
+ return -EINVAL;
ctrls_ = entityControls.at(0);
const auto itExp = ctrls_.find(V4L2_CID_EXPOSURE);
if (itExp == ctrls_.end()) {
LOG(IPARkISP1, Error) << "Can't find exposure control";
- return;
+ return -EINVAL;
}
const auto itGain = ctrls_.find(V4L2_CID_ANALOGUE_GAIN);
if (itGain == ctrls_.end()) {
LOG(IPARkISP1, Error) << "Can't find gain control";
- return;
+ return -EINVAL;
}
autoExposure_ = true;
@@ -111,6 +111,7 @@ void IPARkISP1::configure([[maybe_unused]] const CameraSensorInfo &info,
<< " Gain: " << minGain_ << "-" << maxGain_;
setControls(0);
+ return 0;
}
void IPARkISP1::mapBuffers(const std::vector<IPABuffer> &buffers)
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 538c0139..34814f62 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -653,8 +653,11 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
std::map<uint32_t, ControlInfoMap> entityControls;
entityControls.emplace(0, data->sensor_->controls());
- data->ipa_->configure(sensorInfo, streamConfig, entityControls);
-
+ ret = data->ipa_->configure(sensorInfo, streamConfig, entityControls);
+ if (ret) {
+ LOG(RkISP1, Error) << "failed configuring IPA (" << ret << ")";
+ return ret;
+ }
return 0;
}