[PATCH v2 05/12] drm/vkms: remove linear_eotf

From: Leandro Ribeiro

Date: Fri Nov 06 2026 - 15:20:47 EST


This is being used only for testing purposes. We can have a similar test
using test_linear_lut, so let's drop it.

test_linear_lut has fewer taps than linear_eotf (16 versus 256), but
that is enough here because the test only evaluates values corresponding
to LUT entries, so interpolation between LUT entries is not being
exercised.

In the next commits we change the tests to exercise
apply_lut_to_channel_value() in a more relevant way.

v2:
- Address feedback from Sashiko bot: in the previous version, I forgot
to update the multiplier.
https://sashiko.dev/#/patchset/20260804203351.148521-1-leandro.ribeiro@xxxxxxxxxxxxx?part=4

Reviewed-by: Robert Mader <robert.mader@xxxxxxxxxxxxx>
Tested-by: Robert Mader <robert.mader@xxxxxxxxxxxxx>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@xxxxxxxxxxxxx>
---
drivers/gpu/drm/vkms/tests/vkms_color_test.c | 6 +-
drivers/gpu/drm/vkms/vkms_luts.c | 266 -------------------
drivers/gpu/drm/vkms/vkms_luts.h | 1 -
3 files changed, 3 insertions(+), 270 deletions(-)

diff --git a/drivers/gpu/drm/vkms/tests/vkms_color_test.c b/drivers/gpu/drm/vkms/tests/vkms_color_test.c
index 3489513af352..83ef2afcc819 100644
--- a/drivers/gpu/drm/vkms/tests/vkms_color_test.c
+++ b/drivers/gpu/drm/vkms/tests/vkms_color_test.c
@@ -126,10 +126,10 @@ static void vkms_color_test_lerp(struct kunit *test)

