[{"id":37280,"web_url":"https://patchwork.libcamera.org/comment/37280/","msgid":"<20251211015753.GB24488@pendragon.ideasonboard.com>","date":"2025-12-11T01:57:53","subject":"Re: [RFC PATCH 2/6] ipa: rkisp1: Let all controls be optional","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Dec 09, 2025 at 06:09:50PM +0000, Isaac Scott wrote:\n> Some sensors do not have support for controls such as exposure and gain.\n\nWhat sensors is that ? Do the driver lack support for those controls, or\nis it a hardware issue ?\n\n> These are represented by the new camera_sensor_basic class. To allow\n> these sensors to be compatible with the rkisp1 pipeline handler, we must\n> allow the rkisp1 IPA to be able to initialise with these controls not\n> being required.\n> \n> Check the list of controls supported by the sensor before attempting to\n> use them during IPA initialisation.\n> \n> Signed-off-by: Isaac Scott <isaac.scott@ideasonboard.com>\n> ---\n>  src/ipa/rkisp1/rkisp1.cpp | 30 ++++++++++++++++++++++++------\n>  1 file changed, 24 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 61d3d1f6f..9fee33de2 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -227,15 +227,24 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n>  \t\t\t const std::map<uint32_t, IPAStream> &streamConfig,\n>  \t\t\t ControlInfoMap *ipaControls)\n>  {\n> +\tint32_t minExposure = 0;\n> +\tint32_t minGain = 0;\n> +\tint32_t maxExposure = 0;\n> +\tint32_t maxGain = 0;\n> +\n>  \tsensorControls_ = ipaConfig.sensorControls;\n>  \n>  \tconst auto itExp = sensorControls_.find(V4L2_CID_EXPOSURE);\n> -\tint32_t minExposure = itExp->second.min().get<int32_t>();\n> -\tint32_t maxExposure = itExp->second.max().get<int32_t>();\n> +\tif (itExp != sensorControls_.end()) {\n> +\t\tminExposure = itExp->second.min().get<int32_t>();\n> +\t\tmaxExposure = itExp->second.max().get<int32_t>();\n> +\t}\n>  \n>  \tconst auto itGain = sensorControls_.find(V4L2_CID_ANALOGUE_GAIN);\n> -\tint32_t minGain = itGain->second.min().get<int32_t>();\n> -\tint32_t maxGain = itGain->second.max().get<int32_t>();\n> +\tif (itGain != sensorControls_.end()) {\n> +\t\tminGain = itGain->second.min().get<int32_t>();\n> +\t\tmaxGain = itGain->second.max().get<int32_t>();\n> +\t}\n>  \n>  \tLOG(IPARkISP1, Debug)\n>  \t\t<< \"Exposure: [\" << minExposure << \", \" << maxExposure\n> @@ -249,8 +258,11 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n>  \tcontext_.configuration.paramFormat = ipaConfig.paramFormat;\n>  \n>  \tconst IPACameraSensorInfo &info = ipaConfig.sensorInfo;\n> -\tconst ControlInfo vBlank = sensorControls_.find(V4L2_CID_VBLANK)->second;\n> -\tcontext_.configuration.sensor.defVBlank = vBlank.def().get<int32_t>();\n> +\tif (sensorControls_.idmap().find(V4L2_CID_VBLANK) != sensorControls_.idmap().end()) {\n> +\t\tconst ControlInfo vBlank = sensorControls_.find(V4L2_CID_VBLANK)->second;\n> +\t\tcontext_.configuration.sensor.defVBlank = vBlank.def().get<int32_t>();\n> +\t}\n> +\n>  \tcontext_.configuration.sensor.size = info.outputSize;\n>  \tcontext_.configuration.sensor.lineDuration = info.minLineLength * 1.0s / info.pixelRate;\n>  \n> @@ -392,6 +404,12 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n>  {\n>  \tControlInfoMap::Map ctrlMap = rkisp1Controls;\n>  \n> +\tif (sensorControls.idmap().find(V4L2_CID_EXPOSURE) == sensorControls.idmap().end()) {\n> +\t\tLOG(IPARkISP1, Debug) << \"Sensor does not support V4L2_CID_EXPOSURE,\"\n> +\t\t\t\t      << \" cannot compute exposure time limits\";\n> +\t\treturn;\n> +\t}\n> +\n>  \t/*\n>  \t * Compute exposure time limits from the V4L2_CID_EXPOSURE control\n>  \t * limits and the line duration.","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 A4C94BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Dec 2025 01:58:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6325A6150A;\n\tThu, 11 Dec 2025 02:58:13 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DBF9F606D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Dec 2025 02:58:11 +0100 (CET)","from pendragon.ideasonboard.com (fs96f9c361.tkyc007.ap.nuro.jp\n\t[150.249.195.97])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id CC0391352; \n\tThu, 11 Dec 2025 02:58:09 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"cYebfGbV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1765418290;\n\tbh=SRGqGLsugWJQVWQ8Fy3DfVp85UXYTkoClZUSBj5M3hI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=cYebfGbVJRcnmk6sCnu3tZP9Y47l5wO8hrHRB6R1vGgJrPmrbb7mb3yc2MmvYCtWe\n\tIAvgfNEHH/CHS3BTMa6hTZDUa0H3+bX0pm15hxsh41TJ/lW+1UgSzuj5CNlpPEWyyw\n\tKMBjC+uxNB/5vKaNQHnMrSNh9MFQuobLY/rPgpS4=","Date":"Thu, 11 Dec 2025 10:57:53 +0900","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Isaac Scott <isaac.scott@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH 2/6] ipa: rkisp1: Let all controls be optional","Message-ID":"<20251211015753.GB24488@pendragon.ideasonboard.com>","References":"<20251209180954.332392-1-isaac.scott@ideasonboard.com>\n\t<20251209180954.332392-3-isaac.scott@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251209180954.332392-3-isaac.scott@ideasonboard.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]