[{"id":17513,"web_url":"https://patchwork.libcamera.org/comment/17513/","msgid":"<01a2757a-a156-d0c5-1ef7-61f535d52f7b@ideasonboard.com>","date":"2021-06-11T10:06:42","subject":"Re: [libcamera-devel] [PATCH v3 2/2] ipa: ipu3: Initialize\n\tCameraSensorHelper at IPU3 init stage","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi JM,\n\nOn 11/06/2021 08:03, Jean-Michel Hautbois wrote:\n> In order for the CameraSensorHelper to be instantianted, we need to find\n\ns/instantianted/instantiated/\n\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 | 17 +++++++++++++----\n>  1 file changed, 13 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 415ea9e5..4871fe97 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,15 @@ 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, Fatal) << \"You shall have a camera sensor helper for the \"\n> +\t\t\t\t    << settings.sensorModel << \" sensor.\";\n\nThat's quite demanding ;-) rather than reporting what failed.\n\nPerhaps\n  \"Failed to create camera sensor helper for \" << settings.sensorModel;\n\nAnd it should return a failure code (even if Fatal).\n\nActually, If you return an error code, you shouldn't need to make this a\nfatal print.\n\nUsing Fatal here might not do what we expect, as if the IPA is isolated,\nit will close the IPA process, but not the libcamera process, and in the\nisolated case - it would be harder to see that error print.\n\n--\nKieran\n\n\n\n> +\treturn 0;\n> +}\n> +\n>  int IPAIPU3::start()\n>  {\n>  \tsetControls(0);\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 26EEEC320B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Jun 2021 10:06:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 93C9C6892B;\n\tFri, 11 Jun 2021 12:06:47 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1463E68928\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Jun 2021 12:06:46 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 968C34AD;\n\tFri, 11 Jun 2021 12:06:45 +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=\"WTSbFJ+e\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623406005;\n\tbh=zTPc4vNkuenHE7vApZ4V9RTCGEU/KaZRGIX9KpKcFSM=;\n\th=Reply-To:To:References:From:Subject:Date:In-Reply-To:From;\n\tb=WTSbFJ+eZSeruz7upyBMAyqxZOSYSs4ACf6hWEAma+/RVSsZRauLjwrDuCt5GC62d\n\toEVQCFy2aCgjf8JjKtf8WTfibSL++e1gKCNbqc5HFIZsiKaWDQaHiJdcYkir8/9NLE\n\tAGIp0eZkYfPh3aHDevh5fVgVgBIbLmO1QgZBDrPo=","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210611070311.12080-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210611070311.12080-3-jeanmichel.hautbois@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Organization":"Ideas on Board","Message-ID":"<01a2757a-a156-d0c5-1ef7-61f535d52f7b@ideasonboard.com>","Date":"Fri, 11 Jun 2021 11:06:42 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.8.1","MIME-Version":"1.0","In-Reply-To":"<20210611070311.12080-3-jeanmichel.hautbois@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH v3 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>","Reply-To":"kieran.bingham@ideasonboard.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]