[{"id":37203,"web_url":"https://patchwork.libcamera.org/comment/37203/","msgid":"<855xan1fms.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-12-03T20:20:43","subject":"Re: [PATCH v6 15/24] libcamera: software_isp: debayer_egl: Make\n\tDebayerEGL an environment option","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:\n\n> If GPUISP support is available make it so an environment variable can\n> switch it on.\n>\n> Given we don't have full feature parity with CPUISP just yet on pixel\n> format output, we should default to CPUISP mode giving the user the option\n> to switch on GPUISP by setting LIBCAMERA_SOFTISP_MODE=gpu\n>\n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n> ---\n>  src/libcamera/software_isp/software_isp.cpp | 24 ++++++++++++++++++++-\n>  1 file changed, 23 insertions(+), 1 deletion(-)\n>\n> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\n> index 638d9a6e6..125a5dd81 100644\n> --- a/src/libcamera/software_isp/software_isp.cpp\n> +++ b/src/libcamera/software_isp/software_isp.cpp\n> @@ -15,6 +15,7 @@\n>  \n>  #include <libcamera/base/log.h>\n>  #include <libcamera/base/thread.h>\n> +#include <libcamera/base/utils.h>\n>  \n>  #include <libcamera/controls.h>\n>  #include <libcamera/formats.h>\n> @@ -25,6 +26,9 @@\n>  #include \"libcamera/internal/software_isp/debayer_params.h\"\n>  \n>  #include \"debayer_cpu.h\"\n> +#if HAVE_DEBAYER_EGL\n> +#include \"debayer_egl.h\"\n> +#endif\n>  \n>  /**\n>   * \\file software_isp.cpp\n> @@ -117,7 +121,25 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n>  \t}\n>  \tstats->statsReady.connect(this, &SoftwareIsp::statsReady);\n>  \n> -\tdebayer_ = std::make_unique<DebayerCpu>(std::move(stats), configuration);\n> +#if HAVE_DEBAYER_EGL\n> +\tconst char *softISPMode = utils::secure_getenv(\"LIBCAMERA_SOFTISP_MODE\");\n> +\n> +\tif (softISPMode && !strcmp(softISPMode, \"gpu\")) {\n> +\t\tdebayer_ = std::make_unique<DebayerEGL>(std::move(stats), configuration);\n> +\t\tif (!debayer_) {\n> +\t\t\tLOG(SoftwareIsp, Error) << \"Failed to instantiate GPUISP\";\n> +\t\t\treturn;\n> +\t\t}\n> +\t}\n> +#endif\n> +\tif (!debayer_)\n> +\t\tdebayer_ = std::make_unique<DebayerCpu>(std::move(stats), configuration);\n> +\n> +\tif (!debayer_) {\n> +\t\tLOG(SoftwareIsp, Error) << \"Failed to create Debayer object\";\n> +\t\treturn;\n> +\t}\n> +\n>  \tdebayer_->inputBufferReady.connect(this, &SoftwareIsp::inputReady);\n>  \tdebayer_->outputBufferReady.connect(this, &SoftwareIsp::outputReady);\n\nAs already pointed out, there should be also a configuration file\noption for a more persistent setting.  For example:\n\n  std::optional<std::string> softIspMode = configuration.envOption(\"LIBCAMERA_SOFTISP_MODE\", { \"software_isp\", \"mode\" });\n  if (softIspMode && softIspMode == \"gpu\") {\n        ...\n\nIn any case, the environment variable/option should be documented in\nDocumentation/runtime_configuration.rst.","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 0959AC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Dec 2025 20:20:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3BE95609D8;\n\tWed,  3 Dec 2025 21:20:51 +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 C8493609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Dec 2025 21:20:48 +0100 (CET)","from mail-wm1-f70.google.com (mail-wm1-f70.google.com\n\t[209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-608-Wf7RdX7qMpmTQNmhbGygdg-1; Wed, 03 Dec 2025 15:20:46 -0500","by mail-wm1-f70.google.com with SMTP id\n\t5b1f17b1804b1-477563e531cso1086755e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 03 Dec 2025 12:20:46 -0800 (PST)","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\t5b1f17b1804b1-4792a7a7aaesm68081695e9.11.2025.12.03.12.20.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 03 Dec 2025 12:20:44 -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=\"S8MpiKAO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1764793247;\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\tin-reply-to:in-reply-to:references:references;\n\tbh=lmwLu0Rgff7A8y6UDkZpfk6kSw6mxlDpQPezjv3zMqs=;\n\tb=S8MpiKAOigvUsaTgeMcVGIJR/OvW5M1/jASPPslt9MwpO5Bf3pmhSLzb6GD0LQevPePia7\n\tzGjoVrHprcm4qG3/pTjH41sF+/la2Gb/ViMyUSp12LSsSo3XqVZXG6UApYwA9BzQ6gjI5P\n\tyXTnTlxK7wy4cJ6O2in6mCD5lE5idyo=","X-MC-Unique":"Wf7RdX7qMpmTQNmhbGygdg-1","X-Mimecast-MFC-AGG-ID":"Wf7RdX7qMpmTQNmhbGygdg_1764793245","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764793245; x=1765398045;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=lmwLu0Rgff7A8y6UDkZpfk6kSw6mxlDpQPezjv3zMqs=;\n\tb=rdU203QiR/rQTm5Kxv7G+F6lQZVMDEo/8pEWy2KBgLP+wb69cxMiNC8/9lEhuxgydr\n\tRyg33hBkoHy3bTJ436MiUgfCXgZtt7h/BOQs3fRJF0muK2lH9tZ8F8ry/l2Ow6RpZ5Ez\n\tb6hPLhru6WhUdKTNHwiA0Y9rnuAyZDVLGpC30SFjk7Ac3rJcRNjtgWmcp9nrURpbbCpc\n\tL1bGzLnZqk0g46XHpAfZAjZyFViw5Twdnn0P8RHFQ4tK7UemsP02pXT+sbv1C+NMGKQ+\n\tzYLx/LWxHb/nQk32iLri6TJ/r0beD+eCmeqoeUq+7+2lHbxTWY6cGWSuhxCifxs+6idO\n\tbDQw==","X-Gm-Message-State":"AOJu0Yxo4dvS+ZcZsOiNM9cueidlrXGygYL+QoO8NzCxnxWzygmmi618\n\tPZqlMVd85gtkRwQzw6W06wlh7Te7Qm0GePILWmbmvOqF2sovmfUUjtZZWlgN5+KRImRup5FaR52\n\tf5ezm5olbhGFiCSdvK1GjtUrLMzexlkVTeXXwUh2YcM6I8Jpa9PX8sH4woeLWqfa+V3fTxej6I7\n\tg=","X-Gm-Gg":"ASbGncsT0Lb6U3Ahjk83f0fWA6RO7AXc6XSjxpycojZwzAzEdqJ1FpDu1Tc9w1J73xe\n\tXM/sQSscp+gAvNmv7v68tOKg9Yoe24Y6hSGyUJybVt4nbHSJqzTALxy1TstQiLNnrF2L/iVJN88\n\t2nF99cHKK0j5ISBalqT6KHOvXF1rtvngSDlSVw1IVYZDHJGAd8gX+Q5WuBT5oIaOkN+pahtXRma\n\t8yF9RjkzMBnMbDxwGJdSffnLAbdCA4IV0JI3w8aV1FxYUdGlMYWvzF2kFRnaIMJNJdE+5Dobahg\n\tC+vMMrJWrwzozGLFvdPHCU6bou2HG+L7+fEW3vh8rS/JD2JGuaKrOTSxtrtMUDJE+89rpbCZ9Fw\n\t8njmE4HsxIectUXDhVexz10c7HubIdHFQY75nWeanhNvhofODUhyIhwUbgrqk8hw=","X-Received":["by 2002:a05:600c:1c2a:b0:477:8985:4039 with SMTP id\n\t5b1f17b1804b1-4792af1b697mr45407705e9.17.1764793245135; \n\tWed, 03 Dec 2025 12:20:45 -0800 (PST)","by 2002:a05:600c:1c2a:b0:477:8985:4039 with SMTP id\n\t5b1f17b1804b1-4792af1b697mr45407525e9.17.1764793244739; \n\tWed, 03 Dec 2025 12:20:44 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IHN5iVvWYmtmzQqox0+wwXqjtMDwQ2PCLa0tBxgbUyrYCxsuA35rh4cg3SdomIxFuzq7TmfoA==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Cc":"libcamera-devel@lists.libcamera.org,  pavel@ucw.cz","Subject":"Re: [PATCH v6 15/24] libcamera: software_isp: debayer_egl: Make\n\tDebayerEGL an environment option","In-Reply-To":"<20251202134544.662446-16-bryan.odonoghue@linaro.org> (Bryan\n\tO'Donoghue's message of \"Tue, 2 Dec 2025 13:45:35 +0000\")","References":"<20251202134544.662446-1-bryan.odonoghue@linaro.org>\n\t<20251202134544.662446-16-bryan.odonoghue@linaro.org>","Date":"Wed, 03 Dec 2025 21:20:43 +0100","Message-ID":"<855xan1fms.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"4C6oosZQo9yqF8rbRc7awQvZBGP6ZlO25KXo1FMQ5xk_1764793245","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]