{"id":11385,"url":"https://patchwork.libcamera.org/api/1.1/patches/11385/?format=json","web_url":"https://patchwork.libcamera.org/patch/11385/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210225171205.23341-3-dafna.hirschfeld@collabora.com>","date":"2021-02-25T17:12:04","name":"[libcamera-devel,v2,2/3] src: rkisp1: return error from ipa's configure method if it fails","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"c5d97c74208ad20b267acc0eac6dd3709650c1db","submitter":{"id":46,"url":"https://patchwork.libcamera.org/api/1.1/people/46/?format=json","name":"Dafna Hirschfeld","email":"dafna.hirschfeld@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11385/mbox/","series":[{"id":1729,"url":"https://patchwork.libcamera.org/api/1.1/series/1729/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1729","date":"2021-02-25T17:12:02","name":"rkisp1: add an initial support to different hw revision","version":2,"mbox":"https://patchwork.libcamera.org/series/1729/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11385/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11385/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 75815BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Feb 2021 17:12:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8055468A5F;\n\tThu, 25 Feb 2021 18:12:14 +0100 (CET)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 83DA468A4E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Feb 2021 18:12:13 +0100 (CET)","from guri.fritz.box\n\t(p200300c7cf1cce00c495f7eb403f1d15.dip0.t-ipconnect.de\n\t[IPv6:2003:c7:cf1c:ce00:c495:f7eb:403f:1d15])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits))\n\t(No client certificate requested) (Authenticated sender: dafna)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id 0B3AC1F46358;\n\tThu, 25 Feb 2021 17:12:13 +0000 (GMT)"],"From":"Dafna Hirschfeld <dafna.hirschfeld@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 25 Feb 2021 18:12:04 +0100","Message-Id":"<20210225171205.23341-3-dafna.hirschfeld@collabora.com>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20210225171205.23341-1-dafna.hirschfeld@collabora.com>","References":"<20210225171205.23341-1-dafna.hirschfeld@collabora.com>","Subject":"[libcamera-devel] [PATCH v2 2/3] src: rkisp1: return error from\n\tipa's configure method if it fails","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"kernel@collabora.com","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The IPA of rkisp1 relay on some of the camera's controls.\nTherefore it can't work if those controls are not given.\nReturn -EINVAL from 'configure' in that case.\nAlso return error from the pipeline's 'configure' method\nif the IPA configure fails.\n\nSigned-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n include/libcamera/ipa/rkisp1.mojom       |  2 +-\n src/ipa/rkisp1/rkisp1.cpp                | 11 ++++++-----\n src/libcamera/pipeline/rkisp1/rkisp1.cpp |  7 +++++--\n 3 files changed, 12 insertions(+), 8 deletions(-)","diff":"diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex 9270f9c7..95fa0d93 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -31,7 +31,7 @@ interface IPARkISP1Interface {\n \n \tconfigure(CameraSensorInfo sensorInfo,\n \t\t  map<uint32, IPAStream> streamConfig,\n-\t\t  map<uint32, ControlInfoMap> entityControls) => ();\n+\t\t  map<uint32, ControlInfoMap> entityControls) => (int32 ret);\n \n \tmapBuffers(array<IPABuffer> buffers);\n \tunmapBuffers(array<uint32> ids);\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 67bac986..70e8d8f7 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -38,7 +38,7 @@ public:\n \tint start() override { return 0; }\n \tvoid stop() override {}\n \n-\tvoid configure(const CameraSensorInfo &info,\n+\tint configure(const CameraSensorInfo &info,\n \t\t       const std::map<uint32_t, IPAStream> &streamConfig,\n \t\t       const std::map<uint32_t, ControlInfoMap> &entityControls) override;\n \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n@@ -75,25 +75,25 @@ private:\n  * assemble one. Make sure the reported sensor information are relevant\n  * before accessing them.\n  */\n-void IPARkISP1::configure([[maybe_unused]] const CameraSensorInfo &info,\n+int IPARkISP1::configure([[maybe_unused]] const CameraSensorInfo &info,\n \t\t\t  [[maybe_unused]] const std::map<uint32_t, IPAStream> &streamConfig,\n \t\t\t  const std::map<uint32_t, ControlInfoMap> &entityControls)\n {\n \tif (entityControls.empty())\n-\t\treturn;\n+\t\treturn -EINVAL;\n \n \tctrls_ = entityControls.at(0);\n \n \tconst auto itExp = ctrls_.find(V4L2_CID_EXPOSURE);\n \tif (itExp == ctrls_.end()) {\n \t\tLOG(IPARkISP1, Error) << \"Can't find exposure control\";\n-\t\treturn;\n+\t\treturn -EINVAL;\n \t}\n \n \tconst auto itGain = ctrls_.find(V4L2_CID_ANALOGUE_GAIN);\n \tif (itGain == ctrls_.end()) {\n \t\tLOG(IPARkISP1, Error) << \"Can't find gain control\";\n-\t\treturn;\n+\t\treturn -EINVAL;\n \t}\n \n \tautoExposure_ = true;\n@@ -111,6 +111,7 @@ void IPARkISP1::configure([[maybe_unused]] const CameraSensorInfo &info,\n \t\t<< \" Gain: \" << minGain_ << \"-\" << maxGain_;\n \n \tsetControls(0);\n+\treturn 0;\n }\n \n void IPARkISP1::mapBuffers(const std::vector<IPABuffer> &buffers)\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 538c0139..34814f62 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -653,8 +653,11 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \tstd::map<uint32_t, ControlInfoMap> entityControls;\n \tentityControls.emplace(0, data->sensor_->controls());\n \n-\tdata->ipa_->configure(sensorInfo, streamConfig, entityControls);\n-\n+\tret = data->ipa_->configure(sensorInfo, streamConfig, entityControls);\n+\tif (ret) {\n+\t\tLOG(RkISP1, Error) << \"failed configuring IPA (\" << ret << \")\";\n+\t\treturn ret;\n+\t}\n \treturn 0;\n }\n \n","prefixes":["libcamera-devel","v2","2/3"]}