Show a patch.

GET /api/patches/26598/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 26598,
    "url": "https://patchwork.libcamera.org/api/patches/26598/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26598/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20260503114002.139255-2-robert.mader@collabora.com>",
    "date": "2026-05-03T11:40:00",
    "name": "[1/3] egl: Add more parameters to createInputDMABufTexture2D()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "04161691a0e9dfbcc869ca6a58c9fcbb5c750168",
    "submitter": {
        "id": 140,
        "url": "https://patchwork.libcamera.org/api/people/140/?format=api",
        "name": "Robert Mader",
        "email": "robert.mader@collabora.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26598/mbox/",
    "series": [
        {
            "id": 5898,
            "url": "https://patchwork.libcamera.org/api/series/5898/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5898",
            "date": "2026-05-03T11:39:59",
            "name": "software_isp: Implement DMABuf import for input buffers",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5898/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26598/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26598/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 A7712BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  3 May 2026 11:40:47 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 450BA63022;\n\tSun,  3 May 2026 13:40:47 +0200 (CEST)",
            "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 75EE962FEA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  3 May 2026 13:40:44 +0200 (CEST)",
            "by mx.zohomail.com with SMTPS id 1777808439095550.941595129288;\n\tSun, 3 May 2026 04:40:39 -0700 (PDT)"
        ],
        "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=\"iKKc2dcH\"; \n\tdkim-atps=neutral",
        "ARC-Seal": "i=1; a=rsa-sha256; t=1777808440; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=muarRH+fVgLZpS7FZhJRIMHy96sbFNa9DA39jBKc4aU4RshekDkWO6WKIfsacXOQE+dS+YIPVX2Z88KKKpJRUG6T9xt1AkDckMyJYTBocBx54foTLfeq7vDe3rpFjjYuweB5rrvH+fgZr43/VO+i88HkS4uR5qFIqaSS4MZebJ0=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1777808440;\n\th=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=fD94TTXq7I1f8t/ltsnbXNfzYny3u/OUNNuzZiiFZVs=; \n\tb=lS1HNFJl5TKvbVA8ImgjetxYwQgWd7+1ptr7ywywx4OsZsH6rhjbc0eeXk9g3bxnESqrCcSTYShW5WYZQm4+lILFd5XqJZ6Kx7xU3b5GX+EvF88tO2Pm87wma0uHc4+xljRwkk17HjAjicuw8rdtR5ufqHSrqPKNcKKnGR7Oov0=",
        "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=1777808440;\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:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=fD94TTXq7I1f8t/ltsnbXNfzYny3u/OUNNuzZiiFZVs=;\n\tb=iKKc2dcHF6rERp3qsIVNjOuFE9Nfjjd4HJcyhbVLUNWowzNSs2QUX6IksVEmPNIH\n\tOKMoa/y13Mp8/hxHmzbKWT0EVzY39Wkl06kk7hTEAzDMM+jE1qXr6Td5U96VXKbfsob\n\tf8UAwivDWlQH30cSigwUiR9qo2UJ3buE/Bv/aQ2M=",
        "From": "Robert Mader <robert.mader@collabora.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Robert Mader <robert.mader@collabora.com>",
        "Subject": "[PATCH 1/3] egl: Add more parameters to createInputDMABufTexture2D()",
        "Date": "Sun,  3 May 2026 13:40:00 +0200",
        "Message-ID": "<20260503114002.139255-2-robert.mader@collabora.com>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260503114002.139255-1-robert.mader@collabora.com>",
        "References": "<20260503114002.139255-1-robert.mader@collabora.com>",
        "MIME-Version": "1.0",
        "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": "In order to match createTexture2D(). This will allow us to replace the\nlater with the former going forward.\n\nAlso demote an error log to debug, avoiding flodding the logs in cases\nwhere import failure is an expected result.\n\nSigned-off-by: Robert Mader <robert.mader@collabora.com>\n---\n include/libcamera/internal/egl.h |  4 ++--\n src/libcamera/egl.cpp            | 37 +++++++++++++++++++++++++-------\n 2 files changed, 31 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex 0ad2320b1..bd2f20e33 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -101,7 +101,7 @@ public:\n \n \tint initEGLContext();\n \n-\tint createInputDMABufTexture2D(eGLImage &eglImage, int fd);\n+\tint createInputDMABufTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, int fd);\n \tint createOutputDMABufTexture2D(eGLImage &eglImage, int fd);\n \tvoid createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, void *data);\n \n@@ -133,7 +133,7 @@ private:\n \t\t\t  unsigned int shaderDataLen,\n \t\t\t  Span<const std::string> shaderEnv);\n \n-\tint createDMABufTexture2D(eGLImage &eglImage, int fd, bool output);\n+\tint createDMABufTexture2D(eGLImage &eglImage, int fd, uint32_t drm_format, uint32_t width, uint32_t height, bool output);\n \n \tPFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;\n \tPFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;\ndiff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\nindex f65929470..c30ed95a7 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -19,6 +19,7 @@\n \n #include <libcamera/base/thread.h>\n \n+#include <GLES3/gl32.h>\n #include <libdrm/drm_fourcc.h>\n \n namespace libcamera {\n@@ -102,6 +103,9 @@ void eGL::syncOutput()\n  * \\brief Create a DMA-BUF backed 2D texture\n  * \\param[in,out] eglImage EGL image to associate with the DMA-BUF\n  * \\param[in] fd DMA-BUF file descriptor\n+ * \\param[in] drm_format the DRM fourcc\n+ * \\param[in] width the buffer width\n+ * \\param[in] height the buffer height\n  * \\param[in] output If true, create framebuffer for render target\n  *\n  * Internal implementation for creating DMA-BUF textures. Creates an EGL\n@@ -110,15 +114,15 @@ void eGL::syncOutput()\n  *\n  * \\return 0 on success, or -ENODEV on failure\n  */\n-int eGL::createDMABufTexture2D(eGLImage &eglImage, int fd, bool output)\n+int eGL::createDMABufTexture2D(eGLImage &eglImage, int fd, uint32_t drm_format, uint32_t width, uint32_t height, bool output)\n {\n \tASSERT(tid_ == Thread::currentId());\n \n \t// clang-format off\n \tEGLint image_attrs[] = {\n-\t\tEGL_WIDTH, (EGLint)eglImage.width_,\n-\t\tEGL_HEIGHT, (EGLint)eglImage.height_,\n-\t\tEGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888,\n+\t\tEGL_WIDTH, (EGLint)width,\n+\t\tEGL_HEIGHT, (EGLint)height,\n+\t\tEGL_LINUX_DRM_FOURCC_EXT, (EGLint)drm_format,\n \t\tEGL_DMA_BUF_PLANE0_FD_EXT, fd,\n \t\tEGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,\n \t\tEGL_DMA_BUF_PLANE0_PITCH_EXT, (EGLint)eglImage.stride_,\n@@ -133,7 +137,7 @@ int eGL::createDMABufTexture2D(eGLImage &eglImage, int fd, bool output)\n \t\t\t\t\t      NULL, image_attrs);\n \n \tif (image == EGL_NO_IMAGE_KHR) {\n-\t\tLOG(eGL, Error) << \"eglCreateImageKHR fail\";\n+\t\tLOG(eGL, Debug) << \"eglCreateImageKHR fail\";\n \t\treturn -ENODEV;\n \t}\n \n@@ -171,6 +175,9 @@ int eGL::createDMABufTexture2D(eGLImage &eglImage, int fd, bool output)\n /**\n  * \\brief Create an input DMA-BUF backed texture\n  * \\param[in,out] eglImage EGL image to associate with the DMA-BUF\n+ * \\param[in] format the GL format\n+ * \\param[in] width the buffer width\n+ * \\param[in] height the buffer height\n  * \\param[in] fd DMA-BUF file descriptor\n  *\n  * Creates an EGL image from a DMA-BUF file descriptor and binds it to\n@@ -179,11 +186,25 @@ int eGL::createDMABufTexture2D(eGLImage &eglImage, int fd, bool output)\n  *\n  * \\return 0 on success, or -ENODEV on failure\n  */\n-int eGL::createInputDMABufTexture2D(eGLImage &eglImage, int fd)\n+int eGL::createInputDMABufTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, int fd)\n {\n+\tEGLint drm_format;\n+\n \tASSERT(tid_ == Thread::currentId());\n \n-\treturn createDMABufTexture2D(eglImage, fd, false);\n+\tswitch (format) {\n+\tcase GL_LUMINANCE:\n+\t\tdrm_format = DRM_FORMAT_R8;\n+\t\tbreak;\n+\tcase GL_RG:\n+\t\tdrm_format = DRM_FORMAT_RG88;\n+\t\tbreak;\n+\tdefault:\n+\t\tLOG(eGL, Error) << \"unhandled GL format\";\n+\t\treturn -ENODEV;\n+\t}\n+\n+\treturn createDMABufTexture2D(eglImage, fd, drm_format, width, height, false);\n }\n \n /**\n@@ -202,7 +223,7 @@ int eGL::createOutputDMABufTexture2D(eGLImage &eglImage, int fd)\n {\n \tASSERT(tid_ == Thread::currentId());\n \n-\treturn createDMABufTexture2D(eglImage, fd, true);\n+\treturn createDMABufTexture2D(eglImage, fd, DRM_FORMAT_ARGB8888, eglImage.width_, eglImage.height_, true);\n }\n \n /**\n",
    "prefixes": [
        "1/3"
    ]
}