Patch Detail
Show a patch.
GET /api/1.1/patches/25870/?format=api
{ "id": 25870, "url": "https://patchwork.libcamera.org/api/1.1/patches/25870/?format=api", "web_url": "https://patchwork.libcamera.org/patch/25870/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260120122344.28283-1-robert.mader@collabora.com>", "date": "2026-01-20T12:23:43", "name": "[v3,1/2] egl: Use the Mesa surfaceless platform instead of GBM", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b99ee7176546af46a92f960d6282abba1d9d1720", "submitter": { "id": 140, "url": "https://patchwork.libcamera.org/api/1.1/people/140/?format=api", "name": "Robert Mader", "email": "robert.mader@collabora.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/25870/mbox/", "series": [ { "id": 5721, "url": "https://patchwork.libcamera.org/api/1.1/series/5721/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5721", "date": "2026-01-20T12:23:43", "name": "[v3,1/2] egl: Use the Mesa surfaceless platform instead of GBM", "version": 3, "mbox": "https://patchwork.libcamera.org/series/5721/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/25870/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/25870/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 F3542BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Jan 2026 12:24:07 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 22EEF61FBF;\n\tTue, 20 Jan 2026 13:24:07 +0100 (CET)", "from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com\n\t[136.143.188.112])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 55A2D61A35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Jan 2026 13:24:05 +0100 (CET)", "by mx.zohomail.com with SMTPS id 17689118390971009.6650378051735; \n\tTue, 20 Jan 2026 04:23:59 -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=\"EbCS+Ece\"; \n\tdkim-atps=neutral", "ARC-Seal": "i=1; a=rsa-sha256; t=1768911840; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=Rgxz3PSf941NrIiWjst1MA02p3w8RdwA7Ifh6v77oVwuYvu/aAak+126CT2K6dM1UFCm5uN4+vl7J1+8ruPCA8TQiXxHOITiAwP7+sfab90cLceXxvQSXJzYf7juPY+RHV2lVY63TPMoCWSLP4PAwl5iy6QBMQv8oP89UX0rBZM=", "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1768911840;\n\th=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=ZWT5oBnml50K6Fm+ocsguHWNgGl5nobzdBEbiYg2BcU=; \n\tb=K7lt5Xc12oP9XeTkgakR1azwRlu7KNoz+h+pNNK+CYqIi8fMxWkMv2I8BgwGLd1TYm9duh7E6KRuQkfjsSnOBwIr/SLgkum6xbaEa5QetGHs7d4Lp8o0fIa+8tm74gTsQY9iqkYfIwcit7US6DnEbSXvJkobC03upnU0tYiJjpI=", "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=1768911840;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=ZWT5oBnml50K6Fm+ocsguHWNgGl5nobzdBEbiYg2BcU=;\n\tb=EbCS+EceZQYQgecCxE0u5+WHPJPWPteGdhDClmmqianNYd41WaP4q888om4WDinO\n\tCvPqlRF6V4eYOJepwBG/igquNnLZjAC9qt9hLUrkU+CBS93qiRVvWDVDOC02k9gt82o\n\t1vz/MrqXdlQYOMhz4HCDbOOxKXO2qRus46QOxKdE=", "From": "Robert Mader <robert.mader@collabora.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Robert Mader <robert.mader@collabora.com>, Bryan O'Donoghue\n\t<bryan.odonoghue@linaro.org>, Milan Zamazal <mzamazal@redhat.com>,\n\t=?utf-8?b?QmFybmFiw6FzIFDFkWN6?= =?utf-8?q?e?=\n\t<barnabas.pocze@ideasonboard.com>, Laurent Pinchart\n\t<laurent.pinchart@ideasonboard.com>", "Subject": "[PATCH v3 1/2] egl: Use the Mesa surfaceless platform instead of GBM", "Date": "Tue, 20 Jan 2026 13:23:43 +0100", "Message-ID": "<20260120122344.28283-1-robert.mader@collabora.com>", "X-Mailer": "git-send-email 2.52.0", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "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>" }, "content": "Mesa surfaceless platform appears to be a better fit for the use-case at hand:\n1. Like GBM it is Mesa specific, so no change in supported setups is\n expected. If ever required, a fallback to the generic device platform\n could be added on top.\n2. It leaves the complexity of selecting a renderer device to the\n driver, reducing code and dependencies.\n3. It allows to use llvmpipe / software drivers without dri device,\n which can be useful on CI or debugging (with LIBGL_ALWAYS_SOFTWARE=1).\n\nSigned-off-by: Robert Mader <robert.mader@collabora.com>\nReviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\nTested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sm8250/rb5, x1e/Dell Insprion14p\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\nTested-by: Milan Zamazal <mzamazal@redhat.com> # TI AM69\nTested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # ThinkPad X1 Yoga Gen 7 + ov2740\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\n\nChanges in v3:\n - Minor commit message improvement\n - Use EGL_DEFAULT_DISPLAY instead of nullptr (no change in behavior)\n - Improve comment formating\n - Add Laurents R-B\n\nChanges in v2:\n - Add tags\n---\n include/libcamera/internal/egl.h | 4 +---\n src/libcamera/egl.cpp | 14 +++++++-------\n src/libcamera/software_isp/debayer_egl.cpp | 9 +++------\n src/libcamera/software_isp/debayer_egl.h | 1 -\n 4 files changed, 11 insertions(+), 17 deletions(-)", "diff": "diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex f007f448a..630345ea7 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -16,8 +16,6 @@\n #include <libcamera/base/span.h>\n #include <libcamera/base/utils.h>\n \n-#include \"libcamera/internal/gbm.h\"\n-\n #define EGL_EGLEXT_PROTOTYPES\n #include <EGL/egl.h>\n #include <EGL/eglext.h>\n@@ -96,7 +94,7 @@ public:\n \teGL();\n \t~eGL();\n \n-\tint initEGLContext(GBM *gbmContext);\n+\tint initEGLContext();\n \n \tint createInputDMABufTexture2D(eGLImage &eglImage, int fd);\n \tint createOutputDMABufTexture2D(eGLImage &eglImage, int fd);\ndiff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\nindex da563ee09..5b9bbf410 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -256,24 +256,22 @@ void eGL::createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint\n \n /**\n * \\brief Initialise the EGL context\n- * \\param[in] gbmContext Pointer to initialised GBM context\n *\n- * Sets up the EGL display from the GBM device, creates an OpenGL ES 2.0\n- * context, and retrieves function pointers for required extensions\n- * including:\n+ * Sets up the EGL display, creates an OpenGL ES 2.0 context, and retrieves\n+ * function pointers for required extensions including:\n * - eglCreateImageKHR / eglDestroyImageKHR\n * - glEGLImageTargetTexture2DOES\n *\n * \\return 0 on success, or -ENODEV on failure\n */\n-int eGL::initEGLContext(GBM *gbmContext)\n+int eGL::initEGLContext()\n {\n \tEGLint configAttribs[] = {\n \t\tEGL_RED_SIZE, 8,\n \t\tEGL_GREEN_SIZE, 8,\n \t\tEGL_BLUE_SIZE, 8,\n \t\tEGL_ALPHA_SIZE, 8,\n-\t\tEGL_SURFACE_TYPE, EGL_WINDOW_BIT,\n+\t\tEGL_SURFACE_TYPE, EGL_PBUFFER_BIT,\n \t\tEGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,\n \t\tEGL_NONE\n \t};\n@@ -291,7 +289,9 @@ int eGL::initEGLContext(GBM *gbmContext)\n \t\tgoto fail;\n \t}\n \n-\tdisplay_ = eglGetDisplay(gbmContext->device());\n+\tdisplay_ = eglGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA,\n+\t\t\t\t\t EGL_DEFAULT_DISPLAY,\n+\t\t\t\t\t nullptr);\n \tif (display_ == EGL_NO_DISPLAY) {\n \t\tLOG(eGL, Error) << \"Unable to get EGL display\";\n \t\tgoto fail;\ndiff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\nindex 9693d7252..37c44e8b1 100644\n--- a/src/libcamera/software_isp/debayer_egl.cpp\n+++ b/src/libcamera/software_isp/debayer_egl.cpp\n@@ -141,8 +141,8 @@ int DebayerEGL::initBayerShaders(PixelFormat inputFormat, PixelFormat outputForm\n \tegl_.pushEnv(shaderEnv, \"#extension GL_OES_EGL_image_external: enable\");\n \n \t/*\n-\t * Tell shaders how to re-order output taking account of how the\n-\t * pixels are actually stored by GBM\n+\t * Tell shaders how to re-order output taking account of how the pixels\n+\t * are actually stored by EGL.\n \t */\n \tswitch (outputFormat) {\n \tcase formats::ARGB8888:\n@@ -586,10 +586,7 @@ int DebayerEGL::start()\n {\n \tGLint maxTextureImageUnits;\n \n-\tif (gbmSurface_.createDevice())\n-\t\treturn -ENODEV;\n-\n-\tif (egl_.initEGLContext(&gbmSurface_))\n+\tif (egl_.initEGLContext())\n \t\treturn -ENODEV;\n \n \tglGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureImageUnits);\ndiff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h\nindex a5033bc63..cfbaf8e9d 100644\n--- a/src/libcamera/software_isp/debayer_egl.h\n+++ b/src/libcamera/software_isp/debayer_egl.h\n@@ -113,7 +113,6 @@ private:\n \tRectangle window_;\n \tstd::unique_ptr<SwStatsCpu> stats_;\n \teGL egl_;\n-\tGBM gbmSurface_;\n \tuint32_t width_;\n \tuint32_t height_;\n \tGLint glFormat_;\n", "prefixes": [ "v3", "1/2" ] }