Patch Detail
Show a patch.
GET /api/patches/16892/?format=api
{ "id": 16892, "url": "https://patchwork.libcamera.org/api/patches/16892/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16892/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220802001330.17073-1-laurent.pinchart@ideasonboard.com>", "date": "2022-08-02T00:13:30", "name": "[libcamera-devel] pipeline: rkisp1: Move ControlInfoMap to IPA module", "commit_ref": "961a6cf7cac9b788cc285a58ae1b8a480f00b633", "pull_url": null, "state": "accepted", "archived": false, "hash": "a3a4f7bb9eb4ee1a8847143962a2bd9efc994927", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16892/mbox/", "series": [ { "id": 3354, "url": "https://patchwork.libcamera.org/api/series/3354/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3354", "date": "2022-08-02T00:13:30", "name": "[libcamera-devel] pipeline: rkisp1: Move ControlInfoMap to IPA module", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3354/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16892/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16892/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 4A912C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 2 Aug 2022 00:13:38 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7694363312;\n\tTue, 2 Aug 2022 02:13:37 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 832AF61FAE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 2 Aug 2022 02:13:35 +0200 (CEST)", "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C624D25B;\n\tTue, 2 Aug 2022 02:13:34 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659399217;\n\tbh=pTlqja1EK/d7Tx2BNyPYNEqqEp8tjkAwmKc8tVVLl5A=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=OyGqwRRKGF0w8z4OggQaHjEDDVAe/pF7v2niNZuma7+aaaXUz2th2NCq0t3pzu+dL\n\tEIlZBcuGYs+EM/uv82sXYp7E0J8Uca/TgBx6AUV26uTGflJmlGUSjBhEGOyySvZhZb\n\tSAl+PxP4oWwyXrDySlQk0Li6sSJ63uvdw+eJl9Sbm6M3G25y2whxicL6oCxJjajNBc\n\t3efBgP296tRZr08pGJOiCEZk1QkkK3/tThJbkCWCnvLA/gPjZcIv7Y2ujMGxk0oe2I\n\tUBjTkGlYJwKL309KKiFGbv59kVvNCUWp1+TFz038U0gd9OfQ2FpDeT8683Hhhf6nM+\n\t2T+6MeCToYR+Q==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659399215;\n\tbh=pTlqja1EK/d7Tx2BNyPYNEqqEp8tjkAwmKc8tVVLl5A=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=lsK5+dZjveg279Lp5R9Ed39UKAVIqLi+NglNCgaOb6uKDG7WpDZ0aSjO/lds+aJY5\n\tTDBYpKwvaslNGYgVACcd9n2pVoni6Tlm7p+drHwYoyFhoRlhzZXk3QFV45fepw5eaF\n\tdIYtlc+ci3mYK99vr4rIdiYPJ+hED+m/FtJrXSTw=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"lsK5+dZj\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 2 Aug 2022 03:13:30 +0300", "Message-Id": "<20220802001330.17073-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] pipeline: rkisp1: Move ControlInfoMap to\n\tIPA module", "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>", "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Currently the pipeline handler advertises controls handled by the IPA\nfrom a ControlInfoMap it manually constructs. This is wrong, as the IPA\nmodule is the component that knows what controls it supports. Fix this\nby moving the ControlInfoMap construction to the IPA module, and pass it\nto the pipeline handler as a return value from the IPA init() function.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/ipa/rkisp1.mojom | 2 +-\n src/ipa/rkisp1/rkisp1.cpp | 30 ++++++++++++++++++++---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 31 ++----------------------\n 3 files changed, 30 insertions(+), 33 deletions(-)", "diff": "diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex e35373852b7c..eaf3955e4096 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -11,7 +11,7 @@ import \"include/libcamera/ipa/core.mojom\";\n interface IPARkISP1Interface {\n \tinit(libcamera.IPASettings settings,\n \t uint32 hwRevision)\n-\t\t=> (int32 ret);\n+\t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\n \tstart() => (int32 ret);\n \tstop();\n \ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex e5010f6ab629..52f7143980fe 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -46,7 +46,8 @@ namespace ipa::rkisp1 {\n class IPARkISP1 : public IPARkISP1Interface, public Module\n {\n public:\n-\tint init(const IPASettings &settings, unsigned int hwRevision) override;\n+\tint init(const IPASettings &settings, unsigned int hwRevision,\n+\t\t ControlInfoMap *ipaControls) override;\n \tint start() override;\n \tvoid stop() override {}\n \n@@ -89,12 +90,27 @@ private:\n \tstruct IPAContext context_;\n };\n \n+namespace {\n+\n+/* List of controls handled by the RkISP1 IPA */\n+const ControlInfoMap::Map rkisp1Controls{\n+\t{ &controls::AeEnable, ControlInfo(false, true) },\n+\t{ &controls::Brightness, ControlInfo(-1.0f, 0.993f) },\n+\t{ &controls::Contrast, ControlInfo(0.0f, 1.993f) },\n+\t{ &controls::Saturation, ControlInfo(0.0f, 1.993f) },\n+\t{ &controls::Sharpness, ControlInfo(0.0f, 10.0f, 1.0f) },\n+\t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },\n+};\n+\n+} /* namespace */\n+\n std::string IPARkISP1::logPrefix() const\n {\n \treturn \"rkisp1\";\n }\n \n-int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n+int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n+\t\t ControlInfoMap *ipaControls)\n {\n \t/* \\todo Add support for other revisions */\n \tswitch (hwRevision) {\n@@ -156,7 +172,15 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n \t\treturn -EINVAL;\n \t}\n \n-\treturn createAlgorithms(context_, (*data)[\"algorithms\"]);\n+\tint ret = createAlgorithms(context_, (*data)[\"algorithms\"]);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Return the controls handled by the IPA. */\n+\tControlInfoMap::Map ctrlMap = rkisp1Controls;\n+\t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);\n+\n+\treturn 0;\n }\n \n int IPARkISP1::start()\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex de687f4dc6b0..932873329e89 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -344,7 +344,8 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n \t\tipaTuningFile = std::string(configFromEnv);\n \t}\n \n-\tint ret = ipa_->init({ ipaTuningFile, sensor_->model() }, hwRevision);\n+\tint ret = ipa_->init({ ipaTuningFile, sensor_->model() }, hwRevision,\n+\t\t\t &controlInfo_);\n \tif (ret < 0) {\n \t\tLOG(RkISP1, Error) << \"IPA initialization failure\";\n \t\treturn ret;\n@@ -967,34 +968,6 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n \t\tstd::make_unique<RkISP1CameraData>(this, &mainPath_,\n \t\t\t\t\t\t hasSelfPath_ ? &selfPath_ : nullptr);\n \n-\tControlInfoMap::Map ctrls;\n-\tctrls.emplace(std::piecewise_construct,\n-\t\t std::forward_as_tuple(&controls::Sharpness),\n-\t\t std::forward_as_tuple(0.0f, 10.0f, 1.0f));\n-\n-\tctrls.emplace(std::piecewise_construct,\n-\t\t std::forward_as_tuple(&controls::Brightness),\n-\t\t std::forward_as_tuple(-1.0f, 0.993f));\n-\n-\tctrls.emplace(std::piecewise_construct,\n-\t\t std::forward_as_tuple(&controls::Contrast),\n-\t\t std::forward_as_tuple(0.0f, 1.993f));\n-\n-\tctrls.emplace(std::piecewise_construct,\n-\t\t std::forward_as_tuple(&controls::Saturation),\n-\t\t std::forward_as_tuple(0.0f, 1.993f));\n-\n-\tctrls.emplace(std::piecewise_construct,\n-\t\t std::forward_as_tuple(&controls::draft::NoiseReductionMode),\n-\t\t std::forward_as_tuple(controls::draft::NoiseReductionModeValues));\n-\n-\tctrls.emplace(std::piecewise_construct,\n-\t\t std::forward_as_tuple(&controls::AeEnable),\n-\t\t std::forward_as_tuple(false, true));\n-\n-\tdata->controlInfo_ = ControlInfoMap(std::move(ctrls),\n-\t\t\t\t\t controls::controls);\n-\n \tdata->sensor_ = std::make_unique<CameraSensor>(sensor);\n \tret = data->sensor_->init();\n \tif (ret)\n", "prefixes": [ "libcamera-devel" ] }