Show a patch.

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

{
    "id": 26804,
    "url": "https://patchwork.libcamera.org/api/patches/26804/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26804/",
    "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": "<20260527081534.20245-2-robert.mader@collabora.com>",
    "date": "2026-05-27T08:15:30",
    "name": "[v5,1/5] egl: Add GL format parameter to eGLImage constructor",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "2a1ded33694f9df3e12f25d8ebcc4c7976204d6b",
    "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/26804/mbox/",
    "series": [
        {
            "id": 5965,
            "url": "https://patchwork.libcamera.org/api/series/5965/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5965",
            "date": "2026-05-27T08:15:29",
            "name": "software_isp: Implement DMABuf import for input buffers",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/5965/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26804/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26804/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 E66FBC328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 May 2026 08:16:11 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8DDDF63026;\n\tWed, 27 May 2026 10:16:11 +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 929C462FEA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 May 2026 10:16:08 +0200 (CEST)",
            "by mx.zohomail.com with SMTPS id 1779869761853723.2668974939996;\n\tWed, 27 May 2026 01:16:01 -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=\"fkx0rjeV\"; \n\tdkim-atps=neutral",
        "ARC-Seal": "i=1; a=rsa-sha256; t=1779869764; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=AJByEXEMJ4A8BY6B5C39O7VtgOJw8lpiihA3gDvoqIvAeVZjLyrgp9xDksGRlAH4OXtEOUWXyB6tAEnUeEZiGeu0e0Ce+krrZBTQqgyNSjSSqAiOMQcMjGAHZidCZu+swfJQs27ZY8HclU/HSEePcW/uBwPaafH0iyoWY1Li67M=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1779869764;\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=g1xRZFNPtIbnWKNO7/gV2bhcBzXwE07VvEMR0YwQiOY=; \n\tb=cqdEgOgD981R+/qStEPF0IVKii6FdJISKZO4pyX2Ctw5hy3BbvB2u8WCfRxwpRgAU/EVP+AOQ8BwjvKYM2tRd1vDuVXA43sHCtVZsKD0aDTeiSZ86fbcMbHCpe5FZt9aQ0P2sUeWnoAUajL8/laqXkJkkjWub+MIAb8hm4RflO8=",
        "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=1779869764;\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=g1xRZFNPtIbnWKNO7/gV2bhcBzXwE07VvEMR0YwQiOY=;\n\tb=fkx0rjeVLnv4kd9E12SU5WOcOq51/iXSdpApKN4vJ99maknR2YNkL9qIydbGqhcE\n\tYZ1mrs6KSi50VjYlcVAzz1A0TdGu9oC6pMMmZ03SeM07GDMNc5YH4FGyIz0OA4nTaTp\n\trv2z+Zs2pqbEtEVwE/lR7E1Lm91AgBvsAujTLtjE=",
        "From": "Robert Mader <robert.mader@collabora.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Robert Mader <robert.mader@collabora.com>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>",
        "Subject": "[PATCH v5 1/5] egl: Add GL format parameter to eGLImage constructor",
        "Date": "Wed, 27 May 2026 10:15:30 +0200",
        "Message-ID": "<20260527081534.20245-2-robert.mader@collabora.com>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260527081534.20245-1-robert.mader@collabora.com>",
        "References": "<20260527081534.20245-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 preparation for the following commits. This requires a minor\nreordering in DebayerEGL::start() as the value for the input texture is\nonly known after initBayerShaders().\n\nSigned-off-by: Robert Mader <robert.mader@collabora.com>\nReviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n include/libcamera/internal/egl.h           |  6 ++++--\n src/libcamera/egl.cpp                      | 22 +++++++++++++++++++++-\n src/libcamera/software_isp/debayer_egl.cpp | 10 +++++-----\n 3 files changed, 30 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex 0ec8ea6ec..825240dbb 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -51,14 +51,15 @@ class eGLImage\n public:\n \t/**\n \t * \\brief Construct an eGLImage with explicit stride\n+\t * \\param[in] format Image GL format\n \t * \\param[in] width Image width in pixels\n \t * \\param[in] height Image height in pixels\n \t * \\param[in] stride Row stride in bytes\n \t * \\param[in] texture_unit OpenGL texture unit\n \t * \\param[in] texture_unit_uniform_id Shader uniform ID\n \t */\n-\teGLImage(uint32_t width, uint32_t height, uint32_t stride, GLenum texture_unit, uint32_t texture_unit_uniform_id)\n-\t\t: width_(width), height_(height), stride_(stride),\n+\teGLImage(GLint format, uint32_t width, uint32_t height, uint32_t stride, GLenum texture_unit, uint32_t texture_unit_uniform_id)\n+\t\t: format_(format), width_(width), height_(height), stride_(stride),\n \t\t  framesize_(stride * height),\n \t\t  texture_unit_uniform_id_(texture_unit_uniform_id),\n \t\t  texture_unit_(texture_unit)\n@@ -79,6 +80,7 @@ public:\n \t\tglDeleteTextures(1, &texture_);\n \t}\n \n+\tGLint format_; /**< Image GL format */\n \tuint32_t width_; /**< Image width in pixels */\n \tuint32_t height_; /**< Image height in pixels */\n \tuint32_t stride_; /**< Row stride in bytes */\ndiff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\nindex 19ae92305..2aabfc2e0 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -20,6 +20,8 @@\n \n #include <libcamera/base/thread.h>\n \n+#include <GLES3/gl32.h>\n+\n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(eGL)\n@@ -124,13 +126,31 @@ void eGL::flushOutput()\n  */\n int eGL::createDMABufTexture2D(eGLImage &eglImage, int fd, bool output)\n {\n+\tEGLint drm_format;\n+\n \tASSERT(tid_ == Thread::currentId());\n \n+\tswitch (eglImage.format_) {\n+\tcase GL_RED:\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+\tcase GL_RGBA:\n+\t\tdrm_format = DRM_FORMAT_ARGB8888;\n+\t\tbreak;\n+\tdefault:\n+\t\tLOG(eGL, Error) << \"unhandled GL format\";\n+\t\treturn -ENODEV;\n+\t}\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_LINUX_DRM_FOURCC_EXT, 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_,\ndiff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\nindex 7b9e02d90..8c1f2074d 100644\n--- a/src/libcamera/software_isp/debayer_egl.cpp\n+++ b/src/libcamera/software_isp/debayer_egl.cpp\n@@ -583,14 +583,14 @@ int DebayerEGL::start()\n \n \tLOG(Debayer, Debug) << \"Available fragment shader texture units \" << maxTextureImageUnits;\n \n+\tif (initBayerShaders(inputPixelFormat_, outputPixelFormat_))\n+\t\treturn -EINVAL;\n+\n \t/* Raw bayer input as texture */\n-\teglImageBayerIn_ = std::make_unique<eGLImage>(width_, height_, inputConfig_.stride, GL_TEXTURE0, 0);\n+\teglImageBayerIn_ = std::make_unique<eGLImage>(glFormat_, width_, height_, inputConfig_.stride, GL_TEXTURE0, 0);\n \n \t/* Texture we will render to */\n-\teglImageBayerOut_ = std::make_unique<eGLImage>(outputSize_.width, outputSize_.height, outputConfig_.stride, GL_TEXTURE1, 1);\n-\n-\tif (initBayerShaders(inputPixelFormat_, outputPixelFormat_))\n-\t\treturn -EINVAL;\n+\teglImageBayerOut_ = std::make_unique<eGLImage>(GL_RGBA, outputSize_.width, outputSize_.height, outputConfig_.stride, GL_TEXTURE1, 1);\n \n \treturn 0;\n }\n",
    "prefixes": [
        "v5",
        "1/5"
    ]
}