[{"id":15541,"web_url":"https://patchwork.libcamera.org/comment/15541/","msgid":"<YEa0rneryTL+4Ilz@pendragon.ideasonboard.com>","date":"2021-03-08T23:35:10","subject":"Re: [libcamera-devel] [PATCH v3 2/5] libcamera: ipu3: Register\n\tFrameDurations control","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Feb 22, 2021 at 11:52:19AM +0100, Jacopo Mondi wrote:\n> Register the FrameDurations control in the IPU3 pipeline handler\n> computed using the vertical blanking limits and the sensor\n> pixel rate as parameters.\n> \n> The FrameDurations control limits should be updated everytime a new\n> configuration is applied to the sensor.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 33 +++++++++++++++++++++++++++-\n>  1 file changed, 32 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 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\nShould this be dropped as it's now included in a comment added in patch\n1/5 ?\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\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 *","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 2F363BD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Mar 2021 23:35:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A961568A92;\n\tTue,  9 Mar 2021 00:35:45 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C3096051F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Mar 2021 00:35:43 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 056FA99;\n\tTue,  9 Mar 2021 00:35:41 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"SsSrYhV/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1615246542;\n\tbh=ZNgIqVu8NWEpvl5768txtZWGNeqCqbztMV3BXj8DY0I=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=SsSrYhV/yYghh4Fgchkd4dKuqMkzJeTJ3c30LWRYxAZJlt702pPrC2DhHSXhM1NHt\n\tsCVKxXChDxTO8RDo0+H8Wokmdm4nKib+75W70eQvAhqq1Sv2yIPSbPaRecy/1UmeJE\n\tLdL8LIudubPWDRlIE/RpF+baQLhzsraMzqnU7HUY=","Date":"Tue, 9 Mar 2021 01:35:10 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YEa0rneryTL+4Ilz@pendragon.ideasonboard.com>","References":"<20210222105222.393677-1-jacopo@jmondi.org>\n\t<20210222105222.393677-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210222105222.393677-3-jacopo@jmondi.org>","Subject":"Re: [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>","Cc":"libcamera-devel@lists.libcamera.org","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>"}}]