{"id":27241,"url":"https://patchwork.libcamera.org/api/patches/27241/?format=json","web_url":"https://patchwork.libcamera.org/patch/27241/","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":"<20260706110120.2509826-5-bryan.odonoghue@linaro.org>","date":"2026-07-06T11:01:17","name":"[v4,4/7] libcamera: egl: Add updateTexture2D","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"7a5fcaec82b0ef3f7ca917a2cb25f9cead53c054","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/27241/mbox/","series":[{"id":6040,"url":"https://patchwork.libcamera.org/api/series/6040/?format=json","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/27241/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27241/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 830A6C3318\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jul 2026 11:01:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EA4666602B;\n\tMon,  6 Jul 2026 13:01:37 +0200 (CEST)","from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A09AD66007\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Jul 2026 13:01:34 +0200 (CEST)","by mail-wr1-x436.google.com with SMTP id\n\tffacd0b85a97d-475881b9a4bso2493008f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 06 Jul 2026 04:01:34 -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.33\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 06 Jul 2026 04:01:33 -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=\"EtouIF7O\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1783335694; x=1783940494;\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=jm28t3W8seSh/4fiCoMetv0uEp/689cCMRBSitfqhw4=;\n\tb=EtouIF7O87jh5QNQGt+CYjmDdcWrUDmeHaWz/ajnZjcj4lenawcA/WS7/3T/ifw32U\n\tKEuI6Vo+GR3R5tyHjHuTZv5tsZbqwtNUYZJJY9xncrrpy9D7yySJMIJ+1Mmd3MdpBBPO\n\tX5UVth0oAqrtmEZOdBiIoMzQGz8Rog1nuouluR4SZx1snhCtlMm9qvIVIcRD1TfxOKb1\n\tMdk0gN2Zb6jOLPqtONpXGFUOiDHlmVTxhEizfETvewAwWhZ6iFgQwOL8b7zHf/ih5NDe\n\twLKS8vpS8TnBN0R7cfcAEzwj4gYUBA/JFenIbB8UjXuUsen+WSku8vs8bCP9g+qKPZwY\n\tottg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783335694; x=1783940494;\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=jm28t3W8seSh/4fiCoMetv0uEp/689cCMRBSitfqhw4=;\n\tb=p9qIzDsV/dz4Lvk58b78tjPgUB78+SDJs2izZrbT0XL+/R237JWYE4VSC2kuBwMIas\n\tj+a77mj9pSF8JiPLvaL2A5Z+Cki2beZjMYiVfNTHzANYumHlabul2Kkyx1678OzuBRdp\n\tpk8zWItB8wtbw9DD+Zqkzwj2xfWL9ik5aEqUz6A3N1OEY3H7oLUValqfYVc1Ay04fhgm\n\tkqCnpmUM3edXGcSvGRvh16xuX4LUoDCb/I+4l8FPAkqkGfWf34Rw55D72i6KorYi1VGd\n\t/CSJEo8oY+OjHKH9/qIfZBo0MfNPB4e4nFftW/9IOfiHRmYKrVBbl7lW6QiHZTrPwntY\n\trghw==","X-Gm-Message-State":"AOJu0YzdSj6B4ajs9s3EPFA7BMoMRTr4IVWzGJEqJJQSPkSx52XbjQuK\n\tr+xCvFZWhkq/Yc/0Ie9CcM7Ic+dhBULSRAJYOHL1sKQaHL8abn4LSA242zLcLxj0/+p8cnXQW/s\n\t6zQHZ","X-Gm-Gg":"AfdE7cnSin8wDkyM1x8Lu9WtUBwcvaXUylFAsCKh7kqutlnLp1PzYY/9OQC/7YFBvOM\n\tuKmIGs3eIhLqJd8/6vr7VmllbyupqRkdbtBmLG1Bb1plu9Y9rW7lSKdTlpADxIxSUhnEo82VBYw\n\tAw3frNtH6AZz2SQ5/aURWnlvEbHuw5neXWmG5QdOEL+p9nn8332Jq5tVwGHuFhO6MKb5NZ5e02c\n\tNBUIH8rBx7mSyXxPOR+Q9tny46Ps171WUocyM7BKBpRgghSJP5Ng68hsyoqnhXtT6cYTa8cNmxw\n\tIY3pceNr9yjgYqwz0DYwUl1u3Rp27bV2UKJ5HqoPiz5cwJWS4T+U0PFsPkzMHwkvE/430fuhcTN\n\thruYdQjHlw3Hdw+ubhvY+xPtQ+0jQ1ZXToc9dyW8mwcN7gIINhZ56VLXstDRS9mMd0kiWoabXKT\n\tVpfW+eGbe7svnscqgmPFmbskfRu2fq","X-Received":"by 2002:adf:f3c6:0:b0:460:1301:dec6 with SMTP id\n\tffacd0b85a97d-47aab57d2d8mr7214883f8f.10.1783335694131; \n\tMon, 06 Jul 2026 04:01:34 -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 4/7] libcamera: egl: Add updateTexture2D","Date":"Mon,  6 Jul 2026 12:01:17 +0100","Message-ID":"<20260706110120.2509826-5-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":"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            | 18 ++++++++++++++++++\n 2 files changed, 19 insertions(+)","diff":"diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex 1955d09c5..9b4261c55 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 c1b5514b6..b91f9096a 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -329,6 +329,24 @@ 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+\tglActiveTexture(eglImage.texture_unit_);\n+\tglBindTexture(GL_TEXTURE_2D, eglImage.texture_);\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":["v4","4/7"]}