From patchwork Mon Aug 31 14:48:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 28156 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by patchwork.libcamera.org (Postfix) with ESMTPS id 22587C3260 for ; Mon, 31 Aug 2026 20:16:52 +0000 (UTC) Received: from monstersaurus.ideasonboard.com (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 01ECC324 for ; Mon, 31 Aug 2026 22:15:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1788207322; bh=mq5+HZG16t6Po9Zh97fcxkeu/vXyEGsoFz2JhD/VUfQ=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Resent-From:Resent-To:From; b=asVgXyVSUCGAhgr2ygDImWvwlqlNQXxMs4H+b8ZzpT1yIhV6q1ea5/2ZDDCLvQrv7 2MfImDODU1w7JmIaVrv6VPBdBRDpunX3mpBHSWsTk/ENNT8qz7F+u9DM1jp58+39Gk We2KZKPpwJCnMumrZ1kTkgaYvzChcv+9wymgSHKc= Delivered-To: kbingham@ideasonboard.com Received: from perceval.ideasonboard.com by perceval.ideasonboard.com with LMTP id cFwgGNaTlWr3YhoA4E0KoQ (envelope-from ) for ; Mon, 31 Aug 2026 16:46:46 +0200 Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by perceval.ideasonboard.com (Postfix) with ESMTPS id CC5C6593; Mon, 31 Aug 2026 16:46:45 +0200 (CEST) Authentication-Results: perceval.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=st9vx9w7; dkim-atps=neutral Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 856CF68562; Mon, 31 Aug 2026 16:48:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="st9vx9w7"; 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 108C768450 for ; Mon, 31 Aug 2026 16:48:11 +0200 (CEST) Received: from pb-laptop.local (185.221.143.32.nat.pool.zt.hu [185.221.143.32]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C80F8324; Mon, 31 Aug 2026 16:46:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1788187601; bh=dnroCPr0+VXm3d7ZinAjueEax/kYsLgjPgdsbHyc6+o=; h=From:To:Cc:Subject:Date:From; b=st9vx9w78jbnwQOs2LWch3bcTcUn+PSJl1PsuraCtgn0eL3AX7y/vgncYO260+87l 5HOlvhoV8Su1wl/goU3cA6HPb5sLlwUkoKUSU6goDAmaoZj6NKgIW88yZ/C6FO1sMV QdW4wQptf8BmbSY+ofLWu+76Mt3sPePaZ0Y/Xq54= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Alexi Birlinger , julien.vuillaumier@nxp.com, Robert Mader , Milan Zamazal Subject: [PATCH v1] libcamera: pipeline: simple: Rework software-isp/converter selection Date: Mon, 31 Aug 2026 16:48:07 +0200 Message-ID: <20260831144807.654907-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 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" X-TUID: nwRSGxDtlcRS Resent-From: Kieran Bingham Resent-To: parsemail@patchwork.libcamera.org Commit a19f72569558 ("libcamera: simple: Set the number of software ISP streams to 2") introduced an assertion to ensure that no converter is present when using the software-isp. However, it was not noticed that the earlier commit 4a5ebcf675a4 ("libcamera: simple: Enable SoftISP for imx7-csi") enabled software-isp for "imx7-csi", and since that driver also has an associated converter, and if it is found, the assertion will abort. To resolve the above situation, apply the following rules when deciding whether to use the software-isp or one of the available converters: 1. if the configuration file selects `software_isp: true`, then use that; 2. if at least one converter is available, use the first available one; 3. if the configuration file does not disable the software-isp and the static configuration allows it, use that; 4. otherwise, continue without either Link: https://patchwork.libcamera.org/patch/27955/ Signed-off-by: Barnabás Pőcze Reviewed-by: Milan Zamazal --- src/libcamera/pipeline/simple/simple.cpp | 41 ++++++++++++++++-------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index ca98e74790..991f542c5d 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -250,7 +250,7 @@ struct SimplePipelineInfo { * * The Software ISP can't be used together with the converters. */ - bool swIspEnabled; + bool swIspAllowed; }; namespace { @@ -459,7 +459,7 @@ private: std::map entities_; std::shared_ptr converter_; - bool swIspEnabled_; + bool swIspEnabled_ = false; }; /* ----------------------------------------------------------------------------- @@ -1869,40 +1869,55 @@ bool SimplePipelineHandler::matchDevice(std::shared_ptr media, const SimplePipelineInfo &info, DeviceEnumerator *enumerator) { - unsigned int numStreams = 1; - + struct { + std::shared_ptr dev; + unsigned int streams; + } converter = {}; for (const auto &[name, streams] : info.converters) { DeviceMatch converterMatch(name); - converter_ = acquireMediaDevice(enumerator, converterMatch); - if (converter_) { - numStreams = streams; + converter.dev = acquireMediaDevice(enumerator, converterMatch); + if (converter.dev) { + converter.streams = streams; break; } } - swIspEnabled_ = info.swIspEnabled; + std::optional swIspEnabled; const GlobalConfiguration &configuration = cameraManager()->_d()->configuration(); for (const ValueNode &entry : configuration.configuration()["pipelines"]["simple"]["supported_devices"] .asList()) { auto name = entry["driver"].get(); - if (name == info.driver) { - swIspEnabled_ = entry["software_isp"].get().value_or(swIspEnabled_); + if (name != info.driver) + continue; + + swIspEnabled = entry["software_isp"].get(); + if (swIspEnabled) { LOG(SimplePipeline, Debug) << "Configuration file overrides software ISP for " - << info.driver << " to " << swIspEnabled_; + << info.driver << " to " << *swIspEnabled; break; } } - if (swIspEnabled_) { + const bool useSwIsp = + (swIspEnabled && *swIspEnabled) || /* forced by configuration */ + (info.swIspAllowed && /* allowed by static configuration */ + !converter.dev && /* and there is no converter */ + !(swIspEnabled && !*swIspEnabled)); /* and not disabled by configuration */ + + unsigned int numStreams = 1; /* Only 1 "raw" stream by default. */ + if (useSwIsp) { /* * When the software ISP is enabled, the simple pipeline handler * exposes the raw stream, giving a total of two streams. This * is mutually exclusive with the presence of a converter. */ - ASSERT(!converter_); numStreams = 2; + swIspEnabled_ = true; + } else if (converter.dev) { + converter_ = std::move(converter.dev); + numStreams = converter.streams; } /* Locate the sensors. */