[{"id":31030,"web_url":"https://patchwork.libcamera.org/comment/31030/","msgid":"<20240901201834.GC7282@pendragon.ideasonboard.com>","date":"2024-09-01T20:18:34","subject":"Re: [PATCH v5 09/18] libcamera: software_isp: Call\n\tAlgorithm::configure","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Milan,\n\nThank you for the patch.\n\nOn Fri, Aug 30, 2024 at 09:25:45AM +0200, Milan Zamazal wrote:\n> This patch adds Algorithm::configure call for the defined algorithms.\n> This is preparation only since there are currently no Algorithm based\n> algorithms defined.\n> \n> A part of this change is passing IPAConfigInfo instead of ControlInfoMap\n> to configure() calls as this is what Algorithm::configure expects.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>  .../libcamera/internal/software_isp/software_isp.h   |  2 +-\n>  include/libcamera/ipa/soft.mojom                     |  2 +-\n>  src/ipa/simple/module.h                              |  2 ++\n>  src/ipa/simple/soft_simple.cpp                       | 12 +++++++++---\n>  src/libcamera/pipeline/simple/simple.cpp             | 11 +++++++----\n>  src/libcamera/software_isp/software_isp.cpp          |  7 ++++---\n>  6 files changed, 24 insertions(+), 12 deletions(-)\n> \n> diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\n> index 3a84418e..c5d5a46f 100644\n> --- a/include/libcamera/internal/software_isp/software_isp.h\n> +++ b/include/libcamera/internal/software_isp/software_isp.h\n> @@ -62,7 +62,7 @@ public:\n>  \n>  \tint configure(const StreamConfiguration &inputCfg,\n>  \t\t      const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs,\n> -\t\t      const ControlInfoMap &sensorControls);\n> +\t\t      const ipa::soft::IPAConfigInfo &configInfo);\n>  \n>  \tint exportBuffers(const Stream *stream, unsigned int count,\n>  \t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n> diff --git a/include/libcamera/ipa/soft.mojom b/include/libcamera/ipa/soft.mojom\n> index cc5c37b2..6b049d20 100644\n> --- a/include/libcamera/ipa/soft.mojom\n> +++ b/include/libcamera/ipa/soft.mojom\n> @@ -20,7 +20,7 @@ interface IPASoftInterface {\n>  \t\t=> (int32 ret);\n>  \tstart() => (int32 ret);\n>  \tstop();\n> -\tconfigure(libcamera.ControlInfoMap sensorCtrlInfoMap)\n> +\tconfigure(IPAConfigInfo configInfo)\n>  \t\t=> (int32 ret);\n>  \n>  \t[async] processStats(uint32 frame,\n> diff --git a/src/ipa/simple/module.h b/src/ipa/simple/module.h\n> index 5aaf8eb0..d1321f59 100644\n> --- a/src/ipa/simple/module.h\n> +++ b/src/ipa/simple/module.h\n> @@ -9,6 +9,8 @@\n>  \n>  #include <libcamera/controls.h>\n>  \n> +#include <libcamera/ipa/soft_ipa_interface.h>\n\nDoes this belong to 03/18 ? Actually, in that patch, you add\n\n#include \"soft_ipa_interface.h\"\n\nwhich I think should be dropped as it refers to\nlibcamera/ipa/soft_ipa_interface.h. With that,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n>  #include \"libcamera/internal/software_isp/debayer_params.h\"\n>  #include \"libcamera/internal/software_isp/swisp_stats.h\"\n>  \n> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\n> index 79ed4891..0ea62266 100644\n> --- a/src/ipa/simple/soft_simple.cpp\n> +++ b/src/ipa/simple/soft_simple.cpp\n> @@ -73,7 +73,7 @@ public:\n>  \t\t const SharedFD &fdStats,\n>  \t\t const SharedFD &fdParams,\n>  \t\t const ControlInfoMap &sensorInfoMap) override;\n> -\tint configure(const ControlInfoMap &sensorInfoMap) override;\n> +\tint configure(const IPAConfigInfo &configInfo) override;\n>  \n>  \tint start() override;\n>  \tvoid stop() override;\n> @@ -207,9 +207,9 @@ int IPASoftSimple::init(const IPASettings &settings,\n>  \treturn 0;\n>  }\n>  \n> -int IPASoftSimple::configure(const ControlInfoMap &sensorInfoMap)\n> +int IPASoftSimple::configure(const IPAConfigInfo &configInfo)\n>  {\n> -\tsensorInfoMap_ = sensorInfoMap;\n> +\tsensorInfoMap_ = configInfo.sensorControls;\n>  \n>  \tconst ControlInfo &exposureInfo = sensorInfoMap_.find(V4L2_CID_EXPOSURE)->second;\n>  \tconst ControlInfo &gainInfo = sensorInfoMap_.find(V4L2_CID_ANALOGUE_GAIN)->second;\n> @@ -248,6 +248,12 @@ int IPASoftSimple::configure(const ControlInfoMap &sensorInfoMap)\n>  \t\tagainMinStep_ = 1.0;\n>  \t}\n>  \n> +\tfor (auto const &algo : algorithms()) {\n> +\t\tint ret = algo->configure(context_, configInfo);\n> +\t\tif (ret)\n> +\t\t\treturn ret;\n> +\t}\n> +\n>  \tLOG(IPASoft, Info) << \"Exposure \" << exposureMin_ << \"-\" << exposureMax_\n>  \t\t\t   << \", gain \" << againMin_ << \"-\" << againMax_\n>  \t\t\t   << \" (\" << againMinStep_ << \")\";\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index ebec592a..834b33d9 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -1294,10 +1294,13 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n>  \tinputCfg.stride = captureFormat.planes[0].bpl;\n>  \tinputCfg.bufferCount = kNumInternalBuffers;\n>  \n> -\treturn data->converter_\n> -\t\t       ? data->converter_->configure(inputCfg, outputCfgs)\n> -\t\t       : data->swIsp_->configure(inputCfg, outputCfgs,\n> -\t\t\t\t\t\t data->sensor_->controls());\n> +\tif (data->converter_) {\n> +\t\treturn data->converter_->configure(inputCfg, outputCfgs);\n> +\t} else {\n> +\t\tipa::soft::IPAConfigInfo configInfo;\n> +\t\tconfigInfo.sensorControls = data->sensor_->controls();\n> +\t\treturn data->swIsp_->configure(inputCfg, outputCfgs, configInfo);\n> +\t}\n>  }\n>  \n>  int SimplePipelineHandler::exportFrameBuffers(Camera *camera, Stream *stream,\n> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> index c5db45ae..8f1c0f65 100644\n> --- a/src/libcamera/software_isp/software_isp.cpp\n> +++ b/src/libcamera/software_isp/software_isp.cpp\n> @@ -223,16 +223,17 @@ SoftwareIsp::strideAndFrameSize(const PixelFormat &outputFormat, const Size &siz\n>   * \\brief Configure the SoftwareIsp object according to the passed in parameters\n>   * \\param[in] inputCfg The input configuration\n>   * \\param[in] outputCfgs The output configurations\n> - * \\param[in] sensorControls ControlInfoMap of the controls supported by the sensor\n> + * \\param[in] configInfo The IPA configuration data, received from the pipeline\n> + * handler\n>   * \\return 0 on success, a negative errno on failure\n>   */\n>  int SoftwareIsp::configure(const StreamConfiguration &inputCfg,\n>  \t\t\t   const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs,\n> -\t\t\t   const ControlInfoMap &sensorControls)\n> +\t\t\t   const ipa::soft::IPAConfigInfo &configInfo)\n>  {\n>  \tASSERT(ipa_ && debayer_);\n>  \n> -\tint ret = ipa_->configure(sensorControls);\n> +\tint ret = ipa_->configure(configInfo);\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>","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 9394FC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  1 Sep 2024 20:19:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BB7F6634C8;\n\tSun,  1 Sep 2024 22:19:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A0AD63466\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  1 Sep 2024 22:19:07 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1407F51B;\n\tSun,  1 Sep 2024 22:17:55 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"sXXKZKV7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1725221876;\n\tbh=grE3jCcQnZK2KIFjKoZCMrLX+eONueO/ps1RfkrZWoI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=sXXKZKV7FpJ49p4B2lhjUSl2LAN4mnaky13+EdddbrcOgyXR2PhAffvovnXCJwLhL\n\tDf4sTgxR36agnmT8hOEFZLa8+KAqgm7q4xIHaJ+sQWvGGOL+elKUL1m1D+HgbrzFL8\n\tzMzk6b2NMsYg+jTV8KVXHBjgnkd94D6RDSGu2pnA=","Date":"Sun, 1 Sep 2024 23:18:34 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tUmang Jain <umang.jain@ideasonboard.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>","Subject":"Re: [PATCH v5 09/18] libcamera: software_isp: Call\n\tAlgorithm::configure","Message-ID":"<20240901201834.GC7282@pendragon.ideasonboard.com>","References":"<20240830072554.180672-1-mzamazal@redhat.com>\n\t<20240830072554.180672-10-mzamazal@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240830072554.180672-10-mzamazal@redhat.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]