[{"id":34889,"web_url":"https://patchwork.libcamera.org/comment/34889/","msgid":"<9d60a7a6-8901-4966-a2d1-b29c378842fd@ideasonboard.com>","date":"2025-07-14T13:50:30","subject":"Re: [PATCH v13 05/12] config: Look up IPA configurables in\n\tconfiguration file","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 07. 11. 22:12 keltezéssel, Milan Zamazal írta:\n> This patch adds configuration options for environment variables used in\n> the IPA proxy.  Two utility functions configuration retrieval functions\n> are added, to retrieve lists of values.\n> \n> The configuration snippet:\n> \n>    configuration:\n>      ipa:\n>        config_paths:\n>        - config path 1\n>        - config path 2\n>        - ...\n>        module_paths:\n>        - module path 1\n>        - module path 2\n>        - ...\n>        proxy_paths:\n>        - proxy path 1\n>        - proxy path 2\n>        - ...\n>        force_isolation: BOOL\n> \n> LIBCAMERA_<IPA_NAME>_TUNING_FILE remains configurable only via the\n> environment variable; this is supposed to be used only for testing and\n> debugging and it's not clear what to do about IPA names like \"rpi/vc4\"\n> and \"rpi/pisp\" exactly.\n> \n> There are two ways to pass the configuration to the places where it is\n> needed: Either to pass it as an argument to the method calls that need\n> it, or to pass it to the class constructors and extract the needed\n> configuration from there.  This patch uses the second method as it is\n> less polluting the code.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>   .../libcamera/internal/global_configuration.h | 21 +++++++-\n>   include/libcamera/internal/ipa_manager.h      |  7 ++-\n>   include/libcamera/internal/ipa_proxy.h        |  8 ++-\n>   src/libcamera/camera_manager.cpp              |  2 +-\n>   src/libcamera/global_configuration.cpp        | 47 +++++++++++++++--\n>   src/libcamera/ipa_manager.cpp                 | 39 ++++++++------\n>   src/libcamera/ipa_proxy.cpp                   | 51 +++++++++----------\n>   .../module_ipa_proxy.cpp.tmpl                 |  4 +-\n>   .../module_ipa_proxy.h.tmpl                   |  2 +-\n>   9 files changed, 129 insertions(+), 52 deletions(-)\n> \n> [...]\n> diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp\n> index 9907b9615..468e0ddf8 100644\n> --- a/src/libcamera/ipa_proxy.cpp\n> +++ b/src/libcamera/ipa_proxy.cpp\n> @@ -7,13 +7,16 @@\n> \n>   #include \"libcamera/internal/ipa_proxy.h\"\n> \n> +#include <string>\n>   #include <sys/stat.h>\n>   #include <sys/types.h>\n>   #include <unistd.h>\n> +#include <vector>\n> \n>   #include <libcamera/base/log.h>\n>   #include <libcamera/base/utils.h>\n> \n> +#include \"libcamera/internal/global_configuration.h\"\n>   #include \"libcamera/internal/ipa_module.h\"\n> \n>   /**\n> @@ -48,10 +51,15 @@ LOG_DEFINE_CATEGORY(IPAProxy)\n>   /**\n>    * \\brief Construct an IPAProxy instance\n>    * \\param[in] ipam The IPA module\n> + * \\param[in] configuration The global configuration\n>    */\n> -IPAProxy::IPAProxy(IPAModule *ipam)\n> +IPAProxy::IPAProxy(IPAModule *ipam, const GlobalConfiguration &configuration)\n>   \t: valid_(false), state_(ProxyStopped), ipam_(ipam)\n\nconfigPaths_(configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\",\n                                          { \"ipa\", \"config_paths\" })\n                           .value_or({}))\n\nIf I'm not missing anything, I think it's fine to move the `value_or()` here\nand change the type, instead of doing it everywhere the members are used.\n\n\nRegards,\nBarnabás Pőcze\n\n\n>   {\n> +\tconfigPaths_ = configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\",\n> +\t\t\t\t\t\t   { \"ipa\", \"config_paths\" });\n> +\texecPaths_ = configuration.envListOption(\n> +\t\t\"LIBCAMERA_IPA_PROXY_PATH\", { \"ipa\", \"proxy_paths\" });\n>   }\n> [...]","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4BD7BC3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Jul 2025 13:50:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0A25468F45;\n\tMon, 14 Jul 2025 15:50:34 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7ACBD68F49\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Jul 2025 15:50:31 +0200 (CEST)","from [192.168.33.16] (185.221.140.39.nat.pool.zt.hu\n\t[185.221.140.39])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5807C1B24;\n\tMon, 14 Jul 2025 15:49:59 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"G0XEL1Yy\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1752500999;\n\tbh=irxwr0kXdzr+7R1kWoC7If2qsuu8v2S/ggWU70gfmag=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=G0XEL1YyGnNi9a0daoEPCLX10lcjldy+hAaJPUQs0ejpI5P4ObXXhLIMHBT4DKO9I\n\tymOyMIbFqtfyi8XQFRxCaH1Hbcbq+qiakMTRzOkZfv73illa/gBUHBE05ILSx7y+GD\n\thGHQsHpYzwNqZxL3maSUSZW/Fr63J5nfplZwLDBE=","Message-ID":"<9d60a7a6-8901-4966-a2d1-b29c378842fd@ideasonboard.com>","Date":"Mon, 14 Jul 2025 15:50:30 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v13 05/12] config: Look up IPA configurables in\n\tconfiguration file","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>, =?utf-8?q?Barnab?=\n\t=?utf-8?b?w6FzIFDFkWN6ZQ==?= <barnabas.pocze@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20250711201232.129264-1-mzamazal@redhat.com>\n\t<LqyMuCmx4Rl58Ie5o8SLtCpWIcllcxrO47Q5ncW_W_qdpTbiNK4SmPM5BevZjPEaUe7raK9r7yWO_OIFdvrbgA==@protonmail.internalid>\n\t<20250711201232.129264-6-mzamazal@redhat.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250711201232.129264-6-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34893,"web_url":"https://patchwork.libcamera.org/comment/34893/","msgid":"<85a556d6rj.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-07-14T17:29:42","subject":"Re: [PATCH v13 05/12] config: Look up IPA configurables in\n\tconfiguration file","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Barnabás,\n\nBarnabás Pőcze <barnabas.pocze@ideasonboard.com> writes:\n\n> Hi\n>\n> 2025. 07. 11. 22:12 keltezéssel, Milan Zamazal írta:\n>> This patch adds configuration options for environment variables used in\n>> the IPA proxy.  Two utility functions configuration retrieval functions\n>> are added, to retrieve lists of values.\n>> The configuration snippet:\n>>    configuration:\n>>      ipa:\n>>        config_paths:\n>>        - config path 1\n>>        - config path 2\n>>        - ...\n>>        module_paths:\n>>        - module path 1\n>>        - module path 2\n>>        - ...\n>>        proxy_paths:\n>>        - proxy path 1\n>>        - proxy path 2\n>>        - ...\n>>        force_isolation: BOOL\n>> LIBCAMERA_<IPA_NAME>_TUNING_FILE remains configurable only via the\n>> environment variable; this is supposed to be used only for testing and\n>> debugging and it's not clear what to do about IPA names like \"rpi/vc4\"\n>> and \"rpi/pisp\" exactly.\n>> There are two ways to pass the configuration to the places where it is\n>> needed: Either to pass it as an argument to the method calls that need\n>> it, or to pass it to the class constructors and extract the needed\n>> configuration from there.  This patch uses the second method as it is\n>> less polluting the code.\n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>   .../libcamera/internal/global_configuration.h | 21 +++++++-\n>>   include/libcamera/internal/ipa_manager.h      |  7 ++-\n>>   include/libcamera/internal/ipa_proxy.h        |  8 ++-\n>>   src/libcamera/camera_manager.cpp              |  2 +-\n>>   src/libcamera/global_configuration.cpp        | 47 +++++++++++++++--\n>>   src/libcamera/ipa_manager.cpp                 | 39 ++++++++------\n>>   src/libcamera/ipa_proxy.cpp                   | 51 +++++++++----------\n>>   .../module_ipa_proxy.cpp.tmpl                 |  4 +-\n>>   .../module_ipa_proxy.h.tmpl                   |  2 +-\n>>   9 files changed, 129 insertions(+), 52 deletions(-)\n>> [...]\n>> diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp\n>> index 9907b9615..468e0ddf8 100644\n>> --- a/src/libcamera/ipa_proxy.cpp\n>> +++ b/src/libcamera/ipa_proxy.cpp\n>> @@ -7,13 +7,16 @@\n>>   #include \"libcamera/internal/ipa_proxy.h\"\n>> +#include <string>\n>>   #include <sys/stat.h>\n>>   #include <sys/types.h>\n>>   #include <unistd.h>\n>> +#include <vector>\n>>   #include <libcamera/base/log.h>\n>>   #include <libcamera/base/utils.h>\n>> +#include \"libcamera/internal/global_configuration.h\"\n>>   #include \"libcamera/internal/ipa_module.h\"\n>>   /**\n>> @@ -48,10 +51,15 @@ LOG_DEFINE_CATEGORY(IPAProxy)\n>>   /**\n>>    * \\brief Construct an IPAProxy instance\n>>    * \\param[in] ipam The IPA module\n>> + * \\param[in] configuration The global configuration\n>>    */\n>> -IPAProxy::IPAProxy(IPAModule *ipam)\n>> +IPAProxy::IPAProxy(IPAModule *ipam, const GlobalConfiguration &configuration)\n>>   \t: valid_(false), state_(ProxyStopped), ipam_(ipam)\n>\n> configPaths_(configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\",\n>                                          { \"ipa\", \"config_paths\" })\n>                           .value_or({}))\n>\n> If I'm not missing anything, I think it's fine to move the `value_or()` here\n> and change the type, instead of doing it everywhere the members are used.\n\nOK.  Using braces as the value_or argument doesn't work here with gcc\n14.2.1:\n\n  ../src/libcamera/ipa_proxy.cpp: In constructor ‘libcamera::IPAProxy::IPAProxy(libcamera::IPAModule*, const libcamera::GlobalConfiguration&)’:\n  ../src/libcamera/ipa_proxy.cpp:58:116: error: no matching function for call to ‘std::optional<std::vector<std::__cxx11::basic_string<char> > >::value_or(<brace-enclosed initializer list>)’\n     58 |           configPaths_(configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\", { \"ipa\", \"config_paths\" }).value_or({})),\n        |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~\n  In file included from ../include/libcamera/internal/ipa_proxy.h:10,\n                   from ../src/libcamera/ipa_proxy.cpp:8:\n  /usr/include/c++/14/optional:1022:9: note: candidate: ‘template<class _Up> constexpr _Tp std::optional<_Tp>::value_or(_Up&&) const & [with _Tp = std::vector<std::__cxx11::basic_string<char> >]’\n   1022 |         value_or(_Up&& __u) const&\n        |         ^~~~~~~~\n  /usr/include/c++/14/optional:1022:9: note:   template argument deduction/substitution failed:\n  ../src/libcamera/ipa_proxy.cpp:58:116: note:   couldn’t deduce template parameter ‘_Up’\n     58 |           configPaths_(configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\", { \"ipa\", \"config_paths\" }).value_or({})),\n        |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~\n  /usr/include/c++/14/optional:1035:9: note: candidate: ‘template<class _Up> constexpr _Tp std::optional<_Tp>::value_or(_Up&&) && [with _Tp = std::vector<std::__cxx11::basic_string<char> >]’\n   1035 |         value_or(_Up&& __u) &&\n        |         ^~~~~~~~\n  /usr/include/c++/14/optional:1035:9: note:   template argument deduction/substitution failed:\n  ../src/libcamera/ipa_proxy.cpp:58:116: note:   couldn’t deduce template parameter ‘_Up’\n     58 |           configPaths_(configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\", { \"ipa\", \"config_paths\" }).value_or({})),\n        |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~\n\nI'll use std::vector<std::string>() instead, unless you have a different\nrecommendation.\n\n> Regards,\n> Barnabás Pőcze\n>\n>\n>>   {\n>> +\tconfigPaths_ = configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\",\n>> +\t\t\t\t\t\t   { \"ipa\", \"config_paths\" });\n>> +\texecPaths_ = configuration.envListOption(\n>> +\t\t\"LIBCAMERA_IPA_PROXY_PATH\", { \"ipa\", \"proxy_paths\" });\n>>   }\n>> [...]","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0BDC2BE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Jul 2025 17:29:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2480168F4A;\n\tMon, 14 Jul 2025 19:29:51 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DEC5D68F3F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Jul 2025 19:29:48 +0200 (CEST)","from mail-wr1-f70.google.com (mail-wr1-f70.google.com\n\t[209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-404-HdnClocZPcydqlWHHxCZQQ-1; Mon, 14 Jul 2025 13:29:46 -0400","by mail-wr1-f70.google.com with SMTP id\n\tffacd0b85a97d-3a5780e8137so2970803f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Jul 2025 10:29:46 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-3b5e8dc2087sm13158646f8f.30.2025.07.14.10.29.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 14 Jul 2025 10:29:43 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"aZDhLmrX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1752514187;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=vikxfMKokm2zG/ejirrhKiyi2OyzLTV6HQRKnG/a2Lc=;\n\tb=aZDhLmrXvyY6+BFC0MH/mlnS69meXy+4q65CUsrnEerhKHxG41A2idrXUo9QEv9AqmWJ6k\n\t0iwgoX9vPT+vedCOceAjqtW5aoC6arBGInF+m+T8Ht9kkje1Aq73u01MfNwv/F2rw3EHXI\n\tntRECLVZVYwqWVkZDF6g4EzcbxFvw8c=","X-MC-Unique":"HdnClocZPcydqlWHHxCZQQ-1","X-Mimecast-MFC-AGG-ID":"HdnClocZPcydqlWHHxCZQQ_1752514185","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1752514185; x=1753118985;\n\th=content-transfer-encoding:mime-version:user-agent:date:references\n\t:message-id:in-reply-to:subject:cc:to:from:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=h0KFL7iUUH526IfNQyUjNOQc0GAmROKRSV9cNyN2bYw=;\n\tb=IIOorJiKpSS7nAKuMZ72bSYAvz5orPxSVlp1ja2iza0b5RUjPvfoLJu60EnKT5xdIj\n\twrHG22czK8kD6YMlR6OF7Nvy6ehId4QReCA70B4e9+78VosPhl4/B5YEaxHJUANaLD4s\n\tHpSi+/9Hqya4UrEIz0Zn5xIpxRYteGr+iFWYcJVvcKqasmS0Rt2kB6PbQL/PKOvIx5DA\n\toOoGUCGESEg1tdDUJ1DYtAVoU6YUbwr1t6FrkWKhObqJ8ILOmayV4EP/3HkY76IaI2Kt\n\twHW4nGNiieHtP9c5oUhrGySrNypZx2xHvMc5d/ZF7o4HtQomzvNUqdJPXJ8O4RHH0c/D\n\tyyhw==","X-Gm-Message-State":"AOJu0YwLlmyebLOz7Gn7nFpK6rax7CgBXGV7M48LOXb6Grk3FzPFGSwN\n\tOKRX3RUdoaS35DVz6AeXi8GvcXdZdNSsw/X2bHowf10dOxOhiGTx7fuKlHvO6oQCubolDJ1p0Ud\n\t4o+v0J+hPLMMQyIlmwSs4bi3ImQGO5x2eM7cZyr1N7KoIGXfL02mbjPZ4iacnOU/HVpSFX1zCYM\n\tc=","X-Gm-Gg":"ASbGncvG7TEHNhtruzwAC8gA1UrOXm02YsP8NvQTwldCvrTaAmr8XNjK6+TSi1oLpyY\n\tS233mq2gpSK5B8xvCYuqae7ZaOPw8FAmvhfP43fAMOe77okeHig49dKOZQT5Y0hO09B9TAFRgCj\n\tNV0jX95yASgl3NBx5WmoHl/hXCiH+KYmTyY+Cmn9Rv84l/CdC1zB+vbJ2ICPTVY/Lfm6jb4nTUm\n\tbZDwYbLoPjLPFZMzZdmIt4sKY4pJK/PQjIiYPKPWutt+dnT4G8O50JdZBIMfqufsQRCHo+E6EXb\n\ttxp8vAyEAR9/b2OWMzvVdiXzEPL2UqF0T+R3nJ0yTYhgvDuA7FSq3e7z3+g7Hfb5qiKcOaSXmgv\n\t0GcyEFKnsu5twDDgP","X-Received":["by 2002:a05:6000:4312:b0:3b3:9c46:de96 with SMTP id\n\tffacd0b85a97d-3b60953f4d2mr360630f8f.21.1752514185034; \n\tMon, 14 Jul 2025 10:29:45 -0700 (PDT)","by 2002:a05:6000:4312:b0:3b3:9c46:de96 with SMTP id\n\tffacd0b85a97d-3b60953f4d2mr360603f8f.21.1752514184555; \n\tMon, 14 Jul 2025 10:29:44 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IHDc6HXVUhiBJewhWwmGCwggHN1bkbpKhNiXpr+7+NQq8nq83dI0+Hybe8r1f5u2072RhYEYg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>,  Laurent Pinchart\n\t<laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH v13 05/12] config: Look up IPA configurables in\n\tconfiguration file","In-Reply-To":"<9d60a7a6-8901-4966-a2d1-b29c378842fd@ideasonboard.com> (\n\t=?utf-8?b?IkJhcm5hYsOhcyBQxZFjemUiJ3M=?= message of \"Mon,\n\t14 Jul 2025  15:50:30 +0200\")","Message-ID":"<85a556d6rj.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","References":"<20250711201232.129264-1-mzamazal@redhat.com>\n\t<LqyMuCmx4Rl58Ie5o8SLtCpWIcllcxrO47Q5ncW_W_qdpTbiNK4SmPM5BevZjPEaUe7raK9r7yWO_OIFdvrbgA==@protonmail.internalid>\n\t<20250711201232.129264-6-mzamazal@redhat.com>\n\t<9d60a7a6-8901-4966-a2d1-b29c378842fd@ideasonboard.com>","Date":"Mon, 14 Jul 2025 19:29:42 +0200","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"Bm9IliLrMAe0gYlr0y3hhQ6TG1ROZ44unSkA_m-nHGg_1752514185","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34896,"web_url":"https://patchwork.libcamera.org/comment/34896/","msgid":"<c89a37f6-b6eb-47f7-adcd-229e7c5da32d@ideasonboard.com>","date":"2025-07-14T20:29:01","subject":"Re: [PATCH v13 05/12] config: Look up IPA configurables in\n\tconfiguration file","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"HI\n\n2025. 07. 14. 19:29 keltezéssel, Milan Zamazal írta:\n> Hi Barnabás,\n> \n> Barnabás Pőcze <barnabas.pocze@ideasonboard.com> writes:\n> \n>> Hi\n>>\n>> 2025. 07. 11. 22:12 keltezéssel, Milan Zamazal írta:\n>>> This patch adds configuration options for environment variables used in\n>>> the IPA proxy.  Two utility functions configuration retrieval functions\n>>> are added, to retrieve lists of values.\n>>> The configuration snippet:\n>>>     configuration:\n>>>       ipa:\n>>>         config_paths:\n>>>         - config path 1\n>>>         - config path 2\n>>>         - ...\n>>>         module_paths:\n>>>         - module path 1\n>>>         - module path 2\n>>>         - ...\n>>>         proxy_paths:\n>>>         - proxy path 1\n>>>         - proxy path 2\n>>>         - ...\n>>>         force_isolation: BOOL\n>>> LIBCAMERA_<IPA_NAME>_TUNING_FILE remains configurable only via the\n>>> environment variable; this is supposed to be used only for testing and\n>>> debugging and it's not clear what to do about IPA names like \"rpi/vc4\"\n>>> and \"rpi/pisp\" exactly.\n>>> There are two ways to pass the configuration to the places where it is\n>>> needed: Either to pass it as an argument to the method calls that need\n>>> it, or to pass it to the class constructors and extract the needed\n>>> configuration from there.  This patch uses the second method as it is\n>>> less polluting the code.\n>>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>>> ---\n>>>    .../libcamera/internal/global_configuration.h | 21 +++++++-\n>>>    include/libcamera/internal/ipa_manager.h      |  7 ++-\n>>>    include/libcamera/internal/ipa_proxy.h        |  8 ++-\n>>>    src/libcamera/camera_manager.cpp              |  2 +-\n>>>    src/libcamera/global_configuration.cpp        | 47 +++++++++++++++--\n>>>    src/libcamera/ipa_manager.cpp                 | 39 ++++++++------\n>>>    src/libcamera/ipa_proxy.cpp                   | 51 +++++++++----------\n>>>    .../module_ipa_proxy.cpp.tmpl                 |  4 +-\n>>>    .../module_ipa_proxy.h.tmpl                   |  2 +-\n>>>    9 files changed, 129 insertions(+), 52 deletions(-)\n>>> [...]\n>>> diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp\n>>> index 9907b9615..468e0ddf8 100644\n>>> --- a/src/libcamera/ipa_proxy.cpp\n>>> +++ b/src/libcamera/ipa_proxy.cpp\n>>> @@ -7,13 +7,16 @@\n>>>    #include \"libcamera/internal/ipa_proxy.h\"\n>>> +#include <string>\n>>>    #include <sys/stat.h>\n>>>    #include <sys/types.h>\n>>>    #include <unistd.h>\n>>> +#include <vector>\n>>>    #include <libcamera/base/log.h>\n>>>    #include <libcamera/base/utils.h>\n>>> +#include \"libcamera/internal/global_configuration.h\"\n>>>    #include \"libcamera/internal/ipa_module.h\"\n>>>    /**\n>>> @@ -48,10 +51,15 @@ LOG_DEFINE_CATEGORY(IPAProxy)\n>>>    /**\n>>>     * \\brief Construct an IPAProxy instance\n>>>     * \\param[in] ipam The IPA module\n>>> + * \\param[in] configuration The global configuration\n>>>     */\n>>> -IPAProxy::IPAProxy(IPAModule *ipam)\n>>> +IPAProxy::IPAProxy(IPAModule *ipam, const GlobalConfiguration &configuration)\n>>>    \t: valid_(false), state_(ProxyStopped), ipam_(ipam)\n>>\n>> configPaths_(configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\",\n>>                                           { \"ipa\", \"config_paths\" })\n>>                            .value_or({}))\n>>\n>> If I'm not missing anything, I think it's fine to move the `value_or()` here\n>> and change the type, instead of doing it everywhere the members are used.\n> \n> OK.  Using braces as the value_or argument doesn't work here with gcc\n> 14.2.1:\n> \n>    ../src/libcamera/ipa_proxy.cpp: In constructor ‘libcamera::IPAProxy::IPAProxy(libcamera::IPAModule*, const libcamera::GlobalConfiguration&)’:\n>    ../src/libcamera/ipa_proxy.cpp:58:116: error: no matching function for call to ‘std::optional<std::vector<std::__cxx11::basic_string<char> > >::value_or(<brace-enclosed initializer list>)’\n>       58 |           configPaths_(configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\", { \"ipa\", \"config_paths\" }).value_or({})),\n>          |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~\n>    In file included from ../include/libcamera/internal/ipa_proxy.h:10,\n>                     from ../src/libcamera/ipa_proxy.cpp:8:\n>    /usr/include/c++/14/optional:1022:9: note: candidate: ‘template<class _Up> constexpr _Tp std::optional<_Tp>::value_or(_Up&&) const & [with _Tp = std::vector<std::__cxx11::basic_string<char> >]’\n>     1022 |         value_or(_Up&& __u) const&\n>          |         ^~~~~~~~\n>    /usr/include/c++/14/optional:1022:9: note:   template argument deduction/substitution failed:\n>    ../src/libcamera/ipa_proxy.cpp:58:116: note:   couldn’t deduce template parameter ‘_Up’\n>       58 |           configPaths_(configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\", { \"ipa\", \"config_paths\" }).value_or({})),\n>          |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~\n>    /usr/include/c++/14/optional:1035:9: note: candidate: ‘template<class _Up> constexpr _Tp std::optional<_Tp>::value_or(_Up&&) && [with _Tp = std::vector<std::__cxx11::basic_string<char> >]’\n>     1035 |         value_or(_Up&& __u) &&\n>          |         ^~~~~~~~\n>    /usr/include/c++/14/optional:1035:9: note:   template argument deduction/substitution failed:\n>    ../src/libcamera/ipa_proxy.cpp:58:116: note:   couldn’t deduce template parameter ‘_Up’\n>       58 |           configPaths_(configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\", { \"ipa\", \"config_paths\" }).value_or({})),\n>          |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~\n> \n> I'll use std::vector<std::string>() instead, unless you have a different\n> recommendation.\n\nOkay, I have just seen that it had been introduced in LWG3886,\nI thought it was working since the beginning...\n\n\n> \n>> Regards,\n>> Barnabás Pőcze\n>>\n>>\n>>>    {\n>>> +\tconfigPaths_ = configuration.envListOption(\"LIBCAMERA_IPA_CONFIG_PATH\",\n>>> +\t\t\t\t\t\t   { \"ipa\", \"config_paths\" });\n>>> +\texecPaths_ = configuration.envListOption(\n>>> +\t\t\"LIBCAMERA_IPA_PROXY_PATH\", { \"ipa\", \"proxy_paths\" });\n>>>    }\n>>> [...]\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 53F39C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Jul 2025 20:29:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5171768F4D;\n\tMon, 14 Jul 2025 22:29:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 220DB68F3F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Jul 2025 22:29:06 +0200 (CEST)","from [192.168.33.16] (185.221.140.39.nat.pool.zt.hu\n\t[185.221.140.39])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D530599F;\n\tMon, 14 Jul 2025 22:28:33 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"uTjYUwDA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1752524914;\n\tbh=TgO3WUotpT4ywQIwyssSNqCfV9jJL92RKeIe7yHaEHg=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=uTjYUwDApLa8MQ5c08bl6h1KprqdYFwsnrEADjD6E4IcWXxUyNZd/RvSDg4LFXW5F\n\tmkOnjU6cOxXXyNLvHzpsizLq61+qyTYvTmG6xqbPKyrWuc0qfYFKl4UlpWeMJQI0iR\n\t/LAdqcYLd1ShiWPy63tHjBu8K18KyuUkjJsqv9nc=","Message-ID":"<c89a37f6-b6eb-47f7-adcd-229e7c5da32d@ideasonboard.com>","Date":"Mon, 14 Jul 2025 22:29:01 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v13 05/12] config: Look up IPA configurables in\n\tconfiguration file","To":"Milan Zamazal <mzamazal@redhat.com>, =?utf-8?b?QmFybmFiw6FzIFDFkWN6?=\n\t=?utf-8?q?e?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20250711201232.129264-1-mzamazal@redhat.com>\n\t<LqyMuCmx4Rl58Ie5o8SLtCpWIcllcxrO47Q5ncW_W_qdpTbiNK4SmPM5BevZjPEaUe7raK9r7yWO_OIFdvrbgA==@protonmail.internalid>\n\t<20250711201232.129264-6-mzamazal@redhat.com>\n\t<9d60a7a6-8901-4966-a2d1-b29c378842fd@ideasonboard.com>\n\t<9mxEAqoH1DZYGJhmho63pBo8WZyXCX9rF8woYVQasRzRoy5ujuaUpQvSgwAK7al4RBjUS_3OaDT8EmnuBxHIwg==@protonmail.internalid>\n\t<85a556d6rj.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<85a556d6rj.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]