{"id":15405,"url":"https://patchwork.libcamera.org/api/1.1/patches/15405/?format=json","web_url":"https://patchwork.libcamera.org/patch/15405/","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":"<20220303155305.525877-1-umang.jain@ideasonboard.com>","date":"2022-03-03T15:53:05","name":"[libcamera-devel,1/2] ipa: ipu3: Drop sensor controls private members from IPAIPU3","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"3f15c1af29da6d7c6f03b22d1bf49611a90fdecc","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15405/mbox/","series":[{"id":2949,"url":"https://patchwork.libcamera.org/api/1.1/series/2949/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2949","date":"2022-03-03T15:53:05","name":"[libcamera-devel,1/2] ipa: ipu3: Drop sensor controls private members from IPAIPU3","version":1,"mbox":"https://patchwork.libcamera.org/series/2949/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15405/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15405/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 86617BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  3 Mar 2022 15:53:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EFD0E6115E;\n\tThu,  3 Mar 2022 16:53:18 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 77688601FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Mar 2022 16:53:17 +0100 (CET)","from perceval.ideasonboard.com (unknown [103.251.226.47])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DAAE3885;\n\tThu,  3 Mar 2022 16:53:15 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oX9T+bgi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1646322797;\n\tbh=v2UbwatISs5zDa+89ZTr+iPSWNJWaen13JpRJ9n5w24=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=oX9T+bgiCpq28n3WQmJMHkbhmxxnOMmr4ZzE6kgF3kFpwI0fJdss8VcwfDGG16ZB4\n\tWTvyEIS1kq+E+F0LREAw53D9O9UGmNgG9NLIV2iPlcjLco+i+Zut/QJ5DWX6+18OI3\n\tZYALPW5VQDxJAzUsHUhglLDeVp4oOBMT8VIv+JwM=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  3 Mar 2022 21:23:05 +0530","Message-Id":"<20220303155305.525877-1-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20220301075919.201968-1-umang.jain@ideasonboard.com>","References":"<20220301075919.201968-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/2] ipa: ipu3: Drop sensor controls\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>,\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>","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\nindex e7c49828..d993359a 100644\n--- a/src/ipa/ipu3/ipa_context.h\n+++ b/src/ipa/ipu3/ipa_context.h\n@@ -33,6 +33,7 @@ struct IPASessionConfiguration {\n \t} agc;\n \n \tstruct {\n+\t\tint32_t defVBlank;\n \t\tutils::Duration lineDuration;\n \t} sensor;\n };\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 4b6852a7..7b190217 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -164,11 +164,6 @@ private:\n \n \tIPACameraSensorInfo sensorInfo_;\n \n-\t/* Camera sensor controls. */\n-\tuint32_t defVBlank_;\n-\tuint32_t exposure_;\n-\tuint32_t gain_;\n-\n \t/* Interface to the Camera Helper */\n \tstd::unique_ptr<CameraSensorHelper> camHelper_;\n \n@@ -185,15 +180,16 @@ private:\n  */\n void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)\n {\n+\tconst ControlInfo vBlank = sensorControls.find(V4L2_CID_VBLANK)->second;\n+\tcontext_.configuration.sensor.defVBlank = vBlank.def().get<int32_t>();\n+\n \tconst ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n \tint32_t minExposure = v4l2Exposure.min().get<int32_t>();\n \tint32_t maxExposure = v4l2Exposure.max().get<int32_t>();\n-\texposure_ = minExposure;\n \n \tconst ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;\n \tint32_t minGain = v4l2Gain.min().get<int32_t>();\n \tint32_t maxGain = v4l2Gain.max().get<int32_t>();\n-\tgain_ = minGain;\n \n \t/*\n \t * When the AGC computes the new exposure values for a frame, it needs\n@@ -427,14 +423,6 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n \t */\n \tctrls_ = configInfo.sensorControls;\n \n-\tconst auto itVBlank = ctrls_.find(V4L2_CID_VBLANK);\n-\tif (itVBlank == ctrls_.end()) {\n-\t\tLOG(IPAIPU3, Error) << \"Can't find VBLANK control\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tdefVBlank_ = itVBlank->second.def().get<int32_t>();\n-\n \tcalculateBdsGrid(configInfo.bdsOutputSize);\n \n \t/* Clean frameContext at each reconfiguration. */\n@@ -600,6 +588,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \t\t\t      const ipu3_uapi_stats_3a *stats)\n {\n \tdouble lineDuration = context_.configuration.sensor.lineDuration.get<std::micro>();\n+\tint32_t vBlank = context_.configuration.sensor.defVBlank;\n \tControlList ctrls(controls::controls);\n \n \tfor (auto const &algo : algorithms_)\n@@ -608,7 +597,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \tsetControls(frame);\n \n \t/* \\todo Use VBlank value calculated from each frame exposure. */\n-\tint64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height) * lineDuration;\n+\tint64_t frameDuration = (vBlank + sensorInfo_.outputSize.height) * lineDuration;\n \tctrls.set(controls::FrameDuration, frameDuration);\n \n \tctrls.set(controls::AnalogueGain, context_.frameContext.sensor.gain);\n@@ -644,12 +633,12 @@ void IPAIPU3::setControls(unsigned int frame)\n \tIPU3Action op;\n \top.op = ActionSetSensorControls;\n \n-\texposure_ = context_.frameContext.agc.exposure;\n-\tgain_ = camHelper_->gainCode(context_.frameContext.agc.gain);\n+\tint32_t exposure = context_.frameContext.agc.exposure;\n+\tint32_t gain = camHelper_->gainCode(context_.frameContext.agc.gain);\n \n \tControlList ctrls(ctrls_);\n-\tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));\n-\tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));\n+\tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));\n+\tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain));\n \top.sensorControls = ctrls;\n \n \tqueueFrameAction.emit(frame, op);\n","prefixes":["libcamera-devel","1/2"]}