From patchwork Mon Feb 28 13:22:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 15395 X-Patchwork-Delegate: umang.jain@ideasonboard.com 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 CE17FBE08A for ; Mon, 28 Feb 2022 13:23:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8D6836116E; Mon, 28 Feb 2022 14:23:05 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="CVogriZ2"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1B76D61160 for ; Mon, 28 Feb 2022 14:23:03 +0100 (CET) Received: from perceval.ideasonboard.com (unknown [103.251.226.77]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0053E486; Mon, 28 Feb 2022 14:23:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1646054582; bh=0C9PSKJ5Z4uWhTEiG/4JaQgkVdK4q+o2Fo+2YOIDUWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CVogriZ2EebZwUZgLWUbNLak6BYCP9gqCqABu0Xz8DLA9Sx9a6PCl6L9IGqvan03V YEvtzAjas442XOaeDco79micP17thNulWsD8C6WdxuL4bAcOn0dadtr3ZV2ioreIW+ 5LcpSnkGBFg3dHUH/46PoLtmEKwZZbuO8X8DCP4M= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Feb 2022 18:52:50 +0530 Message-Id: <20220228132250.116211-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220228132250.116211-1-umang.jain@ideasonboard.com> References: <20220228132250.116211-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] ipa: ipu3: Consolidate querying exposure and gain limits 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The exposure and gain limits are queried as part of IPAIPU3::configure(). Consolidate it. Signed-off-by: Umang Jain --- src/ipa/ipu3/ipu3.cpp | 44 +++++++++++++------------------------------ 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 2fab4ee0..33fcf59b 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -196,12 +196,14 @@ private: void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls) { const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second; - int32_t minExposure = v4l2Exposure.min().get(); - int32_t maxExposure = v4l2Exposure.max().get(); + minExposure_ = v4l2Exposure.min().get(); + maxExposure_ = v4l2Exposure.max().get(); + exposure_ = minExposure_; const ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second; - int32_t minGain = v4l2Gain.min().get(); - int32_t maxGain = v4l2Gain.max().get(); + minGain_ = v4l2Gain.min().get(); + maxGain_ = v4l2Gain.max().get(); + gain_ = minGain_; /* * When the AGC computes the new exposure values for a frame, it needs @@ -210,10 +212,10 @@ void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls) * * \todo take VBLANK into account for maximum shutter speed */ - context_.configuration.agc.minShutterSpeed = minExposure * lineDuration_; - context_.configuration.agc.maxShutterSpeed = maxExposure * lineDuration_; - context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain); - context_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain); + context_.configuration.agc.minShutterSpeed = minExposure_ * lineDuration_; + context_.configuration.agc.maxShutterSpeed = maxExposure_ * lineDuration_; + context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain_); + context_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain_); } /** @@ -430,32 +432,12 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, */ ctrls_ = configInfo.sensorControls; - const auto itExp = ctrls_.find(V4L2_CID_EXPOSURE); - if (itExp == ctrls_.end()) { - LOG(IPAIPU3, Error) << "Can't find exposure control"; - return -EINVAL; - } - - const auto itGain = ctrls_.find(V4L2_CID_ANALOGUE_GAIN); - if (itGain == ctrls_.end()) { - LOG(IPAIPU3, Error) << "Can't find gain control"; - return -EINVAL; - } - const auto itVBlank = ctrls_.find(V4L2_CID_VBLANK); if (itVBlank == ctrls_.end()) { LOG(IPAIPU3, Error) << "Can't find VBLANK control"; return -EINVAL; } - minExposure_ = itExp->second.min().get(); - maxExposure_ = itExp->second.max().get(); - exposure_ = minExposure_; - - minGain_ = itGain->second.min().get(); - maxGain_ = itGain->second.max().get(); - gain_ = minGain_; - defVBlank_ = itVBlank->second.def().get(); /* Clean context at configuration */ @@ -465,12 +447,12 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, lineDuration_ = sensorInfo_.lineLength * 1.0s / sensorInfo_.pixelRate; - /* Update the camera controls using the new sensor settings. */ - updateControls(sensorInfo_, ctrls_, ipaControls); - /* Update the IPASessionConfiguration using the sensor settings. */ updateSessionConfiguration(ctrls_); + /* Update the camera controls using the new sensor settings. */ + updateControls(sensorInfo_, ctrls_, ipaControls); + for (auto const &algo : algorithms_) { int ret = algo->configure(context_, configInfo); if (ret)