{"id":15539,"url":"https://patchwork.libcamera.org/api/1.1/patches/15539/?format=json","web_url":"https://patchwork.libcamera.org/patch/15539/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220324142035.47338-4-umang.jain@ideasonboard.com>","date":"2022-03-24T14:20:35","name":"[libcamera-devel,v3,3/3] ipa: ipu3: Ensure controls exists in updateSessionConfiguration()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d27bbd6a4957190438cd7c87ac38c65100cd460f","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":{"id":12,"url":"https://patchwork.libcamera.org/api/1.1/users/12/?format=json","username":"uajain","first_name":"Umang","last_name":"Jain","email":"umang.jain@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/15539/mbox/","series":[{"id":2997,"url":"https://patchwork.libcamera.org/api/1.1/series/2997/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2997","date":"2022-03-24T14:20:32","name":"ipa: ipu3: Consolidate querying of exposure and gain limits","version":3,"mbox":"https://patchwork.libcamera.org/series/2997/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15539/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15539/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DA59AC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Mar 2022 14:20:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A1603604D5;\n\tThu, 24 Mar 2022 15:20:58 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 03B6E604C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Mar 2022 15:20:57 +0100 (CET)","from perceval.ideasonboard.com (unknown [103.86.18.100])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 35D4E1844;\n\tThu, 24 Mar 2022 15:20:54 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648131658;\n\tbh=O79HbxZc3dEQrPzwJu1mlJQvAduOUfEGbfMj49HOlIQ=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=mnETLy31HUqIBm7zCMJ7OCxxD5GgazE70RHuhEr52/sjognHP+5Rk+nSCVCC+hhjh\n\tqf6opiuqcqkQFZ2wRA71UYZ9s5NOGfWksMZCNebs1GaQ7IeymppPfeF2FFrbSRqm0c\n\tlXZEkQMqbP9ET5g/B22Czq/wDFjTrKInlQbjB8s8T4fRlOyYMi7IPTJq32Cl7apLfi\n\tX8N9jIXaBRGN4wTaQCzWiXfZeqJsHnzADSIIDGN1JFrcfemjjeGq/K/ctCEqAmlzE0\n\tC81KrzPQLRaV1DXbNTsYLUJ2Vp+vlyoxO9XKVYORtkKZJDaVfpgomVUsb+wHYJfiKI\n\tDmj240Njuny4Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648131656;\n\tbh=O79HbxZc3dEQrPzwJu1mlJQvAduOUfEGbfMj49HOlIQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Ra9myZ2IpmXhORTSOS3BRwIisrEPRE/kFOMK9U+nSiVDcS4ssiJJRlXhQrI9JZec3\n\tSAx01Sr/Az0c6GCnuf9jjuvmt05wY7250bU/oEZ33FQ48AtlQj5aVM8C57TPSNPaFQ\n\tT0P40cdE9Ssdv5AqAqpACEP5XM179AG9lhksnfvQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Ra9myZ2I\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 24 Mar 2022 19:50:35 +0530","Message-Id":"<20220324142035.47338-4-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20220324142035.47338-1-umang.jain@ideasonboard.com>","References":"<20220324142035.47338-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 3/3] ipa: ipu3: Ensure controls exists\n\tin updateSessionConfiguration()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a control-not-found error checking for the controls being\nqueried in IPAIPU3::updateSessionConfiguration(). If the control\nis not found, progagate the error back to the caller. This requires\na change in the function signature of private member function\nIPAIPU3::updateSessionConfiguration().\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/ipa/ipu3/ipu3.cpp | 44 +++++++++++++++++++++++++++++++------------\n 1 file changed, 32 insertions(+), 12 deletions(-)","diff":"diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 3717d893..66346728 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -149,7 +149,7 @@ private:\n \tvoid updateControls(const IPACameraSensorInfo &sensorInfo,\n \t\t\t    const ControlInfoMap &sensorControls,\n \t\t\t    ControlInfoMap *ipaControls);\n-\tvoid updateSessionConfiguration(const ControlInfoMap &sensorControls);\n+\tint updateSessionConfiguration(const ControlInfoMap &sensorControls);\n \tvoid processControls(unsigned int frame, const ControlList &controls);\n \tvoid fillParams(unsigned int frame, ipu3_uapi_params *params);\n \tvoid parseStatistics(unsigned int frame,\n@@ -180,18 +180,33 @@ private:\n  * \\brief Compute IPASessionConfiguration using the sensor information and the\n  * sensor V4L2 controls\n  */\n-void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)\n+int IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)\n {\n-\tconst ControlInfo vBlank = sensorControls.find(V4L2_CID_VBLANK)->second;\n-\tcontext_.configuration.sensor.defVBlank = vBlank.def().get<int32_t>();\n+\tconst auto itVBlank = sensorControls.find(V4L2_CID_VBLANK);\n+\tif (itVBlank == sensorControls.end()) {\n+\t\tLOG(IPAIPU3, Error) << \"Can't find vblank control\";\n+\t\treturn -EINVAL;\n+\t}\n \n-\tconst ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n-\tint32_t minExposure = v4l2Exposure.min().get<int32_t>();\n-\tint32_t maxExposure = v4l2Exposure.max().get<int32_t>();\n+\tcontext_.configuration.sensor.defVBlank = itVBlank->second.def().get<int32_t>();\n+\n+\tconst auto itExp = sensorControls.find(V4L2_CID_EXPOSURE);\n+\tif (itExp == sensorControls.end()) {\n+\t\tLOG(IPAIPU3, Error) << \"Can't find exposure control\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tint32_t minExposure = itExp->second.min().get<int32_t>();\n+\tint32_t maxExposure = itExp->second.max().get<int32_t>();\n \n-\tconst ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;\n-\tint32_t minGain = v4l2Gain.min().get<int32_t>();\n-\tint32_t maxGain = v4l2Gain.max().get<int32_t>();\n+\tconst auto itGain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN);\n+\tif (itGain == sensorControls.end()) {\n+\t\tLOG(IPAIPU3, Error) << \"Can't find analogue gain control\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tint32_t minGain = itGain->second.min().get<int32_t>();\n+\tint32_t maxGain = itGain->second.max().get<int32_t>();\n \n \t/*\n \t * When the AGC computes the new exposure values for a frame, it needs\n@@ -204,6 +219,8 @@ void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)\n \tcontext_.configuration.agc.maxShutterSpeed = maxExposure * context_.configuration.sensor.lineDuration;\n \tcontext_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain);\n \tcontext_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain);\n+\n+\treturn 0;\n }\n \n /**\n@@ -437,10 +454,13 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n \tupdateControls(sensorInfo_, sensorCtrls_, ipaControls);\n \n \t/* Update the IPASessionConfiguration using the sensor settings. */\n-\tupdateSessionConfiguration(sensorCtrls_);\n+\tint ret = updateSessionConfiguration(sensorCtrls_);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n \n \tfor (auto const &algo : algorithms_) {\n-\t\tint ret = algo->configure(context_, configInfo);\n+\t\tret = algo->configure(context_, configInfo);\n \t\tif (ret)\n \t\t\treturn ret;\n \t}\n","prefixes":["libcamera-devel","v3","3/3"]}