From patchwork Thu Mar 3 15:53:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 15405 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 86617BF415 for ; Thu, 3 Mar 2022 15:53:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EFD0E6115E; Thu, 3 Mar 2022 16:53:18 +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="oX9T+bgi"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 77688601FF for ; Thu, 3 Mar 2022 16:53:17 +0100 (CET) Received: from perceval.ideasonboard.com (unknown [103.251.226.47]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DAAE3885; Thu, 3 Mar 2022 16:53:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1646322797; bh=v2UbwatISs5zDa+89ZTr+iPSWNJWaen13JpRJ9n5w24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oX9T+bgiCpq28n3WQmJMHkbhmxxnOMmr4ZzE6kgF3kFpwI0fJdss8VcwfDGG16ZB4 WTvyEIS1kq+E+F0LREAw53D9O9UGmNgG9NLIV2iPlcjLco+i+Zut/QJ5DWX6+18OI3 ZYALPW5VQDxJAzUsHUhglLDeVp4oOBMT8VIv+JwM= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 21:23:05 +0530 Message-Id: <20220303155305.525877-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220301075919.201968-1-umang.jain@ideasonboard.com> References: <20220301075919.201968-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] ipa: ipu3: Drop sensor controls private members from IPAIPU3 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" Drop exposure, gain private members from IPAIPU3 because the values are handled directly via IPAFrameContext. Move the default vblank value from IPAIPU3 to IPASessionContext structure as it is a default static value not expected to change for a session. Signed-off-by: Umang Jain --- src/ipa/ipu3/ipa_context.h | 1 + src/ipa/ipu3/ipu3.cpp | 29 +++++++++-------------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h index e7c49828..d993359a 100644 --- a/src/ipa/ipu3/ipa_context.h +++ b/src/ipa/ipu3/ipa_context.h @@ -33,6 +33,7 @@ struct IPASessionConfiguration { } agc; struct { + int32_t defVBlank; utils::Duration lineDuration; } sensor; }; diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 4b6852a7..7b190217 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -164,11 +164,6 @@ private: IPACameraSensorInfo sensorInfo_; - /* Camera sensor controls. */ - uint32_t defVBlank_; - uint32_t exposure_; - uint32_t gain_; - /* Interface to the Camera Helper */ std::unique_ptr camHelper_; @@ -185,15 +180,16 @@ private: */ void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls) { + const ControlInfo vBlank = sensorControls.find(V4L2_CID_VBLANK)->second; + context_.configuration.sensor.defVBlank = vBlank.def().get(); + const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second; int32_t minExposure = v4l2Exposure.min().get(); int32_t 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(); - gain_ = minGain; /* * When the AGC computes the new exposure values for a frame, it needs @@ -427,14 +423,6 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, */ ctrls_ = configInfo.sensorControls; - const auto itVBlank = ctrls_.find(V4L2_CID_VBLANK); - if (itVBlank == ctrls_.end()) { - LOG(IPAIPU3, Error) << "Can't find VBLANK control"; - return -EINVAL; - } - - defVBlank_ = itVBlank->second.def().get(); - calculateBdsGrid(configInfo.bdsOutputSize); /* Clean frameContext at each reconfiguration. */ @@ -600,6 +588,7 @@ void IPAIPU3::parseStatistics(unsigned int frame, const ipu3_uapi_stats_3a *stats) { double lineDuration = context_.configuration.sensor.lineDuration.get(); + int32_t vBlank = context_.configuration.sensor.defVBlank; ControlList ctrls(controls::controls); for (auto const &algo : algorithms_) @@ -608,7 +597,7 @@ void IPAIPU3::parseStatistics(unsigned int frame, setControls(frame); /* \todo Use VBlank value calculated from each frame exposure. */ - int64_t frameDuration = (defVBlank_ + sensorInfo_.outputSize.height) * lineDuration; + int64_t frameDuration = (vBlank + sensorInfo_.outputSize.height) * lineDuration; ctrls.set(controls::FrameDuration, frameDuration); ctrls.set(controls::AnalogueGain, context_.frameContext.sensor.gain); @@ -644,12 +633,12 @@ void IPAIPU3::setControls(unsigned int frame) IPU3Action op; op.op = ActionSetSensorControls; - exposure_ = context_.frameContext.agc.exposure; - gain_ = camHelper_->gainCode(context_.frameContext.agc.gain); + int32_t exposure = context_.frameContext.agc.exposure; + int32_t gain = camHelper_->gainCode(context_.frameContext.agc.gain); ControlList ctrls(ctrls_); - ctrls.set(V4L2_CID_EXPOSURE, static_cast(exposure_)); - ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast(gain_)); + ctrls.set(V4L2_CID_EXPOSURE, static_cast(exposure)); + ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast(gain)); op.sensorControls = ctrls; queueFrameAction.emit(frame, op);