From patchwork Sat Mar 5 17:28:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 15420 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 2D29ABE08A for ; Sat, 5 Mar 2022 17:29:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E29156118E; Sat, 5 Mar 2022 18:29:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1646501345; bh=Dra6j4U9wXK1bxGWxix8iPA+iBh2aObdr9gHvtZO8yQ=; 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=k/P+F6sYbtaKrKeAYdGJP+Lgu9jRcQb8NjrKwPK50FtHZynyRLIeH2gCbdouO1T4+ 7jXESkZU+3IsmvJfcTmoW2+5+zdbkptvAVwi+2cPuQfaAmYpghaeBcCMdmnrPoGmqM BfSXNK02QBLVEE0e48PCVKm1Fu1voM9ncd6jTYfWa5loN1+AhWfUxvFVIKpD6Rx28y znxTJly1DzxQZQ9O8838lFoDOdD5tyCKLHd6eMQoxy39V6td0QZMjTArJDAPQ1jISI DOZ7gDqzy8q7l5oxYGFbuMo2PVnPybbGa2zsMiGd0hKQlFaE/+KGLeY8QV8RJiJ0t3 P4/8vuz2pDpdg== 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 A4EC061190 for ; Sat, 5 Mar 2022 18:29:04 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="oeaboy7r"; dkim-atps=neutral Received: from perceval.ideasonboard.com (unknown [103.251.226.47]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 51F1F486; Sat, 5 Mar 2022 18:29:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1646501344; bh=Dra6j4U9wXK1bxGWxix8iPA+iBh2aObdr9gHvtZO8yQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oeaboy7rDCcmiw9C9s6wSSRmEl1RmfUzu6u7MkiXjKb06T1wO7wf7BUA0XbG6MTd7 S6L7JAs0sw5t8BZLvDIZiWmY0cbvxnawWoYMKRbBIKSaxuHO4Ss/Z0fPd8+czg3Qcv WgvO/ZsRxe+/8h6kryZojqCszJaps+aqehjFA8p8= To: libcamera-devel@lists.libcamera.org Date: Sat, 5 Mar 2022 22:58:49 +0530 Message-Id: <20220305172849.1022923-4-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220305172849.1022923-1-umang.jain@ideasonboard.com> References: <20220305172849.1022923-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/3] 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: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain 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 0df358ba..583d6b9a 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