{"id":10938,"url":"https://patchwork.libcamera.org/api/patches/10938/?format=json","web_url":"https://patchwork.libcamera.org/patch/10938/","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":"<20210121174633.382334-3-jacopo@jmondi.org>","date":"2021-01-21T17:46:30","name":"[libcamera-devel,2/5] libcamera: ipu3: Register FrameDurations control","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"045fdaa165deb9c135ed92c30a4a1885cd734d42","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/10938/mbox/","series":[{"id":1594,"url":"https://patchwork.libcamera.org/api/series/1594/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1594","date":"2021-01-21T17:46:28","name":"android: Report frame durations","version":1,"mbox":"https://patchwork.libcamera.org/series/1594/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10938/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10938/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 C5FADC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Jan 2021 17:46:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BD2756820A;\n\tThu, 21 Jan 2021 18:46:44 +0100 (CET)","from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A11C468206\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Jan 2021 18:46:42 +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 relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 6E17CFF80E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Jan 2021 17:46:42 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 21 Jan 2021 18:46:30 +0100","Message-Id":"<20210121174633.382334-3-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.29.2","In-Reply-To":"<20210121174633.382334-1-jacopo@jmondi.org>","References":"<20210121174633.382334-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 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 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 329b9d51cf1b..50b03008c0fb 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 / 1e6f);\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","2/5"]}