From patchwork Tue Dec 9 18:09:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaac Scott X-Patchwork-Id: 25391 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 D0F3CBD1F1 for ; Tue, 9 Dec 2025 18:10:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E40BA6142D; Tue, 9 Dec 2025 19:10:08 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RJpoGrBd"; 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 52B4E61418 for ; Tue, 9 Dec 2025 19:10:05 +0100 (CET) Received: from isaac-ThinkPad-T16-Gen-2.infra.iob (cpc90716-aztw32-2-0-cust408.18-1.cable.virginm.net [86.26.101.153]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8744163B; Tue, 9 Dec 2025 19:10:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1765303804; bh=v4OEVzqe3atiP1slGBUgV57ioCK4aFm197YFbG2eKHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJpoGrBd6QUnfXt0dsoStPlmx4jv3T5hIFNjqFRCgZzZYAMCfLYwfadPijci3X1kt 7duSpKN3bD66vmq5FssPCVugscDXZAB4n13G8X/uLdhXP+eebn4jD5Bp77x7XtJBiZ DSha1bLnGBogbKDnlIQaOG4Ok/KPnlUqb4tw/42M= From: Isaac Scott To: libcamera-devel@lists.libcamera.org Cc: Isaac Scott Subject: [RFC PATCH 2/6] ipa: rkisp1: Let all controls be optional Date: Tue, 9 Dec 2025 18:09:50 +0000 Message-ID: <20251209180954.332392-3-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251209180954.332392-1-isaac.scott@ideasonboard.com> References: <20251209180954.332392-1-isaac.scott@ideasonboard.com> MIME-Version: 1.0 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" Some sensors do not have support for controls such as exposure and gain. These are represented by the new camera_sensor_basic class. To allow these sensors to be compatible with the rkisp1 pipeline handler, we must allow the rkisp1 IPA to be able to initialise with these controls not being required. Check the list of controls supported by the sensor before attempting to use them during IPA initialisation. Signed-off-by: Isaac Scott --- src/ipa/rkisp1/rkisp1.cpp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 61d3d1f6f..9fee33de2 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -227,15 +227,24 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig, const std::map &streamConfig, ControlInfoMap *ipaControls) { + int32_t minExposure = 0; + int32_t minGain = 0; + int32_t maxExposure = 0; + int32_t maxGain = 0; + sensorControls_ = ipaConfig.sensorControls; const auto itExp = sensorControls_.find(V4L2_CID_EXPOSURE); - int32_t minExposure = itExp->second.min().get(); - int32_t maxExposure = itExp->second.max().get(); + if (itExp != sensorControls_.end()) { + minExposure = itExp->second.min().get(); + maxExposure = itExp->second.max().get(); + } const auto itGain = sensorControls_.find(V4L2_CID_ANALOGUE_GAIN); - int32_t minGain = itGain->second.min().get(); - int32_t maxGain = itGain->second.max().get(); + if (itGain != sensorControls_.end()) { + minGain = itGain->second.min().get(); + maxGain = itGain->second.max().get(); + } LOG(IPARkISP1, Debug) << "Exposure: [" << minExposure << ", " << maxExposure @@ -249,8 +258,11 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig, context_.configuration.paramFormat = ipaConfig.paramFormat; const IPACameraSensorInfo &info = ipaConfig.sensorInfo; - const ControlInfo vBlank = sensorControls_.find(V4L2_CID_VBLANK)->second; - context_.configuration.sensor.defVBlank = vBlank.def().get(); + if (sensorControls_.idmap().find(V4L2_CID_VBLANK) != sensorControls_.idmap().end()) { + const ControlInfo vBlank = sensorControls_.find(V4L2_CID_VBLANK)->second; + context_.configuration.sensor.defVBlank = vBlank.def().get(); + } + context_.configuration.sensor.size = info.outputSize; context_.configuration.sensor.lineDuration = info.minLineLength * 1.0s / info.pixelRate; @@ -392,6 +404,12 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo, { ControlInfoMap::Map ctrlMap = rkisp1Controls; + if (sensorControls.idmap().find(V4L2_CID_EXPOSURE) == sensorControls.idmap().end()) { + LOG(IPARkISP1, Debug) << "Sensor does not support V4L2_CID_EXPOSURE," + << " cannot compute exposure time limits"; + return; + } + /* * Compute exposure time limits from the V4L2_CID_EXPOSURE control * limits and the line duration.