{"id":15419,"url":"https://patchwork.libcamera.org/api/1.1/patches/15419/?format=json","web_url":"https://patchwork.libcamera.org/patch/15419/","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":"<20220305172849.1022923-3-umang.jain@ideasonboard.com>","date":"2022-03-05T17:28:48","name":"[libcamera-devel,v2,2/3] ipa: ipu3: Drop sensor controls private members from IPAIPU3","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a93c46db81c4fa0d1e8d14196420f4c9ef070fc5","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":{"id":12,"url":"https://patchwork.libcamera.org/api/1.1/users/12/?format=json","username":"uajain","first_name":"Umang","last_name":"Jain","email":"umang.jain@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/15419/mbox/","series":[{"id":2951,"url":"https://patchwork.libcamera.org/api/1.1/series/2951/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2951","date":"2022-03-05T17:28:46","name":"ipa: ipu3: Consolidate control limits into IPAContext","version":2,"mbox":"https://patchwork.libcamera.org/series/2951/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15419/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15419/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\r\n\t[92.243.16.209])\r\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B0277BE08A\r\n\tfor <parsemail@patchwork.libcamera.org>;\r\n\tSat,  5 Mar 2022 17:29:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7BA1D6118B;\r\n\tSat,  5 Mar 2022 18:29:04 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\r\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 811FF604EA\r\n\tfor <libcamera-devel@lists.libcamera.org>;\r\n\tSat,  5 Mar 2022 18:29:02 +0100 (CET)","from perceval.ideasonboard.com (unknown [103.251.226.47])\r\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2D7AE488;\r\n\tSat,  5 Mar 2022 18:29:00 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\r\n\ts=mail; t=1646501344;\r\n\tbh=adS21eA+3hCQ1yBQ9m8vrCb0Dl95vsLSMAXalXLLTY8=;\r\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\r\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\r\n\tFrom;\r\n\tb=CDV1q1VuIbJGtFJdXWs4t37ZMBI+V3x8Myj7HIFduXG7Jl4HTdiU4FnXqUGLsS0Eo\r\n\tTFdYqK50cm+2KwXn0GpbDY6VA4TlpGfFIZEWdjBEgKhMGueTZ6JZalhelBCyFN2g9p\r\n\t2n63MSD5p3OV9efxTGobLPv4DTFbWh2IE4NVVF/NWpS2ICmpRGEPjCKhiiT7FiK1Bf\r\n\tyHI0gP8WDVfrGmfko0NIwNnDj532iiqIVVFrJKVEaIp2w9X6mTHpv/Zmo3MP3VBvTI\r\n\tdDBmLNEuA/djNSGknmMOzGJkFxuUipjCXflC6a9ruOd+/udtinSwfjupIMKCUEgsID\r\n\tohhPc/FhI9fWA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\r\n\ts=mail; t=1646501342;\r\n\tbh=adS21eA+3hCQ1yBQ9m8vrCb0Dl95vsLSMAXalXLLTY8=;\r\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\r\n\tb=i7X8OeXo5KpzJSo8KJkMbqzFcGRij3fjICO7/a3XjN8YerB+eAwp7j5xpi3/7oVNF\r\n\tCvDcCjrZiPX3DF2dJkSdW3dqKWbIXk8eyz6jXvw7+PvU5GaODVncEQsw99ZsUzCVt/\r\n\tdic8LBpHyYNUvFgMe8JztiNGlalGLN5dyjQkb5EU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \r\n\tunprotected) header.d=ideasonboard.com\r\n\theader.i=@ideasonboard.com\r\n\theader.b=\"i7X8OeXo\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Sat,  5 Mar 2022 22:58:48 +0530","Message-Id":"<20220305172849.1022923-3-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20220305172849.1022923-1-umang.jain@ideasonboard.com>","References":"<20220305172849.1022923-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/3] ipa: ipu3: Drop sensor controls\r\n\tprivate members from IPAIPU3","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>,\r\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>,\r\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Drop exposure, gain private members from IPAIPU3 because the values\nare handled directly via IPAFrameContext.\n\nMove the default vblank value from IPAIPU3 to IPASessionContext\nstructure as it is a default static value not expected to change\nfor a session.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/ipa/ipu3/ipa_context.h |  1 +\n src/ipa/ipu3/ipu3.cpp      | 29 +++++++++--------------------\n 2 files changed, 10 insertions(+), 20 deletions(-)","diff":"diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\r\nindex e7c49828..d993359a 100644\r\n--- a/src/ipa/ipu3/ipa_context.h\r\n+++ b/src/ipa/ipu3/ipa_context.h\r\n@@ -33,6 +33,7 @@ struct IPASessionConfiguration {\r\n \t} agc;\r\n \r\n \tstruct {\r\n+\t\tint32_t defVBlank;\r\n \t\tutils::Duration lineDuration;\r\n \t} sensor;\r\n };\r\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\r\nindex 4b6852a7..0df358ba 100644\r\n--- a/src/ipa/ipu3/ipu3.cpp\r\n+++ b/src/ipa/ipu3/ipu3.cpp\r\n@@ -164,11 +164,6 @@ private:\r\n \r\n \tIPACameraSensorInfo sensorInfo_;\r\n \r\n-\t/* Camera sensor controls. */\r\n-\tuint32_t defVBlank_;\r\n-\tuint32_t exposure_;\r\n-\tuint32_t gain_;\r\n-\r\n \t/* Interface to the Camera Helper */\r\n \tstd::unique_ptr<CameraSensorHelper> camHelper_;\r\n \r\n@@ -185,15 +180,16 @@ private:\r\n  */\r\n void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)\r\n {\r\n+\tconst ControlInfo vBlank = sensorControls.find(V4L2_CID_VBLANK)->second;\r\n+\tcontext_.configuration.sensor.defVBlank = vBlank.def().get<int32_t>();\r\n+\r\n \tconst ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\r\n \tint32_t minExposure = v4l2Exposure.min().get<int32_t>();\r\n \tint32_t maxExposure = v4l2Exposure.max().get<int32_t>();\r\n-\texposure_ = minExposure;\r\n \r\n \tconst ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;\r\n \tint32_t minGain = v4l2Gain.min().get<int32_t>();\r\n \tint32_t maxGain = v4l2Gain.max().get<int32_t>();\r\n-\tgain_ = minGain;\r\n \r\n \t/*\r\n \t * When the AGC computes the new exposure values for a frame, it needs\r\n@@ -427,14 +423,6 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\r\n \t */\r\n \tctrls_ = configInfo.sensorControls;\r\n \r\n-\tconst auto itVBlank = ctrls_.find(V4L2_CID_VBLANK);\r\n-\tif (itVBlank == ctrls_.end()) {\r\n-\t\tLOG(IPAIPU3, Error) << \"Can't find VBLANK control\";\r\n-\t\treturn -EINVAL;\r\n-\t}\r\n-\r\n-\tdefVBlank_ = itVBlank->second.def().get<int32_t>();\r\n-\r\n \tcalculateBdsGrid(configInfo.bdsOutputSize);\r\n \r\n \t/* Clean frameContext at each reconfiguration. */\r\n@@ -600,6 +588,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\r\n \t\t\t      const ipu3_uapi_stats_3a *stats)\r\n {\r\n \tdouble lineDuration = context_.configuration.sensor.lineDuration.get<std::micro>();\r\n+\tint32_t vBlank = context_.configuration.sensor.defVBlank;\r\n \tControlList ctrls(controls::controls);\r\n \r\n \tfor (auto const &algo : algorithms_)\r\n@@ -608,7 +597,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\r\n \tsetControls(frame);\r\n \r\n \t/* \\todo Use VBlank value calculated from each frame exposure. */\r\n-\tint64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height) * lineDuration;\r\n+\tint64_t frameDuration = (vBlank + sensorInfo_.outputSize.height) * lineDuration;\r\n \tctrls.set(controls::FrameDuration, frameDuration);\r\n \r\n \tctrls.set(controls::AnalogueGain, context_.frameContext.sensor.gain);\r\n@@ -644,12 +633,12 @@ void IPAIPU3::setControls(unsigned int frame)\r\n \tIPU3Action op;\r\n \top.op = ActionSetSensorControls;\r\n \r\n-\texposure_ = context_.frameContext.agc.exposure;\r\n-\tgain_ = camHelper_->gainCode(context_.frameContext.agc.gain);\r\n+\tint32_t exposure = context_.frameContext.agc.exposure;\r\n+\tint32_t gain = camHelper_->gainCode(context_.frameContext.agc.gain);\r\n \r\n \tControlList ctrls(ctrls_);\r\n-\tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));\r\n-\tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));\r\n+\tctrls.set(V4L2_CID_EXPOSURE, exposure);\r\n+\tctrls.set(V4L2_CID_ANALOGUE_GAIN, gain);\r\n \top.sensorControls = ctrls;\r\n \r\n \tqueueFrameAction.emit(frame, op);","prefixes":["libcamera-devel","v2","2/3"]}