Patch Detail
Show a patch.
GET /api/patches/27249/?format=api
{ "id": 27249, "url": "https://patchwork.libcamera.org/api/patches/27249/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27249/", "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": "<20260706113900.2530549-5-bryan.odonoghue@linaro.org>", "date": "2026-07-06T11:38:57", "name": "[v5,4/7] libcamera: egl: Add activateBindTexture", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "9f696f7b7abeeab3911d46462aeab136e4437b26", "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/27249/mbox/", "series": [ { "id": 6041, "url": "https://patchwork.libcamera.org/api/series/6041/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6041", "date": "2026-07-06T11:38:53", "name": "libcamera: software_isp: gpu: Add go faster stripes", "version": 5, "mbox": "https://patchwork.libcamera.org/series/6041/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27249/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27249/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 D6D73C330A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 6 Jul 2026 11:39:19 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E98F46603F;\n\tMon, 6 Jul 2026 13:39:18 +0200 (CEST)", "from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DEC7D6603F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 6 Jul 2026 13:39:14 +0200 (CEST)", "by mail-wr1-x434.google.com with SMTP id\n\tffacd0b85a97d-47c2b362ee2so1523492f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 06 Jul 2026 04:39:14 -0700 (PDT)", "from inspiron14p-linux ([109.77.44.220])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-47a9de1e6ccsm24796084f8f.5.2026.07.06.04.39.13\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 06 Jul 2026 04:39:13 -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=\"L+GzB1UQ\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1783337954; x=1783942754;\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=hvwKB7CQKp8AngpWiJmPSQs7XuQyPTLQJEhfb8AHvCw=;\n\tb=L+GzB1UQQJTZ5JGTTxcJdkvlHigwtwFH0tGZkoMaie/fg46FJ6xFyCfEKie/j08pfQ\n\tIWGit+zNsaFsukEOdYn+C994nljaS/D/jiOv+SwRHcs1qBt/W3cAj/NS83qnaKLGm9ho\n\tIhiVI3FLeu2B/jkVagipvYTm5a/jSd1WepecoqsomSFcFM/+xOAQEihV/i+XCyi0zQPg\n\t3bYy7ywaePfAz9HEdnJ9t5qbQ3sYkawe4eAbX5JxxcXei0b+RyviPYCgcMzq7wiMqwoX\n\t/sIugagh4BXHSqtSPG3rl86DWMhXPOLdanXEu8vDMWINFoQ0Zw26xppa3Z7eULFXaw6I\n\tE36w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783337954; x=1783942754;\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=hvwKB7CQKp8AngpWiJmPSQs7XuQyPTLQJEhfb8AHvCw=;\n\tb=Vi2zOn3gJAQ7ZkzdYIPseUEDQg3eEmBpJ6tgYhPTFU+3SsxbOiq30x/NL7SEfQ5L7L\n\tl5cjp9F2WpkStgymoP+D/EjF9+I77ch8jAWExgIEBYuEdGFzK0t9njwlzMKsOiHBdxVK\n\tpgVg104Zb2Xto3cBZe6AfpVamrwl81A85hfK5nimg1ukQKljGwWdjLUWTkPgp9VNgsrA\n\tOx6JOCU5nI0YYyO29rzceTth+6Pohxh7ZVrNi71UFcyxpjOsahDXWc/3Y9aRrJFqCw+2\n\tWgJm3sEQAfF7GN7g3zQXiUPNqHQ5fk0fVgCuqE3iB0JxEvi0msgBVyeckdIx+UJ9yBFk\n\tfcLA==", "X-Gm-Message-State": "AOJu0YxdJEvfmE2TUAs8XegmnytvUenyRAc/GOvM7/mJnua+hfLLpGMn\n\tYgEx5lKmc+mjFxJcJHx+L72RAErTvPUeeJZxxmqRvZ616xASJV9cNb7K7j8KaO+LokLwY4+b5gS\n\tRgUlw", "X-Gm-Gg": "AfdE7cmRNZJk8d4Y9I9XQy/IZCEVGpPiQ5xlCyZUxOSLig4HxhyfVILIk4TaYChmTe4\n\t64fWPK0XQvDU9QAOeV9x1F38i5AStYMH7j83ZtAc+zV2OhW/bdpYfO6e3UZ/Yf3bMyrTdcqtnfb\n\tsCQfUntvTGqBmCMxscVlBoURc3lqzQfsbR5yvZFek1iU0JA1PHtSR2QBXLbRdaT4xsyLdaSE6yq\n\trI/osCdfF3jCFaPrOXbcvIkGYLfLHOEauVb0hiXRyQAXqz7xBO7mXSEBTxkog4+Ay2YqhsjB/Ja\n\t6w9XsCm38FlE03nI41sKrBOKZ6iBNxliNGi8aRcPOqTQdrHp9cOoz0Qfv5ScTF+E6NYHlb+rfgr\n\tmm1Bv3/+5bjJXoYC5XmerctFpwquJx957jnY8jdmAL6/9WTR4geLaYL89GB1+xLe4iAZPzS2R5a\n\t0jxRGtpBs6Gr3LxB4VbGOx8zYCHLMA", "X-Received": "by 2002:a05:6000:24c9:b0:475:f0c2:75a9 with SMTP id\n\tffacd0b85a97d-47aad07bbfdmr12385017f8f.58.1783337954308; \n\tMon, 06 Jul 2026 04:39:14 -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 v5 4/7] libcamera: egl: Add activateBindTexture", "Date": "Mon, 6 Jul 2026 12:38:57 +0100", "Message-ID": "<20260706113900.2530549-5-bryan.odonoghue@linaro.org>", "X-Mailer": "git-send-email 2.54.0", "In-Reply-To": "<20260706113900.2530549-1-bryan.odonoghue@linaro.org>", "References": "<20260706113900.2530549-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>\nReviewed-by: Milan Zamazal <mzamazal@redhat.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 1955d09c5..64196213a 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -111,6 +111,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 c1b5514b6..0726b63f2 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 though\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": [ "v5", "4/7" ] }