{"id":12512,"url":"https://patchwork.libcamera.org/api/1.1/patches/12512/?format=json","web_url":"https://patchwork.libcamera.org/patch/12512/","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":"<20210608074225.59862-4-umang.jain@ideasonboard.com>","date":"2021-06-08T07:42:25","name":"[libcamera-devel,v2,3/3] ipa: ipu3: Calculate frame duration from minimum VBLANK value","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"3ba6854f0f071001e876be7dfccd09004cfdb53e","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12512/mbox/","series":[{"id":2109,"url":"https://patchwork.libcamera.org/api/1.1/series/2109/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2109","date":"2021-06-08T07:42:22","name":"IPAIPU3 drive-by improvements","version":2,"mbox":"https://patchwork.libcamera.org/series/2109/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12512/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12512/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 1162BC3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Jun 2021 07:42:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C44C46892E;\n\tTue,  8 Jun 2021 09:42:44 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C37668928\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Jun 2021 09:42:43 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.251.226.98])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 51601E71;\n\tTue,  8 Jun 2021 09:42:41 +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=\"T++RZiwz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623138162;\n\tbh=/DsO1KS8zSViahVeRlWJBzPZPZsC+CIWJU/8rg56Gyk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=T++RZiwzqEnoxi9NO0oH28zpYnt1097Zq47GuFsYAV+qtu8JwYH/C8ddD/RY2uruX\n\tTaO0LDBOV/al0qf3NSJEV0qUo4BUPB65JMm5ju82HV70uH3Olsdhts0rb6o/3SvCee\n\tQRkbqiX0l33ZdWMnSX35s37mVkAdRxVIJGIhEP2Y=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  8 Jun 2021 13:12:25 +0530","Message-Id":"<20210608074225.59862-4-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210608074225.59862-1-umang.jain@ideasonboard.com>","References":"<20210608074225.59862-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Frame duration is hard-coded for CTS as per [1]. Ideally, to accurately\ncalculate the frame duration, it needs the VBLANK value from every\nframe's exposure. However, this particular bit is yet to be implemented\nin IPAIPU3.\n\nMeanwhile, we can atleast head in the right direction by not hard\ncoding the value, instead using the default VBLANK value as reported\nby the sensor. Update the existing \\todo, to use the derived VBLANK\nvalue as and when it's available from each frame exposure.\n\n[1] 6c5f3fe6ced7 (\"ipa: ipu3: Set output frame duration metadata\")\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nTested-by: Paul Elder <paul.elder@ideasonboard.com>\nTested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/ipu3/ipu3.cpp | 16 +++++++++++++---\n 1 file changed, 13 insertions(+), 3 deletions(-)","diff":"diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 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","prefixes":["libcamera-devel","v2","3/3"]}