{"id":15558,"url":"https://patchwork.libcamera.org/api/1.1/patches/15558/?format=json","web_url":"https://patchwork.libcamera.org/patch/15558/","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":"<20220325103410.38580-3-umang.jain@ideasonboard.com>","date":"2022-03-25T10:34:09","name":"[libcamera-devel,v4,2/3] ipa: ipu3: Drop sensor controls private members from IPAIPU3","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c6d1ba90a033f86b6f0b9b8846ddfdb9a87fa7a9","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/15558/mbox/","series":[{"id":3001,"url":"https://patchwork.libcamera.org/api/1.1/series/3001/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3001","date":"2022-03-25T10:34:07","name":"ipa: ipu3: Consolidate querying of exposure and gain limits","version":4,"mbox":"https://patchwork.libcamera.org/series/3001/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15558/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15558/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 60589C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 25 Mar 2022 10:34:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2822F604C5;\n\tFri, 25 Mar 2022 11:34:30 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AA6C3604C4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Mar 2022 11:34:28 +0100 (CET)","from perceval.ideasonboard.com (unknown [103.86.18.118])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1BF126F3;\n\tFri, 25 Mar 2022 11:34:25 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648204470;\n\tbh=Wr0qqpZRxyYRcwAYfgEzODdEgXoXRNHhujzeiiT8daI=;\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=lu7LLcmzQXRX27rS4kTYE8x+85TukFLZsfyqtRocptxqrNq2dbz9sb5d3LshVETol\n\t4taXRYmHAhsq0tyf/T9Se8rkk4ZqlyjG2zbh1boGKy6Yk1dA7fMkMVRhd2mzlXKW65\n\txDGAJ54JHiL4rNiKXCz8bGZytB6mVVbS03fGwKlRHrr+p7gszjF5GfG2hySP34VI0Q\n\tsBhA9Ibe3aC7yoPxrlsqbcJguuZPrGl+lvwmO+PIQ1zMTqyleOHZ/a571GAZf+a5pY\n\tm1S0Y+yMyM5Q6lYug1m1W/KHy9RHAWiFa4hurph3jhKtbYkEXD+hyIFz2TEYXAI+hf\n\tT+cOe+NgAGHqQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648204468;\n\tbh=Wr0qqpZRxyYRcwAYfgEzODdEgXoXRNHhujzeiiT8daI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BDM6Duxa3r0NxC8lXprUyN/59L25KcslUbrN3HjRgtYZ1UEkYHwSsKvhi6bKw3tFV\n\tjizpbswbQGQpUnTprjh62+CUJAPCfET4lGW3pnsZt89PH9qULxqdGnkglBgPd7ZvPG\n\tAkpS1KRNrTcPzLfmdItGhPEYPEr7DaaiI+GblvLY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"BDM6Duxa\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 25 Mar 2022 16:04:09 +0530","Message-Id":"<20220325103410.38580-3-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20220325103410.38580-1-umang.jain@ideasonboard.com>","References":"<20220325103410.38580-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 2/3] 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>","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 IPASessionConfiguration\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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/ipu3/ipa_context.cpp |  3 +++\n src/ipa/ipu3/ipa_context.h   |  1 +\n src/ipa/ipu3/ipu3.cpp        | 29 +++++++++--------------------\n 3 files changed, 13 insertions(+), 20 deletions(-)","diff":"diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\nindex 1b59c918..b1570dde 100644\n--- a/src/ipa/ipu3/ipa_context.cpp\n+++ b/src/ipa/ipu3/ipa_context.cpp\n@@ -115,6 +115,9 @@ namespace libcamera::ipa::ipu3 {\n  *\n  * \\var IPASessionConfiguration::sensor.lineDuration\n  * \\brief Line duration in microseconds\n+ *\n+ * \\var IPASessionConfiguration::sensor.defVBlank\n+ * \\brief The default vblank value of the sensor\n  */\n \n /**\ndiff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\nindex 6b7a512e..103498ef 100644\n--- a/src/ipa/ipu3/ipa_context.h\n+++ b/src/ipa/ipu3/ipa_context.h\n@@ -37,6 +37,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 a8cc2f6c..3717d893 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -166,11 +166,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@@ -187,15 +182,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@@ -432,14 +428,6 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n \t */\n \tsensorCtrls_ = configInfo.sensorControls;\n \n-\tconst auto itVBlank = sensorCtrls_.find(V4L2_CID_VBLANK);\n-\tif (itVBlank == sensorCtrls_.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@@ -605,6 +593,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@@ -613,7 +602,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@@ -649,12 +638,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(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+\tctrls.set(V4L2_CID_EXPOSURE, exposure);\n+\tctrls.set(V4L2_CID_ANALOGUE_GAIN, gain);\n \top.sensorControls = ctrls;\n \n \tControlList lensCtrls(lensCtrls_);\n","prefixes":["libcamera-devel","v4","2/3"]}