From patchwork Mon Jun 27 16:27:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16394 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 E8455BD808 for ; Mon, 27 Jun 2022 16:28:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 85E4965648; Mon, 27 Jun 2022 18:28:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656347283; bh=FuSvLWC6rEDGiyWw4GH9+mSsVBs1AMYnTSQKdxD+VlI=; 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=prIp1BM5lgzrUZhsYMTK0HWB3eQslrmzMC00t6i+45uLIcTvR7cQoo898orP3TJM1 OxpPKU9yFfYcBk62VJD+t2P72JpVAE54Wahcgb+7MktylnByUTqhekrUKzbK5R4HSQ qNvxyytkVzNg8yVW/ZxXWb98uBSfYeBvx6usAWTPVxNOUwSZrxj/EZUb2K77s2Gfae LV0P/sDAK+j45LJ9acVsVHDZRWbsQansVnP/k3fVRCqv3xGdW0LtVQh+cdlmVmxWFv xF9MecBdvOdRN1ECIzPFqp2EgcOeccxydVAUn67WCFZpOuSbur9NuBVOcy5s1Esx4w ZSLC7nPlvzezA== Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7984265640 for ; Mon, 27 Jun 2022 18:27:53 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 9AA8320004; Mon, 27 Jun 2022 16:27:52 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Mon, 27 Jun 2022 18:27:30 +0200 Message-Id: <20220627162732.33160-14-jacopo@jmondi.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627162732.33160-1-jacopo@jmondi.org> References: <20220627162732.33160-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 13/15] libcamera: ipu3: ipa: Use an updated lineDuration 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 IPA module computes the lineDuration value in the init() function only, and uses it when processing statistics to recompute the shutter duration. As the lineDuration varies when a new mode is applied to the sensor, computing it once at IPA initialization time is not enough. Re-calculate the line duration value at IPA configure() time to make sure the module always uses an updated value. Signed-off-by: Jacopo Mondi --- include/libcamera/ipa/ipu3.mojom | 3 +-- src/ipa/ipu3/ipu3.cpp | 9 ++++----- src/libcamera/pipeline/ipu3/ipu3.cpp | 7 +------ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index 5818cd3a6846..64fe65fdd5fc 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -17,8 +17,7 @@ struct IPAConfigInfo { }; interface IPAIPU3Interface { - init(libcamera.IPASettings settings, - libcamera.IPACameraSensorInfo sensorInfo) + init(libcamera.IPASettings settings) => (int32 ret); start() => (int32 ret); stop(); diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 3efbc84c4ef1..1f80a10bc48d 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -132,8 +132,7 @@ namespace ipa::ipu3 { class IPAIPU3 : public IPAIPU3Interface { public: - int init(const IPASettings &settings, - const IPACameraSensorInfo &sensorInfo) override; + int init(const IPASettings &settings) override; int start() override; void stop() override; @@ -181,6 +180,8 @@ void IPAIPU3::updateSessionConfiguration(const IPAConfigInfo &info) { const IPACameraSensorInfo &sensorInfo = info.sensorInfo; context_.configuration.sensor.vBlank = sensorInfo.vblank; + context_.configuration.sensor.lineDuration = sensorInfo.lineLength * 1.0s + / sensorInfo.pixelRate; const ControlInfoMap &sensorControls = info.sensorControls; @@ -234,8 +235,7 @@ bool IPAIPU3::validateSensorControls() * handler, computes the limits of the controls it handles and returns * them in the \a ipaControls output parameter. */ -int IPAIPU3::init(const IPASettings &settings, - const IPACameraSensorInfo &sensorInfo) +int IPAIPU3::init(const IPASettings &settings) { camHelper_ = CameraSensorHelperFactory::create(settings.sensorModel); if (camHelper_ == nullptr) { @@ -247,7 +247,6 @@ int IPAIPU3::init(const IPASettings &settings, /* Clean context */ context_.configuration = {}; - context_.configuration.sensor.lineDuration = sensorInfo.lineLength * 1.0s / sensorInfo.pixelRate; /* Construct our Algorithms */ algorithms_.push_back(std::make_unique()); diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 815530dd640b..44e65d9f2d46 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1267,12 +1267,7 @@ int IPU3CameraData::loadIPA() if (ret) return ret; - IPACameraSensorInfo sensorInfo{}; - ret = sensor->sensorInfo(&sensorInfo); - if (ret) - return ret; - - ret = ipa_->init(IPASettings{ "", sensor->model() }, sensorInfo); + ret = ipa_->init(IPASettings{ "", sensor->model() }); if (ret) { LOG(IPU3, Error) << "Failed to initialise the IPU3 IPA"; return ret;