From patchwork Wed Jul 2 13:10:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 23722 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 7ED04C3237 for ; Wed, 2 Jul 2025 13:11:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2B1E968E49; Wed, 2 Jul 2025 15:11:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="BnnlczO1"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 38CBC68E3C for ; Wed, 2 Jul 2025 15:10:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751461857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v4OB7kRoKtkWnF2hAc77YkiW5L5NzoXHyJdNzgGfpls=; b=BnnlczO1B0EzAq68Yv2T5Lwo9+vsXORi0s4NM8xB5SxdT0qd3krnINDeWpB8nGMvfDM/Na myh4IYUOZoNQ26H9NiW/Q2fTuuIbHfmKssBJqce87UNSOIN7Dc5cHuJ0DP5h/lQhtf1fvA 8sAvhw8L8D1PWKu2VxIjykwPsRtvIzM= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-657-wbJLoy3lN_iNmdpxnw9EAQ-1; Wed, 02 Jul 2025 09:10:54 -0400 X-MC-Unique: wbJLoy3lN_iNmdpxnw9EAQ-1 X-Mimecast-MFC-AGG-ID: wbJLoy3lN_iNmdpxnw9EAQ_1751461853 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0ADE81955D4E; Wed, 2 Jul 2025 13:10:53 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.33.1]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 40D121944CD1; Wed, 2 Jul 2025 13:10:51 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Kieran Bingham , =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= , Laurent Pinchart Subject: [PATCH v12 06/12] config: Look up pipelines match list in configuration file Date: Wed, 2 Jul 2025 15:10:25 +0200 Message-ID: <20250702131032.47654-7-mzamazal@redhat.com> In-Reply-To: <20250702131032.47654-1-mzamazal@redhat.com> References: <20250702131032.47654-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 7hx_7mKPsv_aKJJ4mtl68jnr1XwTDmkB-rMuUT3bl94_1751461853 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true 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" Let's add a configuration file item for the pipelines match list. The configuration snippet: configuration: pipelines_match_list: rkisp1,simple Signed-off-by: Milan Zamazal --- include/libcamera/internal/global_configuration.h | 3 ++- src/libcamera/camera_manager.cpp | 10 ++++++---- src/libcamera/global_configuration.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/libcamera/internal/global_configuration.h b/include/libcamera/internal/global_configuration.h index b9f6d134a..d1751ee7c 100644 --- a/include/libcamera/internal/global_configuration.h +++ b/include/libcamera/internal/global_configuration.h @@ -48,7 +48,8 @@ public: const std::initializer_list confPath) const; std::optional> envListOption( const char *const envVariable, - const std::initializer_list confPath) const; + const std::initializer_list confPath, + const std::string delimiter = ":") const; private: bool loadFile(const std::filesystem::path &fileName); diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index c47fd3677..8123ae9e3 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -111,14 +111,16 @@ void CameraManager::Private::createPipelineHandlers() * file and only fallback on environment variable or all handlers, if * there is no configuration file. */ - const char *pipesList = - utils::secure_getenv("LIBCAMERA_PIPELINES_MATCH_LIST"); - if (pipesList) { + const auto pipesList = + configuration().envListOption("LIBCAMERA_PIPELINES_MATCH_LIST", + { "pipelines_match_list" }, + ","); + 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 : utils::split(pipesList, ",")) { + for (const auto &pipeName : pipesList.value()) { const PipelineHandlerFactoryBase *factory; factory = PipelineHandlerFactoryBase::getFactoryByName(pipeName); if (!factory) diff --git a/src/libcamera/global_configuration.cpp b/src/libcamera/global_configuration.cpp index cb01eff22..2ac6191dc 100644 --- a/src/libcamera/global_configuration.cpp +++ b/src/libcamera/global_configuration.cpp @@ -176,6 +176,7 @@ std::optional GlobalConfiguration::envOption( * \brief Return values of the configuration option from a file or environment * \param[in] envVariable Environment variable to get the value from * \param[in] confPath The same as in GlobalConfiguration::option + * \param[in] delimiter Items separator in the environment variable * * This helper looks first at the given environment variable and if it is * defined (even if it is empty) then it splits its value by semicolons and @@ -192,11 +193,12 @@ std::optional GlobalConfiguration::envOption( */ std::optional> GlobalConfiguration::envListOption( const char *const envVariable, - const std::initializer_list confPath) const + const std::initializer_list confPath, + const std::string delimiter) const { const char *envValue = utils::secure_getenv(envVariable); if (envValue) { - auto items = utils::split(envValue, ":"); + auto items = utils::split(envValue, delimiter); return std::vector(items.begin(), items.end()); } return listOption(confPath);