From patchwork Wed Jun 24 08:58:42 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: 27029 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 7BBF5C3306 for ; Wed, 24 Jun 2026 08:59:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 817E06588D; Wed, 24 Jun 2026 10:59:08 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OPQzNKFL"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DFD0F65878 for ; Wed, 24 Jun 2026 10:59:02 +0200 (CEST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-490ac357c55so7053825e9.1 for ; Wed, 24 Jun 2026 01:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1782291542; x=1782896342; 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=br9Q7T1ldP/TlFZGIutApjjAtcXAdKfOFS9iVRyulvE=; b=OPQzNKFLOnXfz9CO2GH9GE9V+NCgOpp/q9nxBW2M8sFAjhCSl6GP5TNV/Qmy3UB9oP +mLTqenpoNjfSuseInUQZm0+pNviN1lfvvh3zTStpqf5kEt8JoVs+BhNd25g4Dl69vYP UUzO4FI8tGmqroofOprXmDzi2GjEFtRPbONk52b2AyqU1xBSQz6HlpxpLRd66//Ymdul UJAJhoP1nrEMee0y54ciEjKvOMO7AkCuf++K/V4D94FYEimjnSNwxFd2DjcG8M6gvtMX cHyz93nijT5hpiRZukVvGg3EghRE5rJKKy9gNByRd3YhbP7C1ps43PaB4lNvFdYcUbLC VzYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782291542; x=1782896342; 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=br9Q7T1ldP/TlFZGIutApjjAtcXAdKfOFS9iVRyulvE=; b=ep767KvmWEGnx5G+CseN2WUaK2sW35A7Q0IuNQGJIIRjeh8bRq0JMKgT5yH8bQVsPl SQFXooaXHpJfeN1WHW5zkn66sXMMb8nsuaGj5MarFrIZN8w6ild1NU+SUs5d1P1xUhDI /lPZ3WoRI2Q+ON+P6QNtNKYv6eGv7VdC82W4PeSRhHCYNcLuhfwhQFswPmmKKSQhgbhd YhEKFM0CS/1ymnugyIfgOuhhuW4E6t2MjnrMZIFaL7AWn5x40CrOcA3SSDoJVuLzauJg R1uEvvlCeqbYicjQ0SDt7YpqOi6d+Gld7M8tW64rHDvQYYyZq4LhvU78AV5TsPCEQV7J gyxA== X-Gm-Message-State: AOJu0YyvmcUIDMVJsVtRQNRRwRlQ0JVFc6Z3+RWd9Y0YnqrNeTIG8nbE JtRfX7zCScM1zWSzfGhqqFR5Il8ntvcPGgyQH/RMw0MSdCWDBiFkmQ3BppFAb/wHE/y9uzLH5rN suJYu/OQ= X-Gm-Gg: AfdE7clH1eVel6TYhxc7yOMs/gSgqwq+JSMo5dE57Zv1fCTUX4D89Ofapfno0MoZCxg zi2rGxi8G0xkDOrFvmh3HQ/xoP7/trOg5oSZGyvqdWe72XvUVWKF8wShfP5isXZrLsJlag9ViR4 RHY5GSoiARcRF9eo7veewD+zmomvYuxmELw7UzDJhvdeN6S9V/RT+BMybT8VE40SplJd5j0DI+n wqWIG4JaPWmfinsbBSJBCyQu49f1bHIhsnCUSNcFwqVoYb4+kk3RU1RtbRiRK8/sZLqMmzU5BFN Zz6P4JoLhYj0W+Kh9Ih4BOw5ErwtDzKVSO0gLTxVZnMAOUVcQ2BM/+LWZfQsdL7/i0aIfpk23q8 iE6k9K9V0wf3igqdWghRIy2rtC6Wq0pR5QUZZ9FEnGqZsSkLvm30jic93a1V4Z6rOp4MAOdrQ/0 WGyFUA93Yx7vwQ6qEb0unLJ2RtGHTj X-Received: by 2002:a05:600c:8518:b0:490:a298:acf7 with SMTP id 5b1f17b1804b1-4926086d16bmr35890145e9.17.1782291542242; Wed, 24 Jun 2026 01:59:02 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2026 01:59:01 -0700 (PDT) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: bryan.odonoghue@linaro.org, pavel@ucw.cz Subject: [PATCH 03/10] libcamera: egl: Extend eGL::createTexture2D to understand floats Date: Wed, 24 Jun 2026 09:58:42 +0100 Message-ID: <20260624085849.873784-4-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" We want to have the option to use floats as an intermediary format between different stages of a multi-pass pipeline. Adding floats means also plumbing the infrastructure to differentiate on data-type on the input to texture creation. Add the floats and the plumbing. Signed-off-by: Bryan O'Donoghue Reviewed-by: Robert Mader --- src/libcamera/egl.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp index e83e24606..8d80a6d1a 100644 --- a/src/libcamera/egl.cpp +++ b/src/libcamera/egl.cpp @@ -268,13 +268,29 @@ int eGL::createOutputDMABufTexture2D(eGLImage &eglImage, int fd) */ void eGL::createTexture2D(eGLImage &eglImage, void *data) { + GLenum format; + GLenum type = GL_UNSIGNED_BYTE; + ASSERT(tid_ == Thread::currentId()); glActiveTexture(eglImage.texture_unit_); glBindTexture(GL_TEXTURE_2D, eglImage.texture_); + switch (eglImage.format_) { + case GL_R16F: + format = GL_RED; + type = GL_HALF_FLOAT; + break; + case GL_RG8: + format = GL_RG; + break; + case GL_LUMINANCE: + format = GL_LUMINANCE; + break; + } + // Generate texture, bind, associate image to texture, configure, unbind - glTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, eglImage.format_, GL_UNSIGNED_BYTE, data); + glTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, format, type, data); // Nearest filtering glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);