Show a patch.

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

{
    "id": 27255,
    "url": "https://patchwork.libcamera.org/api/patches/27255/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/27255/",
    "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": "<20260706222245.247396-3-bryan.odonoghue@linaro.org>",
    "date": "2026-07-06T22:22:41",
    "name": "[v6,2/6] libcamera: egl: Add new helper attachTextureToFBO",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ab7e7374ad9f125c072ddf3e4a2bd1cd1cfd2f4e",
    "submitter": {
        "id": 175,
        "url": "https://patchwork.libcamera.org/api/people/175/?format=api",
        "name": "Bryan O'Donoghue",
        "email": "bryan.odonoghue@linaro.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/27255/mbox/",
    "series": [
        {
            "id": 6042,
            "url": "https://patchwork.libcamera.org/api/series/6042/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6042",
            "date": "2026-07-06T22:22:39",
            "name": "libcamera: software_isp: gpu: Add go faster stripes",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/6042/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/27255/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/27255/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 3B8F8C3308\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jul 2026 22:23:03 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF7D76605E;\n\tTue,  7 Jul 2026 00:23:01 +0200 (CEST)",
            "from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com\n\t[IPv6:2a00:1450:4864:20::42c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ED7D16604F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Jul 2026 00:22:58 +0200 (CEST)",
            "by mail-wr1-x42c.google.com with SMTP id\n\tffacd0b85a97d-45fd464d51fso1814859f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 06 Jul 2026 15:22:58 -0700 (PDT)",
            "from inspiron14p-linux ([109.77.44.220])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-47aa039ad21sm27916413f8f.20.2026.07.06.15.22.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 06 Jul 2026 15:22:57 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"QTsGj0c/\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1783376578; x=1783981378;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to:content-type;\n\tbh=sCherSufb0on4kaTY2CKoIjTcZ+GTv1qK3dt1yZ0ysg=;\n\tb=QTsGj0c/FYjGwuBw5jh8YjYIPAhBbfZ2MdTXqwxo54pAnopT3oHh7e9VD7PLAiJ4Dh\n\tSoiin1HvN1PU0AlGv4bwxoxi9hEvRu6uTfpCibqADOfWcOP4fxxPgZMiCjZRqFn5qHvj\n\txsZlBlpv0dSYpFgsyl+LGsyJcBtWPdGYigdEFPKrEXR9GIp+75BTzCCUbg0E2l2iht7s\n\tne7QUizdAOqyv+OgCDdKuZ7b6dCx002IxoCMQkVCLtN4W80Z2LEZuMh2F3+UTJ+mByOI\n\tG9WWxioJT5bwXD+3769oOOma2AcCg8FCvXg5pXwJY6d6GXgsTi9129sjr+fFxSpvdOMu\n\tgwMw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783376578; x=1783981378;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to:content-type;\n\tbh=sCherSufb0on4kaTY2CKoIjTcZ+GTv1qK3dt1yZ0ysg=;\n\tb=CHHjh3Mg14vSUN2Q1AstsfbwDFaT88XI5QeHlLAE/0OfzXhqbdi19026B9sU+asHt/\n\tJAxB7f89dL0DmZ7QIT8yUzwgnTXEMG9aqBOZCBdjrESS+iUQFH8ayR6tT3KR2S4zq2g4\n\tkqY3oe8jIFixB8PTMY8RVP/Uuy50sPirqun7byMCRABxi+GjhxamYelzC0oAlG5mqC33\n\t60VrAcljXHGviwa/wkcRpMDMrCAFmCbQwUvA1BlH8Ib5hMvPCD+1mBNvXVHGC8WPoiBU\n\tk7CD8fYqPv0+rijtPzUu7s01ibzyQqR5+GlRSZA5Fl0Agkzg9IgAaLc/xhBt9jx7U9uT\n\tjsrQ==",
        "X-Gm-Message-State": "AOJu0YynCowIxGaeBIaIVMkx4A5ufY3IzOOfM5TwBvqAiB0y5iRwr/jS\n\tzgJ3vU+FSMn0OO4CuPshUY7+Ox8IMjOPN1qCgOSNCjoljBg4siiPlDrTlWf8hoAkktDOds8jI0T\n\tkj8FN",
        "X-Gm-Gg": "AfdE7cmUfP0sTaMSN3TNGT41mlaslRDZo13/1lvgUJLsB5PiQNnQEomeC/IoMVYEa5s\n\t8KFfBlqKtIixs8l51ylmowUtjwFKoTXFGWsut9z6FeAGjuVRGXR8Jzf+fxUXKXNymV8lV36qfbt\n\tGYafRPqm3uGFHf0+Q8gOjSObc8NfWRkLmiNUGsYVafsKdBlfWzE7glEYefAX/COujxrgpOoSYfI\n\tjeyKM/2P8R7MdKQGrb6IWGzYfnDpF/CaJSWXhkrJNL1TA/asX75Jqo2hLW1WqtuTOmHpu9Kgs/V\n\tJtJAQUG6TSqFQLKJTj/g24brmXMJ1X1jJAxb5W7xlZyCLFFZiBm2MegOT9F3vIw9J2sGDqXRfPx\n\tfYYU8dHQrjCjilyFymJpr9ggsLWHtIj2P/NuyGwNYbuygcMtORQJNdYOFAooDwavbMQjxEvRl+C\n\tjUn8EYXuHqxVHa5+BbWzZT9SFEBHIHbLJ0oFRIWcY=",
        "X-Received": "by 2002:adf:f390:0:b0:473:fe94:9bf1 with SMTP id\n\tffacd0b85a97d-47de66693b9mr1854859f8f.26.1783376578276; \n\tMon, 06 Jul 2026 15:22:58 -0700 (PDT)",
        "From": "Bryan O'Donoghue <bryan.odonoghue@linaro.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "bryan.odonoghue@linaro.org, pavel@ucw.cz,\n\tRobert Mader <robert.mader@collabora.com>,\n\tMilan Zamazal <mzamazal@redhat.com>",
        "Subject": "[PATCH v6 2/6] libcamera: egl: Add new helper attachTextureToFBO",
        "Date": "Mon,  6 Jul 2026 23:22:41 +0100",
        "Message-ID": "<20260706222245.247396-3-bryan.odonoghue@linaro.org>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260706222245.247396-1-bryan.odonoghue@linaro.org>",
        "References": "<20260706222245.247396-1-bryan.odonoghue@linaro.org>",
        "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": "This method does what it says on the tin. It attaches a texture to a\nframebuffer object, splitting existing code into a helper function which we\nwill use in subsequent patches.\n\nReviewed-by: Robert Mader <robert.mader@collabora.com>\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n include/libcamera/internal/egl.h |  2 ++\n src/libcamera/egl.cpp            | 42 +++++++++++++++++++++++---------\n 2 files changed, 32 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex 523a62aa8..085a371f3 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -109,6 +109,8 @@ public:\n \tint createOutputDMABufTexture2D(eGLImage &eglImage, int fd);\n \tvoid createTexture2D(eGLImage &eglImage, void *data);\n \n+\tint attachTextureToFBO(eGLImage &eglImage);\n+\n \tvoid pushEnv(std::vector<std::string> &shaderEnv, const char *str);\n \tvoid makeCurrent();\n \ndiff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\nindex b5a5dc60b..ed67aca7b 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -112,6 +112,32 @@ void eGL::flushOutput()\n \tglFlush();\n }\n \n+/**\n+ * \\brief Attach a texture to a frame-buffer-object\n+ *\n+ * \\param[in,out] eglImage EGL image containing texture to attach to FBO\n+ *\n+ * Helper function to make attachment of texture to FBO easy to reuse.\n+ *\n+ * \\return 0 on success, or -ENODEV on failure\n+ */\n+int eGL::attachTextureToFBO(eGLImage &eglImage)\n+{\n+\tint ret = 0;\n+\n+\t// Generate a framebuffer from our texture direct to dma-buf handle buffer\n+\tglBindFramebuffer(GL_FRAMEBUFFER, eglImage.fbo_);\n+\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, eglImage.texture_, 0);\n+\n+\tGLenum err = glCheckFramebufferStatus(GL_FRAMEBUFFER);\n+\tif (err != GL_FRAMEBUFFER_COMPLETE) {\n+\t\tLOG(eGL, Error) << \"glFrameBufferTexture2D error \" << err;\n+\t\tret = -ENODEV;\n+\t}\n+\n+\treturn ret;\n+}\n+\n /**\n  * \\brief Create a DMA-BUF backed 2D texture\n  * \\param[in,out] eglImage EGL image to associate with the DMA-BUF\n@@ -127,6 +153,7 @@ void eGL::flushOutput()\n int eGL::createDMABufTexture2D(eGLImage &eglImage, int fd, bool output)\n {\n \tEGLint drm_format;\n+\tint ret = 0;\n \n \tASSERT(tid_ == Thread::currentId());\n \n@@ -186,19 +213,10 @@ int eGL::createDMABufTexture2D(eGLImage &eglImage, int fd, bool output)\n \tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n \tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n \n-\tif (output) {\n-\t\t// Generate a framebuffer from our texture direct to dma-buf handle buffer\n-\t\tglBindFramebuffer(GL_FRAMEBUFFER, eglImage.fbo_);\n-\t\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, eglImage.texture_, 0);\n+\tif (output)\n+\t\tret = attachTextureToFBO(eglImage);\n \n-\t\tGLenum err = glCheckFramebufferStatus(GL_FRAMEBUFFER);\n-\t\tif (err != GL_FRAMEBUFFER_COMPLETE) {\n-\t\t\tLOG(eGL, Error) << \"glFrameBufferTexture2D error \" << err;\n-\t\t\treturn -ENODEV;\n-\t\t}\n-\t}\n-\n-\treturn 0;\n+\treturn ret;\n }\n \n /**\n",
    "prefixes": [
        "v6",
        "2/6"
    ]
}