mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leandro Ribeiro <leandro.ribeiro@collabora.com>
To: louis.chauvet@bootlin.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: [PATCH 09/11] drm/vkms: test sRGB and inverse sRGB LUTs using more samples
Date: Tue,  4 Aug 2026 17:33:49 -0300	[thread overview]
Message-ID: <20260804203351.148521-10-leandro.ribeiro@collabora.com> (raw)
In-Reply-To: <20260804203351.148521-1-leandro.ribeiro@collabora.com>

We're currently using srgb_eotf.lut_length samples in
vkms_color_srgb_inv_srgb(). This does not exercise any points that are
not in the forward sRGB LUT, although it exercises points that are not
in its inverse.

Let's test with more samples, to also exercise points that are not in
the forward sRGB LUT.

We chose 4096 samples. LUT inputs are u16, so we could have up to 65536
samples. LUT sizes are usually not higher than 512, so with 4096 we have
at least 8 samples between each LUT point.

We can see a minor error bump with this change. In the next commits we
replace such LUTs with non-uniform optimal ones to reduce the error.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
---
 drivers/gpu/drm/vkms/tests/vkms_color_test.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/vkms/tests/vkms_color_test.c b/drivers/gpu/drm/vkms/tests/vkms_color_test.c
index 571b1b579310..78f67bba33b5 100644
--- a/drivers/gpu/drm/vkms/tests/vkms_color_test.c
+++ b/drivers/gpu/drm/vkms/tests/vkms_color_test.c
@@ -123,14 +123,16 @@ static void vkms_color_test_linear(struct kunit *test)
 static void vkms_color_srgb_inv_srgb(struct kunit *test)
 {
 	u16 srgb, final;
-	u16 tolerance = 119;
+	u16 tolerance = 122;
+	u32 x;
 
-	for (int i = 0; i < srgb_eotf.lut_length; i++) {
-		srgb = apply_lut_to_channel_value(&srgb_eotf, srgb_eotf.x[i], LUT_RED);
+	for (u32 i = 0; i <= 4095; i++) {
+		x = i * U16_MAX / 4095;
+		srgb = apply_lut_to_channel_value(&srgb_eotf, x, LUT_RED);
 		final = apply_lut_to_channel_value(&srgb_inv_eotf, srgb, LUT_RED);
 
-		KUNIT_EXPECT_GE(test, final, (int)srgb_eotf.x[i] - tolerance);
-		KUNIT_EXPECT_LE(test, final, (int)srgb_eotf.x[i] + tolerance);
+		KUNIT_EXPECT_GE(test, final, (int)x - tolerance);
+		KUNIT_EXPECT_LE(test, final, (int)x + tolerance);
 	}
 }
 
-- 
2.55.0


  parent reply	other threads:[~2026-08-04 20:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 20:33 [PATCH 00/11] drm/vkms: improve color curve LUTs precision Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 01/11] drm/vkms: rename VKMS_LUT_SIZE to VKMS_GAMMA_LUT_SIZE Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 02/11] drm/vkms: allow color curve LUTs to have different sizes Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 03/11] drm/vkms: remove TEST_LUT_SIZE Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 04/11] drm/vkms: remove linear_eotf Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 05/11] drm/vkms: improve the way in which we access LUT member Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 06/11] drm/vkms: rename struct vkms_color_lut::base to y Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 07/11] drm/vkms: rename get_lut_index() to get_uniform_lut_index() Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 08/11] drm/vkms: add support to non-uniform LUT for internal color curves Leandro Ribeiro
2026-08-04 20:33 ` Leandro Ribeiro [this message]
2026-08-04 20:33 ` [PATCH 10/11] drm/vkms: add script to create optimized LUTs for " Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 11/11] drm/vkms: replace uniform sRGB LUT and its inverse with optimal ones Leandro Ribeiro
2026-11-04  9:15 ` [PATCH 00/11] drm/vkms: improve color curve LUTs precision Robert Mader

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=20260804203351.148521-10-leandro.ribeiro@collabora.com \
    --to=leandro.ribeiro@collabora.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=linux-kernel@vger.kernel.org \
    --cc=louis.chauvet@bootlin.com \
    --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®