{"id":27258,"url":"https://patchwork.libcamera.org/api/patches/27258/?format=json","web_url":"https://patchwork.libcamera.org/patch/27258/","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":"<20260706222245.247396-6-bryan.odonoghue@linaro.org>","date":"2026-07-06T22:22:44","name":"[v6,5/6] libcamera: egl: Add updateTexture2D","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"6364b7931c4cda4ce6f6ce7044ac3954a00428ec","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/27258/mbox/","series":[{"id":6042,"url":"https://patchwork.libcamera.org/api/series/6042/?format=json","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/27258/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27258/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 328CAC3308\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jul 2026 22:23:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BB83F6605B;\n\tTue,  7 Jul 2026 00:23:07 +0200 (CEST)","from mail-wm1-x333.google.com (mail-wm1-x333.google.com\n\t[IPv6:2a00:1450:4864:20::333])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8278F6604F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Jul 2026 00:23:02 +0200 (CEST)","by mail-wm1-x333.google.com with SMTP id\n\t5b1f17b1804b1-490cf322ed0so22524115e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 06 Jul 2026 15:23:02 -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.23.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 06 Jul 2026 15:23:01 -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=\"KttMJ/q5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1783376582; x=1783981382;\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=/B6GIAyW48ah9/xcsZgbpJ85k5AYURJJX6RMJWKLdbo=;\n\tb=KttMJ/q54CQS+UqWtZ3729Cuc74I1UkdmwqUz6yvdvOqFDjJ0biZ8PfWNfbGo8Zf2O\n\tlOOgi6wYtFznRUAjSxK7T4RV6lxXdmAak143t47pjeVzNk2ysHsXWkQtEv6xfwLa+C9n\n\t4+QTXhroia7kTWs6bJzhh7vHtkMAyykYOEYuinXt+38Ks0SaRVgcsiQbfbSmuU7VbREu\n\tZk5Gd+RO//qNNjPQFlj/I8a6BZ66bWcroJ3KfZxwaaXWBtuf+qOxKYtx9CUd0IS4h5Lo\n\tOSREU3c1ALAaYjKIROJlTGeVSA2ZmkOOw7AYuHz/v8pYSdgBCKZ3OAJRcz30qt1xufP+\n\tTqNg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783376582; x=1783981382;\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=/B6GIAyW48ah9/xcsZgbpJ85k5AYURJJX6RMJWKLdbo=;\n\tb=N7fQpVHgMP86lWhFAGXgXY4PrYrHWOVA5i+BbPolYj/RdERcrEsN3qvYwdZbYAIdek\n\tKTX68a5XcrdTXY/zQ9fZ1ZWSatVvDiE+D9PjHviZ8uxI9R7cPjsQEgykG5oJpKpIPHMB\n\tUIR7o8tw0h6Y1C5blXErVqJme1Wdll5/Kzp48ir2/FqnsKqZ6VGkvCaeTNAJE4kJ9ULt\n\tFywULVDNaflVxHJ4d8sJZXwK1uzIyng/d+t3+s+3G1Oq+FHYUx/9U9Y13krP9vdCf/fW\n\tei+C3xVIYfrEuV2+aqOzsXh0skV4GJQvg9W2lUEz9uxlMIvMJNkE2ozBjEPe/z1F4P1v\n\tzuzg==","X-Gm-Message-State":"AOJu0Yyw4h8KJl7UMsIKA/M9jipribJKNJROomiat0I75oLbS+PtcZVn\n\tsw2CCz4Ur0eUtE1+A70kCVzNAkEVQ1JKpfWdVIsf2wvyIygyEsRVN1soKO10N81CARv96lkRHAr\n\tFxoY8","X-Gm-Gg":"AfdE7clL9F4kAcpmpwFxDYDZESikNuLRRSvtBYvZMOHHK8X34W96XIELs9xkhoUG6VF\n\tjqRixKoa2DuQg6yHaeZic60E5zMovIwjUyNE/xC1VEbvPAZvTQza4tD844l2U1b3STXzkcgjdDZ\n\tIYiOUaMjuT7icIB967qQunO+dsWSR+yCP7yo+n/QmX/T5sgGlYEBkavnQ8tJnCvGtYorOYIor3D\n\tS+M1QbeUaroxd9voKwCTYim5fXVTnK3/QmBrwP6NCq6ECD7XUSS/ocw5yyhiP68Kf8dEZqZSLBl\n\tPCfkOKqv2wP2HuN0JFVtrZBf7PHphbPOM1uddY6MdjDDq044PaklRGRtwefGvPXuZMMcujkwSIP\n\tj5RVEepQPiM+op5wCrcY3aABWM81IzKne37F/BEtd37ZJms7z7YxZMCq6CCOCXPgygSjsnbdPqV\n\tBhK+wmiYqfevXCNLBCxLJU9sz8225+","X-Received":"by 2002:a05:600c:8283:b0:493:b8cd:2555 with SMTP id\n\t5b1f17b1804b1-493df066947mr24762605e9.3.1783376582063; \n\tMon, 06 Jul 2026 15:23:02 -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 5/6] libcamera: egl: Add updateTexture2D","Date":"Mon,  6 Jul 2026 23:22:44 +0100","Message-ID":"<20260706222245.247396-6-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":"The internet box tells me that glTextSubImage2D lets us update a texture's\ndata only, instead of recreating the texture and uploading data.\n\nThis is a smallish optimisation but we are hunting for every possible cycle\nand watt so add the routine as precursor to using it in-place of\ncreateTexture2D on every upload cycle.\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            | 17 +++++++++++++++++\n 2 files changed, 18 insertions(+)","diff":"diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex 64196213a..1e31d490b 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -108,6 +108,7 @@ public:\n \tint createInputDMABufTexture2D(eGLImage &eglImage, int fd);\n \tint createOutputDMABufTexture2D(eGLImage &eglImage, int fd);\n \tvoid createTexture2D(eGLImage &eglImage, void *data);\n+\tvoid updateTexture2D(eGLImage &eglImage, void *data);\n \tvoid createOutputTexture2D(eGLImage &eglImage);\n \n \tint attachTextureToFBO(eGLImage &eglImage);\ndiff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\nindex 0726b63f2..7ec7a654d 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -343,6 +343,23 @@ bool eGL::isAvailable()\n \treturn true;\n }\n \n+/**\n+ * \\brief Update a 2D texture already created\n+ * \\param[in,out] eglImage EGL image to associate with the texture\n+ * \\param[data] Data to update the texture with\n+ *\n+ * Updates a 2D texture in VRAM.\n+ */\n+void eGL::updateTexture2D(eGLImage &eglImage, void *data)\n+{\n+\tASSERT(tid_ == Thread::currentId());\n+\n+\tactivateBindTexture(eglImage);\n+\n+\t// Update an already existing texture\n+\tglTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, eglImage.width_, eglImage.height_, eglImage.format_, GL_UNSIGNED_BYTE, data);\n+}\n+\n /**\n  * \\brief Create a 2D texture attached to an FBO for render-to-texture\n  * \\param[in,out] eglImage EGL image to associate with the texture\n","prefixes":["v6","5/6"]}