[{"id":37363,"web_url":"https://patchwork.libcamera.org/comment/37363/","msgid":"<4609577e-e024-4f18-a4a1-72da1e3afeed@collabora.com>","date":"2025-12-14T13:30:18","subject":"Re: [PATCH v8 17/26] libcamera: software_isp: debayer_egl: Make\n\tDebayerEGL an environment option","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"Hi\n\nOn 12.12.25 01:29, Bryan O'Donoghue wrote:\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> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\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 b31a374d8..efe44e393 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> +\tstd::optional<std::string> softISPMode = configuration.envOption(\"LIBCAMERA_SOFTISP_MODE\", { \"software_isp\", \"mode\" });\n> +\n> +\tif (softISPMode && 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;\nIf we fail to initialize EGL / DebayerEGL, it would probably be better \nto fall back to CPU instead of returning.\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>","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 C4EBFC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 14 Dec 2025 13:30:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B370361924;\n\tSun, 14 Dec 2025 14:30:31 +0100 (CET)","from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com\n\t[136.143.188.12])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0032E61613\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 14 Dec 2025 14:30:29 +0100 (CET)","by mx.zohomail.com with SMTPS id 1765719023328803.5629270289098;\n\tSun, 14 Dec 2025 05:30:23 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"L81pDU2g\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1765719026; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=ly+ZX95TsxuK5kPvInZj5VfdFndTpqSlkSRktZDDHxUPJxH73dBJDDrgZWYLVVGcRFTViSYrjaY6ACWWlIJlvWHXf/5veWnLKGSRFf/Z9lYfzJmx4wB4Tknl1XS+YFP1Is7BlPAodoy2APEI6RKdG8SBY5L3r8jreaidZppWTp4=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1765719026;\n\th=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=BuDRIKxbp7syIs7ndeW8L5tC8K1qFxkppA7hMb9xFYs=; \n\tb=JIUGRQ0NXhrwObJVpcebl54GLINN38E78jK+5zWxOWk7WdYpjp8UOhpAgJak0Fn2xDj05ow5cQm10H59irOQItINha80bTu+rrTKyMnhyWo62F3MRLRSloVmodW3NkrCD2Jq4tiGcfb2IjEItSkEV1MWtrg3ly/fLJTgmKjmsNM=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1765719025;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;\n\tbh=BuDRIKxbp7syIs7ndeW8L5tC8K1qFxkppA7hMb9xFYs=;\n\tb=L81pDU2gADhn3GyxMV7gVZfw693PY/s/aQl/zFj1X4buSH2JrToBVm8RWuuZahL2\n\tGXthEXVOk1BdtC29tLudIEQPGIV74Pa2pRXCXSbJVy4l4wrxYGy5MbzKk4gfTWiMPVI\n\t3tK6oflIaq2c+ciflsexMf2kemtcCWJ0WKNVEEGs=","Message-ID":"<4609577e-e024-4f18-a4a1-72da1e3afeed@collabora.com>","Date":"Sun, 14 Dec 2025 14:30:18 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v8 17/26] libcamera: software_isp: debayer_egl: Make\n\tDebayerEGL an environment option","To":"libcamera-devel@lists.libcamera.org","References":"<20251212002937.3118-1-bryan.odonoghue@linaro.org>\n\t<20251212002937.3118-18-bryan.odonoghue@linaro.org>","Content-Language":"en-US, de-DE, en-GB","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<20251212002937.3118-18-bryan.odonoghue@linaro.org>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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":37431,"web_url":"https://patchwork.libcamera.org/comment/37431/","msgid":"<d5a611bd-50da-45d6-8ce1-71015bbf642b@ideasonboard.com>","date":"2025-12-18T09:52:44","subject":"Re: [PATCH v8 17/26] libcamera: software_isp: debayer_egl: Make\n\tDebayerEGL an environment option","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. 12. 12. 1:29 keltezéssel, Bryan O'Donoghue írta:\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> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\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 b31a374d8..efe44e393 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> +\tstd::optional<std::string> softISPMode = configuration.envOption(\"LIBCAMERA_SOFTISP_MODE\", { \"software_isp\", \"mode\" });\n> +\n> +\tif (softISPMode && softISPMode == \"gpu\") {\n> +\t\tdebayer_ = std::make_unique<DebayerEGL>(std::move(stats), configuration);\n> +\t\tif (!debayer_) {\n\n`std::make_unique()` never returns `nullptr`.\n\n\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>","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 6B64CBD7D8\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Dec 2025 09:52:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 70C5061B0E;\n\tThu, 18 Dec 2025 10:52:50 +0100 (CET)","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 A5CDE6142F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Dec 2025 10:52:48 +0100 (CET)","from [192.168.33.31] (185.221.143.114.nat.pool.zt.hu\n\t[185.221.143.114])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 43C46122A;\n\tThu, 18 Dec 2025 10:52:41 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tgoew5/x\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1766051561;\n\tbh=siWgCknpjFR7ImZv7m/ouuZ/FffLFUBvh22IMDT82e4=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=tgoew5/xR7zHvMkqE7e6X+/p9gTrFdRemPcBXWxNe8bZHP56GoQUs+oBRLQYZcND2\n\tOBacDnR+KlFi0WidPnf+GjPH3kAlEEIBKxnG4AzvBl37q3+3xs+rsXLu5DH1MG91Xm\n\txp0fn6dwlquRgG7ZGbeWWl2xHbiA3bmHqcjHdGgw=","Message-ID":"<d5a611bd-50da-45d6-8ce1-71015bbf642b@ideasonboard.com>","Date":"Thu, 18 Dec 2025 10:52:44 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v8 17/26] libcamera: software_isp: debayer_egl: Make\n\tDebayerEGL an environment option","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"pavel@ucw.cz, Milan Zamazal <mzamazal@redhat.com>","References":"<20251212002937.3118-1-bryan.odonoghue@linaro.org>\n\t<20251212002937.3118-18-bryan.odonoghue@linaro.org>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20251212002937.3118-18-bryan.odonoghue@linaro.org>","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>"}}]