{"id":11358,"url":"https://patchwork.libcamera.org/api/patches/11358/?format=json","web_url":"https://patchwork.libcamera.org/patch/11358/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210222105222.393677-3-jacopo@jmondi.org>","date":"2021-02-22T10:52:19","name":"[libcamera-devel,v3,2/5] libcamera: ipu3: Register FrameDurations control","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"021a8d0bce9aab1d605beb4b7fe8de9caf5dcbad","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11358/mbox/","series":[{"id":1717,"url":"https://patchwork.libcamera.org/api/series/1717/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1717","date":"2021-02-22T10:52:17","name":"android: Report frame durations","version":3,"mbox":"https://patchwork.libcamera.org/series/1717/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11358/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11358/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 3D81BBD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Feb 2021 10:52:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 94B1C68A14;\n\tMon, 22 Feb 2021 11:52:01 +0100 (CET)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B7A3868A05\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Feb 2021 11:51:58 +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 relay11.mail.gandi.net (Postfix) with ESMTPSA id 8501D10000F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Feb 2021 10:51:58 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 22 Feb 2021 11:52:19 +0100","Message-Id":"<20210222105222.393677-3-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.30.0","In-Reply-To":"<20210222105222.393677-1-jacopo@jmondi.org>","References":"<20210222105222.393677-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 2/5] 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 sensor\npixel 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 | 33 +++++++++++++++++++++++++++-\n 1 file changed, 32 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex f867b5913b27..5c24f6a0c451 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -824,6 +824,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@@ -836,7 +837,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@@ -851,6 +851,37 @@ 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\tv4l2VBlank.min().get<int32_t>() + sensorInfo.outputSize.height,\n+\t\tv4l2VBlank.max().get<int32_t>() + sensorInfo.outputSize.height,\n+\t\tv4l2VBlank.def().get<int32_t>() + sensorInfo.outputSize.height,\n+\t};\n+\n+\tstd::array<int64_t, 3> frameDurations;\n+\tfor (unsigned int i = 0; i < frameHeights.size(); ++i) {\n+\t\tuint64_t frameSize = lineLength * frameHeights[i];\n+\t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n+\t}\n+\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","v3","2/5"]}