Patch Detail
Show a patch.
GET /api/patches/27257/?format=api
{ "id": 27257, "url": "https://patchwork.libcamera.org/api/patches/27257/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27257/", "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": "<20260706222245.247396-5-bryan.odonoghue@linaro.org>", "date": "2026-07-06T22:22:43", "name": "[v6,4/6] libcamera: egl: Add activateBindTexture", "commit_ref": null, "pull_url": null, "state": "accepted", "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/27257/mbox/", "series": [ { "id": 6042, "url": "https://patchwork.libcamera.org/api/series/6042/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6042", "date": "2026-07-06T22:22:39", "name": "libcamera: software_isp: gpu: Add go faster stripes", "version": 6, "mbox": "https://patchwork.libcamera.org/series/6042/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27257/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27257/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 A4B60C3308\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 6 Jul 2026 22:23:06 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D66DA6606D;\n\tTue, 7 Jul 2026 00:23:05 +0200 (CEST)", "from mail-wr1-x430.google.com (mail-wr1-x430.google.com\n\t[IPv6:2a00:1450:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B68B466054\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 7 Jul 2026 00:23:01 +0200 (CEST)", "by mail-wr1-x430.google.com with SMTP id\n\tffacd0b85a97d-45fd464d51fso1814869f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 06 Jul 2026 15:23:01 -0700 (PDT)", "from inspiron14p-linux ([109.77.44.220])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-47aa039ad21sm27916413f8f.20.2026.07.06.15.22.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 06 Jul 2026 15:23:00 -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=\"w9MAXx16\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1783376581; x=1783981381;\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:content-type;\n\tbh=hvwKB7CQKp8AngpWiJmPSQs7XuQyPTLQJEhfb8AHvCw=;\n\tb=w9MAXx16IUTiD3cUdtk0UUyoc6qo9MMydvOOx72mxckmBNrfppvLn/KOuwu12BLCgd\n\tEnP+v8hTh7WuwWV1/+4mFX9yUiVs0vwmrycsBYi6Eb5NwEzTctqiZLW15TTfGL4fctbs\n\tByeech4BU07nh2oQi2kGwscTBZr2qXsGZPhtW7rfQcmjrCYncyiTS/eTYh9nscVR77ql\n\tZwevjzRLoZjN7IS0xdETJAtPjeZkwLh2vH7aAmyxnyLMYXJYeCI92A/sYJPw2XEHRJyw\n\tmMBvscmNSWcPMwAAgqfNfsdNm5+MV1cCmvhpwHuKBfESN0HtMRcCHWOzN5Ooa3Vs7n5/\n\t+frQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783376581; x=1783981381;\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:content-type;\n\tbh=hvwKB7CQKp8AngpWiJmPSQs7XuQyPTLQJEhfb8AHvCw=;\n\tb=mSnkQhOOFxlMOEzMpKsLyfwBkaiGVpS5r03L7Xr5FOdA+EgQd6NPH+L10OH0bqOJJi\n\tKwF9u7wNgJ0s/lTf3q1gYy5aA9Dcl8Gq54P+W+YFuQ1BaOiFiLWsDYSFewk2T3tc1+Hh\n\tmprRmaGB9vjlGY3A7f2pp+U9sQ7kPibGlv1neMywb+XjCf9ZxivbAngmBFDY4KHbCrM2\n\tlqL/6AOxotqMr30U78e0pxCESlydFwY/MRnpv2CBztETo9LBwN8VQGJRLlWh6hb4fiyB\n\t4MLU/CaT0b/UxY5kxtTHGNnxSPcwjDWoJqRv6ToH1hXa5VvFSlmOoxhnXkyXbRI/4olx\n\tR2gw==", "X-Gm-Message-State": "AOJu0YyLYAUqeBI49A7imub2/SY8snH7+b3emkyoZ+yVGKGXEBkWxNFY\n\twzvcbWhVrOF2VB/Eo+1BHjvzof9ABRT6e8V97dPetkLS9oo62TrHVTFasES62rjPDoT+WAFRrBD\n\th8KN5", "X-Gm-Gg": "AfdE7cm/IEiBk32lve+NPdhIwLs3bv+WiLgWgZDV4HMUsNxaT61K/1TnBBammnvIEzf\n\t3LRdnFTxG4baB2nzMbDwRXJgclc+zKoSclz7QVHzZBVuTtLwxwMpt8E2AKxSfXnG9rJRz1GXQDb\n\tpZWvLcjycD0rhgoQho8Ft7sZgWMWjCjFzxaYW1ogtqgkYUKVLwDe3d74/SbiT/wNlePoDXH4mbs\n\ta6QzFT6Wfo3oObaqmKAxpK1YLlzx62ZXV6huygynhE11MhRSMLL8ehQLWLRA39yWP3kBGWCETON\n\takJsd2O9sm4DvU7s56Gj8ZzPrzYFNmQahIGB73pldEAf4fJEj3AxRTRJydHNH0lYnvv/2IDXnuV\n\t6nK8CrfPQdL05mWC7wQRLB546q2QVQtRONjQ1Fqsyvmhal8a2duzUJXgNRAIkMPVgUtaKobev9d\n\tj3gOKnKu/FEN2MxsGb4NbmyNH2VDPI0ECwNeQrqV4=", "X-Received": "by 2002:a5d:4ecd:0:b0:46f:7d90:8125 with SMTP id\n\tffacd0b85a97d-47de665b2ecmr1530441f8f.15.1783376581282; \n\tMon, 06 Jul 2026 15:23:01 -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 v6 4/6] libcamera: egl: Add activateBindTexture", "Date": "Mon, 6 Jul 2026 23:22:43 +0100", "Message-ID": "<20260706222245.247396-5-bryan.odonoghue@linaro.org>", "X-Mailer": "git-send-email 2.54.0", "In-Reply-To": "<20260706222245.247396-1-bryan.odonoghue@linaro.org>", "References": "<20260706222245.247396-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": [ "v6", "4/6" ] }