[{"id":26709,"web_url":"https://patchwork.libcamera.org/comment/26709/","msgid":"<CAHW6GYJfFai5xd71+pY71UqJM-Hb_CbH_oBFD-9=i6yjjSAFJA@mail.gmail.com>","date":"2023-03-22T13:54:40","subject":"Re: [libcamera-devel] [PATCH v1 01/10] ipa: raspberrypi Store the\n\ttarget string in the controller","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for the patch!\n\nOn Wed, 22 Mar 2023 at 13:06, Naushir Patuck via libcamera-devel\n<libcamera-devel@lists.libcamera.org> wrote:\n>\n> The target string may be used by algorithms to determine the running\n> hardware target.\n>\n> Store the target string provided by the camera tuning files in the\n> controller state. Add a getTarget() member function to retrieve this\n> string.\n>\n> Validate the correct hardware target (\"bcm2835\") during the IPA\n> initialisation phase.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nLGTM.\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks!\nDavid\n\n> ---\n>  src/ipa/raspberrypi/controller/algorithm.h    | 4 ++++\n>  src/ipa/raspberrypi/controller/controller.cpp | 6 ++++++\n>  src/ipa/raspberrypi/controller/controller.h   | 4 ++++\n>  src/ipa/raspberrypi/raspberrypi.cpp           | 8 ++++++++\n>  4 files changed, 22 insertions(+)\n>\n> diff --git a/src/ipa/raspberrypi/controller/algorithm.h b/src/ipa/raspberrypi/controller/algorithm.h\n> index 4f3275987305..7c22fbe4945c 100644\n> --- a/src/ipa/raspberrypi/controller/algorithm.h\n> +++ b/src/ipa/raspberrypi/controller/algorithm.h\n> @@ -41,6 +41,10 @@ public:\n>         {\n>                 return controller_->getGlobalMetadata();\n>         }\n> +       const std::string &getTarget() const\n> +       {\n> +               return controller_->getTarget();\n> +       }\n>\n>  private:\n>         Controller *controller_;\n> diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp\n> index e91567852d00..a6250ee140b0 100644\n> --- a/src/ipa/raspberrypi/controller/controller.cpp\n> +++ b/src/ipa/raspberrypi/controller/controller.cpp\n> @@ -38,6 +38,7 @@ int Controller::read(char const *filename)\n>\n>         std::unique_ptr<YamlObject> root = YamlParser::parse(file);\n>         double version = (*root)[\"version\"].get<double>(1.0);\n> +       target_ = (*root)[\"target\"].get<std::string>(\"bcm2835\");\n>\n>         if (version < 2.0) {\n>                 LOG(RPiController, Warning)\n> @@ -142,3 +143,8 @@ Algorithm *Controller::getAlgorithm(std::string const &name) const\n>         }\n>         return nullptr;\n>  }\n> +\n> +const std::string &Controller::getTarget() const\n> +{\n> +       return target_;\n> +}\n> diff --git a/src/ipa/raspberrypi/controller/controller.h b/src/ipa/raspberrypi/controller/controller.h\n> index e6c950c3a509..24e02903d438 100644\n> --- a/src/ipa/raspberrypi/controller/controller.h\n> +++ b/src/ipa/raspberrypi/controller/controller.h\n> @@ -46,6 +46,7 @@ public:\n>         void process(StatisticsPtr stats, Metadata *imageMetadata);\n>         Metadata &getGlobalMetadata();\n>         Algorithm *getAlgorithm(std::string const &name) const;\n> +       const std::string &getTarget() const;\n>\n>  protected:\n>         int createAlgorithm(const std::string &name, const libcamera::YamlObject &params);\n> @@ -53,6 +54,9 @@ protected:\n>         Metadata globalMetadata_;\n>         std::vector<AlgorithmPtr> algorithms_;\n>         bool switchModeCalled_;\n> +\n> +private:\n> +       std::string target_;\n>  };\n>\n>  } /* namespace RPiController */\n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> index 1375795568e2..86359538cf67 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -269,6 +269,14 @@ int IPARPi::init(const IPASettings &settings, bool lensPresent, IPAInitResult *r\n>                 return ret;\n>         }\n>\n> +       const std::string &target = controller_.getTarget();\n> +       if (target != \"bcm2835\") {\n> +               LOG(IPARPI, Error)\n> +                       << \"Tuning data file target returned \\\"\" << target << \"\\\"\"\n> +                       << \", expected \\\"bcm2835\\\"\";\n> +               return -EINVAL;\n> +       }\n> +\n>         lensPresent_ = lensPresent;\n>\n>         controller_.initialise();\n> --\n> 2.34.1\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 B2655C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Mar 2023 13:54:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 05080626E5;\n\tWed, 22 Mar 2023 14:54:54 +0100 (CET)","from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com\n\t[IPv6:2001:4860:4864:20::2e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B937B61ECE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Mar 2023 14:54:52 +0100 (CET)","by mail-oa1-x2e.google.com with SMTP id\n\t586e51a60fabf-17786581fe1so19454023fac.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Mar 2023 06:54:52 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679493294;\n\tbh=Jns2e/Ot3Xq66uzhg4ER/O63bgyan8Qpt9hUHPG3wL4=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Cs55fE1G0yvx8Pa/kBakQWgMjzS5zd3mZR+JET4mHAHme7ADTF2KHN9LjBfQqmdTW\n\tJYST9K66p1W4HD0j4K/BoblRc4Qm/DwBjpJcgSGD2gHvPKrwp2BkV9lc9PjjrCo0+s\n\t3poPd0Jc2nDGlJbKLygvUeHvRdqZnTPoQrwcL4vwg9uXLbHdSVoFmamFlcA1eke7nm\n\tMO6ABK36ihE53c8oU5Gxe2nqdOAKZjVFqb5S73NAokKNvknXHz3cUAdAjnLkFNDAWi\n\thsadssMXPxU6BaNln0dDpHVkLSbh5rK/VLKldvPWsl2gsro8IT/GDw12NqNSE/reuL\n\tMurU0de+K4ROA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1679493291;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=NWsawK8tjijz2CiFTbWPm7qLoE/RUGxhFQibUB8ahwo=;\n\tb=o+rWAYFIkPgvGQ7CfLnYUkXrg/FKhswxQt2z52aYyCex+f3CndvEmhxye1uvpKVwfM\n\tR6ede4jNCqFv4K6Xmz/P9PlnGkm9gAhZSIeAF2BQTNsx9MwFxwHFspKQBXyTcVuoi1Vj\n\tEHJHQkK/UUJZ80mlEnrvZxWIaUdI5SYf5TfpPxupWjVJs/soOK21XQyQKwyFbZmAC4+Y\n\tZ2pOu3hcROY1imTUlHnbROpt6j/kL3YeHSmShWTpOr8g9mnaN8ov0mdGgm/9gHqg9uTZ\n\tFAI9iJY0UXDm7PjH13CSqxQZige02f+G/VDdnzkp/y05y6RJlclGEar9DL7V2iTELKIe\n\tfkaQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"o+rWAYFI\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679493291;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=NWsawK8tjijz2CiFTbWPm7qLoE/RUGxhFQibUB8ahwo=;\n\tb=5T+5Lx7QauvR0hmWNoSyWsbgVG1HGmDf+SzpPPecXu0Ig44OzA7R2E0j7tI8bxwGle\n\tyaWhUGBikzWRPuNwK89x/Wg5Tl/rlicLEc2M49wCJfgk8KL9djUsBsaC2NYaNqSm1Zjf\n\t98UBXqCBi24u+5c90YUqtkwtKDw+ysOHxiHD+DvmwTA7BwlCS+IEBRGYu74VmVDyhiL5\n\tpXe92o/mRFVwTHJl/3o3+zwTvidQAbjQO15tXlsy6aAoRWgwiDO84zWMxficO42Xfwhr\n\tAjEQvB4NCh9kQB8yMmzEbLtspQ953MNhg988jzfdNTKbfVjpE6R20ojN4m8Muz6hebU2\n\tk9WQ==","X-Gm-Message-State":"AO0yUKUgIs12hf5w9V9UPtN/tPF/oCxHsIey+sLfC8xDLAziN3PzSlzr\n\tZhc9aSDKrw9WI6sKVUdi787qa7TUibm/CkzALWCPOEUveLqDTaVv4xA=","X-Google-Smtp-Source":"AK7set8uTQ+OScm7xpIQB7DuiB4wZBPSVQXDZp2+IO3I1ifQ4GHhsTPENvhp3rn3wWShq3AMOSyZb6sd8x3GwMbCVpg=","X-Received":"by 2002:a05:6870:1314:b0:177:a8c9:9028 with SMTP id\n\t20-20020a056870131400b00177a8c99028mr1018858oab.11.1679493291429;\n\tWed, 22 Mar 2023 06:54:51 -0700 (PDT)","MIME-Version":"1.0","References":"<20230322130612.5208-1-naush@raspberrypi.com>\n\t<20230322130612.5208-2-naush@raspberrypi.com>","In-Reply-To":"<20230322130612.5208-2-naush@raspberrypi.com>","Date":"Wed, 22 Mar 2023 13:54:40 +0000","Message-ID":"<CAHW6GYJfFai5xd71+pY71UqJM-Hb_CbH_oBFD-9=i6yjjSAFJA@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v1 01/10] ipa: raspberrypi Store the\n\ttarget string in the controller","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":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26717,"web_url":"https://patchwork.libcamera.org/comment/26717/","msgid":"<20230323160128.pltnsqbqxmpd65rl@uno.localdomain>","date":"2023-03-23T16:01:28","subject":"Re: [libcamera-devel] [PATCH v1 01/10] ipa: raspberrypi Store the\n\ttarget string in the controller","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Naush\n\nOn Wed, Mar 22, 2023 at 01:06:03PM +0000, Naushir Patuck via libcamera-devel wrote:\n> The target string may be used by algorithms to determine the running\n> hardware target.\n>\n> Store the target string provided by the camera tuning files in the\n> controller state. Add a getTarget() member function to retrieve this\n> string.\n>\n> Validate the correct hardware target (\"bcm2835\") during the IPA\n> initialisation phase.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/ipa/raspberrypi/controller/algorithm.h    | 4 ++++\n>  src/ipa/raspberrypi/controller/controller.cpp | 6 ++++++\n>  src/ipa/raspberrypi/controller/controller.h   | 4 ++++\n>  src/ipa/raspberrypi/raspberrypi.cpp           | 8 ++++++++\n>  4 files changed, 22 insertions(+)\n>\n> diff --git a/src/ipa/raspberrypi/controller/algorithm.h b/src/ipa/raspberrypi/controller/algorithm.h\n> index 4f3275987305..7c22fbe4945c 100644\n> --- a/src/ipa/raspberrypi/controller/algorithm.h\n> +++ b/src/ipa/raspberrypi/controller/algorithm.h\n> @@ -41,6 +41,10 @@ public:\n>  \t{\n>  \t\treturn controller_->getGlobalMetadata();\n>  \t}\n> +\tconst std::string &getTarget() const\n> +\t{\n> +\t\treturn controller_->getTarget();\n> +\t}\n\nIs this used ? Maybe in the next patches...\n\nOtherwise\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n   j\n\n>\n>  private:\n>  \tController *controller_;\n> diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp\n> index e91567852d00..a6250ee140b0 100644\n> --- a/src/ipa/raspberrypi/controller/controller.cpp\n> +++ b/src/ipa/raspberrypi/controller/controller.cpp\n> @@ -38,6 +38,7 @@ int Controller::read(char const *filename)\n>\n>  \tstd::unique_ptr<YamlObject> root = YamlParser::parse(file);\n>  \tdouble version = (*root)[\"version\"].get<double>(1.0);\n> +\ttarget_ = (*root)[\"target\"].get<std::string>(\"bcm2835\");\n>\n>  \tif (version < 2.0) {\n>  \t\tLOG(RPiController, Warning)\n> @@ -142,3 +143,8 @@ Algorithm *Controller::getAlgorithm(std::string const &name) const\n>  \t}\n>  \treturn nullptr;\n>  }\n> +\n> +const std::string &Controller::getTarget() const\n> +{\n> +\treturn target_;\n> +}\n> diff --git a/src/ipa/raspberrypi/controller/controller.h b/src/ipa/raspberrypi/controller/controller.h\n> index e6c950c3a509..24e02903d438 100644\n> --- a/src/ipa/raspberrypi/controller/controller.h\n> +++ b/src/ipa/raspberrypi/controller/controller.h\n> @@ -46,6 +46,7 @@ public:\n>  \tvoid process(StatisticsPtr stats, Metadata *imageMetadata);\n>  \tMetadata &getGlobalMetadata();\n>  \tAlgorithm *getAlgorithm(std::string const &name) const;\n> +\tconst std::string &getTarget() const;\n>\n>  protected:\n>  \tint createAlgorithm(const std::string &name, const libcamera::YamlObject &params);\n> @@ -53,6 +54,9 @@ protected:\n>  \tMetadata globalMetadata_;\n>  \tstd::vector<AlgorithmPtr> algorithms_;\n>  \tbool switchModeCalled_;\n> +\n> +private:\n> +\tstd::string target_;\n>  };\n>\n>  } /* namespace RPiController */\n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> index 1375795568e2..86359538cf67 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -269,6 +269,14 @@ int IPARPi::init(const IPASettings &settings, bool lensPresent, IPAInitResult *r\n>  \t\treturn ret;\n>  \t}\n>\n> +\tconst std::string &target = controller_.getTarget();\n> +\tif (target != \"bcm2835\") {\n> +\t\tLOG(IPARPI, Error)\n> +\t\t\t<< \"Tuning data file target returned \\\"\" << target << \"\\\"\"\n> +\t\t\t<< \", expected \\\"bcm2835\\\"\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n>  \tlensPresent_ = lensPresent;\n>\n>  \tcontroller_.initialise();\n> --\n> 2.34.1\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 61784C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Mar 2023 16:01:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A7FF76270D;\n\tThu, 23 Mar 2023 17:01:33 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3637A626DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Mar 2023 17:01:32 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9F2E09A8;\n\tThu, 23 Mar 2023 17:01:31 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679587293;\n\tbh=psQMQffw9X45CG1EwcDgps0E7I4EPBpmawsJoqn4Vvc=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=eIawnHHcdoYft6YPg2mPzE2oQpor7PVOhGRdnhXjIBhISnNwZhL8LA4QXiz82Txjq\n\t/LOpC+SpS+cn4EbWHYoL6uHSydqBUj7R/GwGTtIb2d63gSjKvPVgWXZuwEvXEsaLDj\n\tFdTz13y3l0tJA3CEoykeLRXO7vfQOBVWPAtQeAG7qquQhuZloicC41W9vU+4H+msMN\n\tsS5DB9xdkra/vMHuj0PrSligQzCcBahJYYDU8WzZNVb7THFkK4hXUaGiJMHRb94nav\n\tB8lYjnzch1CXWbYkgunCEEQoVujIkA783SWzL7w+iO/ZPmEAKTHxb3TAtcTfgtDBZY\n\t+WIlE3bToxBmQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1679587291;\n\tbh=psQMQffw9X45CG1EwcDgps0E7I4EPBpmawsJoqn4Vvc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=N21xYTshSpG3Sz3gz2MqCpUTYsHiE/PpyWFNaaTSdwC8bpwim4RdLXOnyDA3zOZ5/\n\tFfFmRkrlBpYIC5aUbH1cPNq3rCQH2khsMuyKLGdFNVbMIanfuqpkia45odA1/mpUNl\n\t4kd+3ScUJ4d45TKusglNoVyyulejknsEWhUsPrmg="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"N21xYTsh\"; dkim-atps=neutral","Date":"Thu, 23 Mar 2023 17:01:28 +0100","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<20230323160128.pltnsqbqxmpd65rl@uno.localdomain>","References":"<20230322130612.5208-1-naush@raspberrypi.com>\n\t<20230322130612.5208-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230322130612.5208-2-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v1 01/10] ipa: raspberrypi Store the\n\ttarget string in the controller","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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]