[{"id":37937,"web_url":"https://patchwork.libcamera.org/comment/37937/","msgid":"<9f01bba8-0045-4294-bc93-a37309be1ffd@ideasonboard.com>","date":"2026-01-26T11:30:21","subject":"Re: [PATCH 1/7] libcamera: software_isp: egl: Add gl_scale_param to\n\tcreateTexture2D()","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2026. 01. 26. 11:42 keltezéssel, Rick ten Wolde írta:\n> From: Xander Pronk <xander.c.pronk@gmail.com>\n> \n> Add a gl_scale_param to createTexture2D() to allow overriding\n> the currently hardcoded GL_NEAREST value.\n> \n> Co-authored-by: Rick ten Wolde <rick_libcamera@wolde.info>\n> Signed-off-by: Rick ten Wolde <rick_libcamera@wolde.info>\n> Signed-off-by: Xander Pronk <xander.c.pronk@gmail.com>\n> ---\n>   include/libcamera/internal/egl.h | 2 +-\n>   src/libcamera/egl.cpp            | 7 ++++---\n>   2 files changed, 5 insertions(+), 4 deletions(-)\n> \n> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\n> index a9292112..9c0504fb 100644\n> --- a/include/libcamera/internal/egl.h\n> +++ b/include/libcamera/internal/egl.h\n> @@ -113,7 +113,7 @@ public:\n>   \tint createInputDMABufTexture2D(eGLImage &eglImage, int fd);\n>   \tint createOutputDMABufTexture2D(eGLImage &eglImage, int fd);\n>   \tvoid destroyDMABufTexture(eGLImage &eglImage);\n> -\tvoid createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, void *data);\n> +\tvoid createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, void *data, GLint gl_scale_param=GL_NEAREST);\n\nPlease camel case:\n\n   GLint glScaleParam = GL_NEAREST\n\nalthough to me \"filtering\" or similar sounds like a more appropriate name.\n\n\nRegards,\nBarnabás Pőcze\n\n\n>   \n>   \tvoid pushEnv(std::vector<std::string> &shaderEnv, const char *str);\n>   \tvoid makeCurrent();\n> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\n> index 0544056b..3565bfd3 100644\n> --- a/src/libcamera/egl.cpp\n> +++ b/src/libcamera/egl.cpp\n> @@ -229,13 +229,14 @@ void eGL::destroyDMABufTexture(eGLImage &eglImage)\n>    * \\param[in] width Texture width in pixels\n>    * \\param[in] height Texture height in pixels\n>    * \\param[in] data Pointer to pixel data, or nullptr for uninitialised texture\n> + * \\param[in] gl_scale_param GL texture filter setting\n>    *\n>    * Creates a 2D texture from a CPU-accessible memory buffer. The texture\n>    * is configured with nearest filtering and clamp-to-edge wrapping. This\n>    * is useful for uploading static data like lookup tables or uniform color\n>    * matrices to the GPU.\n>    */\n> -void eGL::createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, void *data)\n> +void eGL::createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, void *data, GLint gl_scale_param)\n>   {\n>   \tASSERT(tid_ == Thread::currentId());\n>   \n> @@ -246,8 +247,8 @@ void eGL::createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint\n>   \tglTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n>   \n>   \t// Nearest filtering\n> -\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n> -\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n> +\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_scale_param);\n> +\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_scale_param);\n>   \n>   \t// Wrap to edge to avoid edge artifacts\n>   \tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);","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 9A511C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Jan 2026 11:30:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E6BEE61FC5;\n\tMon, 26 Jan 2026 12:30:26 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 573F161A35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Jan 2026 12:30:26 +0100 (CET)","from [192.168.33.36] (185.221.142.123.nat.pool.zt.hu\n\t[185.221.142.123])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 99548161;\n\tMon, 26 Jan 2026 12:29:50 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"vsJ1C/i5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1769426990;\n\tbh=lAbrC8g0k4NYusJImi3NtyOJ2HT+iNFH48C71qM0Mlk=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=vsJ1C/i5+75SdphIxIZTyLHTFLrces87eEnD0PH6hCUIM811tHvqEWDThnilTlRaY\n\taODtIHYNJt/cnWWXvPyvw3mXqszyPW+f1KFBLfhMMCOhASmk6ZrcP+pBtP4OG6hLzh\n\t5DyiJZomfTSeENcoXUGBJN5efi5020LQ7az8LKcs=","Message-ID":"<9f01bba8-0045-4294-bc93-a37309be1ffd@ideasonboard.com>","Date":"Mon, 26 Jan 2026 12:30:21 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/7] libcamera: software_isp: egl: Add gl_scale_param to\n\tcreateTexture2D()","To":"Rick ten Wolde <rick.w.ten.wolde@gmail.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"xander.c.pronk@gmail.com, derekgielen@outlook.com,\n\t22012540@student.hhs.nl, johannes.goede@oss.qualcomm.com,\n\tRick ten Wolde <rick_libcamera@wolde.info>","References":"<20260126104256.119697-1-rick.w.ten.wolde@gmail.com>\n\t<20260126104256.119697-2-rick.w.ten.wolde@gmail.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20260126104256.119697-2-rick.w.ten.wolde@gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","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>"}},{"id":38076,"web_url":"https://patchwork.libcamera.org/comment/38076/","msgid":"<6b06dfc5-7db3-41f1-af44-c477eac15e70@linaro.org>","date":"2026-02-04T15:05:56","subject":"Re: [PATCH 1/7] libcamera: software_isp: egl: Add gl_scale_param to\n\tcreateTexture2D()","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"content":"On 26/01/2026 10:42, Rick ten Wolde wrote:\n> From: Xander Pronk <xander.c.pronk@gmail.com>\n> \n> Add a gl_scale_param to createTexture2D() to allow overriding\n> the currently hardcoded GL_NEAREST value.\n> \n> Co-authored-by: Rick ten Wolde <rick_libcamera@wolde.info>\n> Signed-off-by: Rick ten Wolde <rick_libcamera@wolde.info>\n> Signed-off-by: Xander Pronk <xander.c.pronk@gmail.com>\n> ---\n>   include/libcamera/internal/egl.h | 2 +-\n>   src/libcamera/egl.cpp            | 7 ++++---\n>   2 files changed, 5 insertions(+), 4 deletions(-)\n> \n> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\n> index a9292112..9c0504fb 100644\n> --- a/include/libcamera/internal/egl.h\n> +++ b/include/libcamera/internal/egl.h\n> @@ -113,7 +113,7 @@ public:\n>   \tint createInputDMABufTexture2D(eGLImage &eglImage, int fd);\n>   \tint createOutputDMABufTexture2D(eGLImage &eglImage, int fd);\n>   \tvoid destroyDMABufTexture(eGLImage &eglImage);\n> -\tvoid createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, void *data);\n> +\tvoid createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, void *data, GLint gl_scale_param=GL_NEAREST);\n\nInstead of setting this statically, I think it would be neater to simply \nchange the callsites.\n\n> \n>   \tvoid pushEnv(std::vector<std::string> &shaderEnv, const char *str);\n>   \tvoid makeCurrent();\n> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\n> index 0544056b..3565bfd3 100644\n> --- a/src/libcamera/egl.cpp\n> +++ b/src/libcamera/egl.cpp\n> @@ -229,13 +229,14 @@ void eGL::destroyDMABufTexture(eGLImage &eglImage)\n>    * \\param[in] width Texture width in pixels\n>    * \\param[in] height Texture height in pixels\n>    * \\param[in] data Pointer to pixel data, or nullptr for uninitialised texture\n> + * \\param[in] gl_scale_param GL texture filter setting\n>    *\n>    * Creates a 2D texture from a CPU-accessible memory buffer. The texture\n>    * is configured with nearest filtering and clamp-to-edge wrapping. This\n>    * is useful for uploading static data like lookup tables or uniform color\n>    * matrices to the GPU.\n>    */\n> -void eGL::createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, void *data)\n> +void eGL::createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint32_t height, void *data, GLint gl_scale_param)\n>   {\n>   \tASSERT(tid_ == Thread::currentId());\n> \n> @@ -246,8 +247,8 @@ void eGL::createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint\n>   \tglTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n> \n>   \t// Nearest filtering\n> -\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n> -\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n> +\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_scale_param);\n> +\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_scale_param);\n> \n>   \t// Wrap to edge to avoid edge artifacts\n>   \tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n> --\n> 2.51.0\n> \n\nOther than that LGTM.\n\nReviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>","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 02505BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Feb 2026 15:06:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ECC4662032;\n\tWed,  4 Feb 2026 16:06:01 +0100 (CET)","from mail-wm1-x333.google.com (mail-wm1-x333.google.com\n\t[IPv6:2a00:1450:4864:20::333])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 01C4461FBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Feb 2026 16:05:59 +0100 (CET)","by mail-wm1-x333.google.com with SMTP id\n\t5b1f17b1804b1-483100e97d8so5636335e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 04 Feb 2026 07:05:59 -0800 (PST)","from [192.168.0.40] (188-141-3-146.dynamic.upc.ie. [188.141.3.146])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-483108d79c9sm50775875e9.1.2026.02.04.07.05.57\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 04 Feb 2026 07:05:58 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"jBym8TJB\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1770217559; x=1770822359;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:in-reply-to:content-language:from\n\t:references:cc:to:subject:user-agent:mime-version:date:message-id\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=FOjZkMPJFQWYgKdJmCJ47pyYPDpyohLu0EcjE/foK80=;\n\tb=jBym8TJB3eTv1qyooBg25enWkYw74edte2JXJ4A9Xekw8HJODXcUrjrhYKWYpv9La5\n\t0TvK8awzYJVt8nBd63g5y8QX+ApJtktOC19tzJyCYPffjVVy6RXZa3fAML3Z8zvPxhf2\n\tCpDuOhWdp0wteCGRNLMWg654Yk9GStUZfmc6LV7Kk1yfS+8elMxtAhybnrJvYh2OqN4n\n\t3949Ms5/MYp8iXeJwO+HBpp8D0mq28UKUnT84fNpChbVnCchJkTMTIUuE1nlDpd/k1P4\n\tovs7mgTay922wkTMFjqRHRnYhL5VSZYpdKQE2ShimNsKSLhTnr2j5jYHQFCZ1ibkMrRA\n\to20A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1770217559; x=1770822359;\n\th=content-transfer-encoding:in-reply-to:content-language:from\n\t:references:cc:to:subject:user-agent:mime-version:date:message-id\n\t:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=FOjZkMPJFQWYgKdJmCJ47pyYPDpyohLu0EcjE/foK80=;\n\tb=O9KoBFbZSnpxxYAQaP4ZT7nJQlW3sDR9MfdmfpRYhjcSzgxRLZ22D90LMDbH4s589h\n\tC2UHysKwLuKVPkoZuWfG+0r1VWFMZshB/xx8+gDDV1sbcULhZnki/o/sFReM5iuhJ+GI\n\txacKLojjZ+5rbxNdhlZr1A6Kkj3dXjSV4lnVrYg+XYs3BPbBbQF1/QU6W0DZ2tYWo7rj\n\thfrvrGGRQqPGJaHFVinldI4a71bOr+MpTZJWgJ8epHsRWNRWGDasqkRnIGbWw3/QpCVz\n\tQklRA2DPJ6x1CipP33A4Nb7jf3kSW+pB2IhmJH/yb5GtetaaJ0+PMN12K9ew2O4j60S5\n\t467Q==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCVHcMmL+06NlSXl1R/2facjJjGCMpmnv/cGh7Klkf/zSVfkATZ8h+8eXabMjURMkbUg3dXWh6S9DYP2u74SABM=@lists.libcamera.org","X-Gm-Message-State":"AOJu0YyeuACVO5p3SpC39P5rtes9fFCwoL94ZZGO+mnRvcRj1rXk7wT9\n\trmLvI+GUNI12cMwZhuUtDUu6o1HyswUb0pXf57Gz342OSY0u+QNEdHDUPJbYvh4xYPo=","X-Gm-Gg":"AZuq6aIFoUdgLf9+DRAoM/ALonkdIg0uVgn2H1WusBLYDRjnEOvNcykTUqIj9n5TyOz\n\t6GFf170iFzZszFzqTSrr/vhAAaqOPYwG9MbJPSLwtz5vahJ+jtmo1DxGq2XJPxhEmZHB/93ATY6\n\tJMdH4vZb+clXqFFS2tjJXIi96wTsM+DFuvroXkddq1FvSx6iGNviQJFec/UNeQnKqGPZUMIccWL\n\tnLp4IV6IlrVhTTcCcNNIvRbjcrN4Zeu9QIoJ9M6/cbOmgcLH5avVAozFm0qH6jHMJPnrSe7x1b3\n\tAhd19gV/x3r0uc6jW8PIjVd2IK5Ym0bt5BBSyrkTiP/bUI/7rQ0eXdUTm0eZ+TjCC8BD4TE+Mpe\n\tqBZFBIriK23866Du2PBI9qwX1CLhge9ub5fA7fsnoU9tqk29JTZNT9DrlrnbiUKrzpdLl5WtEUm\n\tBdnStTBhoNEDXmNjGU5iEMK7i5/cMWeE7NFfJD12k3DjZuVY2GEecy","X-Received":"by 2002:a05:600c:34d5:b0:47a:81b7:9a20 with SMTP id\n\t5b1f17b1804b1-4830e930f67mr41341555e9.9.1770217559270; \n\tWed, 04 Feb 2026 07:05:59 -0800 (PST)","Message-ID":"<6b06dfc5-7db3-41f1-af44-c477eac15e70@linaro.org>","Date":"Wed, 4 Feb 2026 15:05:56 +0000","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/7] libcamera: software_isp: egl: Add gl_scale_param to\n\tcreateTexture2D()","To":"Rick ten Wolde <rick.w.ten.wolde@gmail.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"xander.c.pronk@gmail.com, derekgielen@outlook.com,\n\t22012540@student.hhs.nl, johannes.goede@oss.qualcomm.com,\n\tRick ten Wolde <rick_libcamera@wolde.info>","References":"<20260126104256.119697-1-rick.w.ten.wolde@gmail.com>\n\t<JgJp5lYfvd5uCagifr6EHXsMQbA0NQjvk-t2sq8ZTM3jZN4S9HhPdqtpkOkJ9ZTzs23ZSnYNi41uUtIwM-P_mQ==@protonmail.internalid>\n\t<20260126104256.119697-2-rick.w.ten.wolde@gmail.com>","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Content-Language":"en-US","In-Reply-To":"<20260126104256.119697-2-rick.w.ten.wolde@gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}}]