From patchwork Fri Sep 18 07:59:48 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 28322 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 BEFE4C3292 for ; Fri, 18 Sep 2026 08:07:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5EA6B6872F; Fri, 18 Sep 2026 10:07:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="OI0rWIoL"; dkim-atps=neutral Received: from mail-wr2-x10.google.com (mail-wr2-x10.google.com [IPv6:2a00:1450:4864:30::10]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9245F6872C for ; Fri, 18 Sep 2026 10:07:48 +0200 (CEST) Received: by mail-wr2-x10.google.com with SMTP id ffacd0b85a97d-48435bcf9d9so56215f8f.1 for ; Fri, 18 Sep 2026 01:07:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1789718868; x=1790323668; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Qz5jf9P35F/52+lUmbLJSC1RBbr7eDCTO3oQLAEKVGg=; b=OI0rWIoL5NQhfvVnNtvjWpmnly/wNEy25QcJ5Jxac9AxQSkvEo0znNPa4n/DwP/uJS bFSq35dIHWrYsc0m4/DM5finWR8qKNIiw6xShrqf7Yv74KWOz4incDiPSNLns9S6uoEi CYPav/uMBr96zP2D9d5hE5k5A9RC2Yf+AlSd8GtDqGXhCquNwerx/y1i8pS05yHPAgHm TgMhIDO/KPB5ssFm0lKJiQ0wVGauj6RXZhB3cqEqNJkFqwP792wOuNKhmUKju8h5dUJb Eo/miupnvd5hvly8GkKC6aKhqd77yYrAKzhYeGo6pQAMZzDjaclFDXP5Bz3sTIdX935f rtTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789718868; x=1790323668; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Qz5jf9P35F/52+lUmbLJSC1RBbr7eDCTO3oQLAEKVGg=; b=mgZNG9OLd9kqxltSw3RBIp56pE8QMKst0R9j8F4QnVX79z87xDiICuM6+H/CtnTYvu yzQjlz/wSOQq6YSMAoNJZi79ZhdUdXsIhGT1w4SStivbcN6ibaEZJ1HCDHoS//8UQCgc H2AC/NgYl+BLNUJYBfrJ2EN4BM3ngFEt1ritU46hrJms+TFkxT5A3tuU5bSocDB7SNDw 7AxZpYEu06kOAqvMmZpCOhnvN9llWCBrAvn7tyZLxZptWnHvoJa+WYPwi+O05xppYpId fPiSAvqHL7/y/yWyyJUKQXpCfbunHFtG9ivbGQLhAf7i7j/I68bkCm+wfOOo6j4F00hV dPiA== X-Gm-Message-State: AFuF++kvNSb007Gwp5jkfjkxEC9I0DVVCdUTxDvcqpHFRzP5v+4bD29g btCm1L6b6Dt2urR4JGKVjVWgRKAhnwEILoSQKqPV+hk6bbT9aeEwcIhAvWcYOVgDaju0btZgJtA JoAK92lc= X-Gm-Gg: AYBFou3llkPdfSrPrveG4Jc7KJl+YT9Du0ALI40WEePEsXOAgEifaEby5+uNCZe95vd B+AcAogDnqAZGyOsPT7LniiHQhTfSy5wgwvCaXvJ7OaJeiVssZXf+cad5Kl2MgzFu1u8vHT+mxq WhylkdKDSMZD1XATee3IVagbWA51JFFAlj3T3j/X7cE1QAn2Od+0lWCuluM7520ue5uQH6pffCJ dRTWBfwuNv5EWdo96ucyfrQwGUNXTMQnL8zIXBF4muYKYuJqeVzN988UTyPT03N3UNNjOyf0rik rnVvFXZeIW2+SkH6vWLkfyVSC5ij/hhAzlL4MG6/eMIie7wXpBum2GhTPu89VMFucVfcTdn55TY r+lzsCvnsugFunohcxj8jm6bLLuBn+7xHx9acPAqGSuIsbaZP15f2LbUpoOlCkFGhEDrEnDosh9 xjsgnLbUakGiFE7i4IifoCbvAUfgG7ZREx189ZTA6Vu37h/y8H0SyNB32OtlqGQG9RpdExcuixI dmY1ZY4G0KYanhDea74YA6cQYDkvOc7l8V4rySCZga2G4GYmHN3lbuU0x78JgrSYOy/T6a28772 4xRLON6d6grerUis7v99mzpKjcHDhkD9Clv8/6KvO0GDgVxYtTX7i1kD0axqVvDzVT9/fG2rR4r i3rHjyFRJa70GqfZJFYuOlAFtBRRtGiauLtg= X-Received: by 2002:a05:6000:41d8:b0:487:342:d144 with SMTP id ffacd0b85a97d-4871fa33199mr1219448f8f.2.1789718868015; Fri, 18 Sep 2026 01:07:48 -0700 (PDT) Received: from naush-dell.pitowers.org ([2a00:1098:3142:1f:45e3:df8b:2b18:6253]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-487203f077fsm1742230f8f.26.2026.09.18.01.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 01:07:47 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [RFC PATCH v1 10/20] libcamera: camera_manager: Extract the pipeline handler factory list Date: Fri, 18 Sep 2026 08:59:48 +0100 Message-ID: <20260918080734.1228227-11-naush@raspberrypi.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260918080734.1228227-1-naush@raspberrypi.com> References: <20260918080734.1228227-1-naush@raspberrypi.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" Split the selection of the pipeline handler factories to consider out of createPipelineHandlers() into a pipelineFactories() helper returning them in match order. This is done to avoid code duplication as the camera enumeration (added in a future commit) needs the same list. Signed-off-by: Naushir Patuck --- include/libcamera/internal/camera_manager.h | 1 + src/libcamera/camera_manager.cpp | 37 ++++++++++++++------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/include/libcamera/internal/camera_manager.h b/include/libcamera/internal/camera_manager.h index 89c8e4eda766..e6df676bb655 100644 --- a/include/libcamera/internal/camera_manager.h +++ b/include/libcamera/internal/camera_manager.h @@ -53,6 +53,7 @@ protected: private: int init(); + std::vector pipelineFactories() const; void createPipelineHandlers(); void pipelineFactoryMatch(const PipelineHandlerFactoryBase *factory); std::shared_ptr findMatchingHandler(const MediaDevice *media); diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index bd9cc155b961..55cf650b8e66 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -120,8 +120,15 @@ int CameraManager::Private::init() return 0; } -void CameraManager::Private::createPipelineHandlers() +/* + * Retrieve the pipeline handler factories to consider, in match order. When a + * list of preferred pipelines is defined in the configuration, the ordered list + * is exclusive. Otherwise all factories are returned in registration order. + */ +std::vector CameraManager::Private::pipelineFactories() const { + std::vector selected; + /* * \todo Try to read handlers and order from configuration * file and only fallback on environment variable or all handlers, if @@ -129,11 +136,9 @@ void CameraManager::Private::createPipelineHandlers() */ const auto pipesList = configuration().listOption({ "pipelines_match_list" }); + + /* The configured list is exclusive, skip all other factories. */ if (pipesList.has_value()) { - /* - * When a list of preferred pipelines is defined, iterate - * through the ordered list to match the enumerated devices. - */ for (const auto &pipeName : pipesList.value()) { const PipelineHandlerFactoryBase *factory; factory = PipelineHandlerFactoryBase::getFactoryByName(pipeName); @@ -143,10 +148,10 @@ void CameraManager::Private::createPipelineHandlers() LOG(Camera, Debug) << "Found listed pipeline handler '" << pipeName << "'"; - pipelineFactoryMatch(factory); + selected.push_back(factory); } - return; + return selected; } const std::vector &factories = @@ -157,12 +162,20 @@ void CameraManager::Private::createPipelineHandlers() LOG(Camera, Debug) << "Found registered pipeline handler '" << factory->name() << "'"; - /* - * Try each pipeline handler until it exhaust - * all pipelines it can provide. - */ - pipelineFactoryMatch(factory); + selected.push_back(factory); } + + return selected; +} + +void CameraManager::Private::createPipelineHandlers() +{ + /* + * Try each pipeline handler until it exhausts + * all pipelines it can provide. + */ + for (const PipelineHandlerFactoryBase *factory : pipelineFactories()) + pipelineFactoryMatch(factory); } void CameraManager::Private::pipelineFactoryMatch(const PipelineHandlerFactoryBase *factory)