From patchwork Thu Aug 18 09:44:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 17167 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 36097C3275 for ; Thu, 18 Aug 2022 09:44:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E972961FD4; Thu, 18 Aug 2022 11:44:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660815879; bh=+uybV4qf1Od8cQF4W78+yEOQts6G9bmIEMK8TVkNhb4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RG2nAC31cAHURskJ9qN9hYAMCOV5nWRgS/4GI9TT19axSzu65N3gUIiropNYCBQzt UQg7T63Hm/LgEKDwQOjvyKtmVh2ZzBXQA6mhGCXWVZMudkinKtymhn0PBTUak4ca3s cVug6twIRPe0eTs7C/gGsRAiqfmk1xEHgQGXgcbqmxRJWwcZQW82FxKNe+Q+PoTXJu bg4d05fS8Qa/GX4A7CGUEiGehWbsWeNh3JQ5LNb+FXTLvvImNHxu0pZqm7BhIT3uSw k3DIPHIvbvvlhrf1l1R3L5jhmbgFHh2itwbJCw84RsB7Bs012LRKKczHx++8VMJejp JA3gjFoQdjAzA== Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0C73E61FCD for ; Thu, 18 Aug 2022 11:44:35 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 3454FFF808; Thu, 18 Aug 2022 09:44:33 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Aug 2022 11:44:05 +0200 Message-Id: <20220818094410.1671-13-jacopo@jmondi.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220818094410.1671-1-jacopo@jmondi.org> References: <20220818094410.1671-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 12/17] ipa: ipu3: Compute line duration at configure() time X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The IPU3 IPA module computes the sensor line duration at initialization time only. As the sensor line duration varies according to the applied configuration, re-compute it at IPA::configure() time as well. While at it, remove the initialization of lineDuration_ from IPA::init() as it only generates confusion to see it there. Signed-off-by: Jacopo Mondi --- src/ipa/ipu3/ipu3.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index eabf179aaa0a..077cf8050508 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -164,7 +164,7 @@ private: void updateControls(const IPACameraSensorInfo &sensorInfo, const ControlInfoMap &sensorControls, ControlInfoMap *ipaControls); - void updateSessionConfiguration(const ControlInfoMap &sensorControls); + void updateSessionConfiguration(const IPAConfigInfo &configInfo); bool validateSensorControls(); @@ -194,8 +194,11 @@ std::string IPAIPU3::logPrefix() const * \brief Compute IPASessionConfiguration using the sensor information and the * sensor V4L2 controls */ -void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls) +void IPAIPU3::updateSessionConfiguration(const IPAConfigInfo &configInfo) { + const IPACameraSensorInfo &sensorInfo = configInfo.sensorInfo; + const ControlInfoMap &sensorControls = configInfo.sensorControls; + const ControlInfo vBlank = sensorControls.find(V4L2_CID_VBLANK)->second; context_.configuration.sensor.defVBlank = vBlank.def().get(); @@ -218,6 +221,8 @@ void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls) * * \todo take VBLANK into account for maximum shutter speed */ + context_.configuration.sensor.lineDuration = sensorInfo.lineLength * 1.0s + / sensorInfo.pixelRate; context_.configuration.agc.minShutterSpeed = minExposure * context_.configuration.sensor.lineDuration; context_.configuration.agc.maxShutterSpeed = maxExposure * context_.configuration.sensor.lineDuration; context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain); @@ -330,7 +335,6 @@ int IPAIPU3::init(const IPASettings &settings, /* Clean context */ context_.configuration = {}; - context_.configuration.sensor.lineDuration = sensorInfo.lineLength * 1.0s / sensorInfo.pixelRate; /* Load the tuning data file. */ File file(settings.configurationFile.c_str()); @@ -504,7 +508,7 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, updateControls(sensorInfo_, sensorCtrls_, ipaControls); /* Update the IPASessionConfiguration using the sensor settings. */ - updateSessionConfiguration(sensorCtrls_); + updateSessionConfiguration(configInfo); for (auto const &algo : algorithms()) { int ret = algo->configure(context_, configInfo);