From patchwork Wed Jun 24 08:58:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 27031 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C0308C3306 for ; Wed, 24 Jun 2026 08:59:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7754B65890; Wed, 24 Jun 2026 10:59:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ngp6Ewap"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2DCB26588B for ; Wed, 24 Jun 2026 10:59:04 +0200 (CEST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-490cf322ed0so7762595e9.1 for ; Wed, 24 Jun 2026 01:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1782291544; x=1782896344; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rvAQEVMSRheyGM8shl7R1Ii/hn68JOYesKLUlq7bdnc=; b=ngp6EwapBGiYmXOHkkFA0kmJ3fg+4idn7+LbBYksXo6KZ1e7PW1rrA1t6HDrJ3pWp9 TG0/UVubh0v7eOz9aLW4i68m7EjR00xd5eSkk6KlOzsIXwCU7KXPoBmCxrtZHbX6m8vP cu4itzwGQnqTvu9eSPYFvp9j5xglA64VjSwIK91sTABTfTJpjD1b/Kbkp78jXp2NzD14 6kRR0CWNMCOQMdM+mbnp8wayWC3hWp+5JvKceA7fs/yZHpcVpj4x2jFsKhogCuAvu0l6 /kctsX00IMgLsQ6JCWnRj0JObJTlaNgnrm2O+6YFdur3a4LcORb2ogQwX0ackfLDm0z/ UgEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782291544; x=1782896344; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rvAQEVMSRheyGM8shl7R1Ii/hn68JOYesKLUlq7bdnc=; b=O/Zg2N9qD80kbHbdstYngMrlTSvREnjPOP34SNrggGtzI/PmP/Sr5li7ieD8IC5M3T XJwqYZFq9eP/XasAprPCCAuBxdxLESdXJ2w2MVeCiE/CC+C1suJ9rFxFIfTmzTt9hJoA dW4NvKCl5l7OWwOsK/o1yCm+yLtWznSU/xt209WG6e9bKAxT5WJaZHMYa8eGQ69ABxz4 fQABWgfW6gmKJa1fOnaSJ/OgdF2zoeoKpKolVYEADxPDqja53/+tTP9Y7AWOYrI+te5V 4tsuf1c65neRBu0eI6dcfZY+Cx3ply/I4PHEDasb4bEhlDkxXVetvjGpm65Xi2BOLv9b LtHA== X-Gm-Message-State: AOJu0YyHGWuY2H49J96ByvD+cg6y64nISE9NOSbTyQKZgTI/hekhK4Aw tcqmSdv/Qf5CEbOiLsALLUZli5eyJrtGxRSwohBpHdqelUb33hm7bszEK4rq7H78/9Dymuw26pJ ADPjrZ1k= X-Gm-Gg: AfdE7cnuTByU9cf2kNnf3MplyBZwpHHY3owbQbWoSx2CN9dMYwIl1n1JTpZ3NikinvI 2hL0LJ17SIngearmeuLyOitr/4xXc/srsqQWz1ZPls/5e78n8kkAuMAqaUmKVXZrIX9mLyr22pa UF4fzZcQ8p+MHPXQQPIhsVZjiCFodMbdlMSnvLNK3BZMlERU6kBzQsD4SFF9ETbN+/UvjRmC+c0 cM8fzNG8Wm+4rlkO5DRL+P7ozjuQ6y/CRuG/RRCXdcF7zgazt+H1iMe22xBJNvd6HlJRBuWnV7A cFJxYwdFgb1qbkYrwJ0u8KbpSR0OEe0SNDqVu6uHdroCQVIom1BaXGhPhYN+Cd2gqINaR3Xskby K65oUXPcnvv6kB1POZrbzH4qVZnUQp1UzJLr+EbH5xIsoy/UHBqOrD7WJMyMtx5tZZCVm9vRyGG uU4mmkpEQMCo7dCyAdogWL8ccdHRis X-Received: by 2002:a05:600c:3110:b0:492:51aa:2d46 with SMTP id 5b1f17b1804b1-492608521a0mr29036095e9.13.1782291543628; Wed, 24 Jun 2026 01:59:03 -0700 (PDT) Received: from inspiron14p-linux ([109.76.100.231]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49261063d6esm25128375e9.2.2026.06.24.01.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2026 01:59:03 -0700 (PDT) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: bryan.odonoghue@linaro.org, pavel@ucw.cz Subject: [PATCH 05/10] libcamera: egl: Add createOutputTexture2D Date: Wed, 24 Jun 2026 09:58:44 +0100 Message-ID: <20260624085849.873784-6-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 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Creates a non-dmabuf texture attached to a frame-buffer-object FBO, which allows for render-to-texture. Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/egl.h | 1 + src/libcamera/egl.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h index 0709f9019..b992baf25 100644 --- a/include/libcamera/internal/egl.h +++ b/include/libcamera/internal/egl.h @@ -108,6 +108,7 @@ public: int createInputDMABufTexture2D(eGLImage &eglImage, int fd); int createOutputDMABufTexture2D(eGLImage &eglImage, int fd); void createInputTexture2D(eGLImage &eglImage, void *data); + void createOutputTexture2D(eGLImage &eglImage); int attachTextureToFBO(eGLImage &eglImage); diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp index 2825d34d3..123653b58 100644 --- a/src/libcamera/egl.cpp +++ b/src/libcamera/egl.cpp @@ -345,6 +345,22 @@ bool eGL::isAvailable() return true; } +/** + * \brief Create a 2D texture attached to an FBO for render-to-texture + * \param[in,out] eglImage EGL image to associate with the texture + * \param[in] format OpenGL internal format (e.g., GL_RGB, GL_RGBA) + * + * Creates a 2D texture in VRAM. The texture + * is configured with nearest filtering and clamp-to-edge wrapping. This + * is useful for uploading static data like lookup tables or uniform color + * matrices to the GPU. + */ +void eGL::createOutputTexture2D(eGLImage &eglImage) +{ + createInputTexture2D(eglImage, NULL); + attachTextureToFBO(eglImage); +} + /** * \brief Initialise the EGL context *