{"id":17172,"url":"https://patchwork.libcamera.org/api/1.1/patches/17172/?format=json","web_url":"https://patchwork.libcamera.org/patch/17172/","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":"<20220818094410.1671-18-jacopo@jmondi.org>","date":"2022-08-18T09:44:10","name":"[libcamera-devel,v3,17/17] ipa: rkisp1: Store configuration data in context","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"15201cb84258bd2fe1c77842a8bf1f0150f67d2a","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17172/mbox/","series":[{"id":3426,"url":"https://patchwork.libcamera.org/api/1.1/series/3426/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3426","date":"2022-08-18T09:43:53","name":"libcamera: Align IPU3 and RKISP1 interfaces","version":3,"mbox":"https://patchwork.libcamera.org/series/3426/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17172/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17172/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 4FE91C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Aug 2022 09:44:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1BDFF61FD7;\n\tThu, 18 Aug 2022 11:44:46 +0200 (CEST)","from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CEB1061FDB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Aug 2022 11:44:40 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id D2DB3FF806;\n\tThu, 18 Aug 2022 09:44:39 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660815886;\n\tbh=yAzfEucn64cZbT1mW9CLX+VERX4KGIvc6xRdCAfi+6E=;\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=EWfSg/Ujg4Tl/gOLAw0An7NqENh0qfDShuSNMSgqKWqLJjU/nUB8lQwJn0jDdKFDy\n\tCJo7295T6r2fFftwnKhD/KP5ddMsagE8Rd/tBYRlunAJwEhGPD20R9E8OGJgFq3Hxp\n\t0BUNY1b+3z6QKnZPGRo5GCzaajtZKDITwv+uF5TIP/3P9NpEZMflc5sMBriBz22j5Y\n\triBHjI8iTwFB+ZMmCOGLGrja9dn9HnV0+W1aHBoYiGgpR1EIoXYqkdw1gRhOZwwcJB\n\tT9rh/UWyS8xNsfrDh6Zq3YsAGWSssUQNcRhtAeppmdjTQpLIEULk261mIgMFRPS2ds\n\tIQ9ckMyCMSwcQ==","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 18 Aug 2022 11:44:10 +0200","Message-Id":"<20220818094410.1671-18-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.37.2","In-Reply-To":"<20220818094410.1671-1-jacopo@jmondi.org>","References":"<20220818094410.1671-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 17/17] ipa: rkisp1: Store configuration\n\tdata in context","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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The RkISP1 IPA module stores per-configuration session data, such as the\nsensor and lens controls and the sensor information, in class member\nvariables.\n\nAs the IPAContext structure has exactly a place for session-specific\nconfiguration data, move those information in the context_ and remove\nthem from the class.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/ipa/rkisp1/ipa_context.cpp | 15 +++++++++++++++\n src/ipa/rkisp1/ipa_context.h   |  6 ++++++\n src/ipa/rkisp1/rkisp1.cpp      | 33 ++++++++++++++-------------------\n 3 files changed, 35 insertions(+), 19 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex ef8bb8e931c8..e31059e52cee 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -100,6 +100,21 @@ namespace libcamera::ipa::rkisp1 {\n  * \\brief Sensor output resolution\n  */\n \n+/**\n+ * \\var IPASessionConfiguration::sensorCtrls\n+ * \\brief The list of V4L2 sensor controls limits\n+ */\n+\n+/**\n+ * \\var IPASessionConfiguration::lensCtrls\n+ * \\brief The list of V4L2 lens controls limits\n+ */\n+\n+/**\n+ * \\var IPASessionConfiguration::sensorInfo\n+ * \\brief The sensor configuration for the streaming session\n+ */\n+\n /**\n  * \\var IPAFrameContext::agc\n  * \\brief Context for the Automatic Gain Control algorithm\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex dd756f4025d1..6151f35af900 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -14,6 +14,8 @@\n \n #include <libcamera/geometry.h>\n \n+#include <libcamera/ipa/core_ipa_interface.h>\n+\n #include <libipa/fc_queue.h>\n \n namespace libcamera {\n@@ -41,6 +43,10 @@ struct IPASessionConfiguration {\n \tstruct {\n \t\trkisp1_cif_isp_version revision;\n \t} hw;\n+\n+\tControlInfoMap sensorCtrls;\n+\tControlInfoMap lensCtrls;\n+\tIPACameraSensorInfo sensorInfo;\n };\n \n struct IPAActiveState {\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex a1834034e617..01d64c48b126 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -71,9 +71,6 @@ private:\n \tstd::map<unsigned int, FrameBuffer> buffers_;\n \tstd::map<unsigned int, MappedFrameBuffer> mappedBuffers_;\n \n-\tControlInfoMap sensorCtrls_;\n-\tstd::optional<ControlInfoMap> lensCtrls_;\n-\n \t/* revision-specific data */\n \trkisp1_cif_isp_version hwRevision_;\n \tunsigned int hwHistBinNMax_;\n@@ -211,9 +208,17 @@ bool IPARkISP1::validateSensorControls(const ControlInfoMap &sensorControls)\n \n void IPARkISP1::updateSessionConfiguration(const IPAConfigInfo &configInfo)\n {\n-\tconst IPACameraSensorInfo &sensorInfo = configInfo.sensorInfo;\n-\tconst ControlInfoMap &sensorControls = configInfo.sensorControls;\n+\t/* Clear the IPA context before the streaming session. */\n+\tcontext_.frameContexts.clear();\n+\tcontext_ = {};\n+\n+\tcontext_.configuration.sensorCtrls = configInfo.sensorControls;\n+\tcontext_.configuration.lensCtrls = configInfo.lensControls;\n+\n+\t/* Set the hardware revision for the algorithms. */\n+\tcontext_.configuration.hw.revision = hwRevision_;\n \n+\tconst ControlInfoMap &sensorControls = configInfo.sensorControls;\n \tconst ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n \tconst ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;\n \tint32_t minExposure = v4l2Exposure.min().get<int32_t>();\n@@ -226,16 +231,9 @@ void IPARkISP1::updateSessionConfiguration(const IPAConfigInfo &configInfo)\n \t\t<< \"Exposure: \" << minExposure << \"-\" << maxExposure\n \t\t<< \" Gain: \" << minGain << \"-\" << maxGain;\n \n-\t/* Clear the IPA context before the streaming session. */\n-\tcontext_.frameContexts.clear();\n-\tcontext_ = {};\n-\n-\t/* Set the hardware revision for the algorithms. */\n-\tcontext_.configuration.hw.revision = hwRevision_;\n-\n-\tcontext_.configuration.sensor.size = sensorInfo.outputSize;\n-\tcontext_.configuration.sensor.lineDuration = sensorInfo.lineLength * 1.0s\n-\t\t\t\t\t\t   / sensorInfo.pixelRate;\n+\tcontext_.configuration.sensor.size = configInfo.sensorInfo.outputSize;\n+\tcontext_.configuration.sensor.lineDuration = configInfo.sensorInfo.lineLength * 1.0s\n+\t\t\t\t\t\t   / configInfo.sensorInfo.pixelRate;\n \n \t/*\n \t * When the AGC computes the new exposure values for a frame, it needs\n@@ -259,9 +257,6 @@ int IPARkISP1::configure(const IPAConfigInfo &configInfo)\n \t\treturn -EINVAL;\n \t}\n \n-\tsensorCtrls_ = configInfo.sensorControls;\n-\tlensCtrls_ = configInfo.lensControls;\n-\n \tupdateSessionConfiguration(configInfo);\n \n \tfor (auto const &algo : algorithms()) {\n@@ -358,7 +353,7 @@ void IPARkISP1::setControls(unsigned int frame)\n \tuint32_t exposure = context_.activeState.agc.exposure;\n \tuint32_t gain = camHelper_->gainCode(context_.activeState.agc.gain);\n \n-\tControlList ctrls(sensorCtrls_);\n+\tControlList ctrls(context_.configuration.sensorCtrls);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));\n \tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain));\n \n","prefixes":["libcamera-devel","v3","17/17"]}