From patchwork Wed Jul 8 14:14:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 27302 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 18D04C3306 for ; Wed, 8 Jul 2026 14:14:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C4E0B660A2; Wed, 8 Jul 2026 16:14:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="i833rs3h"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BE8DF65FF1 for ; Wed, 8 Jul 2026 16:14:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783520094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XzYRQqs2k+fB7epVZ3D6QgHUY1JryaBpxta+uI3DXWE=; b=i833rs3hFyBPqZta+INhlv9mxl8focsP2djtmmpJqyxnuOyF7Cl6ZXocskYbCcmEgeDB1O Jq91+ta9rLwB6FYuwWFXYIHVcMsNXLAKVwE9qQolJsFhwpjD9W04L3+RsPoMEKinuCCGqz PyIxN2twLey6YvY3NhQWS0zLykCntks= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-pd6MC0Z0OcOrwMnHJTvXXw-1; Wed, 08 Jul 2026 10:14:50 -0400 X-MC-Unique: pd6MC0Z0OcOrwMnHJTvXXw-1 X-Mimecast-MFC-AGG-ID: pd6MC0Z0OcOrwMnHJTvXXw_1783520089 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FE3D180060C; Wed, 8 Jul 2026 14:14:48 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.48.228]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2626438590; Wed, 8 Jul 2026 14:14:44 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Xander Pronk , Bryan O'Donoghue , Hans de Goede , Laurent Pinchart , Bryan O'Donoghue , Rick ten Wolde , Milan Zamazal Subject: [RFC PATCH v6 1/6] libcamera: software_isp: egl: Add filter parameter to createTexture2D() Date: Wed, 8 Jul 2026 16:14:29 +0200 Message-ID: <20260708141436.119165-2-mzamazal@redhat.com> In-Reply-To: <20260708141436.119165-1-mzamazal@redhat.com> References: <20260708141436.119165-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: sU5959sc6-geTudaALT6U13zJroYqWmnIuwZ5TIYDsI_1783520089 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true 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" From: Xander Pronk Add `filter' parameter to createTexture2D() to allow overriding the currently hardcoded GL_NEAREST value. This is needed for grid-based lens shading interpolation, which is implemented in followup patches. Reviewed-by: Bryan O'Donoghue Co-developed-by: Rick ten Wolde Signed-off-by: Rick ten Wolde Signed-off-by: Xander Pronk Signed-off-by: Milan Zamazal --- include/libcamera/internal/egl.h | 2 +- src/libcamera/egl.cpp | 9 +++++---- src/libcamera/software_isp/debayer_egl.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h index 523a62aa8..030c813a5 100644 --- a/include/libcamera/internal/egl.h +++ b/include/libcamera/internal/egl.h @@ -107,7 +107,7 @@ public: int createInputDMABufTexture2D(eGLImage &eglImage, int fd); int createOutputDMABufTexture2D(eGLImage &eglImage, int fd); - void createTexture2D(eGLImage &eglImage, void *data); + void createTexture2D(eGLImage &eglImage, void *data, GLint filter); void pushEnv(std::vector &shaderEnv, const char *str); void makeCurrent(); diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp index b5a5dc60b..aeac5d313 100644 --- a/src/libcamera/egl.cpp +++ b/src/libcamera/egl.cpp @@ -242,13 +242,14 @@ int eGL::createOutputDMABufTexture2D(eGLImage &eglImage, int fd) * \brief Create a 2D texture from a memory buffer * \param[in,out] eglImage EGL image to associate with the texture * \param[in] data Pointer to pixel data, or nullptr for uninitialised texture + * \param[in] filter GL texture filter setting * * Creates a 2D texture from a CPU-accessible memory buffer. The texture - * is configured with nearest filtering and clamp-to-edge wrapping. This + * is configured the specified 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::createTexture2D(eGLImage &eglImage, void *data) +void eGL::createTexture2D(eGLImage &eglImage, void *data, GLint filter) { ASSERT(tid_ == Thread::currentId()); @@ -259,8 +260,8 @@ void eGL::createTexture2D(eGLImage &eglImage, void *data) glTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, eglImage.format_, GL_UNSIGNED_BYTE, data); // Nearest filtering - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); // Wrap to edge to avoid edge artifacts glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 56545816e..5f492318e 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -527,7 +527,7 @@ int DebayerEGL::debayerGPU(FrameBuffer *input, FrameBuffer *output, const Debaye LOG(Debayer, Error) << "mmap-ing buffer(s) failed"; return -ENODEV; } - egl_.createTexture2D(*eglImageBayerIn_, inMapped->value().planes()[0].data()); + egl_.createTexture2D(*eglImageBayerIn_, inMapped->value().planes()[0].data(), GL_NEAREST); } /* Generate the output render framebuffer as render to texture */