{"id":15538,"url":"https://patchwork.libcamera.org/api/1.1/patches/15538/?format=json","web_url":"https://patchwork.libcamera.org/patch/15538/","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":"<20220324142035.47338-3-umang.jain@ideasonboard.com>","date":"2022-03-24T14:20:34","name":"[libcamera-devel,v3,2/3] ipa: ipu3: Drop sensor controls private members from IPAIPU3","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"fa90fc690dbe1bd91b597c2f61857fffdc03910b","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/15538/mbox/","series":[{"id":2997,"url":"https://patchwork.libcamera.org/api/1.1/series/2997/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2997","date":"2022-03-24T14:20:32","name":"ipa: ipu3: Consolidate querying of exposure and gain limits","version":3,"mbox":"https://patchwork.libcamera.org/series/2997/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15538/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15538/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 768D4C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Mar 2022 14:20:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3E6CA604D4;\n\tThu, 24 Mar 2022 15:20:54 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5BD9B604C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Mar 2022 15:20:53 +0100 (CET)","from perceval.ideasonboard.com (unknown [103.86.18.100])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 44F851844;\n\tThu, 24 Mar 2022 15:20:50 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648131654;\n\tbh=zc39wk+H5OxlQO7xzQdrOPi/HFEGmd3msaMIDLF2/G8=;\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=0FfQLw1wmQBn7wyCXnmPPZp5UcdmXU4Z824kq3oDJ3M7pbGiW0fRo0y3DfH6PhWz7\n\t9roLrlEWuKhMuYwoPCwcManZ2xvwx5tkXUaflW9MQtkdTN6GtIPVzwqMi4E/cxYStX\n\t9743Tbm1/3DLgKMmDnAAcxdhHwLyjz/T0HJJZygM3lPb4d0YrqEZxl/h/bpjaI/thV\n\tcMLStRckd+XiOji5wBrKrBL70L/jAhxmnUzdcW5WS0EIiPmQQDw1VrUiDZBK3duufL\n\tXnQMrQBWPEhGzK0q9fC279HVoUxaod0/YneAFI9f/3zrbx99q50bAbqJoVw9QGk8+X\n\t6gDs/qHPGOE+Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648131653;\n\tbh=zc39wk+H5OxlQO7xzQdrOPi/HFEGmd3msaMIDLF2/G8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BQCbhlyaIY8/1X9SAomOkXcdpEhAE+MUGmGWCW1Ld63bS2SceHN0KRUayH80aQnYm\n\tEYE75lO00r/pyfeUVraIGzWM0dWqpMGxGtbTXD3WEHnhM/W7w1Y+VQkxrY7pZHhh7i\n\t6rUs6lClbdfyE/RGXlgVcOIftAi6A1ulIjLBWnnE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"BQCbhlya\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 24 Mar 2022 19:50:34 +0530","Message-Id":"<20220324142035.47338-3-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20220324142035.47338-1-umang.jain@ideasonboard.com>","References":"<20220324142035.47338-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 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 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>\nReviewed-by: Kieran Bingham <kieran.bingham@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 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","v3","2/3"]}