static void vkms_color_test_linear(struct kunit *test)
{
- for (int i = 0; i < linear_eotf.lut_length; i++) {
- int linear = apply_lut_to_channel_value(&linear_eotf, i * 0x101, LUT_RED);
+ for (int i = 0; i < test_linear_lut.lut_length; i++) {
+ int linear = apply_lut_to_channel_value(&test_linear_lut, i * 0x1111, LUT_RED);

- KUNIT_EXPECT_EQ(test, DIV_ROUND_CLOSEST(linear, 0x101), i);
+ KUNIT_EXPECT_EQ(test, DIV_ROUND_CLOSEST(linear, 0x1111), i);
}
}

diff --git a/drivers/gpu/drm/vkms/vkms_luts.c b/drivers/gpu/drm/vkms/vkms_luts.c
index 6dcdef26bda8..d0e96df2c120 100644
--- a/drivers/gpu/drm/vkms/vkms_luts.c
+++ b/drivers/gpu/drm/vkms/vkms_luts.c
@@ -12,272 +12,6 @@
* https://gitlab.freedesktop.org/hwentland/lutgen
*/

-static struct drm_color_lut linear_array[] = {
- { 0x0, 0x0, 0x0, 0 },
- { 0x101, 0x101, 0x101, 0 },
- { 0x202, 0x202, 0x202, 0 },
- { 0x303, 0x303, 0x303, 0 },
- { 0x404, 0x404, 0x404, 0 },
- { 0x505, 0x505, 0x505, 0 },
- { 0x606, 0x606, 0x606, 0 },
- { 0x707, 0x707, 0x707, 0 },
- { 0x808, 0x808, 0x808, 0 },
- { 0x909, 0x909, 0x909, 0 },
- { 0xa0a, 0xa0a, 0xa0a, 0 },
- { 0xb0b, 0xb0b, 0xb0b, 0 },
- { 0xc0c, 0xc0c, 0xc0c, 0 },
- { 0xd0d, 0xd0d, 0xd0d, 0 },
- { 0xe0e, 0xe0e, 0xe0e, 0 },
- { 0xf0f, 0xf0f, 0xf0f, 0 },
- { 0x1010, 0x1010, 0x1010, 0 },
- { 0x1111, 0x1111, 0x1111, 0 },
- { 0x1212, 0x1212, 0x1212, 0 },
- { 0x1313, 0x1313, 0x1313, 0 },
- { 0x1414, 0x1414, 0x1414, 0 },
- { 0x1515, 0x1515, 0x1515, 0 },
- { 0x1616, 0x1616, 0x1616, 0 },
- { 0x1717, 0x1717, 0x1717, 0 },
- { 0x1818, 0x1818, 0x1818, 0 },
- { 0x1919, 0x1919, 0x1919, 0 },
- { 0x1a1a, 0x1a1a, 0x1a1a, 0 },
- { 0x1b1b, 0x1b1b, 0x1b1b, 0 },
- { 0x1c1c, 0x1c1c, 0x1c1c, 0 },
- { 0x1d1d, 0x1d1d, 0x1d1d, 0 },
- { 0x1e1e, 0x1e1e, 0x1e1e, 0 },
- { 0x1f1f, 0x1f1f, 0x1f1f, 0 },
- { 0x2020, 0x2020, 0x2020, 0 },
- { 0x2121, 0x2121, 0x2121, 0 },
- { 0x2222, 0x2222, 0x2222, 0 },
- { 0x2323, 0x2323, 0x2323, 0 },
- { 0x2424, 0x2424, 0x2424, 0 },
- { 0x2525, 0x2525, 0x2525, 0 },
- { 0x2626, 0x2626, 0x2626, 0 },
- { 0x2727, 0x2727, 0x2727, 0 },
- { 0x2828, 0x2828, 0x2828, 0 },
- { 0x2929, 0x2929, 0x2929, 0 },
- { 0x2a2a, 0x2a2a, 0x2a2a, 0 },
- { 0x2b2b, 0x2b2b, 0x2b2b, 0 },
- { 0x2c2c, 0x2c2c, 0x2c2c, 0 },
- { 0x2d2d, 0x2d2d, 0x2d2d, 0 },
- { 0x2e2e, 0x2e2e, 0x2e2e, 0 },
- { 0x2f2f, 0x2f2f, 0x2f2f, 0 },
- { 0x3030, 0x3030, 0x3030, 0 },
- { 0x3131, 0x3131, 0x3131, 0 },
- { 0x3232, 0x3232, 0x3232, 0 },
- { 0x3333, 0x3333, 0x3333, 0 },
- { 0x3434, 0x3434, 0x3434, 0 },
- { 0x3535, 0x3535, 0x3535, 0 },
- { 0x3636, 0x3636, 0x3636, 0 },
- { 0x3737, 0x3737, 0x3737, 0 },
- { 0x3838, 0x3838, 0x3838, 0 },
- { 0x3939, 0x3939, 0x3939, 0 },
- { 0x3a3a, 0x3a3a, 0x3a3a, 0 },
- { 0x3b3b, 0x3b3b, 0x3b3b, 0 },
- { 0x3c3c, 0x3c3c, 0x3c3c, 0 },
- { 0x3d3d, 0x3d3d, 0x3d3d, 0 },
- { 0x3e3e, 0x3e3e, 0x3e3e, 0 },
- { 0x3f3f, 0x3f3f, 0x3f3f, 0 },
- { 0x4040, 0x4040, 0x4040, 0 },
- { 0x4141, 0x4141, 0x4141, 0 },
- { 0x4242, 0x4242, 0x4242, 0 },
- { 0x4343, 0x4343, 0x4343, 0 },
- { 0x4444, 0x4444, 0x4444, 0 },
- { 0x4545, 0x4545, 0x4545, 0 },
- { 0x4646, 0x4646, 0x4646, 0 },
- { 0x4747, 0x4747, 0x4747, 0 },
- { 0x4848, 0x4848, 0x4848, 0 },
- { 0x4949, 0x4949, 0x4949, 0 },
- { 0x4a4a, 0x4a4a, 0x4a4a, 0 },
- { 0x4b4b, 0x4b4b, 0x4b4b, 0 },
- { 0x4c4c, 0x4c4c, 0x4c4c, 0 },
- { 0x4d4d, 0x4d4d, 0x4d4d, 0 },
- { 0x4e4e, 0x4e4e, 0x4e4e, 0 },
- { 0x4f4f, 0x4f4f, 0x4f4f, 0 },
- { 0x5050, 0x5050, 0x5050, 0 },
- { 0x5151, 0x5151, 0x5151, 0 },
- { 0x5252, 0x5252, 0x5252, 0 },
- { 0x5353, 0x5353, 0x5353, 0 },
- { 0x5454, 0x5454, 0x5454, 0 },
- { 0x5555, 0x5555, 0x5555, 0 },
- { 0x5656, 0x5656, 0x5656, 0 },
- { 0x5757, 0x5757, 0x5757, 0 },
- { 0x5858, 0x5858, 0x5858, 0 },
- { 0x5959, 0x5959, 0x5959, 0 },
- { 0x5a5a, 0x5a5a, 0x5a5a, 0 },
- { 0x5b5b, 0x5b5b, 0x5b5b, 0 },
- { 0x5c5c, 0x5c5c, 0x5c5c, 0 },
- { 0x5d5d, 0x5d5d, 0x5d5d, 0 },
- { 0x5e5e, 0x5e5e, 0x5e5e, 0 },
- { 0x5f5f, 0x5f5f, 0x5f5f, 0 },
- { 0x6060, 0x6060, 0x6060, 0 },
- { 0x6161, 0x6161, 0x6161, 0 },
- { 0x6262, 0x6262, 0x6262, 0 },
- { 0x6363, 0x6363, 0x6363, 0 },
- { 0x6464, 0x6464, 0x6464, 0 },
- { 0x6565, 0x6565, 0x6565, 0 },
- { 0x6666, 0x6666, 0x6666, 0 },
- { 0x6767, 0x6767, 0x6767, 0 },
- { 0x6868, 0x6868, 0x6868, 0 },
- { 0x6969, 0x6969, 0x6969, 0 },
- { 0x6a6a, 0x6a6a, 0x6a6a, 0 },
- { 0x6b6b, 0x6b6b, 0x6b6b, 0 },
- { 0x6c6c, 0x6c6c, 0x6c6c, 0 },
- { 0x6d6d, 0x6d6d, 0x6d6d, 0 },
- { 0x6e6e, 0x6e6e, 0x6e6e, 0 },
- { 0x6f6f, 0x6f6f, 0x6f6f, 0 },
- { 0x7070, 0x7070, 0x7070, 0 },
- { 0x7171, 0x7171, 0x7171, 0 },
- { 0x7272, 0x7272, 0x7272, 0 },
- { 0x7373, 0x7373, 0x7373, 0 },
- { 0x7474, 0x7474, 0x7474, 0 },
- { 0x7575, 0x7575, 0x7575, 0 },
- { 0x7676, 0x7676, 0x7676, 0 },
- { 0x7777, 0x7777, 0x7777, 0 },
- { 0x7878, 0x7878, 0x7878, 0 },
- { 0x7979, 0x7979, 0x7979, 0 },
- { 0x7a7a, 0x7a7a, 0x7a7a, 0 },
- { 0x7b7b, 0x7b7b, 0x7b7b, 0 },
- { 0x7c7c, 0x7c7c, 0x7c7c, 0 },
- { 0x7d7d, 0x7d7d, 0x7d7d, 0 },
- { 0x7e7e, 0x7e7e, 0x7e7e, 0 },
- { 0x7f7f, 0x7f7f, 0x7f7f, 0 },
- { 0x8080, 0x8080, 0x8080, 0 },
- { 0x8181, 0x8181, 0x8181, 0 },
- { 0x8282, 0x8282, 0x8282, 0 },
- { 0x8383, 0x8383, 0x8383, 0 },
- { 0x8484, 0x8484, 0x8484, 0 },
- { 0x8585, 0x8585, 0x8585, 0 },
- { 0x8686, 0x8686, 0x8686, 0 },
- { 0x8787, 0x8787, 0x8787, 0 },
- { 0x8888, 0x8888, 0x8888, 0 },
- { 0x8989, 0x8989, 0x8989, 0 },
- { 0x8a8a, 0x8a8a, 0x8a8a, 0 },
- { 0x8b8b, 0x8b8b, 0x8b8b, 0 },
- { 0x8c8c, 0x8c8c, 0x8c8c, 0 },
- { 0x8d8d, 0x8d8d, 0x8d8d, 0 },
- { 0x8e8e, 0x8e8e, 0x8e8e, 0 },
- { 0x8f8f, 0x8f8f, 0x8f8f, 0 },
- { 0x9090, 0x9090, 0x9090, 0 },
- { 0x9191, 0x9191, 0x9191, 0 },
- { 0x9292, 0x9292, 0x9292, 0 },
- { 0x9393, 0x9393, 0x9393, 0 },
- { 0x9494, 0x9494, 0x9494, 0 },
- { 0x9595, 0x9595, 0x9595, 0 },
- { 0x9696, 0x9696, 0x9696, 0 },
- { 0x9797, 0x9797, 0x9797, 0 },
- { 0x9898, 0x9898, 0x9898, 0 },
- { 0x9999, 0x9999, 0x9999, 0 },
- { 0x9a9a, 0x9a9a, 0x9a9a, 0 },
- { 0x9b9b, 0x9b9b, 0x9b9b, 0 },
- { 0x9c9c, 0x9c9c, 0x9c9c, 0 },
- { 0x9d9d, 0x9d9d, 0x9d9d, 0 },
- { 0x9e9e, 0x9e9e, 0x9e9e, 0 },
- { 0x9f9f, 0x9f9f, 0x9f9f, 0 },
- { 0xa0a0, 0xa0a0, 0xa0a0, 0 },
- { 0xa1a1, 0xa1a1, 0xa1a1, 0 },
- { 0xa2a2, 0xa2a2, 0xa2a2, 0 },
- { 0xa3a3, 0xa3a3, 0xa3a3, 0 },
- { 0xa4a4, 0xa4a4, 0xa4a4, 0 },
- { 0xa5a5, 0xa5a5, 0xa5a5, 0 },
- { 0xa6a6, 0xa6a6, 0xa6a6, 0 },
- { 0xa7a7, 0xa7a7, 0xa7a7, 0 },
- { 0xa8a8, 0xa8a8, 0xa8a8, 0 },
- { 0xa9a9, 0xa9a9, 0xa9a9, 0 },
- { 0xaaaa, 0xaaaa, 0xaaaa, 0 },
- { 0xabab, 0xabab, 0xabab, 0 },
- { 0xacac, 0xacac, 0xacac, 0 },
- { 0xadad, 0xadad, 0xadad, 0 },
- { 0xaeae, 0xaeae, 0xaeae, 0 },
- { 0xafaf, 0xafaf, 0xafaf, 0 },
- { 0xb0b0, 0xb0b0, 0xb0b0, 0 },
- { 0xb1b1, 0xb1b1, 0xb1b1, 0 },
- { 0xb2b2, 0xb2b2, 0xb2b2, 0 },
- { 0xb3b3, 0xb3b3, 0xb3b3, 0 },
- { 0xb4b4, 0xb4b4, 0xb4b4, 0 },
- { 0x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6, 0 },
- { 0xd7d7, 0xd7d7, 0xd7d7, 0 },
- { 0xd8d8, 0xd8d8, 0xd8d8, 0 },
- { 0xd9d9, 0xd9d9, 0xd9d9, 0 },
- { 0xdada, 0xdada, 0xdada, 0 },
- { 0xdbdb, 0xdbdb, 0xdbdb, 0 },
- { 0xdcdc, 0xdcdc, 0xdcdc, 0 },
- { 0xdddd, 0xdddd, 0xdddd, 0 },
- { 0xdede, 0xdede, 0xdede, 0 },
- { 0xdfdf, 0xdfdf, 0xdfdf, 0 },
- { 0xe0e0, 0xe0e0, 0xe0e0, 0 },
- { 0xe1e1, 0xe1e1, 0xe1e1, 0 },
- { 0xe2e2, 0xe2e2, 0xe2e2, 0 },
- { 0xe3e3, 0xe3e3, 0xe3e3, 0 },
- { 0xe4e4, 0xe4e4, 0xe4e4, 0 },
- { 0xe5e5, 0xe5e5, 0xe5e5, 0 },
- { 0xe6e6, 0xe6e6, 0xe6e6, 0 },
- { 0xe7e7, 0xe7e7, 0xe7e7, 0 },
- { 0xe8e8, 0xe8e8, 0xe8e8, 0 },
- { 0xe9e9, 0xe9e9, 0xe9e9, 0 },
- { 0xeaea, 0xeaea, 0xeaea, 0 },
- { 0xebeb, 0xebeb, 0xebeb, 0 },
- { 0xecec, 0xecec, 0xecec, 0 },
- { 0xeded, 0xeded, 0xeded, 0 },
- { 0xeeee, 0xeeee, 0xeeee, 0 },
- { 0xefef, 0xefef, 0xefef, 0 },
- { 0xf0f0, 0xf0f0, 0xf0f0, 0 },
- { 0xf1f1, 0xf1f1, 0xf1f1, 0 },
- { 0xf2f2, 0xf2f2, 0xf2f2, 0 },
- { 0xf3f3, 0xf3f3, 0xf3f3, 0 },
- { 0xf4f4, 0xf4f4, 0xf4f4, 0 },
- { 0xf5f5, 0xf5f5, 0xf5f5, 0 },
- { 0xf6f6, 0xf6f6, 0xf6f6, 0 },
- { 0xf7f7, 0xf7f7, 0xf7f7, 0 },
- { 0xf8f8, 0xf8f8, 0xf8f8, 0 },
- { 0xf9f9, 0xf9f9, 0xf9f9, 0 },
- { 0xfafa, 0xfafa, 0xfafa, 0 },
- { 0xfbfb, 0xfbfb, 0xfbfb, 0 },
- { 0xfcfc, 0xfcfc, 0xfcfc, 0 },
- { 0xfdfd, 0xfdfd, 0xfdfd, 0 },
- { 0xfefe, 0xfefe, 0xfefe, 0 },
- { 0xffff, 0xffff, 0xffff, 0 },
-};
-
-const struct vkms_color_lut linear_eotf = {
- .base = linear_array,
- .lut_length = ARRAY_SIZE(linear_array),
- .channel_value2index_ratio = 0xff00ffll
-};
-EXPORT_SYMBOL(linear_eotf);
-
static struct drm_color_lut srgb_array[] = {
{ 0x0, 0x0, 0x0, 0 },
{ 0x13, 0x13, 0x13, 0 },
diff --git a/drivers/gpu/drm/vkms/vkms_luts.h b/drivers/gpu/drm/vkms/vkms_luts.h
index 8078ab33b83e..655e9553cd91 100644
--- a/drivers/gpu/drm/vkms/vkms_luts.h
+++ b/drivers/gpu/drm/vkms/vkms_luts.h
@@ -3,7 +3,6 @@
#ifndef _VKMS_LUTS_H_
#define _VKMS_LUTS_H_

-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;

--
2.56.0