[{"id":32528,"web_url":"https://patchwork.libcamera.org/comment/32528/","msgid":"<2nZqSSX0kXpTZch0KN13y8sJrQ92o1keDgfK-TbsnC3q2wjZIcXQ0I714HrdZzl5sC3iK5kWT1OFl900o3ELpDvFpAQOGcWBzQ2mMMl8vCU=@protonmail.com>","date":"2024-12-04T17:47:04","subject":"Re: [PATCH v5 10/15] config: Look up RkISP1 tuning file in\n\tconfiguration file","submitter":{"id":133,"url":"https://patchwork.libcamera.org/api/people/133/","name":"Pőcze Barnabás","email":"pobrn@protonmail.com"},"content":"Hi\n\n\n2024. október 1., kedd 12:28 keltezéssel, Milan Zamazal <mzamazal@redhat.com> írta:\n\n> The configuration snippet:\n>\n>   configuration:\n>     pipeline:\n>       rkisp1:\n>         tuning_file: FILE\n>\n> This environment variable has not been documented.\n>\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 20 +++++++++++++++-----\n>  1 file changed, 15 insertions(+), 5 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index c02c7cf37..da94e41d5 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -35,6 +35,7 @@\n>  #include \"libcamera/internal/delayed_controls.h\"\n>  #include \"libcamera/internal/device_enumerator.h\"\n>  #include \"libcamera/internal/framebuffer.h\"\n> +#include \"libcamera/internal/global_configuration.h\"\n>  #include \"libcamera/internal/ipa_manager.h\"\n>  #include \"libcamera/internal/media_device.h\"\n>  #include \"libcamera/internal/pipeline_handler.h\"\n> @@ -348,12 +349,21 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n>  \t * environment variable overrides it.\n>  \t */\n>  \tstd::string ipaTuningFile;\n> -\tchar const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RKISP1_TUNING_FILE\");\n> -\tif (!configFromEnv || *configFromEnv == '\\0') {\n> -\t\tipaTuningFile =\n> -\t\t\tipa_->configurationFile(sensor_->model() + \".yaml\", \"uncalibrated.yaml\");\n> +\tconst std::string confPath =\n> +\t\tstd::string(\"pipelines.rkisp1.cameras.\") + sensor_->id() + std::string(\".tuning_file\");\n\nJust `+ \".tuning_file\"` should work.\n\n\n> +\tconst auto confTuningFile =\n> +\t\tGlobalConfiguration::envOption(\n> +\t\t\t\"LIBCAMERA_RKISP1_TUNING_FILE\", confPath.c_str());\n> +\tif (!confTuningFile.has_value() || confTuningFile.value() == \"\") {\n> +\t\tipaTuningFile = ipa_->configurationFile(sensor_->model() + \".yaml\");\n> +\t\t/*\n> +\t\t * If the tuning file isn't found, fall back to the\n> +\t\t * 'uncalibrated' configuration file.\n> +\t\t */\n> +\t\tif (ipaTuningFile.empty())\n> +\t\t\tipaTuningFile = ipa_->configurationFile(\"uncalibrated.yaml\");\n\n\nDoes\n\n  ipaTuningFile = ipa_->configurationFile(sensor_->model() + \".yaml\", \"uncalibrated.yaml\")\n\nnot work?\n\n\n>  \t} else {\n> -\t\tipaTuningFile = std::string(configFromEnv);\n> +\t\tipaTuningFile = confTuningFile.value();\n>  \t}\n>\n>  \tIPACameraSensorInfo sensorInfo{};\n> --\n> 2.44.1\n\n\nRegards,\nBarnabás Pőcze","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 420D8BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Dec 2024 17:47:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9DFDA660DA;\n\tWed,  4 Dec 2024 18:47:11 +0100 (CET)","from mail-40134.protonmail.ch (mail-40134.protonmail.ch\n\t[185.70.40.134])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BD9FD660D1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Dec 2024 18:47:08 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"hlbbxBc0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1733334428; x=1733593628;\n\tbh=YXQmUtvayiAqc+up6u2aXjrdpvGBUzNf5y+TvZtOK80=;\n\th=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:\n\tFeedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n\tMessage-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;\n\tb=hlbbxBc0jAcR4TPVWxUGqBmWuBH8U8n7j4vhKVxGMeHSCJ0hQmQzcB9WEFiiJORf4\n\tRZNnCi3zZY5fzziCsmJvcUFKA0xTKWO5hw4oAyqXYBrVYMx3/P5TyWr5+SzwM/LQaf\n\txCzX7/UmzkYb65yqQolWmOigOKrQPY91+u5xJ3yfVlIdNJ6W+Pg0x/VZQ2+Y1rCiTC\n\tbIEYGv7qpitzycHu3ChkvTARWmqQXFL9YoVDkElrxd4qnkYD3t0TByEgsAOl/Og7I3\n\tzEsO4Wqwp6HD2s2MQ6sKfvaMyNqXwcqCIEi2wxXBFClx0wb0oa0YFdjCmWuUslH7nI\n\tqufe2XiXpFGpg==","Date":"Wed, 04 Dec 2024 17:47:04 +0000","To":"Milan Zamazal <mzamazal@redhat.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Subject":"Re: [PATCH v5 10/15] config: Look up RkISP1 tuning file in\n\tconfiguration file","Message-ID":"<2nZqSSX0kXpTZch0KN13y8sJrQ92o1keDgfK-TbsnC3q2wjZIcXQ0I714HrdZzl5sC3iK5kWT1OFl900o3ELpDvFpAQOGcWBzQ2mMMl8vCU=@protonmail.com>","In-Reply-To":"<20241001102810.479285-11-mzamazal@redhat.com>","References":"<20241001102810.479285-1-mzamazal@redhat.com>\n\t<20241001102810.479285-11-mzamazal@redhat.com>","Feedback-ID":"20568564:user:proton","X-Pm-Message-ID":"628c10c3d02199758821fbb46ad32fa8d3cd09b7","MIME-Version":"1.0","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":32542,"web_url":"https://patchwork.libcamera.org/comment/32542/","msgid":"<87h67iz1kn.fsf@redhat.com>","date":"2024-12-05T13:44:40","subject":"Re: [PATCH v5 10/15] config: Look up RkISP1 tuning file 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 <pobrn@protonmail.com> writes:\n\n> Hi\n>\n>\n> 2024. október 1., kedd 12:28 keltezéssel, Milan Zamazal <mzamazal@redhat.com> írta:\n>\n>> The configuration snippet:\n>>\n>>   configuration:\n>>     pipeline:\n>>       rkisp1:\n>>         tuning_file: FILE\n>>\n>> This environment variable has not been documented.\n>>\n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 20 +++++++++++++++-----\n>>  1 file changed, 15 insertions(+), 5 deletions(-)\n>>\n>> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>> index c02c7cf37..da94e41d5 100644\n>> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>> @@ -35,6 +35,7 @@\n>>  #include \"libcamera/internal/delayed_controls.h\"\n>>  #include \"libcamera/internal/device_enumerator.h\"\n>>  #include \"libcamera/internal/framebuffer.h\"\n>> +#include \"libcamera/internal/global_configuration.h\"\n>>  #include \"libcamera/internal/ipa_manager.h\"\n>>  #include \"libcamera/internal/media_device.h\"\n>>  #include \"libcamera/internal/pipeline_handler.h\"\n>> @@ -348,12 +349,21 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n>>  \t * environment variable overrides it.\n>>  \t */\n>>  \tstd::string ipaTuningFile;\n>> -\tchar const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RKISP1_TUNING_FILE\");\n>> -\tif (!configFromEnv || *configFromEnv == '\\0') {\n>> -\t\tipaTuningFile =\n>> -\t\t\tipa_->configurationFile(sensor_->model() + \".yaml\", \"uncalibrated.yaml\");\n>> +\tconst std::string confPath =\n>> +\t\tstd::string(\"pipelines.rkisp1.cameras.\") + sensor_->id() + std::string(\".tuning_file\");\n>\n> Just `+ \".tuning_file\"` should work.\n\nIndeed, it does.\n\n>> +\tconst auto confTuningFile =\n>> +\t\tGlobalConfiguration::envOption(\n>> +\t\t\t\"LIBCAMERA_RKISP1_TUNING_FILE\", confPath.c_str());\n>> +\tif (!confTuningFile.has_value() || confTuningFile.value() == \"\") {\n>> +\t\tipaTuningFile = ipa_->configurationFile(sensor_->model() + \".yaml\");\n>> +\t\t/*\n>> +\t\t * If the tuning file isn't found, fall back to the\n>> +\t\t * 'uncalibrated' configuration file.\n>> +\t\t */\n>> +\t\tif (ipaTuningFile.empty())\n>> +\t\t\tipaTuningFile = ipa_->configurationFile(\"uncalibrated.yaml\");\n>\n>\n> Does\n>\n>   ipaTuningFile = ipa_->configurationFile(sensor_->model() + \".yaml\", \"uncalibrated.yaml\")\n>\n> not work?\n\nIt does, a piece of old code slipped in back in some rebase.\n\n>>  \t} else {\n>> -\t\tipaTuningFile = std::string(configFromEnv);\n>> +\t\tipaTuningFile = confTuningFile.value();\n>>  \t}\n>>\n>>  \tIPACameraSensorInfo sensorInfo{};\n>> --\n>> 2.44.1\n>\n>\n> Regards,\n> Barnabás Pőcze","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 8DB7AC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Dec 2024 13:44:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8AD42660FD;\n\tThu,  5 Dec 2024 14:44:47 +0100 (CET)","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 68A866608C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Dec 2024 14:44:46 +0100 (CET)","from mail-wr1-f72.google.com (mail-wr1-f72.google.com\n\t[209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-176-tnp0rE_-Ob694JxkSyXyhQ-1; Thu, 05 Dec 2024 08:44:43 -0500","by mail-wr1-f72.google.com with SMTP id\n\tffacd0b85a97d-385e1339790so643659f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 05 Dec 2024 05:44:43 -0800 (PST)","from nuthatch (ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-3862190975fsm1952996f8f.68.2024.12.05.05.44.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 05 Dec 2024 05:44:41 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"BwYX778Z\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1733406285;\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=DX1xldFytSz9haBnP5Bn0W9LTqgXfytUEEmvwMi8qdE=;\n\tb=BwYX778ZKv1FKaxA/OZakGTO99hjpcVs6KM5ykQf1YdXdE49ya6N4YowUySJApTLDiUNU9\n\tpfjWtdDLXkobEPW/oe80l7O+Z9rDJ438iU+/ehX3qmAOh9G34GfuOWrcqAtNcOyMx41xoX\n\tCZqItR0SJDUDVy9pO48eavgDFPnapwI=","X-MC-Unique":"tnp0rE_-Ob694JxkSyXyhQ-1","X-Mimecast-MFC-AGG-ID":"tnp0rE_-Ob694JxkSyXyhQ","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1733406282; x=1734011082;\n\th=content-transfer-encoding:mime-version:user-agent:message-id:date\n\t:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=59AAy8wKUu9I07mv3AUMGHdajpwHYVup9hHbf6Pxq0A=;\n\tb=vbGPZEj4DJ91OkkgZPBDLZRRFxLfJp5WmFgrqulMwB6GGRwCWLv6iRg+uLapBqLvgG\n\tecdzlaLTsSKHu/7HnXhGKq9EqyIM/De+GzP/z2tEam5yilUwprwdhBnxqUpYbWb4IF7E\n\tPGGdvUo8EotJEHozLdu4VQrS7yf2pcV4lOZ6E3qaIVa0lKonV/u1rzzw9VKiyhLXzUfR\n\t9L9zbUfrjAGgbRtg7Kvx0kyeGsWnkcOqWV0WZNBZF+qmEHthf+9xE8Doxsqi2J5BsZR4\n\teoic8IC4SSqLHuML+uBxUP1ifk970A415W71N7bpNnNOOraO471fNVlNuFvwRiKMJO7X\n\tHQmw==","X-Gm-Message-State":"AOJu0YwDefcOi8MNrTIaOHQVE85Kc0kbJSu4rvU3JhsatmwO4Vvw9kWx\n\tcXMq7c+xB7BrwZV2W7EJP8pYuMrk4OODY25YtjnKuvVeoxD7kX0lWduD7ifa5kzWHuIJMgBQIpH\n\tGPDEMQNK+wj0HdXSq3LlUPKZi0MoFnJGz7ULfDJ2bZaf0o3QEDsja6UzHF11LPlio63qUU4E=","X-Gm-Gg":"ASbGnctEUM/NcNisxzriD66oaGJkcgouw1kjPuaOILquQzB5sBEU1Ixjzzn1irqsVPX\n\tqTxoN3S4FoNOazhguhSbVPDEeUPL7Tuh1+vSdp2HMZ8xXeVj9eZSN3rlOL6UY0PQ2ok1dMMzTOF\n\t9XSJ2kK077DJatFxvZ2aku0w6kUjLCMdO4xCRRDpIuNo0/Lq8h0Szq5y0VBe4ABgM6SM+d86JaO\n\tM+RUoLse7ZaoQ6QXEgLML/2E22kW6bkOQWnfdhZqHgzpNxAuUi4b1XeumMAupAoM5DfhtU=","X-Received":["by 2002:a05:6000:471d:b0:385:e394:37ed with SMTP id\n\tffacd0b85a97d-385fd3eb189mr9796125f8f.18.1733406282584; \n\tThu, 05 Dec 2024 05:44:42 -0800 (PST)","by 2002:a05:6000:471d:b0:385:e394:37ed with SMTP id\n\tffacd0b85a97d-385fd3eb189mr9796109f8f.18.1733406282268; \n\tThu, 05 Dec 2024 05:44:42 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IE19j1hI5gPX7W8rbjUzFmfrJKEAvHZv5XJoqxb8t4/LiniKv3ybFk3cE0cSr7xTKXvZJT2Ww==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org,  Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>, Naushir Patuck <naush@raspberrypi.com>","Subject":"Re: [PATCH v5 10/15] config: Look up RkISP1 tuning file in\n\tconfiguration file","In-Reply-To":"<2nZqSSX0kXpTZch0KN13y8sJrQ92o1keDgfK-TbsnC3q2wjZIcXQ0I714HrdZzl5sC3iK5kWT1OFl900o3ELpDvFpAQOGcWBzQ2mMMl8vCU=@protonmail.com>\n\t( =?utf-8?b?IkJhcm5hYsOhcyBQxZFjemUiJ3M=?= message of \"Wed,\n\t04 Dec 2024  17:47:04 +0000\")","References":"<20241001102810.479285-1-mzamazal@redhat.com>\n\t<20241001102810.479285-11-mzamazal@redhat.com>\n\t<2nZqSSX0kXpTZch0KN13y8sJrQ92o1keDgfK-TbsnC3q2wjZIcXQ0I714HrdZzl5sC3iK5kWT1OFl900o3ELpDvFpAQOGcWBzQ2mMMl8vCU=@protonmail.com>","Date":"Thu, 05 Dec 2024 14:44:40 +0100","Message-ID":"<87h67iz1kn.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"2-66nquXmbd_Cih4GnlNAFx4SOXNwD9sCmQvgSxYlts_1733406283","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>"}}]