{"id":27033,"url":"https://patchwork.libcamera.org/api/patches/27033/?format=json","web_url":"https://patchwork.libcamera.org/patch/27033/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260624085849.873784-8-bryan.odonoghue@linaro.org>","date":"2026-06-24T08:58:46","name":"[07/10] libcamera: egl: Add activateBindTexture","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6988d4cab7c4f3295cecea48fa07578a5f0c8b6a","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/?format=json","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27033/mbox/","series":[{"id":6015,"url":"https://patchwork.libcamera.org/api/series/6015/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6015","date":"2026-06-24T08:58:39","name":"libcamera: software_isp: gpu: Add go faster stripes","version":1,"mbox":"https://patchwork.libcamera.org/series/6015/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27033/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27033/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 23AB5C3306\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Jun 2026 08:59:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C2873658A4;\n\tWed, 24 Jun 2026 10:59:18 +0200 (CEST)","from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E68C65870\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Jun 2026 10:59:05 +0200 (CEST)","by mail-wm1-x335.google.com with SMTP id\n\t5b1f17b1804b1-4923139e940so4872405e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Jun 2026 01:59:05 -0700 (PDT)","from inspiron14p-linux ([109.76.100.231])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-49261063d6esm25128375e9.2.2026.06.24.01.59.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 24 Jun 2026 01:59:04 -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=\"xWS2j76z\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1782291545; x=1782896345;\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=NUS4ldqtNiG20r3GBYJr0jvyQGDFpx2Gb3eb+pQy1x8=;\n\tb=xWS2j76zCZ99iEqddghkKXki0aFa0sedD8ri0mhhlTFnNLw06juhgrZtpfPUSJQWP+\n\tkhpjjoNajbDDIQdliSViIQWmpxvHCmbEl6tapguElBOqJandii0aC23myeFFmA15r6uH\n\twWcirIe/l70hHY/JA1mKbpHB5Fq8rh4l6xTQAuBNAfaUHG5g+UX8Dg/4A0DO1M0YHx9N\n\ttR63KrNtIM3BtPhL5kzVqWtDT4vZbLgIbAYoUWXZSZ1YhxqYg2kiC03iwU7gPO+Kvgqi\n\ts8yDUc5J33E67arsP7+w+vgiKGJy1vMd0JsjrWdpkjC87/sYKlyC8yZbdx8lal9mB073\n\tWWXg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1782291545; x=1782896345;\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=NUS4ldqtNiG20r3GBYJr0jvyQGDFpx2Gb3eb+pQy1x8=;\n\tb=X1u4rNZN5gI9q4hhYBL81nVh7E6btTlqmZ0pn5wAFAiCM1Tb5CRY3y/+bo76j2sEYs\n\tpkDZ/Iq5c6aZoI+IPYjlW4LMQEn0nFbQk5DwXhYZ00BLV9LSSORMJ2RVnlLvsQ7b+Wcj\n\tehHijNPXl/FtA1bk+DSdZdvu/HQulO7tT78j8I3FECMFLGsHIcvUJb8yrgGaaDREOqsB\n\t8iMCa2mWp3khBnmnJhBMt4CzvK1skzsBpa/UHb9/X3RCEri91eaXuxTWiCVsswvaxYZK\n\tqOtAG3SLAxjxv2kYZqo8wmHSZv9kSaY7Dj+zCGCQ/hNT088XYeirUyQMkj5wJ7CmwCCb\n\tpTkQ==","X-Gm-Message-State":"AOJu0YyQrYgAhP5EzsUOosvnLzs2u2Sj8TcprV3Zqj4dna4CqFsJfC5x\n\tApI/Fzvqm5dtIsPnS/zrwxc/bdnHIITHAgZE2S9SBgYhfWjVhlsSS04IqIacPbTRbb0TPWxOukj\n\tHWIz5Ueo=","X-Gm-Gg":"AfdE7ck2D9Qrk6dMJSHkM0/bvmSb9YRwi/zGXz9K0auOXFbB7+u1fkWvxXuimkdnt9B\n\tTqJmvIR9sPXILbXWNFJ6eP/jYH6rbMbUihji6zH1VEKn67ukLUaTnedCqLdjpsbmm2YxyH3oGP1\n\tNKh70wWOOr3XJbh46T1snRqz0h1q2R699rphwVZPH6qcOc8e1b/y5mKpTf2BOTJL5pZqwIhcejB\n\tp5uQoO4qz/PvVpiZyUsvY3XI4Z/0n1fa7zIyfvFT13Pmp66vwd+WRc4h8lz4bcvi9TUs2OpM5db\n\tXbXS6mkCk96sP120n8vnpwI58MoWwHol/Jr2xqmsR/l4fnHYCGKTYIF1KXuGk58VpMLVeZ4xkkz\n\tsQUdrW90Bradn0L7lAukssWrKtVnKvAYbjDI3wWISweWFNaw3YDYtMbhBTvKsQkcIbWEF7KcHfI\n\t/8Axo2L6EVJj2BRpsu1LeZgTfyH/tI","X-Received":"by 2002:a05:600c:3e88:b0:489:5022:39a4 with SMTP id\n\t5b1f17b1804b1-4925b3532ffmr95245295e9.9.1782291545074; \n\tWed, 24 Jun 2026 01:59:05 -0700 (PDT)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"bryan.odonoghue@linaro.org,\n\tpavel@ucw.cz","Subject":"[PATCH 07/10] libcamera: egl: Add activateBindTexture","Date":"Wed, 24 Jun 2026 09:58:46 +0100","Message-ID":"<20260624085849.873784-8-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260624085849.873784-1-bryan.odonoghue@linaro.org>","References":"<20260624085849.873784-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\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n include/libcamera/internal/egl.h |  1 +\n src/libcamera/egl.cpp            | 14 +++++++++-----\n 2 files changed, 10 insertions(+), 5 deletions(-)","diff":"diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex f1fa75d96..59fd52749 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 6134b05f9..f26fe2e53 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -138,6 +138,13 @@ int eGL::attachTextureToFBO(eGLImage &eglImage)\n \treturn ret;\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 +204,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@@ -273,8 +278,7 @@ void eGL::createInputTexture2D(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 \tswitch (eglImage.format_) {\n \tcase GL_R16F:\n","prefixes":["07/10"]}