Patch Detail
Show a patch.
GET /api/1.1/patches/27239/?format=api
{ "id": 27239, "url": "https://patchwork.libcamera.org/api/1.1/patches/27239/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27239/", "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": "<20260706110120.2509826-3-bryan.odonoghue@linaro.org>", "date": "2026-07-06T11:01:15", "name": "[v4,2/7] libcamera: egl: Add new helper attachTextureToFBO", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ab7e7374ad9f125c072ddf3e4a2bd1cd1cfd2f4e", "submitter": { "id": 175, "url": "https://patchwork.libcamera.org/api/1.1/people/175/?format=api", "name": "Bryan O'Donoghue", "email": "bryan.odonoghue@linaro.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27239/mbox/", "series": [ { "id": 6040, "url": "https://patchwork.libcamera.org/api/1.1/series/6040/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6040", "date": "2026-07-06T11:01:13", "name": "libcamera: software_isp: gpu: Add go faster stripes", "version": 4, "mbox": "https://patchwork.libcamera.org/series/6040/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27239/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27239/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 C7A5DC330A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 6 Jul 2026 11:01:35 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 58ECE6601E;\n\tMon, 6 Jul 2026 13:01:35 +0200 (CEST)", "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C097966007\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 6 Jul 2026 13:01:32 +0200 (CEST)", "by mail-wm1-x32e.google.com with SMTP id\n\t5b1f17b1804b1-493c19bad03so26453695e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 06 Jul 2026 04:01:32 -0700 (PDT)", "from inspiron14p-linux ([109.77.44.220])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-47aa0960634sm25190846f8f.26.2026.07.06.04.01.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 06 Jul 2026 04:01:31 -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=\"mvBO5g1f\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1783335692; x=1783940492;\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=sCherSufb0on4kaTY2CKoIjTcZ+GTv1qK3dt1yZ0ysg=;\n\tb=mvBO5g1f7tJ6PKUdt0ZhBXCcr5meLfrqRN2iqRk8gqJQSDA3RwCAfX+snkqxf6IBOJ\n\tXO4T2LCADaHtiFWdoYhsxCKS9TAi59lY9zqnHVRDbNPsmHh0teM6U1CEPPIzk/mz8MFp\n\tgYbw1GxrocrQQFFmzZUZ8870kPQZqju6uRUOM3pNg5epVv5s809BLdFbrQdwiM8/gzEs\n\tj0f2ZEbdkcX5W9zRJaPb8gwXTXHQUx8o0XjVCWVQrw6R5jMAvz3lmHyNqaSFBnDA16lT\n\tG0mLLsT6It8ow0ImqB3RNTa3ISuyUhcwhMNE4aPmCY8DFo/fl5KAaavdxkfJWXqCYfU0\n\tL9Cg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783335692; x=1783940492;\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=sCherSufb0on4kaTY2CKoIjTcZ+GTv1qK3dt1yZ0ysg=;\n\tb=CAGj335mBVe5GXv2i43r6fV8gHLCo/VSBbokNAmWq4bGfN8pMcdfNCWDvzV4ZykLuG\n\tgrrF4Xz6YuU2UWW9MoQuhJ3LA0LyhnAWWdiMhwKQ3pb+jYebrKOMDpxLNhRjs4a9mom8\n\t3rfA5ae6C/W234FsTz7lYbhX6eDC7A6IMp5akd6Wij85uwIET0mHYdOIA2aQ6gvzKOKX\n\tabl5w18vAe1fShqZGvujqn30WnQ1Lv7B3ybfMFEiEuxB8035X68W96RI3CR7GfHBFNmd\n\t7Tbnl7SHXEsWScedUFAMOsdvJ42jqanSidIeuzY6gMCV/gryUAwK9ER/vyNxytU9d1gi\n\tS9Xw==", "X-Gm-Message-State": "AOJu0YztEoRpOhrWmMSyL5i4wjzUm6MZFjsMHDmZyq4uus/TrOlVtCex\n\t74RzzRIGlD98RhJOpvLxrbZyMzGSK2/66K/yJp81lxUVTd972QYhMbjwvD7GuZnn88nNsAZTVWZ\n\tW6I2B", "X-Gm-Gg": "AfdE7cldx9ygtZk9kObPte0d4jSgjzywFvlKT2g2/9cFsLjcCIevQiH18bTkFTJHWDT\n\tNw3OBBeZwCq3sWCB6aWE1jSFrNV6RSdtJWr9kH7q4EHmtnmmN+NoleY0eZxl6QIZ6KsQM2C569R\n\tE4wE9feLRE5BJ7lfFxXLKhrLdakPLfMZb/fFEC6t0eSH+sJa3IVZZTiHSolFH00yp91Gm4w6oGm\n\tYJatwGm2sJHfv4vPuUUl8eam1RoLeEdDecSxvvOb/g9alYM3WafZoIgPPC30QJAbr5kfYCC919/\n\timCXTcF93HMaR6lAZMpVJ7pJoKLwyXeTWY7BKZ7QHB+uoHVzHKJ+euW50iscaDivBlMf3uenmWJ\n\tzbs5fIMIAqcn5tp37gn/laXZZ6yB11vNDApluqUwpQWjcn2OeGypoGOEjhOp2lkjUvNQk8OdeNY\n\tIlv6oKWT5bsKzm2RZOlyArhkWjl/4/", "X-Received": "by 2002:a05:600c:34cb:b0:493:b150:c607 with SMTP id\n\t5b1f17b1804b1-493d11d936amr110500875e9.12.1783335692234; \n\tMon, 06 Jul 2026 04:01:32 -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 v4 2/7] libcamera: egl: Add new helper attachTextureToFBO", "Date": "Mon, 6 Jul 2026 12:01:15 +0100", "Message-ID": "<20260706110120.2509826-3-bryan.odonoghue@linaro.org>", "X-Mailer": "git-send-email 2.54.0", "In-Reply-To": "<20260706110120.2509826-1-bryan.odonoghue@linaro.org>", "References": "<20260706110120.2509826-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": [ "v4", "2/7" ] }