From patchwork Tue Feb 16 12:26:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11313 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5873EBD1F1 for ; Tue, 16 Feb 2021 12:26:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 35F5B637F0; Tue, 16 Feb 2021 13:26:40 +0100 (CET) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 20568637EA for ; Tue, 16 Feb 2021 13:26:38 +0100 (CET) Received: from guri.fritz.box (unknown [IPv6:2a02:810a:880:f54:806:ee8a:d491:814b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dafna) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 6ADDC1F453AD; Tue, 16 Feb 2021 12:26:37 +0000 (GMT) From: Dafna Hirschfeld To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Feb 2021 13:26:23 +0100 Message-Id: <20210216122624.27940-3-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216122624.27940-1-dafna.hirschfeld@collabora.com> References: <20210216122624.27940-1-dafna.hirschfeld@collabora.com> Subject: [libcamera-devel] [PATCH 2/3] src: rkisp1: return error from ipa's configure method if it fails X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, kernel@collabora.com MIME-Version: 1.0 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The IPA of rkisp1 relay some of the camera's controls. Therefore it can't work if those controls don't exist. Return a negative int in that case. Also return error from the 'configure' method of the pipeline handler if the IPA configure fails. Signed-off-by: Dafna Hirschfeld Reviewed-by: Paul Elder --- include/libcamera/ipa/rkisp1.mojom | 2 +- src/ipa/rkisp1/rkisp1.cpp | 11 ++++++----- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 7 +++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom index 9270f9c7..95fa0d93 100644 --- a/include/libcamera/ipa/rkisp1.mojom +++ b/include/libcamera/ipa/rkisp1.mojom @@ -31,7 +31,7 @@ interface IPARkISP1Interface { configure(CameraSensorInfo sensorInfo, map streamConfig, - map entityControls) => (); + map entityControls) => (int32 ret); mapBuffers(array buffers); unmapBuffers(array ids); diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 67bac986..b0641faf 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -38,7 +38,7 @@ public: int start() override { return 0; } void stop() override {} - void configure(const CameraSensorInfo &info, + int configure(const CameraSensorInfo &info, const std::map &streamConfig, const std::map &entityControls) override; void mapBuffers(const std::vector &buffers) 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, +int IPARkISP1::configure([[maybe_unused]] const CameraSensorInfo &info, [[maybe_unused]] const std::map &streamConfig, const std::map &entityControls) { if (entityControls.empty()) - return; + return -1; 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 -1; } const auto itGain = ctrls_.find(V4L2_CID_ANALOGUE_GAIN); if (itGain == ctrls_.end()) { LOG(IPARkISP1, Error) << "Can't find gain control"; - return; + return -1; } 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 &buffers) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 1dd878fc..dad8e5d4 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 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; }