Show a patch.

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

{
    "id": 26937,
    "url": "https://patchwork.libcamera.org/api/patches/26937/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26937/",
    "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": "<20260618122245.946138-5-bryan.odonoghue@linaro.org>",
    "date": "2026-06-18T12:22:17",
    "name": "[04/30] libcamera: software_isp: egl: Add new helper attachTextureToFBO",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "9cc49b36e8c4a8ee38047516212aa326f33be8d1",
    "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/26937/mbox/",
    "series": [
        {
            "id": 6005,
            "url": "https://patchwork.libcamera.org/api/series/6005/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6005",
            "date": "2026-06-18T12:22:13",
            "name": "RFC/RFT: gpuisp: Multipass with speed optimisations on top",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/6005/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26937/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26937/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 D31FFC3302\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Jun 2026 12:23:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B1B7D62B41;\n\tThu, 18 Jun 2026 14:23:07 +0200 (CEST)",
            "from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A0C65629AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 14:23:00 +0200 (CEST)",
            "by mail-wm1-x32c.google.com with SMTP id\n\t5b1f17b1804b1-49230a567a9so4339415e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 05:23:00 -0700 (PDT)",
            "from inspiron14p-linux ([109.76.144.236])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4922fa3a4easm275198015e9.3.2026.06.18.05.22.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 18 Jun 2026 05:22:59 -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=\"Ko3rLRBk\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1781785380; x=1782390180;\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;\n\tbh=vRWhBE/nddyiuyjIUBDoioByaHPkqc4AcaoqAb/P8s0=;\n\tb=Ko3rLRBkLH2LospBm+bTfOQ4pCyPMgz5ZES2WRbTUY5Yuklc9TmttFEEkuhUVY+wBm\n\tbVBDtqyJl12nu55JnaZzIXo/DvLioRwIIUnaWtlv5bo9fUj8+D57vaAVYZYH7IOb6onw\n\tO6j7atuCjTJ2R6InFC8JFIiiZsH0laeCd5fcWO57BFIZAGp2JVRz4Awjkj5oC8790yFI\n\t1KKNgsMnhUlOr1WjwBVLoeiUjfD5SiZARsGe+zcwABr2t7jogaRuJF1cNI6IdC8F7Bvv\n\t54l9L86OZ9peZ4Czyrp7f9R8DzRPMYeDxeATV16f2tfwTzPz2AeJlo9nGtiqjSb4VAhC\n\t36bw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1781785380; x=1782390180;\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;\n\tbh=vRWhBE/nddyiuyjIUBDoioByaHPkqc4AcaoqAb/P8s0=;\n\tb=fRzYRGJb8OomdLKa5OWlfANVj3Xzks/5Rq1OTTm+F4Yij+wAPFsxuuecXm8tQSXLm4\n\tUrBhoSrLsk5NNS3mxZgwkw7VKElMIn1HhH/K8zYLoq/0z2RB311u3cmZfOUk31R+fUA4\n\th9FMXdPsUtW+7KJsGMSN+AIa5yhbwEsGO0IoBpgnVUZxbCrnYIIAMB+FkZw3g30Fuf8t\n\tgrnIPPqWW1xji7h+hUovmG0E9GtfY9RQnXaYVsKA9YGKCQ7HG+ft2BqCGXEa4ItSyAdq\n\tddQ9ygGQQY6BDtpVOgrpnl69lhMalrdqN6wJTM40UFsIyPPw6pxiEvtL38jaCeEOZ8uB\n\tW/Wg==",
        "X-Gm-Message-State": "AOJu0YwSCLzmZqkLMnoYaYa2qenpk+5Mvt+AHUKbfWkfNiYySre43sux\n\thFXLgeQKeBPWE34Fjka4xKoptTTIlzm1H1E3mPtjsvca3c3RLtl/3B0TvpHEd4AHBWflDTKWh1n\n\tEVK8kvqA=",
        "X-Gm-Gg": "AfdE7cmp55t0OXLGbk7NIZhXkj9meR7AUmDzy5WbWpGFre/r+RKvkJI+UFtxvecruKb\n\tw1DzQEOQR1O8Z26FZ40vdqrfqhlo7i9tMIBBwMZjendvtsUypMdyDUoHJd6TpzNxYl3leO4a8YB\n\tEmfOGw0qRClHHQ+g/kM4r0qhmIrW3tNfR9yo6AWMn4bclWUFZhFsviAGK3FcCqUIZNY0bEwrbCP\n\tCSA+nLCqMelVcpTNGdZRr45S5OcdsbFK7VQhbP/2aPtVRGWWPPAIgt/AKAQHANQ2zdB4Obre2wo\n\tqkNc0SbjtVrwCu8syOGe6oMjyv2149TaDKmLBz9G5SjMlDMjGsPFUiyamNlr/HyKrRlEKND69P7\n\tSEfjIwWh+RqI+cAPN75SgybcTG2ouOo8Owj0lMvZH444VRsKZ2Hc816oTndO2587r8veUPMXfOG\n\tkZ6iEBaVEhx7P2jxoG90ehqMEWCbc2",
        "X-Received": "by 2002:a05:600c:8217:b0:492:3754:15f2 with SMTP id\n\t5b1f17b1804b1-4923754161dmr77053665e9.32.1781785380068; \n\tThu, 18 Jun 2026 05:23:00 -0700 (PDT)",
        "From": "Bryan O'Donoghue <bryan.odonoghue@linaro.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "bryan.odonoghue@linaro.org,\n\tpavel@ucw.cz",
        "Subject": "[PATCH 04/30] libcamera: software_isp: egl: Add new helper\n\tattachTextureToFBO",
        "Date": "Thu, 18 Jun 2026 13:22:17 +0100",
        "Message-ID": "<20260618122245.946138-5-bryan.odonoghue@linaro.org>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260618122245.946138-1-bryan.odonoghue@linaro.org>",
        "References": "<20260618122245.946138-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\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 57f90d93f..d88617afa 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -108,6 +108,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 c185bb7ad..3ea694d7c 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;\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": [
        "04/30"
    ]
}