{"id":18428,"url":"https://patchwork.libcamera.org/api/1.1/patches/18428/?format=json","web_url":"https://patchwork.libcamera.org/patch/18428/","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":"<20230322130612.5208-2-naush@raspberrypi.com>","date":"2023-03-22T13:06:03","name":"[libcamera-devel,v1,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/18428/mbox/","series":[{"id":3810,"url":"https://patchwork.libcamera.org/api/1.1/series/3810/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3810","date":"2023-03-22T13:06:02","name":"Raspberry Pi: Generalised algorithms","version":1,"mbox":"https://patchwork.libcamera.org/series/3810/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18428/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18428/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 151AEC3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Mar 2023 13:06:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 715CF62712;\n\tWed, 22 Mar 2023 14:06:20 +0100 (CET)","from mail-io1-xd32.google.com (mail-io1-xd32.google.com\n\t[IPv6:2607:f8b0:4864:20::d32])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 98A3861ECE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Mar 2023 14:06:18 +0100 (CET)","by mail-io1-xd32.google.com with SMTP id s4so8385897ioj.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Mar 2023 06:06:18 -0700 (PDT)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tl6-20020a026646000000b003c488204c6fsm4927960jaf.76.2023.03.22.06.06.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 22 Mar 2023 06:06:17 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679490380;\n\tbh=NIKBqVYG6vvjAOK1iHAq4BUqgpfey+pFNIS1WFEVp10=;\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:\n\tFrom;\n\tb=g7qWtwF6CpRXeVOV+20oxBxMdjZR2roOmvc0JCzxQ/ve87PCn7VGLuxeiBelIonAh\n\tlGVd917DaiMZZad6pS2T0sJ2RbC3hyRj9JTwbMc+PUCaVbbHAFQpQ6FrYu60XbwQa7\n\tLke/1+pBWAn1NxqerTX7FVjufQSbXkju/CWwaOJflls01zZUn3nYT9YEno3SiKAU5O\n\tjPLE8neolj1e9Ms3NUurHq5itDG7qerkXmy9frn2NqAoRxVUFOA2aGxuoaPxm1zSSU\n\tCMu2+Q2VUiAYcvBrkw9ydidtggHOh/WzYTU0V7RJH7veZHmfMNTxChdr7XKfCXoctV\n\tsDbDkOs0lXyEA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1679490377;\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=Mg0Olb+1u+WM6x4FwKzljBeNwsaSSj8LW3QZkB2AKhw=;\n\tb=LyhreHbArJKyGb3bkyzwkNE4TXOFOpPbbXv+MwlxT6fezfmruxmPTgFKDp0C9N3iHQ\n\tz6avAR5h7kYOZLiJgFFU2MXrmwNd1C/ToAR1RDB6nW7Nt0jvT/Yj3bLHMLUJZOygOO1z\n\ttWveFDI8Bey7XqSHDCMqpnV0d3tRSJyd3vX1MTDa9UHwR8ndKiL7wYmLSGWWQiqI0Pi/\n\tQIJGCR7IaS5F4uyLQmaEK3hEYtBCsZv94a+EV7V2nomgr3lTLoTjWkwRNHz/48QUEd70\n\tYpnikqXXbtWW8rlVIUL/AffQUrsFbRI5WiY3tYS2WZLOLKhf7JSecKl4EMYU5AShcoS6\n\tJ50A=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"LyhreHbA\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679490377;\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=Mg0Olb+1u+WM6x4FwKzljBeNwsaSSj8LW3QZkB2AKhw=;\n\tb=wXmcfzyVZ9Db2AvQdj30dJ84sX/ipNb0VZbT5Pcj4LLvqA9D2fEKh6odz6micixiOK\n\tSLclXHls+CpWaXQnok0ET3iSwLXvDlmmyy4vx/tW+yH9A4rDmzec0LWRc7sFKlnQm7Xf\n\t68oGZobJl7CTBuoNY5Mz0QLpz1h3nkFj9YF2pVMFCkJGd+HFWFRjw9bfLICjRf3fppAU\n\tyKiu0Y4sZluI2Pjvq4HZUbEos2sNYlhoF4SiSZa8KohKH83q3AQbhgofJY8wj13wWFqm\n\tjqIjZlLzaqG0/7DiZADhSC8a5tvCDybeFlhgP63wvtB1wjoCwaNASqPSa4rhSzSz3cop\n\tYS3A==","X-Gm-Message-State":"AO0yUKWo5bOyLUGDLYIOR9Cgb6OnB+bStkemSSIw7XpKsY2EFC4BXAeL\n\tM8r6OkAzug6oXjX+Nj/MJs0+YfqE5BxWrS8lkqVYaA==","X-Google-Smtp-Source":"AK7set8/g4ZpNMLIOiK5Jo1Oy0tBL6jgFFrhO67ZgvkwQDxi67QNeRhNlGVj8N4RTkVqDPskqkTBNg==","X-Received":"by 2002:a5e:aa0d:0:b0:74c:aa8f:a83e with SMTP id\n\ts13-20020a5eaa0d000000b0074caa8fa83emr4179450ioe.6.1679490377220; \n\tWed, 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","Content-Transfer-Encoding":"8bit","Subject":"[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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.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>\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","v1","01/10"]}