Patch Detail
Show a patch.
GET /api/1.1/patches/27242/?format=api
{ "id": 27242, "url": "https://patchwork.libcamera.org/api/1.1/patches/27242/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27242/", "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-6-bryan.odonoghue@linaro.org>", "date": "2026-07-06T11:01:18", "name": "[v4,5/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/1.1/people/175/?format=api", "name": "Bryan O'Donoghue", "email": "bryan.odonoghue@linaro.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27242/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/27242/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27242/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 445D1C330A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 6 Jul 2026 11:01:40 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0EF9666017;\n\tMon, 6 Jul 2026 13:01:40 +0200 (CEST)", "from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com\n\t[IPv6:2a00:1450:4864:20::42e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E7BD56602D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 6 Jul 2026 13:01:35 +0200 (CEST)", "by mail-wr1-x42e.google.com with SMTP id\n\tffacd0b85a97d-474303f3c72so1680808f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 06 Jul 2026 04:01:35 -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.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 06 Jul 2026 04:01:34 -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=\"rfOlRj/e\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1783335695; x=1783940495;\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=fVHnbZZMdwqZk7BriO9P1JA0RaTstJWzBgni6R3v/IE=;\n\tb=rfOlRj/e+VZWhjkFHMhg6qqFPHJMfhnP+EKgMH+8DgdDU5MSeAAjebyzWEfLLke565\n\tfZL9lfxCGhx9X4n1oKsjRuAz26D4AfNXLxcl/7/AUKIoODlhv3Kshc00ZZyVsJJ1INbl\n\twAheN5Bz8ijUVZFbemfig77irE0mLrtFi6t0c3zaFDcRg847Vn2fk9X4st4Tv4S9eegM\n\trU7l/mQXsKIAWQbr4AZDc7YOjb8VDdAszAFPJ544NanJ68e6m1vEzcARUFyvIBQl+Ucj\n\t/GHnsUE8F+5gMLPv3TGkAXAkRDlXgXRslqGCd3+IpqUrSy0gEFdrx3kixE83dzzxDK5r\n\tM61w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783335695; x=1783940495;\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=fVHnbZZMdwqZk7BriO9P1JA0RaTstJWzBgni6R3v/IE=;\n\tb=he576qzGP1kPKVhw9hygV9Ve6IX4TieRAiRXXDmblEyV7Bq1BdhgA7CW6zbyfeZAr1\n\tWatEcfJAeNrXYts9YksQMdKt51HQ5g0NoDmS3lkrfKxhT8Dy9f/Fl3ppT20/QYQs+p7S\n\tP3OhM2mSQcSTrcSDwI1J2vnbJakjacPzDRwDMWEznqUOhrqxZmRvkDIhx34R4/H3oe7/\n\tHyju1sWZoRZgPhvpk3UPXJqpwsyTbXlgw74sECL5EmxGt/IIVUkaiIGUi6+Jf5TCMt4K\n\tL/viDYG9etuS8t7cTK3Fiy4LfjBEexLWdi1iXm9nZaqGtXWuPVmkY87iSAyNs5NzDPP5\n\tE9Iw==", "X-Gm-Message-State": "AOJu0YzOTh7Ax6Ja3vq4HvHvngTlONM5Wp+k36DU4CbLjHA9bpDJEYSf\n\tLETtzkgm/TnB/AZJldInI9FABYSvbfwux1D+SHkpU76t+Kuz9mgnmsn5NjnbQ1QxygqP91ZXAs/\n\tEn1tw", "X-Gm-Gg": "AfdE7ckHpwGSPU/Bz63UGQJai3Bhookqni9HaGNCVIFF4BH6fJDue6XFFmhknJZ3uvn\n\ttrYhLnVCOBsA7p0ZkjPDOhx9ote+ZUFDJei2haxNAYEoYFyK04jAcpo4vL/Xeygkc2aZQsBPY0d\n\t55FB27a5rR3k41kCHA7PP0pUs3+HNNEBQV4OGS/ADOWAcW2sj0434Ca5Q+Id+0cpuhZREunZo/j\n\tIuvHhFvFewTLaBLXSnKUxKv/tqNa/y52VacCLmhHXOGVD+3rVxMfSKck04dTktU6BTHuvJBATvj\n\ty1LsBF8nvkjlUi4nJPPI1Aq8XO+BPb73ix7ZqudFnXBB/12DhkgwxssRL5+Iao+P3STHMykKfbe\n\t8XLTID60lIkQSg/IcuyamNqTHRurzlnrlGoDs/PhHErt6uJybWW3dyBXdn6fBSNvSyRER9P/t92\n\t2EtFCDWk0D8GJRx0g+UYCiHrx7IFlX", "X-Received": "by 2002:a05:6000:61e:b0:475:da0e:7465 with SMTP id\n\tffacd0b85a97d-47aa92c070dmr12584346f8f.5.1783335695236; \n\tMon, 06 Jul 2026 04:01:35 -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 5/7] libcamera: egl: Add activateBindTexture", "Date": "Mon, 6 Jul 2026 12:01:18 +0100", "Message-ID": "<20260706110120.2509826-6-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": "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 9b4261c55..1e31d490b 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 b91f9096a..fae907881 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": [ "v4", "5/7" ] }