Patch Detail
Show a patch.
GET /api/patches/27053/?format=api
{ "id": 27053, "url": "https://patchwork.libcamera.org/api/patches/27053/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27053/", "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-7-bryan.odonoghue@linaro.org>", "date": "2026-06-26T11:33:23", "name": "[v3,6/8] libcamera: egl: Add activateBindTexture", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5bd8abb567cd571c03648e81b2b364a39137a937", "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/27053/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/27053/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27053/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 BA038C3305\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Jun 2026 11:33:50 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2462B65EE7;\n\tFri, 26 Jun 2026 13:33:50 +0200 (CEST)", "from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n\t[IPv6:2a00:1450:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9939965ED9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2026 13:33:44 +0200 (CEST)", "by mail-wm1-x32d.google.com with SMTP id\n\t5b1f17b1804b1-491609cdd8fso5636225e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2026 04:33:44 -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.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 26 Jun 2026 04:33:43 -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=\"Bcl1K1kQ\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1782473624; x=1783078424;\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=2KTYsvtLCYMoZAZ84aLQ+1jc+QNVClAOTdv+yBbXJ0w=;\n\tb=Bcl1K1kQJkJvtqJOgMebG2wn/SM+C5Xp5aw6WH1nfPS+yoXkPMRNlMtpS4s8jJPbRJ\n\tlh9uXVU9WByRdmhE37f1wMsEhwZ7RQz9GvlsEDdP4QENtVibtcpdhVF/0L4rroyJXtN+\n\tre2cPUNGk+5PbrsAZ6zEHTcgzRmwK/KZoP1yePIgoyFHZzMD4iCVLqU3PvL3HE5Gp3nB\n\tKOB5Vx2k03q51xcMAYDDIRublzyO/Kl/exFAUVtd+urZbUye+gfvAN0tQhitGWWW6ZvZ\n\tM7sOQc83em2zL4jwA3LfubvC4u9yD2YZriDw5mQRHGGlwrpNxEUpkGmB7Jfq8TqVIvdi\n\tanuA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1782473624; x=1783078424;\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=2KTYsvtLCYMoZAZ84aLQ+1jc+QNVClAOTdv+yBbXJ0w=;\n\tb=UJHSfFfTM06zT9Q72wlHuTCSjlhWR7qxV3B61ovn8L8RXa3Le/LzVF2t3mDtb3Xtmw\n\tVfP++hIoDJAkD33NcFRNzKXfo36LAgaH5NG/IceL+U3KLWEA/yEpg0dUq5u3zOWApQAQ\n\tLDdISTPsnf614FWIFd5tVSQWUWpV1lGMXirSGyw/j4wDa06Lnihw2aS1sMf4JDvfFWnY\n\txH2Z4h4KYDUMUMgSy2Sntn2L11gISbMPxWy2DjRTvYBKQDETTHzqNF/b8ivnvREwhOh3\n\t1ZUVwihti6rdumkOBsXvIWHUib1ji1XGqbhh2h2oEBcKjBn4O7hX2GxgIhX4NAhgGrBa\n\tmQbg==", "X-Gm-Message-State": "AOJu0YwjMJHpn0UmlCvp1/Rfr3D++VVNS9ukOWlhs8yg3lI7/g4AQHYf\n\tcbG74W5sxyCqr98bQZP0CoXKF80QYYUZTh3Jt4VEFP6K4obJtBWwawe7YyZHz93MQlfLRfWcjTG\n\tpUu7xilQ=", "X-Gm-Gg": "AfdE7cnGAvUXi8/6wAD8htV0vV6BQQthLJapz6m+JM6rTOy8Snot0EG7eDICSThcL2E\n\tfzslk43UqVEDpsZW9QnOjEhTOKJ5q67zVDKkac5giCWXMUi0qIHVuL2SgaazjAeC2Iu6kEoxd9f\n\tLXB1i8yAUrfvo8fjc2qwTWInWHDuQ0SnBjSbsPwOek66YKVH5DWw8y/H+6l2B0x+WuVRqk9B1wv\n\tsNlxHTSE6PsuFD/+TXcGZI/x0n9ezGPmyeGVgwM4XNe6dT5Y/7zMLge8QCX76DyhRUNhi0e/Brk\n\tTx1LsoqKPcu2QZk0C0LKcTVP0gHJb8OGo9riUG00IyGtDN9fOypq40kQYqTjznjSVlQMaYjjcjP\n\tmOSYWGFFzLunH2rMvsWnhDTszpaDHsXV60o/VqDyHHwT6HlnMhQoQQuZuKRT7eLLa1XAY4/VOtF\n\tncMIo3xN7ZrUmYgNEzmYCfkONbzA==", "X-Received": "by 2002:a05:600c:3e0d:b0:492:4723:166b with SMTP id\n\t5b1f17b1804b1-49266873f80mr91322505e9.13.1782473624138; \n\tFri, 26 Jun 2026 04:33:44 -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 6/8] libcamera: egl: Add activateBindTexture", "Date": "Fri, 26 Jun 2026 12:33:23 +0100", "Message-ID": "<20260626113325.3218045-7-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": "When operating from a texture cache on dma-buf inputs we will no longer\ncreate new textures nor attach those textures for dma-buf handles we have\nalready encountered.\n\nThis means we will use the texture id associated with a given texture unit\nto switch between one texture and another. The pages associated with the\ntexture will have been populated with new data by the CSI2 receiver. All we\nwill do is say to the GPU \"reuse this texture id\" aka zero-copy.\n\nHowever we must also activate and bind that texture for each loop. This\ncost is small but necessary for zero-copy.\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 | 1 +\n src/libcamera/egl.cpp | 24 +++++++++++++++++++-----\n 2 files changed, 20 insertions(+), 5 deletions(-)", "diff": "diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex 9b679332c..e4d366abd 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -112,6 +112,7 @@ public:\n \tvoid createOutputTexture2D(eGLImage &eglImage);\n \n \tint attachTextureToFBO(eGLImage &eglImage);\n+\tvoid activateBindTexture(eGLImage &eglImage);\n \n \tvoid pushEnv(std::vector<std::string> &shaderEnv, const char *str);\n \tvoid makeCurrent();\ndiff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\nindex 22f46e92a..4eabddcc7 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -138,6 +138,23 @@ int eGL::attachTextureToFBO(eGLImage &eglImage)\n \treturn ret;\n }\n \n+/**\n+ * \\brief Activate a texture unit and bind a texture to that unit\n+ * \\param[in,out] eglImage EGL image containing data related to unit and texture id\n+ *\n+ * When we create a texture we will bind a texture unit and texture id so\n+ * we can set filters. For the case where a texture already exists thought\n+ * we need to activate and bind an existing texture. This helper function\n+ * facilitates both cases.\n+ *\n+ */\n+void eGL::activateBindTexture(eGLImage &eglImage)\n+{\n+\t// Bind texture unit and texture\n+\tglActiveTexture(eglImage.texture_unit_);\n+\tglBindTexture(GL_TEXTURE_2D, eglImage.texture_);\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@@ -197,9 +214,7 @@ int eGL::createDMABufTexture2D(eGLImage &eglImage, int fd, bool output)\n \t\treturn -ENODEV;\n \t}\n \n-\t// Bind texture unit and texture\n-\tglActiveTexture(eglImage.texture_unit_);\n-\tglBindTexture(GL_TEXTURE_2D, eglImage.texture_);\n+\tactivateBindTexture(eglImage);\n \n \t// Generate texture with filter semantics\n \tglEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);\n@@ -270,8 +285,7 @@ void eGL::createTexture2D(eGLImage &eglImage, void *data)\n {\n \tASSERT(tid_ == Thread::currentId());\n \n-\tglActiveTexture(eglImage.texture_unit_);\n-\tglBindTexture(GL_TEXTURE_2D, eglImage.texture_);\n+\tactivateBindTexture(eglImage);\n \n \t// Generate texture, bind, associate image to texture, configure, unbind\n \tglTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, eglImage.format_, GL_UNSIGNED_BYTE, data);\n", "prefixes": [ "v3", "6/8" ] }