From patchwork Mon Mar 27 12:20:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18470 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 20378C326C for ; Mon, 27 Mar 2023 12:20:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7390462726; Mon, 27 Mar 2023 14:20:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1679919643; bh=PtM2d3RdN/izHmZQwStx7IjYq7zepzd3IeF7YNSRGBs=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=pOw7ggfpgavG8x/QhhujwZMFwS7Gb+F+N2lW8fvKYrJzbGOypktuN8Cd7yj+XeFt5 s+gFnUYuJYNgHmX+9SdtbeoD7Q96nTm1P7/1QSjho1JtfLp0pxKhmykm4NdChJg7Qt YZHUUi+Ylo+akjaul5hoQ2GgckLSu96rTMNi9yIMwTRyb6jOKqZTWrC8WZ9/EdmJQs gNSp5KHhPwMkmrex7cnHuGKFecKXiSGRwFwdAIVaJbhLGA7KlupD8CxGTHEhxJQtD1 oEU/N0t44U+LJm3osVlQ2qQ4u2rZVjCfRK233tm/tNioXrJtXBohGqVyYYbwNC1f/z urELZgOElV9Jg== Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6F2346271C for ; Mon, 27 Mar 2023 14:20:42 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="mSrXaNy/"; dkim-atps=neutral Received: by mail-io1-xd33.google.com with SMTP id e13so3813580ioc.0 for ; Mon, 27 Mar 2023 05:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1679919641; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PJ25gprEnpGANBs1RoR9sTHxbPydBDJjgb2I5S0jxek=; b=mSrXaNy/f3ourPOokwBLfyFyk4a2DGIv4lCfsUg2Crj73/4uoyrFEfiNiEUQIkdWkF MEWvAK6X/jC+JkpQ3K78ZTQfEgRJqOBZ5UZDfzH+AczIdY6wYr7hf0JirsGaSgO1fgRD AjQMNn2ZhlLmS3Rq5t/byEW5XnbFcFaRR9pHnx7sqdtj0yWrcee1D7zxiHJ10+1DXJ7R I2o+6pJVTG0CPvXbb87LkY/cgNapdrdXRLPTIkOstSO7IjVHm0RvTk/Drt1stQmR3KR/ gL5sVAgXabUiBTBnClNBo6lumHv3rF9/kw2ljU77n6xwkYWTJLzBLZEjMTEg3wrfgVA4 xH6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679919641; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PJ25gprEnpGANBs1RoR9sTHxbPydBDJjgb2I5S0jxek=; b=FNA1JJLq8YAvio7EQs/iTk4U5jV+L2E+U3cvBH541KpDG7P6te9hROGVKJcvURoTOp 02enZs+26iKietzba9v/Vn9xUQMEaKxDTD+y7HPNhXNo135W1nEuG1ImWnN3hWJ+7pRW D6bsK0gI1Gm7Qs8W/ChSnf3exxjQ1gfVv9NzD7E+UIhShdUy6fN85TDkTJ3Ut8NxJIDe nVy5HI/AG/GeP3lH65XevgzKkt3oYqkFbHQZnWJifU1UCh7/qe2i8RjUm+CD4tXRA7eL 3AQx4gOr5SRfJDWdbxEGJy6Y9ayUJFjUa7NM8ub1FCYD8X0g5GkxKTSRhufdeNJNr7ji vHeQ== X-Gm-Message-State: AO0yUKX4kNMxGW47M94tHaXNwdI1Vqw2f2oatMl2vGk/BBdPXQvwwbHM Aq6+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 bl11-20020a056602408b00b007589e6913f1mr12124881iob.9.1679919640966; Mon, 27 Mar 2023 05:20:40 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id r7-20020a5edb47000000b00758ff97aaedsm3239026iop.16.2023.03.27.05.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 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 Subject: [libcamera-devel] [PATCH v2 01/10] ipa: raspberrypi Store the target string in the controller X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The target string may be used by algorithms to determine the running hardware target. Store the target string provided by the camera tuning files in the controller state. Add a getTarget() member function to retrieve this string. Validate the correct hardware target ("bcm2835") during the IPA initialisation phase. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/ipa/raspberrypi/controller/algorithm.h | 4 ++++ src/ipa/raspberrypi/controller/controller.cpp | 6 ++++++ src/ipa/raspberrypi/controller/controller.h | 4 ++++ src/ipa/raspberrypi/raspberrypi.cpp | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/src/ipa/raspberrypi/controller/algorithm.h b/src/ipa/raspberrypi/controller/algorithm.h index 4f3275987305..7c22fbe4945c 100644 --- a/src/ipa/raspberrypi/controller/algorithm.h +++ b/src/ipa/raspberrypi/controller/algorithm.h @@ -41,6 +41,10 @@ public: { return controller_->getGlobalMetadata(); } + const std::string &getTarget() const + { + return controller_->getTarget(); + } private: Controller *controller_; diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp index e91567852d00..a6250ee140b0 100644 --- a/src/ipa/raspberrypi/controller/controller.cpp +++ b/src/ipa/raspberrypi/controller/controller.cpp @@ -38,6 +38,7 @@ int Controller::read(char const *filename) std::unique_ptr root = YamlParser::parse(file); double version = (*root)["version"].get(1.0); + target_ = (*root)["target"].get("bcm2835"); if (version < 2.0) { LOG(RPiController, Warning) @@ -142,3 +143,8 @@ Algorithm *Controller::getAlgorithm(std::string const &name) const } return nullptr; } + +const std::string &Controller::getTarget() const +{ + return target_; +} diff --git a/src/ipa/raspberrypi/controller/controller.h b/src/ipa/raspberrypi/controller/controller.h index e6c950c3a509..24e02903d438 100644 --- a/src/ipa/raspberrypi/controller/controller.h +++ b/src/ipa/raspberrypi/controller/controller.h @@ -46,6 +46,7 @@ public: void process(StatisticsPtr stats, Metadata *imageMetadata); Metadata &getGlobalMetadata(); Algorithm *getAlgorithm(std::string const &name) const; + const std::string &getTarget() const; protected: int createAlgorithm(const std::string &name, const libcamera::YamlObject ¶ms); @@ -53,6 +54,9 @@ protected: Metadata globalMetadata_; std::vector algorithms_; bool switchModeCalled_; + +private: + std::string target_; }; } /* namespace RPiController */ diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 1375795568e2..86359538cf67 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -269,6 +269,14 @@ int IPARPi::init(const IPASettings &settings, bool lensPresent, IPAInitResult *r return ret; } + const std::string &target = controller_.getTarget(); + if (target != "bcm2835") { + LOG(IPARPI, Error) + << "Tuning data file target returned \"" << target << "\"" + << ", expected \"bcm2835\""; + return -EINVAL; + } + lensPresent_ = lensPresent; controller_.initialise();