Patch Detail
Show a patch.
GET /api/patches/27050/?format=api
{ "id": 27050, "url": "https://patchwork.libcamera.org/api/patches/27050/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27050/", "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": "<20260626113325.3218045-4-bryan.odonoghue@linaro.org>", "date": "2026-06-26T11:33:20", "name": "[v3,3/8] 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/people/175/?format=api", "name": "Bryan O'Donoghue", "email": "bryan.odonoghue@linaro.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27050/mbox/", "series": [ { "id": 6020, "url": "https://patchwork.libcamera.org/api/series/6020/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6020", "date": "2026-06-26T11:33:17", "name": "libcamera: software_isp: gpu: Add go faster stripes", "version": 3, "mbox": "https://patchwork.libcamera.org/series/6020/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27050/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27050/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 18F06C3303\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Jun 2026 11:33:45 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6A29565902;\n\tFri, 26 Jun 2026 13:33:44 +0200 (CEST)", "from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 209EE658F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2026 13:33:41 +0200 (CEST)", "by mail-wm1-x334.google.com with SMTP id\n\t5b1f17b1804b1-490cf3000f0so8767895e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2026 04:33:41 -0700 (PDT)", "from inspiron14p-linux ([109.76.78.98])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-49268fe31b0sm79265985e9.4.2026.06.26.04.33.39\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 26 Jun 2026 04:33:39 -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=\"b12rW2fW\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1782473621; x=1783078421;\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=LrHNd8eVo+wksS/oQ0Oh5AIQ6rb4Iv4ObWfNNR4zJvg=;\n\tb=b12rW2fWaA163AKi+VM9PwV8abAnfwTZjpGGs0gdQVeivtAKMUmF1BhUzMW8bPdu9X\n\t075JFvYG/KJQHy1GMU6ou4JCqew/eABOBreXZI6s5hTIAOCAlORpVdZyUOmu7qAOny+I\n\teK+0UM1Ni9o26iWINsdhDusc516dg4FVIbSrLU8aWW+itmIjFFS8t2XdBKNo4T3+xF6w\n\tP1Tmwc3i+ZaBXKbl0Ro7eF5R/lsJmDxEo3NeqAtBROjAAwO085mMr8ifdhfub0/Laek4\n\ttSfDor8aV8wE5Ypp+ScR+8QTe6YITAxmAfHjbDPtm9LPkBG57ptJQdAcV6ARnmEj8lla\n\tZBcg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1782473621; x=1783078421;\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=LrHNd8eVo+wksS/oQ0Oh5AIQ6rb4Iv4ObWfNNR4zJvg=;\n\tb=kArrbHOMs4cKM4VnDJj3cJArM992M/QNdLT4/A8RG1C+tyKRps8AN4zgVt6FFGUlt5\n\tivlWdh9YZM+dwDQN3A4mgqbZXrSFQ6tkwub5xZ5XHfkkD4mukWYt2NBeuVA2SUf1FN5N\n\tXLqAeukgofby9F6FBcVBtz/KVoSvS9VXguJ1ImpQMAgkNqiXP5/giOVyu6A+7Gg0CnNe\n\tDbXeVjq6j1Tw0t52MNUTg2iSELprJb+7uxiNZO4sUNmpQaDpDK82rlXmh/1L7fbC6Pol\n\tfR94xtCvdpiuWNc0yDkS/IVbmF0u0G9VHsAel4WrmxY4JDoU+AVLlt17fTEJ+CsV5Epe\n\tDAzQ==", "X-Gm-Message-State": "AOJu0YyH0lqq8eEJbJPavk4J7TdBGP9s72FEB6Zs4n2ttZMcKXO/33CM\n\tm2EdJkVhg+q31hILDOr+tVDfQ15j0Jjrg0TquudTsf+d8bPCSG1ynh5eKQJ3oS+1IJtF4dCBu1b\n\tA4IlA81A=", "X-Gm-Gg": "AfdE7ckAaVc7RLPV6l6uYTq9+ka1Tw+FJYy5ABanF0MozEETlnsSNVLwX0coOUZ9exu\n\tOpPMYpPP1NtyjV/H3WD6Btce9YMgbGp/sps1xxr/+GAnSI7ia9ornW8i3FPhxzRttFoKjbHUkps\n\tFeGXv+Lqz1fjlxsrhayNJlr310xt/3f6nGD9Cr86+C/2qEYtuk+mbJQWpxfO5xC5vJwH7JpKNIM\n\tdBRgZaE62LtY97nHhRY9F0JcQ1jeFEkVxD2c7LsNx24cmikUBNfCWZacArayguUlpzCbunmIcw1\n\tt6P7bW0tv5O1YZ30m2UvC1GDCNm6VhYiK+RC2do9RZgyvPwv9oVFX9MtYMi6l8NJHVmB7SEPJhu\n\tysmhCg/pzAVTg0X3gFaQ1YMSu62PbA2nacldhY56PVat7HKYtvy/OqpGzWueYVfke9mmZLjizh4\n\t9zCy/ZwreA23c60vhfn6YYlRi2gw==", "X-Received": "by 2002:a05:600c:3552:b0:492:700b:deea with SMTP id\n\t5b1f17b1804b1-492700bdef5mr3810595e9.13.1782473620548; \n\tFri, 26 Jun 2026 04:33:40 -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>", "Subject": "[PATCH v3 3/8] libcamera: egl: Add new helper attachTextureToFBO", "Date": "Fri, 26 Jun 2026 12:33:20 +0100", "Message-ID": "<20260626113325.3218045-4-bryan.odonoghue@linaro.org>", "X-Mailer": "git-send-email 2.54.0", "In-Reply-To": "<20260626113325.3218045-1-bryan.odonoghue@linaro.org>", "References": "<20260626113325.3218045-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>\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 f7bfb28d4..4b0757afd 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 f03abb8ae..e83e24606 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": [ "v3", "3/8" ] }