{"id":27519,"url":"https://patchwork.libcamera.org/api/patches/27519/?format=json","web_url":"https://patchwork.libcamera.org/patch/27519/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260729025557.2261274-1-qi.hou@oss.nxp.com>","date":"2026-07-29T02:55:57","name":"[v3] libcamera: egl: Pass EGLDisplay to eGL constructor to avoid double init","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"3fd6969454171a82862ef7db7269c85d0dc8032c","submitter":{"id":455,"url":"https://patchwork.libcamera.org/api/people/455/?format=json","name":"Qi Hou (OSS)","email":"qi.hou@oss.nxp.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27519/mbox/","series":[{"id":6089,"url":"https://patchwork.libcamera.org/api/series/6089/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6089","date":"2026-07-29T02:55:57","name":"[v3] libcamera: egl: Pass EGLDisplay to eGL constructor to avoid double init","version":3,"mbox":"https://patchwork.libcamera.org/series/6089/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27519/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27519/checks/","tags":{},"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 F2E3CC3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 29 Jul 2026 02:56:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3EF6567FAB;\n\tWed, 29 Jul 2026 04:56:11 +0200 (CEST)","from GVXPR05CU001.outbound.protection.outlook.com\n\t(mail-swedencentralazlp170130007.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f403:c202::7])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B85F767EB2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Jul 2026 04:56:08 +0200 (CEST)","from AM9PR04MB7556.eurprd04.prod.outlook.com\n\t(2603:10a6:20b:2df::11)\n\tby GVXPR04MB12342.eurprd04.prod.outlook.com (2603:10a6:150:31a::16)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.12;\n\tWed, 29 Jul 2026 02:56:06 +0000","from AM9PR04MB7556.eurprd04.prod.outlook.com\n\t([fe80::8599:94b0:43ea:32ed]) by\n\tAM9PR04MB7556.eurprd04.prod.outlook.com\n\t([fe80::8599:94b0:43ea:32ed%7]) with mapi id 15.21.0270.009;\n\tWed, 29 Jul 2026 02:56:06 +0000"],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=NXP1.onmicrosoft.com\n\theader.i=@NXP1.onmicrosoft.com header.b=\"Mrl0FIXX\"; \n\tdkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=oss.nxp.com;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n\tb=WUGGEtzDfgbrGwG0xG63SKAoA3a4BQ262RX3RADfc81mxKseMyvIVJQfHLGQQnpEdL5SogPu0MU6dK7joCCyoPPwFkBfKnKxw4+dAeNQ/3PD1gxol9E0C9N26QxEV6RNq/xx6qoCQsDZDGYmoXsqMcfUllBWsWpRJtXVG16hX4y1cKTvTBXUY1OYawpCbf2YVTa7tFVcp45AMPn0IWabeBQzUTErUr0fShpMcgKXhUgpv/mXnhWz0DRthbQ/35yiw0n7WpbPDnqkz+cqmexpdlwxb+9p9pRDkuqaWHwu0VZuzatSps+HNh98Vckul2rlN9rHTE44v3dz6rc5lTdUtg==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector10001;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n\tbh=cmr4eQw8fTF/Qc97OLmxlVTvdNhSGcYTYkK5nzO7Uz0=;\n\tb=vfNKP4AIRatLisj5sWDBq3bUevcU6lJaLDM3wVES08Lsj/E0RVLfa8h1fX5ofbc4yrulP44hpjZA4O4stkUvJlBFjE5Ysm41f2P0TC5koRmUGcdTIXLAZOCHyb5EywNi2jTi1wd97qMR/w8n/dMaSraMxU7DOph6ai+MrvTDcs6N90W33VTlZQpJaYHaGqENZbll5ow46FV7o4spd7IwcRaqI6Ab1Z0FkeRWRKOtlrPtaDBQxG5YOfqIxsiQ8sCT0xOiH25opyoy1ZOpLaajQmfvK6GRs03M45ag9DuZaKhkcp6H3b/ZTiNO/u48CLFL0UHEYmuywUw8jwlk6sXrEQ==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=oss.nxp.com;\n\tdmarc=pass action=none header.from=oss.nxp.com; \n\tdkim=pass header.d=oss.nxp.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com;\n\ts=selector1-NXP1-onmicrosoft-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=cmr4eQw8fTF/Qc97OLmxlVTvdNhSGcYTYkK5nzO7Uz0=;\n\tb=Mrl0FIXXS2TvkdlVAgBXBWEGKcgx31Dn7W9l3XKEtL8+KsBdZpnzIdZon0rGvb4Wib1stZwCUt1i7eyaLQTA00HcUAVC8tyqvDCkA3p8WuxVPDnIfeqdZUWlzDxtCmQ/FCKH9kgEBVSDVdd0T5mX7DBvnKvXo84V202ogI6nG0Kz5BPRzJ1hPb1yshMNC3EycCJvrAe2APfv5AAJExChTGbh3z1vizkdefzdGChViDDdXGXHgTFUN6CD8DSIOMjZrmPbn/NWsgyJBzCNf+7YjHGP8V+9lBl1IXhcWlwgUg675STzqXX6tuUBv09ITwCQ7UlE4dLtGa94P60Xqhop4g==","From":"qi.hou@oss.nxp.com","To":"libcamera-devel@lists.libcamera.org","Cc":"jared.hu@nxp.com,\n\tqi.hou@oss.nxp.com,\n\tjulien.vuillaumier@nxp.com","Subject":"[PATCH v3] libcamera: egl: Pass EGLDisplay to eGL constructor to\n\tavoid double init","Date":"Wed, 29 Jul 2026 11:55:57 +0900","Message-Id":"<20260729025557.2261274-1-qi.hou@oss.nxp.com>","X-Mailer":"git-send-email 2.34.1","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain","X-ClientProxiedBy":"SE2P216CA0085.KORP216.PROD.OUTLOOK.COM\n\t(2603:1096:101:2c6::11) To AM9PR04MB7556.eurprd04.prod.outlook.com\n\t(2603:10a6:20b:2df::11)","MIME-Version":"1.0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"AM9PR04MB7556:EE_|GVXPR04MB12342:EE_","X-MS-Office365-Filtering-Correlation-Id":"413a86fe-831b-4915-4206-08deed1cef1e","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;\n\tARA:13230040|366016|376014|1800799024|23010399003|19092799006|56012099006|11063799006|10067099003|6133799003|18002099003|3023799007;","X-Microsoft-Antispam-Message-Info":"pyyGG254/2QFzyYYL7/mG7cqynrOija5qU7zTYp2rRQApBGTpQwLDjXzmSbRM0eIgEvrl6OTdKrxohAIne5SejD3tzfsb3VQzzyTjrYTuImu6/AlyXTsX7s84n4bmI9SL4PRrFQWeTKv+krdlqADqXIj6xgNngDADo7EGSFgMZFuZhW3xO83WGmxXnt6JDAvUIi7WHMKQZzirPHI1O6JCfxv8dW01HWyJNMYHP8Rv9kc2VHEj8VH1VyFOaoTwt6cKQy32Kpm5dgae+nzGwDtTj+A3QysVSfMnHaxKJbo2daX9kQcKXSctNsEnVH8R0sSTEkiIR/cPvaRUc9PybYyPhLELaPFtC3UO265UHuWXKx8AlhlmU2j5mHvwcnnvfI5KnrwM2IEQUJzn+gRF1Yp419q64FRpvHeBHU1Cd1xft13m5wtnWzj9zmE6kRCKtCv8zcMluTJsT77JgHwNdsn3aGSRnpVQGasOWuIJ00wYnw1zPo2u5nwmFQm4AMlMl8FtHGiN+nhRfTKPnjpgZyvQKNY7BZcYCpLrovldyqKKKfMvmRgUo5ZTEp3Hk43XmHsKIah+uvbzb3VCWILDjZ/o1sjnXvgRIF6mwXhaHqJOjBDjNervsnzI5b83TMq9Lr7iPtt8lIsjX4CFT0R9hC+ynQvEX/XXH7v/1ExybopdNM=","X-Forefront-Antispam-Report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:AM9PR04MB7556.eurprd04.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230040)(366016)(376014)(1800799024)(23010399003)(19092799006)(56012099006)(11063799006)(10067099003)(6133799003)(18002099003)(3023799007);\n\tDIR:OUT; SFP:1101; ","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"cuY9L2ebUCWOA/8Epy60fvgNPjmGpSbnxwwpiQKGpRkA8fO6GUAk8uH2bXMBP89Igpv8DFkUGe1wDTGzgf2caAilqELORlnTl4ilKA1jhzq2TtPtY9oHWq7qEuFfjHpJv5g4AKK1c6WFHWq2V2TOyow33t4cZ/W6RlMadbAPQ+qg+eJTad7b3hCtT6yRlJ5p4JYv2bN4dvVyxB4lNdOeov0lk9LH9s97FfSJDJ5yHDmfhGg+wrKr2e/H0l97KCWqfSWyusI0a04Cwjnq+zmJOqFCz6Z9oFb4vSH4hHaQHT/8LRQCKTL27zB1Ck62n8H0woAkdq35YTfa4OLcND/ioReSU5M7yg76PETzKIwsHQDxAT7qRPAZI5CYfW4APbqPqvKZkKBshv4zNZs9zF3u7DXjWFeQCSQl3c/1Xxds7OKQMu/EkYt/qYANAsc1f1fWk12T3kORmEkDiGc9bB92Hu2/3OfN1gAbMKe+9QdJEVYfuU7Pcf3tdKAH1NgSQHKTf6RaOEQsleQOMYQ9kb/cEAAOHlApiFcB2tqSVyMBTudJqxsASDm4DT/vXZkk6uqooV/yPO+fGggTsrxw8XSqpCxCEGxdrQK2iU5+x5T97Sz+oXPRb2LnA7OL8GiqV4lAiPEUwfFi6Fe8qwOUILWc9OlIVlRWbnlp80zLnKFuxXKZPApEkhTDfQ9PrphRWTBV13QsLhGTarejJIAWLGjh878JkSKXh2rT8/fT7nJN9/EAZPtMlAfybyfyXdi2ykuW9FP3Sa1vuai0uwn3OrpD1bHGkdwtVwoUI2+W903wFlqHSKqhjWVWFiLaGZ+Se4/VbYKVpQ7UabkqOquHj4DIs1PtixD1qZaY/gd+mGb0rDUGoKtRZILb21Y7h501YYWLSdDB+5E4V2s7crVq307apjF+QGB3Xljr4mBr84eUO7vZwRCpHCk8JN12U9akMfsgE+sWyfjIhiwqQLW36bOGzH/nl4NT2Yra5Rs5yR+1CRk0l+HlkgAfjQMAd4u7r/p7+RheYXfbRyvYVaNM6MYCbq71NBUfTsZ2kJf4RLz1WIOYtLaKNo+teI4WdGBGPyU/L41TLSKY69KdYPUAf7zUFvEPbXuO6wVvo0U6J5AKTLBIerqj6eG96QDVAbPi5GuGMBBuRRhinx/G3K/c1ChQsIqoyxsAhrrgw9+pGdPl0fY9gtp5O4/KlUMKz4LUQTjiwptuRacnxGMzD4jlHiDwU1DaVAiDEboLSPhfnWnfETBsKDKnj2WM0AYDXB17qbOik7pEKQGg8v94my2+OjxOjuHUBlNokRuxF8b+zw8QZ8rCTD7AK58xwLSib8ot0D2bB13dV/JkeLCn4zkvTowUQ4pAHsWAPPn1gIpX+5YsH1/5vWcXeNRDnC46dVaqilozrXY/O2VxLB+asUnfLCe/Zh6WfqXU9ZBzdfDJ6QHNohn4M/kSCRQqCyTrKbXpmlBI7amI9cJoQ3BzVPbysuVelznmpUdCcI1w3Kd8Ly8U6hd4OITVW73Ql595oQhXlKod8DsVGX/j2R8JKni8XVMTy4D/Duyv6LEgtrgG339jC7Z8DyUnyPGdhFda+3odxslNikNkChDEaF3UG8f2wtxrKXX9PpMEogOmCIyoKqj4X9inxNg5miR1f5+vo/swyUsEmX7zv8dtMZlGjpcX3susmPyaRjf8dOWHAX0lzm6cmnrAFC3mVxpLlSpZ/PFWCG9PM5rYulsfX4SyBJ2hMSgP3bzl7CoMSuEiBP6MoVDi9Lo=","X-OriginatorOrg":"oss.nxp.com","X-MS-Exchange-CrossTenant-Network-Message-Id":"413a86fe-831b-4915-4206-08deed1cef1e","X-MS-Exchange-CrossTenant-AuthSource":"AM9PR04MB7556.eurprd04.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"29 Jul 2026 02:56:06.3382\n\t(UTC)","X-MS-Exchange-CrossTenant-FromEntityHeader":"Hosted","X-MS-Exchange-CrossTenant-Id":"686ea1d3-bc2b-4c6f-a92c-d99c5c301635","X-MS-Exchange-CrossTenant-MailboxType":"HOSTED","X-MS-Exchange-CrossTenant-UserPrincipalName":"D6M/QlcSdVm7rwQFJgdIe3w7f9JxJ5pF3BkxA0jFHt5D7eNtiv3HyqtMRS5WLh/vTbA4nI1vVqF3CqFUI/LXNaXnW8/df5nMK9qzwew8cbc=","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"GVXPR04MB12342","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>"},"content":"From: Qi Hou <qi.hou@nxp.com>\n\nisAvailable() previously called probeDisplay() to run a full EGL\ninitialisation sequence and then immediately terminated the display with\neglTerminate(). When SoftwareIsp subsequently created a DebayerEGL\ninstance, initEGLContext() would call probeDisplay() again, repeating\nthe full initialisation.\n\nFix this by reusing the display obtained during the availability check.\nprobeDisplay() is promoted to a public static method and isAvailable()\nis removed. The eGL constructor now takes the EGLDisplay as a parameter\nand stores it directly, so initEGLContext() no longer needs to call\nprobeDisplay(). DebayerEGL is updated to accept and forward the display\nto eGL, and SoftwareIsp calls eGL::probeDisplay() once, passing the\nresult straight to DebayerEGL when EGL is available.\n\nSigned-off-by: Qi Hou <qi.hou@nxp.com>\n---\n include/libcamera/internal/egl.h            |  5 +--\n src/libcamera/egl.cpp                       | 42 +++++++--------------\n src/libcamera/software_isp/debayer_egl.cpp  |  5 ++-\n src/libcamera/software_isp/debayer_egl.h    |  2 +-\n src/libcamera/software_isp/software_isp.cpp |  5 ++-\n 5 files changed, 23 insertions(+), 36 deletions(-)","diff":"diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex 1e31d490b..7ef1ca0d9 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -99,11 +99,11 @@ private:\n class eGL\n {\n public:\n-\teGL();\n+\teGL(EGLDisplay display);\n \t~eGL();\n \n \tint initEGLContext();\n-\tstatic bool isAvailable();\n+\tstatic EGLDisplay probeDisplay();\n \n \tint createInputDMABufTexture2D(eGLImage &eglImage, int fd);\n \tint createOutputDMABufTexture2D(eGLImage &eglImage, int fd);\n@@ -137,7 +137,6 @@ private:\n \tEGLContext context_ = EGL_NO_CONTEXT;\n \tEGLSurface surface_ = EGL_NO_SURFACE;\n \n-\tstatic EGLDisplay probeDisplay();\n \tint compileShader(int shaderType, GLuint &shaderId, Span<const unsigned char> shaderData,\n \t\t\t  Span<const std::string> shaderEnv);\n \ndiff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\nindex 7ec7a654d..01e51cda8 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -64,12 +64,15 @@ LOG_DEFINE_CATEGORY(eGL)\n \n /**\n  * \\brief Construct an EGL helper\n+ * \\param[in] display The EGL display to use\n  *\n  * Creates an eGL instance with uninitialised context. Call initEGLContext()\n- * to set up the EGL display, context, and load extension functions.\n+ * to set up the EGL context, and load extension functions.\n  */\n-eGL::eGL()\n+eGL::eGL(EGLDisplay display)\n+\t: display_(display)\n {\n+\tASSERT(display_ != EGL_NO_DISPLAY);\n }\n \n /**\n@@ -299,15 +302,17 @@ void eGL::createTexture2D(eGLImage &eglImage, void *data)\n \tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n }\n \n+/**\n+ * \\brief Try to create an EGL display for surfaceless rendering\n+ *\n+ * Tries to create an EGL display for surfaceless rendering.\n+ *\n+ * \\return A EGL display handle if successful, otherwise \\a EGL_NO_DISPLAY\n+ */\n EGLDisplay eGL::probeDisplay()\n {\n \tEGLDisplay display;\n \n-\tif (!eglBindAPI(EGL_OPENGL_ES_API)) {\n-\t\tLOG(eGL, Info) << \"API bind fail\";\n-\t\treturn EGL_NO_DISPLAY;\n-\t}\n-\n \tdisplay = eglGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA,\n \t\t\t\t\tEGL_DEFAULT_DISPLAY,\n \t\t\t\t\tnullptr);\n@@ -325,24 +330,6 @@ EGLDisplay eGL::probeDisplay()\n \treturn display;\n }\n \n-/**\n- * \\brief Probe whether EGL surfaceless rendering is available\n- *\n- * Checks if an EGL surfaceless display can be obtained and initialised.\n- * The display is immediately terminated so that no resources are leaked.\n- *\n- * \\return True if EGL surfaceless rendering is available, false otherwise\n- */\n-bool eGL::isAvailable()\n-{\n-\tEGLDisplay display = probeDisplay();\n-\tif (display == EGL_NO_DISPLAY)\n-\t\treturn false;\n-\n-\teglTerminate(display);\n-\treturn true;\n-}\n-\n /**\n  * \\brief Update a 2D texture already created\n  * \\param[in,out] eglImage EGL image to associate with the texture\n@@ -403,9 +390,8 @@ int eGL::initEGLContext()\n \tEGLint numConfigs;\n \tEGLConfig config;\n \n-\tdisplay_ = probeDisplay();\n-\tif (display_ == EGL_NO_DISPLAY) {\n-\t\tLOG(eGL, Error) << \"Unable to probe display\";\n+\tif (!eglBindAPI(EGL_OPENGL_ES_API)) {\n+\t\tLOG(eGL, Error) << \"API bind fail\";\n \t\tgoto fail;\n \t}\n \ndiff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\nindex dd2041219..20b478b1c 100644\n--- a/src/libcamera/software_isp/debayer_egl.cpp\n+++ b/src/libcamera/software_isp/debayer_egl.cpp\n@@ -40,9 +40,10 @@ namespace libcamera {\n  * \\brief Construct a DebayerEGL object\n  * \\param[in] stats Statistics processing object\n  * \\param[in] cm The camera manager\n+ * \\param[in] display The EGL display to use\n  */\n-DebayerEGL::DebayerEGL(std::unique_ptr<SwStatsCpu> stats, const CameraManager &cm)\n-\t: Debayer(cm), stats_(std::move(stats))\n+DebayerEGL::DebayerEGL(std::unique_ptr<SwStatsCpu> stats, const CameraManager &cm, EGLDisplay display)\n+\t: Debayer(cm), stats_(std::move(stats)), egl_(display)\n {\n }\n \ndiff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h\nindex e613639f5..30e51a477 100644\n--- a/src/libcamera/software_isp/debayer_egl.h\n+++ b/src/libcamera/software_isp/debayer_egl.h\n@@ -40,7 +40,7 @@ class CameraManager;\n class DebayerEGL : public Debayer\n {\n public:\n-\tDebayerEGL(std::unique_ptr<SwStatsCpu> stats, const CameraManager &cm);\n+\tDebayerEGL(std::unique_ptr<SwStatsCpu> stats, const CameraManager &cm, EGLDisplay display);\n \t~DebayerEGL();\n \n \tint configure(const StreamConfiguration &inputCfg,\ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex c73a16ce0..c7165771c 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -120,8 +120,9 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n \t}\n \n \tif (!softISPMode || softISPMode == \"gpu\") {\n-\t\tif (eGL::isAvailable()) {\n-\t\t\tdebayer_ = std::make_unique<DebayerEGL>(std::move(stats), cm);\n+\t\tauto display = eGL::probeDisplay();\n+\t\tif (display != EGL_NO_DISPLAY) {\n+\t\t\tdebayer_ = std::make_unique<DebayerEGL>(std::move(stats), cm, display);\n \t\t} else {\n \t\t\tLOG(SoftwareIsp, Info)\n \t\t\t\t<< \"EGL not available, falling back to CPU debayer\";\n","prefixes":["v3"]}