{"id":18470,"url":"https://patchwork.libcamera.org/api/1.1/patches/18470/?format=json","web_url":"https://patchwork.libcamera.org/patch/18470/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230327122030.11756-2-naush@raspberrypi.com>","date":"2023-03-27T12:20:21","name":"[libcamera-devel,v2,01/10] ipa: raspberrypi Store the target string in the controller","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"9046fb89854350feb8ec85427b193689118e73e8","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18470/mbox/","series":[{"id":3819,"url":"https://patchwork.libcamera.org/api/1.1/series/3819/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3819","date":"2023-03-27T12:20:20","name":"Raspberry Pi: Generalised algorithms","version":2,"mbox":"https://patchwork.libcamera.org/series/3819/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18470/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18470/checks/","tags":{},"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 20378C326C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Mar 2023 12:20:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7390462726;\n\tMon, 27 Mar 2023 14:20:43 +0200 (CEST)","from mail-io1-xd33.google.com (mail-io1-xd33.google.com\n\t[IPv6:2607:f8b0:4864:20::d33])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6F2346271C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Mar 2023 14:20:42 +0200 (CEST)","by mail-io1-xd33.google.com with SMTP id e13so3813580ioc.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Mar 2023 05:20:42 -0700 (PDT)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tr7-20020a5edb47000000b00758ff97aaedsm3239026iop.16.2023.03.27.05.20.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Mar 2023 05:20:40 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679919643;\n\tbh=PtM2d3RdN/izHmZQwStx7IjYq7zepzd3IeF7YNSRGBs=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=pOw7ggfpgavG8x/QhhujwZMFwS7Gb+F+N2lW8fvKYrJzbGOypktuN8Cd7yj+XeFt5\n\ts+gFnUYuJYNgHmX+9SdtbeoD7Q96nTm1P7/1QSjho1JtfLp0pxKhmykm4NdChJg7Qt\n\tYZHUUi+Ylo+akjaul5hoQ2GgckLSu96rTMNi9yIMwTRyb6jOKqZTWrC8WZ9/EdmJQs\n\tgNSp5KHhPwMkmrex7cnHuGKFecKXiSGRwFwdAIVaJbhLGA7KlupD8CxGTHEhxJQtD1\n\toEU/N0t44U+LJm3osVlQ2qQ4u2rZVjCfRK233tm/tNioXrJtXBohGqVyYYbwNC1f/z\n\turELZgOElV9Jg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1679919641;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=PJ25gprEnpGANBs1RoR9sTHxbPydBDJjgb2I5S0jxek=;\n\tb=mSrXaNy/f3ourPOokwBLfyFyk4a2DGIv4lCfsUg2Crj73/4uoyrFEfiNiEUQIkdWkF\n\tMEWvAK6X/jC+JkpQ3K78ZTQfEgRJqOBZ5UZDfzH+AczIdY6wYr7hf0JirsGaSgO1fgRD\n\tAjQMNn2ZhlLmS3Rq5t/byEW5XnbFcFaRR9pHnx7sqdtj0yWrcee1D7zxiHJ10+1DXJ7R\n\tI2o+6pJVTG0CPvXbb87LkY/cgNapdrdXRLPTIkOstSO7IjVHm0RvTk/Drt1stQmR3KR/\n\tgL5sVAgXabUiBTBnClNBo6lumHv3rF9/kw2ljU77n6xwkYWTJLzBLZEjMTEg3wrfgVA4\n\txH6w=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"mSrXaNy/\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679919641;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=PJ25gprEnpGANBs1RoR9sTHxbPydBDJjgb2I5S0jxek=;\n\tb=FNA1JJLq8YAvio7EQs/iTk4U5jV+L2E+U3cvBH541KpDG7P6te9hROGVKJcvURoTOp\n\t02enZs+26iKietzba9v/Vn9xUQMEaKxDTD+y7HPNhXNo135W1nEuG1ImWnN3hWJ+7pRW\n\tD6bsK0gI1Gm7Qs8W/ChSnf3exxjQ1gfVv9NzD7E+UIhShdUy6fN85TDkTJ3Ut8NxJIDe\n\tnVy5HI/AG/GeP3lH65XevgzKkt3oYqkFbHQZnWJifU1UCh7/qe2i8RjUm+CD4tXRA7eL\n\t3AQx4gOr5SRfJDWdbxEGJy6Y9ayUJFjUa7NM8ub1FCYD8X0g5GkxKTSRhufdeNJNr7ji\n\tvHeQ==","X-Gm-Message-State":"AO0yUKX4kNMxGW47M94tHaXNwdI1Vqw2f2oatMl2vGk/BBdPXQvwwbHM\n\tAq6+2Mn0yqMK9YsN/jMZLhRHl/+df4qtLzaiha6dnA==","X-Google-Smtp-Source":"AK7set+4Uikiu4a/rBgXilsoKWB8zVTMbhiPOGPeLBAWCO4XIsyt+y2sl/MKN1Dg8SeATb4YRJlA3A==","X-Received":"by 2002:a05:6602:408b:b0:758:9e69:13f1 with SMTP id\n\tbl11-20020a056602408b00b007589e6913f1mr12124881iob.9.1679919640966; \n\tMon, 27 Mar 2023 05:20:40 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 27 Mar 2023 13:20:21 +0100","Message-Id":"<20230327122030.11756-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230327122030.11756-1-naush@raspberrypi.com>","References":"<20230327122030.11756-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.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>"},"content":"The target string may be used by algorithms to determine the running\nhardware target.\n\nStore the target string provided by the camera tuning files in the\ncontroller state. Add a getTarget() member function to retrieve this\nstring.\n\nValidate the correct hardware target (\"bcm2835\") during the IPA\ninitialisation phase.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.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(+)","diff":"diff --git a/src/ipa/raspberrypi/controller/algorithm.h b/src/ipa/raspberrypi/controller/algorithm.h\nindex 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 \n private:\n \tController *controller_;\ndiff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp\nindex 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+}\ndiff --git a/src/ipa/raspberrypi/controller/controller.h b/src/ipa/raspberrypi/controller/controller.h\nindex 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 */\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 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","prefixes":["libcamera-devel","v2","01/10"]}