From: Louis Chauvet <louis.chauvet@bootlin.com>
To: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Cc: airlied@gmail.com, alex.hung@amd.com, daniel@fooishbar.org,
hamohammed.sa@gmail.com, harry.wentland@amd.com,
maarten.lankhorst@linux.intel.com, melissa.srw@gmail.com,
mripard@kernel.org, pekka.paalanen@collabora.com,
robert.mader@collabora.com, simona@ffwll.ch, tzimmermann@suse.de,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 03/12] drm/vkms: allow color curve LUTs to have different sizes
Date: Wed, 18 Nov 2026 15:32:59 +0100 [thread overview]
Message-ID: <eb298f9c-b938-49ef-9040-100a45266765@bootlin.com> (raw)
In-Reply-To: <20261106201813.129911-4-leandro.ribeiro@collabora.com>
On 11/6/26 21:18, Leandro Ribeiro wrote:
> Instead of keeping a hardcoded size that all LUTs representing color
> curves must use, use ARRAY_SIZE() instead.
>
> Besides making the code clearer, this allows us to create optimal LUTs
> for each color curve, and each of them can naturally have a different
> size. In the next commits we introduce these optimal LUTs.
>
> Reviewed-by: Robert Mader <robert.mader@collabora.com>
> Tested-by: Robert Mader <robert.mader@collabora.com>
> Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
> drivers/gpu/drm/vkms/tests/vkms_color_test.c | 4 ++--
> drivers/gpu/drm/vkms/vkms_luts.c | 12 ++++++------
> drivers/gpu/drm/vkms/vkms_luts.h | 2 --
> 3 files changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/vkms/tests/vkms_color_test.c b/drivers/gpu/drm/vkms/tests/vkms_color_test.c
> index 1a1c7cac2f15..18e73a8a5c31 100644
> --- a/drivers/gpu/drm/vkms/tests/vkms_color_test.c
> +++ b/drivers/gpu/drm/vkms/tests/vkms_color_test.c
> @@ -128,7 +128,7 @@ static void vkms_color_test_lerp(struct kunit *test)
>
> static void vkms_color_test_linear(struct kunit *test)
> {
> - for (int i = 0; i < LUT_SIZE; i++) {
> + for (int i = 0; i < linear_eotf.lut_length; i++) {
> int linear = apply_lut_to_channel_value(&linear_eotf, i * 0x101, LUT_RED);
>
> KUNIT_EXPECT_EQ(test, DIV_ROUND_CLOSEST(linear, 0x101), i);
> @@ -139,7 +139,7 @@ static void vkms_color_srgb_inv_srgb(struct kunit *test)
> {
> u16 srgb, final;
>
> - for (int i = 0; i < LUT_SIZE; i++) {
> + for (int i = 0; i < srgb_eotf.lut_length; i++) {
> srgb = apply_lut_to_channel_value(&srgb_eotf, i * 0x101, LUT_RED);
> final = apply_lut_to_channel_value(&srgb_inv_eotf, srgb, LUT_RED);
>
> diff --git a/drivers/gpu/drm/vkms/vkms_luts.c b/drivers/gpu/drm/vkms/vkms_luts.c
> index 82cb792f10d8..6dcdef26bda8 100644
> --- a/drivers/gpu/drm/vkms/vkms_luts.c
> +++ b/drivers/gpu/drm/vkms/vkms_luts.c
> @@ -12,7 +12,7 @@
> * https://gitlab.freedesktop.org/hwentland/lutgen
> */
>
> -static struct drm_color_lut linear_array[LUT_SIZE] = {
> +static struct drm_color_lut linear_array[] = {
> { 0x0, 0x0, 0x0, 0 },
> { 0x101, 0x101, 0x101, 0 },
> { 0x202, 0x202, 0x202, 0 },
> @@ -273,12 +273,12 @@ static struct drm_color_lut linear_array[LUT_SIZE] = {
>
> const struct vkms_color_lut linear_eotf = {
> .base = linear_array,
> - .lut_length = LUT_SIZE,
> + .lut_length = ARRAY_SIZE(linear_array),
> .channel_value2index_ratio = 0xff00ffll
> };
> EXPORT_SYMBOL(linear_eotf);
>
> -static struct drm_color_lut srgb_array[LUT_SIZE] = {
> +static struct drm_color_lut srgb_array[] = {
> { 0x0, 0x0, 0x0, 0 },
> { 0x13, 0x13, 0x13, 0 },
> { 0x27, 0x27, 0x27, 0 },
> @@ -539,12 +539,12 @@ static struct drm_color_lut srgb_array[LUT_SIZE] = {
>
> const struct vkms_color_lut srgb_eotf = {
> .base = srgb_array,
> - .lut_length = LUT_SIZE,
> + .lut_length = ARRAY_SIZE(srgb_array),
> .channel_value2index_ratio = 0xff00ffll
> };
> EXPORT_SYMBOL(srgb_eotf);
>
> -static struct drm_color_lut srgb_inv_array[LUT_SIZE] = {
> +static struct drm_color_lut srgb_inv_array[] = {
> { 0x0, 0x0, 0x0, 0 },
> { 0xcc2, 0xcc2, 0xcc2, 0 },
> { 0x15be, 0x15be, 0x15be, 0 },
> @@ -805,7 +805,7 @@ static struct drm_color_lut srgb_inv_array[LUT_SIZE] = {
>
> const struct vkms_color_lut srgb_inv_eotf = {
> .base = srgb_inv_array,
> - .lut_length = LUT_SIZE,
> + .lut_length = ARRAY_SIZE(srgb_inv_array),
> .channel_value2index_ratio = 0xff00ffll
> };
> EXPORT_SYMBOL(srgb_inv_eotf);
> diff --git a/drivers/gpu/drm/vkms/vkms_luts.h b/drivers/gpu/drm/vkms/vkms_luts.h
> index 925a4a7b84e2..8078ab33b83e 100644
> --- a/drivers/gpu/drm/vkms/vkms_luts.h
> +++ b/drivers/gpu/drm/vkms/vkms_luts.h
> @@ -3,8 +3,6 @@
> #ifndef _VKMS_LUTS_H_
> #define _VKMS_LUTS_H_
>
> -#define LUT_SIZE 256
> -
> extern const struct vkms_color_lut linear_eotf;
> extern const struct vkms_color_lut srgb_eotf;
> extern const struct vkms_color_lut srgb_inv_eotf;
next prev parent reply other threads:[~2026-11-18 14:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 20:18 [PATCH v2 00/12] drm/vkms: improve color curve LUTs precision Leandro Ribeiro
2026-11-06 20:18 ` [PATCH v2 01/12] drm/vkms: rename VKMS_LUT_SIZE to VKMS_GAMMA_LUT_SIZE Leandro Ribeiro
2026-11-18 14:30 ` Louis Chauvet
2026-11-06 20:18 ` [PATCH v2 02/12] vkms: properly compute gamma LUT size in vkms_atomic_check() Leandro Ribeiro
2026-11-18 14:31 ` Louis Chauvet
2026-11-06 20:18 ` [PATCH v2 03/12] drm/vkms: allow color curve LUTs to have different sizes Leandro Ribeiro
2026-11-18 14:32 ` Louis Chauvet [this message]
2026-11-06 20:18 ` [PATCH v2 04/12] drm/vkms: remove TEST_LUT_SIZE Leandro Ribeiro
2026-11-18 14:37 ` Louis Chauvet
2026-11-06 20:18 ` [PATCH v2 05/12] drm/vkms: remove linear_eotf Leandro Ribeiro
2026-11-18 14:39 ` Louis Chauvet
2026-11-06 20:18 ` [PATCH v2 06/12] drm/vkms: improve the way in which we access LUT member Leandro Ribeiro
2026-11-18 14:43 ` Louis Chauvet
2026-11-06 20:18 ` [PATCH v2 07/12] drm/vkms: rename struct vkms_color_lut::base to y Leandro Ribeiro
2026-11-18 14:44 ` Louis Chauvet
2026-11-06 20:18 ` [PATCH v2 08/12] drm/vkms: rename get_lut_index() to get_uniform_lut_index() Leandro Ribeiro
2026-11-18 14:44 ` Louis Chauvet
2026-11-06 20:18 ` [PATCH v2 09/12] drm/vkms: add support to non-uniform LUT for internal color curves Leandro Ribeiro
2026-11-06 20:18 ` [PATCH v2 10/12] drm/vkms: test sRGB and inverse sRGB LUTs using more samples Leandro Ribeiro
2026-11-06 20:18 ` [PATCH v2 11/12] drm/vkms: add script to create optimized LUTs for color curves Leandro Ribeiro
2026-11-06 20:18 ` [PATCH v2 12/12] drm/vkms: replace uniform sRGB LUT and its inverse with optimal ones Leandro Ribeiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eb298f9c-b938-49ef-9040-100a45266765@bootlin.com \
--to=louis.chauvet@bootlin.com \
--cc=airlied@gmail.com \
--cc=alex.hung@amd.com \
--cc=daniel@fooishbar.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=harry.wentland@amd.com \
--cc=leandro.ribeiro@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=melissa.srw@gmail.com \
--cc=mripard@kernel.org \
--cc=pekka.paalanen@collabora.com \
--cc=robert.mader@collabora.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®