From patchwork Tue Mar 1 07:59:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 15396 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 0D3A3BE08A for ; Tue, 1 Mar 2022 07:59:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5FDBE61166; Tue, 1 Mar 2022 08:59:29 +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="HMv/AnAI"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A3795604ED for ; Tue, 1 Mar 2022 08:59:28 +0100 (CET) Received: from perceval.ideasonboard.com (unknown [103.251.226.77]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3723E478; Tue, 1 Mar 2022 08:59:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1646121568; bh=CBorNZRKGUit1VO0vApRkeK2qU8sy04nVtGQasmr6Ts=; h=From:To:Cc:Subject:Date:From; b=HMv/AnAIcVShV4zhiAFS51Chqh+WPqNyYs1o1ws9W0QGOZloNRyoDuGPtpkOaMiFU UMxN2KUruyT1RxxuFqPa9f4MKmGLwwZcsO4z7LGsQXHzluq2/kgQYRulvIQLaEx7AT gW1XgqxSmoMFO8k/wen3cx1r58AlheIDuFab5pOA= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Tue, 1 Mar 2022 13:29:19 +0530 Message-Id: <20220301075919.201968-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] ipa: ipu3: Consolidate querying of 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 required for AGC configuration handled in IPAIPU3::updateSessionConfiguration(), which is happening already. Therefore the max/min private members in IPAIPU3 class for exposure/gain serve no use except setting initial values of exposure_ and gain_ members. Drop the max/min private members from IPAIPU3 class and set initial gain_ and exposure_ in IPAIPU3::updateSessionConfiguration(). Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham --- Changes in v2: - Split into separate patch - Prepped over "v4 ipa: ipu3: Misc clean up" - Don't include max/min exposure/gain members in IPASessionConfiguration, as they aren't used anywhere. --- src/ipa/ipu3/ipu3.cpp | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 17324616..4b6852a7 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -167,11 +167,7 @@ private: /* Camera sensor controls. */ uint32_t defVBlank_; uint32_t exposure_; - uint32_t minExposure_; - uint32_t maxExposure_; uint32_t gain_; - uint32_t minGain_; - uint32_t maxGain_; /* Interface to the Camera Helper */ std::unique_ptr camHelper_; @@ -192,10 +188,12 @@ 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(); + 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 @@ -429,32 +427,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(); calculateBdsGrid(configInfo.bdsOutputSize); From patchwork Thu Mar 3 15:53:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 15406 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 2B860BF415 for ; Thu, 3 Mar 2022 15:53:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CEA1A60475; Thu, 3 Mar 2022 16:53:37 +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="oxpYR1c9"; 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 8DEF5601FF for ; Thu, 3 Mar 2022 16:53:36 +0100 (CET) Received: from perceval.ideasonboard.com (unknown [103.251.226.47]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3DBC9885; Thu, 3 Mar 2022 16:53:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1646322816; bh=hF/YEMh/XHW/4FWsj5zrsbFi1cD4pp/tDPJQuo2ZL0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oxpYR1c9bBPrHulUgBg6u7RHku/OT+WDo0EDEmY9Fpe2yNVLz6zNd7optnnZgr4nb ZOspq/UkxAQawupSfwlwxHd9PiGZT4xEuRBS+2f1Xqk+6zwWsph7psVDhCgU/Mo5UM 4j4pJS1Q3urdWt6OrG2eSD8qrnSCqvAdbX0URYwI= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 21:23:22 +0530 Message-Id: <20220303155322.525946-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 2/2] ipa: ipu3: Ensure controls exists in updateSessionConfiguration() 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" Add a control-not-found error checking for the controls being queried in IPAIPU3::updateSessionConfiguration(). Signed-off-by: Umang Jain --- src/ipa/ipu3/ipu3.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 7b190217..6e4aa674 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -180,16 +180,31 @@ private: */ void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls) { - const ControlInfo vBlank = sensorControls.find(V4L2_CID_VBLANK)->second; - context_.configuration.sensor.defVBlank = vBlank.def().get(); + const auto itVBlank = sensorControls.find(V4L2_CID_VBLANK); + if (itVBlank == sensorControls.end()) { + LOG(IPAIPU3, Error) << "Can't find vblank control"; + return; + } - const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second; - int32_t minExposure = v4l2Exposure.min().get(); - int32_t maxExposure = v4l2Exposure.max().get(); + context_.configuration.sensor.defVBlank = itVBlank->second.def().get(); + + const auto itExp = sensorControls.find(V4L2_CID_EXPOSURE); + if (itExp == sensorControls.end()) { + LOG(IPAIPU3, Error) << "Can't find exposure control"; + return; + } + + int32_t minExposure = itExp->second.min().get(); + int32_t maxExposure = itExp->second.max().get(); + + const auto itGain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN); + if (itGain == sensorControls.end()) { + LOG(IPAIPU3, Error) << "Can't find analogue gain control"; + return; + } - const ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second; - int32_t minGain = v4l2Gain.min().get(); - int32_t maxGain = v4l2Gain.max().get(); + int32_t minGain = itGain->second.min().get(); + int32_t maxGain = itGain->second.max().get(); /* * When the AGC computes the new exposure values for a frame, it needs