{"id":27250,"url":"https://patchwork.libcamera.org/api/patches/27250/?format=json","web_url":"https://patchwork.libcamera.org/patch/27250/","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":"<20260706113900.2530549-6-bryan.odonoghue@linaro.org>","date":"2026-07-06T11:38:58","name":"[v5,5/7] libcamera: egl: Add updateTexture2D","commit_ref":null,"pull_url":null,"state":"new","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/27250/mbox/","series":[{"id":6041,"url":"https://patchwork.libcamera.org/api/series/6041/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6041","date":"2026-07-06T11:38:53","name":"libcamera: software_isp: gpu: Add go faster stripes","version":5,"mbox":"https://patchwork.libcamera.org/series/6041/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27250/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27250/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 CB512C330A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jul 2026 11:39:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 91E9966030;\n\tMon,  6 Jul 2026 13:39:19 +0200 (CEST)","from mail-wr1-x431.google.com (mail-wr1-x431.google.com\n\t[IPv6:2a00:1450:4864:20::431])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9CFBA6600A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Jul 2026 13:39:15 +0200 (CEST)","by mail-wr1-x431.google.com with SMTP id\n\tffacd0b85a97d-4720f3bf164so1931706f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 06 Jul 2026 04:39:15 -0700 (PDT)","from inspiron14p-linux ([109.77.44.220])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-47a9de1e6ccsm24796084f8f.5.2026.07.06.04.39.14\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 06 Jul 2026 04:39:14 -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=\"Mnreu3TL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1783337955; x=1783942755;\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=/B6GIAyW48ah9/xcsZgbpJ85k5AYURJJX6RMJWKLdbo=;\n\tb=Mnreu3TLiDs8ZvIuEMr6OSDGSkTCkLGdpQ3IIQUtPpuhCrFyxgok0DzMma9wVhy8Vs\n\tJBaeieSx1cjeKeW42dYqZ96xILBraSjGV9sRrRSOosADd4A4f2GRbfVVXrKRWHUzV+XD\n\tN3Fwzv5nGfbbWDoIT3Hy0ODjdZj16l26S2qUX2xOCxke2dxdsOE6wcshMZt1ODf4T7BC\n\tr4YfZhRVbD836t4yMFXtigcrgbAZTDAIkI1/11eGc0gAkiAFa3f22LqBlnBUKi9GTBV0\n\tc6d/FasqvDLV9YEoq/WRGYdUxoN3iwvjB0YZ3EE4oOrZOYZfkSB+0yPI+xCpY9OjlJAi\n\trzug==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1783337955; x=1783942755;\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=/B6GIAyW48ah9/xcsZgbpJ85k5AYURJJX6RMJWKLdbo=;\n\tb=N/TFLUAMX1Qc0HtYWR/1tnnNuAPojaxLRzuVgVEFv6Q0NFYgNDk3ED7vVKgsDfmZm/\n\ted3zKu3Y0FBey3GU50pZur+DFnfjTZO0dCIehUJwjvb3Zogc99Hzic/ylvqGV3hzEX4f\n\tP40nuedEvmvRnwzSr7ldeZ8nGETFDrDalLzxYciKlv1iC+RA0Fi7XtPPhOp1VC54j97/\n\tfEr7/XI2eaWTy8uvQM9iCXGepISW5QE4C3vOxKVAFoheEZFAXi2CwKrMOrePO2KnLtO2\n\tT//8sn/2AuMxS68wwbc8/tmyQj21XiV3Viep+a7NozONlkdyO6tS69VWdp7adkwl3gyE\n\t0IOw==","X-Gm-Message-State":"AOJu0Yzyr83SCbmaAdBlkIMz3cbtuS2Cw39TkIPwb8vaQSdAPMFD5zbW\n\tkjS2zD8TgdUMimjnK3pNy01O4erwQIqpJs0PPaVuUr8SJp03zGg4yda00tMi0w29tiBLtLbQBJa\n\tM+Gk0","X-Gm-Gg":"AfdE7cnsInnuJLHWdmekGQxXuxJBp3EWwQEciYJK+KfYAtjM2qSUpkDrA8xuQSXEYof\n\tRDYQkxqpy8zb92+2V165Sx3PnXj6fy5SWv/5IDyKzrS9R/SVk/12xDcVurlpUQUqAUq2H1DfWVz\n\tELbxDEEbctCmhS+eJbYzfpd0e44tgUyAxFryZroGFqdGMmqya5Q7PKzjJ4zzhyg6xNx5pjcy5kd\n\ttkl3z4JyyLH4O+jt3gkFCNXBz4vp1ybNRlPpiavsqH+H4cy4Hlff3QaY0poixibiXvN0KnhntOF\n\tirR0Vv4CKzOin0YzlX8PkRLHZ++LSOoJj1F+3qySPU3QDbbJWP9LrMAB1qOY3/mMjJFfNYiQsfp\n\tslP4DJVr4HGzzcRapxv17ziv34TbRUSx8EHCuZkWudrDZ0sOYXf7EfgE57O3X5vU6+5KJMq/iho\n\t+p6WPhCXrmzlKpBXLrQ2vzozSL4YSd","X-Received":"by 2002:adf:f84e:0:b0:474:a0a3:df0c with SMTP id\n\tffacd0b85a97d-47de6173bb0mr369642f8f.10.1783337955185; \n\tMon, 06 Jul 2026 04:39:15 -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 v5 5/7] libcamera: egl: Add updateTexture2D","Date":"Mon,  6 Jul 2026 12:38:58 +0100","Message-ID":"<20260706113900.2530549-6-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260706113900.2530549-1-bryan.odonoghue@linaro.org>","References":"<20260706113900.2530549-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":["v5","5/7"]}