From patchwork Wed Mar 22 13:06:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18428 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 151AEC3260 for ; Wed, 22 Mar 2023 13:06:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 715CF62712; Wed, 22 Mar 2023 14:06:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1679490380; bh=NIKBqVYG6vvjAOK1iHAq4BUqgpfey+pFNIS1WFEVp10=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=g7qWtwF6CpRXeVOV+20oxBxMdjZR2roOmvc0JCzxQ/ve87PCn7VGLuxeiBelIonAh lGVd917DaiMZZad6pS2T0sJ2RbC3hyRj9JTwbMc+PUCaVbbHAFQpQ6FrYu60XbwQa7 Lke/1+pBWAn1NxqerTX7FVjufQSbXkju/CWwaOJflls01zZUn3nYT9YEno3SiKAU5O jPLE8neolj1e9Ms3NUurHq5itDG7qerkXmy9frn2NqAoRxVUFOA2aGxuoaPxm1zSSU CMu2+Q2VUiAYcvBrkw9ydidtggHOh/WzYTU0V7RJH7veZHmfMNTxChdr7XKfCXoctV sDbDkOs0lXyEA== Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 98A3861ECE for ; Wed, 22 Mar 2023 14:06:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="LyhreHbA"; dkim-atps=neutral Received: by mail-io1-xd32.google.com with SMTP id s4so8385897ioj.11 for ; Wed, 22 Mar 2023 06:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1679490377; 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=Mg0Olb+1u+WM6x4FwKzljBeNwsaSSj8LW3QZkB2AKhw=; b=LyhreHbArJKyGb3bkyzwkNE4TXOFOpPbbXv+MwlxT6fezfmruxmPTgFKDp0C9N3iHQ z6avAR5h7kYOZLiJgFFU2MXrmwNd1C/ToAR1RDB6nW7Nt0jvT/Yj3bLHMLUJZOygOO1z tWveFDI8Bey7XqSHDCMqpnV0d3tRSJyd3vX1MTDa9UHwR8ndKiL7wYmLSGWWQiqI0Pi/ QIJGCR7IaS5F4uyLQmaEK3hEYtBCsZv94a+EV7V2nomgr3lTLoTjWkwRNHz/48QUEd70 YpnikqXXbtWW8rlVIUL/AffQUrsFbRI5WiY3tYS2WZLOLKhf7JSecKl4EMYU5AShcoS6 J50A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679490377; 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=Mg0Olb+1u+WM6x4FwKzljBeNwsaSSj8LW3QZkB2AKhw=; b=wXmcfzyVZ9Db2AvQdj30dJ84sX/ipNb0VZbT5Pcj4LLvqA9D2fEKh6odz6micixiOK SLclXHls+CpWaXQnok0ET3iSwLXvDlmmyy4vx/tW+yH9A4rDmzec0LWRc7sFKlnQm7Xf 68oGZobJl7CTBuoNY5Mz0QLpz1h3nkFj9YF2pVMFCkJGd+HFWFRjw9bfLICjRf3fppAU yKiu0Y4sZluI2Pjvq4HZUbEos2sNYlhoF4SiSZa8KohKH83q3AQbhgofJY8wj13wWFqm jqIjZlLzaqG0/7DiZADhSC8a5tvCDybeFlhgP63wvtB1wjoCwaNASqPSa4rhSzSz3cop YS3A== X-Gm-Message-State: AO0yUKWo5bOyLUGDLYIOR9Cgb6OnB+bStkemSSIw7XpKsY2EFC4BXAeL M8r6OkAzug6oXjX+Nj/MJs0+YfqE5BxWrS8lkqVYaA== X-Google-Smtp-Source: AK7set8/g4ZpNMLIOiK5Jo1Oy0tBL6jgFFrhO67ZgvkwQDxi67QNeRhNlGVj8N4RTkVqDPskqkTBNg== X-Received: by 2002:a5e:aa0d:0:b0:74c:aa8f:a83e with SMTP id s13-20020a5eaa0d000000b0074caa8fa83emr4179450ioe.6.1679490377220; Wed, 22 Mar 2023 06:06:17 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id l6-20020a026646000000b003c488204c6fsm4927960jaf.76.2023.03.22.06.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 06:06:17 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 22 Mar 2023 13:06:03 +0000 Message-Id: <20230322130612.5208-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322130612.5208-1-naush@raspberrypi.com> References: <20230322130612.5208-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 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 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: David Plowman Reviewed-by: Jacopo Mondi --- 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();