{"id":11018,"url":"https://patchwork.libcamera.org/api/1.1/patches/11018/?format=json","web_url":"https://patchwork.libcamera.org/patch/11018/","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":"<20210126173008.446321-3-jacopo@jmondi.org>","date":"2021-01-26T17:30:04","name":"[libcamera-devel,v2,2/6] libcamera: ipu3: Register FrameDurations control","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"9bd2918d2b01e501c8559cc2709a24300377aa83","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/11018/mbox/","series":[{"id":1612,"url":"https://patchwork.libcamera.org/api/1.1/series/1612/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1612","date":"2021-01-26T17:30:02","name":"android: Report frame durations","version":2,"mbox":"https://patchwork.libcamera.org/series/1612/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11018/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11018/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 F0EFFBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jan 2021 17:29:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 84E9E6832D;\n\tTue, 26 Jan 2021 18:29:56 +0100 (CET)","from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E267268318\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 18:29:53 +0100 (CET)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id B14A7E0009\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 17:29:53 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Jan 2021 18:30:04 +0100","Message-Id":"<20210126173008.446321-3-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.30.0","In-Reply-To":"<20210126173008.446321-1-jacopo@jmondi.org>","References":"<20210126173008.446321-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 2/6] libcamera: ipu3: Register\n\tFrameDurations control","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Register the FrameDurations control in the IPU3 pipeline handler\ncomputed using the vertical blanking limits and the current\nconfiguration pixel rate as parameters.\n\nThe FrameDurations control limits should be updated everytime a new\nconfiguration is applied to the sensor.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 35 +++++++++++++++++++++++++++-\n 1 file changed, 34 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex db0d6b91be70..fe5694f9893a 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -754,6 +754,7 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n \t\treturn ret;\n \n \tControlInfoMap::Map controls = IPU3Controls;\n+\tconst ControlInfoMap &sensorControls = sensor->controls();\n \n \t/*\n \t * Compute exposure time limits.\n@@ -766,7 +767,6 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n \t */\n \tdouble lineDuration = sensorInfo.lineLength\n \t\t\t    / (sensorInfo.pixelRate / 1e6);\n-\tconst ControlInfoMap &sensorControls = sensor->controls();\n \tconst ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n \tint32_t minExposure = v4l2Exposure.min().get<int32_t>() * lineDuration;\n \tint32_t maxExposure = v4l2Exposure.max().get<int32_t>() * lineDuration;\n@@ -781,6 +781,39 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n \tcontrols[&controls::ExposureTime] = ControlInfo(minExposure, maxExposure,\n \t\t\t\t\t\t\tdefExposure);\n \n+\t/*\n+\t * Compute the frame duration limits.\n+\t *\n+\t * \\todo The frame duration limits depend on the sensor configuration.\n+\t * Initialize the control using the frame sizes and pixel rate of the\n+\t * current configuration.\n+\t *\n+\t * The frame length is computed assuming a fixed line length combined\n+\t * with the vertical frame sizes.\n+\t */\n+\tconst ControlInfo &v4l2HBlank = sensorControls.find(V4L2_CID_HBLANK)->second;\n+\tuint32_t hblank = v4l2HBlank.def().get<int32_t>();\n+\tuint32_t lineLength = sensorInfo.outputSize.width + hblank;\n+\n+\tconst ControlInfo &v4l2VBlank = sensorControls.find(V4L2_CID_VBLANK)->second;\n+\tstd::array<uint32_t, 3> frameHeights{\n+\t\t(v4l2VBlank.min().get<int32_t>() + sensorInfo.outputSize.height),\n+\t\t(v4l2VBlank.max().get<int32_t>() + sensorInfo.outputSize.height),\n+\t\t(v4l2VBlank.def().get<int32_t>() + sensorInfo.outputSize.height),\n+\t};\n+\n+\tstd::vector<int64_t> frameDurations;\n+\tframeDurations.reserve(3);\n+\tstd::transform(frameHeights.begin(), frameHeights.end(),\n+\t\t       std::back_inserter(frameDurations),\n+\t\t       [&](int32_t frameHeight) {\n+\t\t\t       int64_t frameSize = lineLength * frameHeight;\n+\t\t\t       return frameSize / (sensorInfo.pixelRate / 1000000U);\n+\t\t       });\n+\tcontrols[&controls::FrameDurations] = ControlInfo(frameDurations[0],\n+\t\t\t\t\t\t\t  frameDurations[1],\n+\t\t\t\t\t\t\t  frameDurations[2]);\n+\n \t/*\n \t * Compute the scaler crop limits.\n \t *\n","prefixes":["libcamera-devel","v2","2/6"]}