From patchwork Tue Mar 26 11:24:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 19802 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 131DEBD160 for ; Tue, 26 Mar 2024 11:26:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6A66263037; Tue, 26 Mar 2024 12:26:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="FELgYXHM"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8CE3F61C41 for ; Tue, 26 Mar 2024 12:26:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711452370; 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; bh=uaQOuMyYz7XzT4AZC36fIlHXF2v3BTwQKoTpKnMt3l4=; b=FELgYXHMHMHlMSzBinmcz78ho3MFjrn/SgSowBfr7QYWqm06s8Djn0Mcqhsin14MhXnSIn HlDvpLUV9HD2UmQgcUYS62HHYNYQ9at28FJzIKjA4KPUMZG1Zcree36nKh7h4LoTIkmYT0 hc1PsphTehIcvrdz5GHcpfrHO76Sotk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-XfW-AuGoM8u0zA_yqg8cHg-1; Tue, 26 Mar 2024 07:26:08 -0400 X-MC-Unique: XfW-AuGoM8u0zA_yqg8cHg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id A9638101A526 for ; Tue, 26 Mar 2024 11:26:08 +0000 (UTC) Received: from nuthatch.brq.redhat.com (unknown [10.43.17.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 352D43C20; Tue, 26 Mar 2024 11:26:08 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal Subject: [RFC PATCH 00/11] Add global configuration file Date: Tue, 26 Mar 2024 12:24:03 +0100 Message-ID: <20240326112419.503286-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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" This patch series introduces global configuration file for libcamera, to provide runtime configuration means other than environment variables. Instead of, or in addition to, the growing list of configuration environment variables, the whole configuration can be specified in a single configuration file. This is both simpler and more flexible. This is not a replacement for specific configuration files already present in libcamera. The patches implement what is needed to introduce the configuration file providing configuration options corresponding to the current environment variables. They demonstrate how to deal with the key points that must be considered. See commit messages for more details. The configuration file is a YAML file. It is looked up in user’s home directory or, if not present, in system-wide libcamera directories. Environment variables, if set, still take precedence. This RFC is not exhaustive, there can be future enhancements, most notably configuration file validation to avoid confusions caused by typos etc. The current patch series is based on the last posted software ISP branch. Milan Zamazal (11): config: Introduce global runtime configuration config: Move global configuration to base config: Look up logging levels in the configuration file config: Add configuration retrieval helpers config: Look up log file in configuration file config: Look up log color configuration in configuration file config: Look up rpi config path in configuration file config: Look up IPA configurables in configuration file config: Look up RkISP1 tuning file in configuration file config: Allow enabling software ISP in runtime config: Add global configuration documentation Documentation/index.rst | 2 +- Documentation/meson.build | 2 +- ...ariables.rst => runtime_configuration.rst} | 56 ++++++- .../libcamera/internal/global_configuration.h | 63 +++++++ include/libcamera/internal/meson.build | 1 + src/libcamera/base/global_configuration.cpp | 154 ++++++++++++++++++ src/libcamera/base/log.cpp | 24 ++- src/libcamera/base/meson.build | 15 ++ src/libcamera/{ => base}/yaml_parser.cpp | 0 src/libcamera/camera_manager.cpp | 9 + src/libcamera/ipa_manager.cpp | 23 ++- src/libcamera/ipa_proxy.cpp | 8 +- src/libcamera/meson.build | 14 -- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 +- .../pipeline/rpi/common/pipeline_base.cpp | 8 +- src/libcamera/pipeline/simple/simple.cpp | 10 ++ src/libcamera/process.cpp | 11 +- 17 files changed, 371 insertions(+), 38 deletions(-) rename Documentation/{environment_variables.rst => runtime_configuration.rst} (76%) create mode 100644 include/libcamera/internal/global_configuration.h create mode 100644 src/libcamera/base/global_configuration.cpp rename src/libcamera/{ => base}/yaml_parser.cpp (100%)