[{"id":17616,"web_url":"https://patchwork.libcamera.org/comment/17616/","msgid":"<142e0db9-90ef-cfb9-df05-5c066a2aa802@ideasonboard.com>","date":"2021-06-17T12:21:08","subject":"Re: [libcamera-devel] [PATCH v4 2/2] ipa: ipu3: Initialize\n\tCameraSensorHelper at IPU3 init stage","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi JM,\n\nOn 6/15/21 7:05 PM, Jean-Michel Hautbois wrote:\n> In order for the CameraSensorHelper to be instantiated, we need to find\n> its factory using the camera sensor model name stored in\n> IPASettings::sensorModel. As we don't need to do it at each configure\n> call (the sensor is not changing in-between), implement the init call in\n> IPAIPU3 to do that.\n>\n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>   src/ipa/ipu3/ipu3.cpp | 18 ++++++++++++++----\n>   1 file changed, 14 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 8b4c7351..e68e9bb3 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -23,6 +23,7 @@\n>   \n>   #include \"ipu3_agc.h\"\n>   #include \"ipu3_awb.h\"\n> +#include \"libipa/camera_sensor_helper.h\"\n>   \n>   static constexpr uint32_t kMaxCellWidthPerSet = 160;\n>   static constexpr uint32_t kMaxCellHeightPerSet = 56;\n> @@ -36,10 +37,7 @@ namespace ipa::ipu3 {\n>   class IPAIPU3 : public IPAIPU3Interface\n>   {\n>   public:\n> -\tint init([[maybe_unused]] const IPASettings &settings) override\n> -\t{\n> -\t\treturn 0;\n> -\t}\n> +\tint init(const IPASettings &settings) override;\n>   \tint start() override;\n>   \tvoid stop() override {}\n>   \n> @@ -78,6 +76,8 @@ private:\n>   \tstd::unique_ptr<IPU3Awb> awbAlgo_;\n>   \t/* Interface to the AEC/AGC algorithm */\n>   \tstd::unique_ptr<IPU3Agc> agcAlgo_;\n> +\t/* Interface to the Camera Helper */\n> +\tstd::unique_ptr<CameraSensorHelper> camHelper_;\n>   \n>   \t/* Local parameter storage */\n>   \tstruct ipu3_uapi_params params_;\n> @@ -85,6 +85,16 @@ private:\n>   \tstruct ipu3_uapi_grid_config bdsGrid_;\n>   };\n>   \n> +int IPAIPU3::init(const IPASettings &settings)\n> +{\n> +\tcamHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n> +\tif (camHelper_ == nullptr) {\n> +\t\tLOG(IPAIPU3, Error) << \"Failed to create camera sensor helper for \" << settings.sensorModel;\n> +\t\treturn -1;\n\nWhen can this fail? Probably when we are missing some sensorModel's \nCameraSensorHelper class right? So in this that case, I would return:\n\n     return -EINVAL;\n\n\n> +\t}\n\nNew line here:\n\nWith that,\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> +\treturn 0;\n> +}\n> +\n>   int IPAIPU3::start()\n>   {\n>   \tsetControls(0);","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 0DDE7BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Jun 2021 12:21:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7D9116892D;\n\tThu, 17 Jun 2021 14:21:16 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 76C266050C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Jun 2021 14:21:14 +0200 (CEST)","from [192.168.0.107] (unknown [103.238.109.26])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1157DE7B;\n\tThu, 17 Jun 2021 14:21:12 +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=\"O15Ao4Yz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623932473;\n\tbh=CjznksmWCpzF2If1UKrFUMQcY2WdCz/LIBntX5s/DKg=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=O15Ao4YzVCdrIr0C5uAjjPDYsv+6AxH/DBLlGUoBGwL8/vFK6cKF5IbY18J6dViIY\n\tILnaVkqROjst9G/upTo432wA0pnhoyPxGNUVOKYs0Pdcw79uHz9mfKdQNrbo7bt7eF\n\tKh376Z0rmz0ut34WkatL0ja9ng1a6FRuKFFp9HaI=","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210615133534.29502-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210615133534.29502-3-jeanmichel.hautbois@ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<142e0db9-90ef-cfb9-df05-5c066a2aa802@ideasonboard.com>","Date":"Thu, 17 Jun 2021 17:51:08 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.10.2","MIME-Version":"1.0","In-Reply-To":"<20210615133534.29502-3-jeanmichel.hautbois@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"8bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH v4 2/2] ipa: ipu3: Initialize\n\tCameraSensorHelper at IPU3 init stage","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>"}},{"id":17624,"web_url":"https://patchwork.libcamera.org/comment/17624/","msgid":"<20210618101953.ht75hsjyr6qramtc@uno.localdomain>","date":"2021-06-18T10:19:53","subject":"Re: [libcamera-devel] [PATCH v4 2/2] ipa: ipu3: Initialize\n\tCameraSensorHelper at IPU3 init stage","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Jean-Michel\n\nOn Tue, Jun 15, 2021 at 03:35:34PM +0200, Jean-Michel Hautbois wrote:\n> In order for the CameraSensorHelper to be instantiated, we need to find\n> its factory using the camera sensor model name stored in\n> IPASettings::sensorModel. As we don't need to do it at each configure\n> call (the sensor is not changing in-between), implement the init call in\n> IPAIPU3 to do that.\n>\n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/ipu3.cpp | 18 ++++++++++++++----\n>  1 file changed, 14 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 8b4c7351..e68e9bb3 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -23,6 +23,7 @@\n>\n>  #include \"ipu3_agc.h\"\n>  #include \"ipu3_awb.h\"\n> +#include \"libipa/camera_sensor_helper.h\"\n>\n>  static constexpr uint32_t kMaxCellWidthPerSet = 160;\n>  static constexpr uint32_t kMaxCellHeightPerSet = 56;\n> @@ -36,10 +37,7 @@ namespace ipa::ipu3 {\n>  class IPAIPU3 : public IPAIPU3Interface\n>  {\n>  public:\n> -\tint init([[maybe_unused]] const IPASettings &settings) override\n> -\t{\n> -\t\treturn 0;\n> -\t}\n> +\tint init(const IPASettings &settings) override;\n>  \tint start() override;\n>  \tvoid stop() override {}\n>\n> @@ -78,6 +76,8 @@ private:\n>  \tstd::unique_ptr<IPU3Awb> awbAlgo_;\n>  \t/* Interface to the AEC/AGC algorithm */\n>  \tstd::unique_ptr<IPU3Agc> agcAlgo_;\n> +\t/* Interface to the Camera Helper */\n> +\tstd::unique_ptr<CameraSensorHelper> camHelper_;\n\nWe do not include <memory>, we should.\n\n>\n>  \t/* Local parameter storage */\n>  \tstruct ipu3_uapi_params params_;\n> @@ -85,6 +85,16 @@ private:\n>  \tstruct ipu3_uapi_grid_config bdsGrid_;\n>  };\n>\n> +int IPAIPU3::init(const IPASettings &settings)\n> +{\n> +\tcamHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n> +\tif (camHelper_ == nullptr) {\n> +\t\tLOG(IPAIPU3, Error) << \"Failed to create camera sensor helper for \" << settings.sensorModel;\n> +\t\treturn -1;\n\nMaybe use an error code ? ENODEV ?\nJust a nit\n\n> +\t}\n\nEmpty line maybe ?\n\nAll minors:\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n   j\n> +\treturn 0;\n> +}\n> +\n>  int IPAIPU3::start()\n>  {\n>  \tsetControls(0);\n> --\n> 2.30.2\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 7ABC0BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Jun 2021 10:19:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B7FFB68942;\n\tFri, 18 Jun 2021 12:19:05 +0200 (CEST)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9FFC060298\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jun 2021 12:19:04 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id 2774F24000C;\n\tFri, 18 Jun 2021 10:19:03 +0000 (UTC)"],"Date":"Fri, 18 Jun 2021 12:19:53 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<20210618101953.ht75hsjyr6qramtc@uno.localdomain>","References":"<20210615133534.29502-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210615133534.29502-3-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210615133534.29502-3-jeanmichel.hautbois@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v4 2/2] ipa: ipu3: Initialize\n\tCameraSensorHelper at IPU3 init stage","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":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]