[{"id":26791,"web_url":"https://patchwork.libcamera.org/comment/26791/","msgid":"<168003245322.3713142.6914064574406246091@Monstersaurus>","date":"2023-03-28T19:40:53","subject":"Re: [libcamera-devel] [PATCH v2 01/10] ipa: raspberrypi Store the\n\ttarget string in the controller","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck via libcamera-devel (2023-03-27 13:20:21)\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> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\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 0B68CBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Mar 2023 19:40:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9187762740;\n\tTue, 28 Mar 2023 21:40:57 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 66FF561ECD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Mar 2023 21:40:56 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EC349AD5;\n\tTue, 28 Mar 2023 21:40:55 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1680032457;\n\tbh=8UZt1itLV1mu1ggxx1xFkJNm9NU2fV5DKHi5C+Uei10=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=qlWWOi+MrQEYPJftcZKv2vGgKsfTZlO4nFK3qiFmwRualYPiDD7wffnDypEB1CK9g\n\twr5okisEM/xFB2nOj1fNCv7HS4f8CekgArDqY0XgFxJ7issnGmOPAufBdQjJqipqlM\n\t+IgCyQ+RKmS12RD1FQYZz6SLMSIXhkvs6nGCVw//2u3HZ8AYTdfvYxE96NIl4rqd+S\n\twGlz0ydFLeM9UIbndSNvx7h6Ew63fCawDxZFNuS8tZbJGz/mc8l87C+pKEGIQhOJDc\n\tOZrgHErRLgMag35AWtKn04bId16glj3FVWS+WDEpMf9WUvihdDl8H8VMpR0Km/aeHN\n\tWx3MCZOUX2I/g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1680032456;\n\tbh=8UZt1itLV1mu1ggxx1xFkJNm9NU2fV5DKHi5C+Uei10=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=mIJocKN90et/Oqnzx4pKmMZ6AgPAIJ5cIAiaiYm9vNRD6JkywH3+W1HBibmZxwu9L\n\txegCCM/FHm5dG8e4J0WvGhzzTQUpjEysDFZbZ/Qd5kDJl6amuLwLHarKKPkWFGeXSP\n\t3WxCpxm4iO+48PeM9+EA2yixuYWeC4ehtGk38AK8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"mIJocKN9\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20230327122030.11756-2-naush@raspberrypi.com>","References":"<20230327122030.11756-1-naush@raspberrypi.com>\n\t<20230327122030.11756-2-naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 28 Mar 2023 20:40:53 +0100","Message-ID":"<168003245322.3713142.6914064574406246091@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2 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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]