[{"id":17471,"web_url":"https://patchwork.libcamera.org/comment/17471/","msgid":"<20210608074927.GM156622@pyrite.rasen.tech>","date":"2021-06-08T07:49:27","subject":"Re: [libcamera-devel] [PATCH v2 3/3] ipa: ipu3: Calculate frame\n\tduration from minimum VBLANK value","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Umang,\n\nOn Tue, Jun 08, 2021 at 01:12:25PM +0530, Umang Jain wrote:\n> Frame duration is hard-coded for CTS as per [1]. Ideally, to accurately\n> calculate the frame duration, it needs the VBLANK value from every\n> frame's exposure. However, this particular bit is yet to be implemented\n> in IPAIPU3.\n> \n> Meanwhile, we can atleast head in the right direction by not hard\n\ns/atleast/at least/\n\n> coding the value, instead using the default VBLANK value as reported\n> by the sensor. Update the existing \\todo, to use the derived VBLANK\n> value as and when it's available from each frame exposure.\n> \n> [1] 6c5f3fe6ced7 (\"ipa: ipu3: Set output frame duration metadata\")\n> \n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> Tested-by: Paul Elder <paul.elder@ideasonboard.com>\n> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/ipa/ipu3/ipu3.cpp | 16 +++++++++++++---\n>  1 file changed, 13 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 97ddb863..415ea9e5 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -66,6 +66,7 @@ private:\n>  \tIPACameraSensorInfo sensorInfo_;\n>  \n>  \t/* Camera sensor controls. */\n> +\tuint32_t defVBlank_;\n>  \tuint32_t exposure_;\n>  \tuint32_t minExposure_;\n>  \tuint32_t maxExposure_;\n> @@ -162,6 +163,12 @@ void IPAIPU3::configure(const IPAConfigInfo &configInfo)\n>  \t\treturn;\n>  \t}\n>  \n> +\tconst auto itVBlank = ctrls_.find(V4L2_CID_VBLANK);\n> +\tif (itVBlank == ctrls_.end()) {\n> +\t\tLOG(IPAIPU3, Error) << \"Can't find VBLANK control\";\n> +\t\treturn;\n> +\t}\n> +\n>  \tminExposure_ = std::max(itExp->second.min().get<int32_t>(), 1);\n>  \tmaxExposure_ = itExp->second.max().get<int32_t>();\n>  \texposure_ = minExposure_;\n> @@ -170,6 +177,8 @@ void IPAIPU3::configure(const IPAConfigInfo &configInfo)\n>  \tmaxGain_ = itGain->second.max().get<int32_t>();\n>  \tgain_ = minGain_;\n>  \n> +\tdefVBlank_ = itVBlank->second.def().get<int32_t>();\n> +\n>  \tparams_ = {};\n>  \n>  \tcalculateBdsGrid(configInfo.bdsOutputSize);\n> @@ -273,9 +282,10 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n>  \tif (agcAlgo_->updateControls())\n>  \t\tsetControls(frame);\n>  \n> -\t/* \\todo Populate this with real values */\n> -\tctrls.set(controls::FrameDuration,\n> -\t\t  static_cast<int64_t>(33334));\n> +\t/* \\todo Use VBlank value calculated from each frame exposure. */\n> +\tint64_t frameDuration = sensorInfo_.lineLength * (defVBlank_ + sensorInfo_.outputSize.height) /\n> +\t\t\t\t(sensorInfo_.pixelRate / 1e6);\n> +\tctrls.set(controls::FrameDuration, frameDuration);\n>  \n>  \tIPU3Action op;\n>  \top.op = ActionMetadataReady;\n> -- \n> 2.31.1\n>","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 B4253BD22E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Jun 2021 07:49:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 749EC6892D;\n\tTue,  8 Jun 2021 09:49:37 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F349C68928\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Jun 2021 09:49:35 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DB3323E6;\n\tTue,  8 Jun 2021 09:49:33 +0200 (CEST)"],"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=\"Q+GtSSpb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623138575;\n\tbh=ILhtXLIEXD1F33HVn/M5OkUoLMHy40fFptf5C525mMk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Q+GtSSpbXWxBa+e0XEJWr/udl90O0sT3sNniBVHbSLAibIArjuM5Vk3PGLr8BpPPJ\n\tKf3Vg6zA443YlKpsvSNrji3k3gDTLZAiEzFGwDft89vIK1fV3ZVdO+BBg+O5GX+86h\n\tku9Rj/tefU0PwttRNNRhgIKu2NIYA3kN/YN5l9IQ=","Date":"Tue, 8 Jun 2021 16:49:27 +0900","From":"paul.elder@ideasonboard.com","To":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<20210608074927.GM156622@pyrite.rasen.tech>","References":"<20210608074225.59862-1-umang.jain@ideasonboard.com>\n\t<20210608074225.59862-4-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20210608074225.59862-4-umang.jain@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 3/3] ipa: ipu3: Calculate frame\n\tduration from minimum VBLANK value","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","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]