Skip to contentSkip to conversation

tests/kms_color: Fix CRC mismatch issues with ctm test

PATCH Superseded Uma Shankar 4 participants 10 messages Mar 24, 2019 – Mar 25, 2019

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests/kms_color: Fix CRC mismatch issues with ctm test

Due to Gamma/Degamma limitation with precision (lack of exact 1.0 representation) due to ABI restriction, applying linear gamma affects crc. This patch fixes the same by making ctm tests independant of gamma/degamma.

v2: Disable degamma/gamma programming for ctm max test as it leads to crc mimsmatch. Limiting it to this test case alone as other tests need it to be enabled, hence not touching those scenarios.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108147

---
 tests/kms_color.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
tests/kms_color.c +14 -2
index decf3c2..93560d4 100644
@@ -696,8 +696,15 @@ static bool test_pipe_ctm(data_t *data,
 		igt_assert(fb_modeset_id);
 		igt_plane_set_fb(primary, &fb_modeset);
 
-		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * Don't program LUT's for max CTM cases as limitation of
+		 * representing 1.0 due to ABI limits causes crc mismatch
+		 */
+		if (memcmp(before, after, sizeof(color_t)))
+			set_degamma(data, primary->pipe, degamma_linear);
+			set_gamma(data, primary->pipe, gamma_linear);
+		}
+
 		disable_ctm(primary->pipe);
 		igt_display_commit(&data->display);
 
@@ -1005,6 +1012,11 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 		 * produce with an 8 bits per color framebuffer. */
 		igt_require(!IS_CHERRYVIEW(data->devid));
 
+		/* Disable and let default luts be applied by kernel */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
+
 		igt_assert(test_pipe_ctm(data, primary, red_green_blue,
 					 full_rgb, ctm));
 	}
Signature · 6 lines
1.9.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_color: Fix CRC mismatch issues with ctm test (rev2)

== Series Details ==

== Series Details ==

Series: tests/kms_color: Fix CRC mismatch issues with ctm test (rev2)
URL : https://patchwork.freedesktop.org/series/58412/
State : failure

== Summary ==

IGT patchset build failed on latest successful build 09796413394c5490c4adfc5cded5d4344af6af17 tests/kms_cursor_legacy: Fix assertion failure due to vblank mismatch

../tests/kms_color.c:711:40: error: ‘fb’ undeclared (first use in this function)

   paint_rectangles(data, mode, after, &fb);
                                        ^~
../tests/kms_color.c:716:45: error: ‘crc_software’ undeclared (first use in this function)
   igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
                                             ^~~~~~~~~~~~
../tests/kms_color.c:724:45: error: ‘crc_hardware’ undeclared (first use in this function); did you mean ‘crc_software’?
   igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
                                             ^~~~~~~~~~~~
                                             crc_software
../tests/kms_color.c:667:7: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  bool ret = true;
       ^~~

../tests/kms_color.c: At top level:
../tests/kms_color.c:735:2: warning: data definition has no type or storage class
free(degamma_linear);
^~~~
../tests/kms_color.c:735:2: error: type defaults to ‘int’ in declaration of ‘free’ [-Werror=implicit-int] ../tests/kms_color.c:735:2: warning: parameter names (without types) in function declaration ../tests/kms_color.c:735:2: error: conflicting types for ‘free’
In file included from ../lib/igt_core.h:37:0,

                 from ../lib/drmtest.h:39,
                 from ../tests/kms_color.c:29:
/usr/include/stdlib.h:563:13: note: previous declaration of ‘free’ was here
 extern void free (void *__ptr) __THROW;
             ^~~~

../tests/kms_color.c:736:2: warning: data definition has no type or storage class
free(gamma_linear);
^~~~
../tests/kms_color.c:736:2: error: type defaults to ‘int’ in declaration of ‘free’ [-Werror=implicit-int] ../tests/kms_color.c:736:2: warning: parameter names (without types) in function declaration ../tests/kms_color.c:736:2: error: conflicting types for ‘free’
In file included from ../lib/igt_core.h:37:0,

                 from ../lib/drmtest.h:39,
                 from ../tests/kms_color.c:29:
/usr/include/stdlib.h:563:13: note: previous declaration of ‘free’ was here
 extern void free (void *__ptr) __THROW;
             ^~~~

../tests/kms_color.c:738:2: error: expected identifier or ‘(’ before ‘return’
return ret;
^~~~~~
../tests/kms_color.c:739:1: error: expected identifier or ‘(’ before ‘}’ token
}
^
../tests/kms_color.c: In function ‘test_pipe_ctm’:
../tests/kms_color.c:733:2: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw
In reply to Uma Shankar

When degamma & gamma LUTs are disabled & CTM is enabled, i915 programs a linear table in the degamma/gamma LUTs :

https://cgit.freedesktop.org/drm/drm-intel/tree/drivers/gpu/drm/i915/intel_color.c#n463
https://cgit.freedesktop.org/drm/drm-intel/tree/drivers/gpu/drm/i915/intel_color.c#n495

All the values programmed are in u16 range which is also what userspace can program (this applies to BDW/SKL/KBL). What is it that the kernel is able to program but not userspace?

-Lionel

Quoted 40 lines · Uma Shankar

Due to Gamma/Degamma limitation with precision (lack of exact 1.0 representation) due to ABI restriction, applying linear gamma affects crc. This patch fixes the same by making ctm tests independant of gamma/degamma.

v2: Disable degamma/gamma programming for ctm max test as it leads to crc mimsmatch. Limiting it to this test case alone as other tests need it to be enabled, hence not touching those scenarios.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108147

---
  tests/kms_color.c | 16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
tests/kms_color.c +9 -2
index decf3c2..93560d4 100644
@@ -696,8 +696,15 @@ static bool test_pipe_ctm(data_t *data,
  		igt_assert(fb_modeset_id);
  		igt_plane_set_fb(primary, &fb_modeset);
 
-		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * Don't program LUT's for max CTM cases as limitation of
+		 * representing 1.0 due to ABI limits causes crc mismatch
+		 */
+		if (memcmp(before, after, sizeof(color_t)))
+			set_degamma(data, primary->pipe, degamma_linear);
+			set_gamma(data, primary->pipe, gamma_linear);
+		}
+
  		disable_ctm(primary->pipe);
  		igt_display_commit(&data->display);
 
@@ -1005,6 +1012,11 @@ run_tests_for_pipe(data_t *data, enum pipe p)
  		 * produce with an 8 bits per color framebuffer. */

tests/kms_color.c run_tests_for_pipe(data_t *data, enum pipe p) · line 1022

Quoted 10 lines
tests/kms_color.c +5 -0
  		igt_require(!IS_CHERRYVIEW(data->devid));
 
+		/* Disable and let default luts be applied by kernel */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
+
  		igt_assert(test_pipe_ctm(data, primary, red_green_blue,
  					 full_rgb, ctm));
  	}

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw
Quoted 13 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 7:11 AM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

When degamma & gamma LUTs are disabled & CTM is enabled, i915 programs a linear table in the degamma/gamma LUTs :

Quoted 8 lines

https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n463
https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n495

All the values programmed are in u16 range which is also what userspace can program (this applies to BDW/SKL/KBL).
What is it that the kernel is able to program but not userspace?

Hi Lionel,
Issue is with representing 1.0 which needs a 3.16 kind of representation. So directly doing it in Kernel to program linear luts using below:

for (i = 0; i < lut_size; i++) {
			u32 v = (i * (1 << 16)) / (lut_size - 1);
			I915_WRITE(PRE_CSC_GAMC_DATA(pipe), v);
		}

takes care of the corner case. The ABI is getting extended and we will need higher precision luts, but for now due to lack of it, putting the same to be done in driver.

Regards,
Uma Shankar

Quoted 44 lines

-Lionel

Quoted 41 lines · Uma Shankar

Due to Gamma/Degamma limitation with precision (lack of exact 1.0 representation) due to ABI restriction, applying linear gamma affects crc. This patch fixes the same by making ctm tests independant of gamma/degamma.

v2: Disable degamma/gamma programming for ctm max test as it leads to crc mimsmatch. Limiting it to this test case alone as other tests need it to be enabled, hence not touching those scenarios.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108147

---
  tests/kms_color.c | 16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
tests/kms_color.c index renamed from tests/kms_color.c +0 -0

decf3c2..93560d4 100644

tests/kms_color.c +9 -2
@@ -696,8 +696,15 @@ static bool test_pipe_ctm(data_t *data,
  		igt_assert(fb_modeset_id);
  		igt_plane_set_fb(primary, &fb_modeset);
 
-		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * Don't program LUT's for max CTM cases as limitation of
+		 * representing 1.0 due to ABI limits causes crc mismatch
+		 */
+		if (memcmp(before, after, sizeof(color_t)))
+			set_degamma(data, primary->pipe, degamma_linear);
+			set_gamma(data, primary->pipe, gamma_linear);
+		}
+
  		disable_ctm(primary->pipe);
  		igt_display_commit(&data->display);
 
@@ -1005,6 +1012,11 @@ run_tests_for_pipe(data_t *data, enum pipe p)
  		 * produce with an 8 bits per color framebuffer. */
  		igt_require(!IS_CHERRYVIEW(data->devid));
 
Quoted 9 lines

tests/kms_color.c run_tests_for_pipe(data_t *data, enum pipe p) · line 1022

Quoted 8 lines
tests/kms_color.c +5 -0
+		/* Disable and let default luts be applied by kernel */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
+
  		igt_assert(test_pipe_ctm(data, primary, red_green_blue,
  					 full_rgb, ctm));
  	}

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw
Quoted 27 lines · Uma
Quoted 12 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 7:11 AM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

When degamma & gamma LUTs are disabled & CTM is enabled, i915 programs a linear table in the degamma/gamma LUTs :

Quoted 8 lines

https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n463
https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n495

All the values programmed are in u16 range which is also what userspace can program (this applies to BDW/SKL/KBL).
What is it that the kernel is able to program but not userspace?

Hi Lionel,
Issue is with representing 1.0 which needs a 3.16 kind of representation. So directly doing it in Kernel to program linear luts using below:

for (i = 0; i < lut_size; i++) {
			u32 v = (i * (1 << 16)) / (lut_size - 1);
			I915_WRITE(PRE_CSC_GAMC_DATA(pipe), v);
		}
Quoted 5 lines

takes care of the corner case. The ABI is getting extended and we will need higher precision luts, but for now due to lack of it, putting the same to be done in driver.

Regards,
Uma Shankar

Hi Uma,

This is for GLK right?
What about the failures on KBL/SKL?

There the hardware doesn't have fixed point values.

Thanks,

-Lionel

Quoted 45 lines
Quoted 45 lines

-Lionel

Quoted 41 lines · Uma Shankar

Due to Gamma/Degamma limitation with precision (lack of exact 1.0 representation) due to ABI restriction, applying linear gamma affects crc. This patch fixes the same by making ctm tests independant of gamma/degamma.

v2: Disable degamma/gamma programming for ctm max test as it leads to crc mimsmatch. Limiting it to this test case alone as other tests need it to be enabled, hence not touching those scenarios.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108147

---
   tests/kms_color.c | 16 ++++++++++++++--
   1 file changed, 14 insertions(+), 2 deletions(-)
tests/kms_color.c index renamed from tests/kms_color.c +0 -0

decf3c2..93560d4 100644

tests/kms_color.c +9 -2
@@ -696,8 +696,15 @@ static bool test_pipe_ctm(data_t *data,
   		igt_assert(fb_modeset_id);
   		igt_plane_set_fb(primary, &fb_modeset);
 
-		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * Don't program LUT's for max CTM cases as limitation of
+		 * representing 1.0 due to ABI limits causes crc mismatch
+		 */
+		if (memcmp(before, after, sizeof(color_t)))
+			set_degamma(data, primary->pipe, degamma_linear);
+			set_gamma(data, primary->pipe, gamma_linear);
+		}
+
   		disable_ctm(primary->pipe);
   		igt_display_commit(&data->display);
 
@@ -1005,6 +1012,11 @@ run_tests_for_pipe(data_t *data, enum pipe p)
   		 * produce with an 8 bits per color framebuffer. */
   		igt_require(!IS_CHERRYVIEW(data->devid));
 
Quoted 8 lines
Quoted 8 lines

tests/kms_color.c run_tests_for_pipe(data_t *data, enum pipe p) · line 1022

Quoted 8 lines
tests/kms_color.c +5 -0
+		/* Disable and let default luts be applied by kernel */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
+
   		igt_assert(test_pipe_ctm(data, primary, red_green_blue,
   					 full_rgb, ctm));
   	}

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#5 lore raw
Quoted 48 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 3:46 PM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

Quoted 25 lines · Uma
Quoted 14 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 7:11 AM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

When degamma & gamma LUTs are disabled & CTM is enabled, i915 programs a linear table in the degamma/gamma LUTs :

Quoted 8 lines

https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n463
https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n495

All the values programmed are in u16 range which is also what userspace can program (this applies to BDW/SKL/KBL). What is it that the kernel is able to program but not userspace?

Hi Lionel,
Issue is with representing 1.0 which needs a 3.16 kind of representation. So directly doing it in Kernel to program linear luts using below:

Quoted 6 lines
for (i = 0; i < lut_size; i++) {
			u32 v = (i * (1 << 16)) / (lut_size - 1);
			I915_WRITE(PRE_CSC_GAMC_DATA(pipe), v);
		}

takes care of the corner case. The ABI is getting extended and we will need higher precision luts, but for now due to lack of it, putting the same to be

done in driver.

Quoted 3 lines

Regards,
Uma Shankar

Quoted 6 lines

Hi Uma,

This is for GLK right?
What about the failures on KBL/SKL?

There the hardware doesn't have fixed point values.

On Gen9, it uses bdw_load_gamma_lut function. For all values its good, but when it comes to programming GCMAX, ABI fells short:

I915_WRITE(PREC_PAL_GC_MAX(pipe, 0), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 1), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 2), (1 << 16) - 1);

This expects input in U1.16 format. This may be the reason we are seeing this issue on Gen9 as well.

Regards,
Uma Shankar

Quoted 50 lines

Thanks,

-Lionel

Quoted 45 lines
Quoted 45 lines

-Lionel

Quoted 41 lines · Uma Shankar

Due to Gamma/Degamma limitation with precision (lack of exact 1.0 representation) due to ABI restriction, applying linear gamma affects crc. This patch fixes the same by making ctm tests independant of gamma/degamma.

v2: Disable degamma/gamma programming for ctm max test as it leads to crc mimsmatch. Limiting it to this test case alone as other tests need it to be enabled, hence not touching those scenarios.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108147

---
   tests/kms_color.c | 16 ++++++++++++++--
   1 file changed, 14 insertions(+), 2 deletions(-)
tests/kms_color.c index renamed from tests/kms_color.c +0 -0

decf3c2..93560d4 100644

tests/kms_color.c +9 -2
@@ -696,8 +696,15 @@ static bool test_pipe_ctm(data_t *data,
   		igt_assert(fb_modeset_id);
   		igt_plane_set_fb(primary, &fb_modeset);
 
-		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * Don't program LUT's for max CTM cases as limitation of
+		 * representing 1.0 due to ABI limits causes crc mismatch
+		 */
+		if (memcmp(before, after, sizeof(color_t)))
+			set_degamma(data, primary->pipe, degamma_linear);
+			set_gamma(data, primary->pipe, gamma_linear);
+		}
+
   		disable_ctm(primary->pipe);
   		igt_display_commit(&data->display);
 
@@ -1005,6 +1012,11 @@ run_tests_for_pipe(data_t *data, enum pipe p)
   		 * produce with an 8 bits per color framebuffer. */
   		igt_require(!IS_CHERRYVIEW(data->devid));
 
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines

tests/kms_color.c run_tests_for_pipe(data_t *data, enum pipe p) · line 1022

Quoted 8 lines
tests/kms_color.c +5 -0
+		/* Disable and let default luts be applied by kernel */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
+
   		igt_assert(test_pipe_ctm(data, primary, red_green_blue,
   					 full_rgb, ctm));
   	}

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#6 lore raw
Quoted 53 lines · Uma
Quoted 53 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 3:46 PM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

Quoted 25 lines · Uma
Quoted 14 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 7:11 AM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

When degamma & gamma LUTs are disabled & CTM is enabled, i915 programs a linear table in the degamma/gamma LUTs :

Quoted 8 lines

https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n463
https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n495

All the values programmed are in u16 range which is also what userspace can program (this applies to BDW/SKL/KBL). What is it that the kernel is able to program but not userspace?

Hi Lionel,
Issue is with representing 1.0 which needs a 3.16 kind of representation. So directly doing it in Kernel to program linear luts using below:

Quoted 6 lines
for (i = 0; i < lut_size; i++) {
			u32 v = (i * (1 << 16)) / (lut_size - 1);
			I915_WRITE(PRE_CSC_GAMC_DATA(pipe), v);
		}

takes care of the corner case. The ABI is getting extended and we will need higher precision luts, but for now due to lack of it, putting the same to be

done in driver.

Quoted 3 lines

Regards,
Uma Shankar

Hi Uma,

This is for GLK right?
What about the failures on KBL/SKL?

Quoted 8 lines
Quoted 1 line

There the hardware doesn't have fixed point values.

On Gen9, it uses bdw_load_gamma_lut function. For all values its good, but when it comes to programming GCMAX, ABI fells short:

I915_WRITE(PREC_PAL_GC_MAX(pipe, 0), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 1), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 2), (1 << 16) - 1);

IIRC that's also the wrong set of register we're writing here.

Quoted 71 lines

This expects input in U1.16 format. This may be the reason we are seeing this issue on Gen9 as well.

Regards,
Uma Shankar

Quoted 50 lines

Thanks,

-Lionel

Quoted 45 lines
Quoted 45 lines

-Lionel

Quoted 41 lines · Uma Shankar

Due to Gamma/Degamma limitation with precision (lack of exact 1.0 representation) due to ABI restriction, applying linear gamma affects crc. This patch fixes the same by making ctm tests independant of gamma/degamma.

v2: Disable degamma/gamma programming for ctm max test as it leads to crc mimsmatch. Limiting it to this test case alone as other tests need it to be enabled, hence not touching those scenarios.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108147

---
   tests/kms_color.c | 16 ++++++++++++++--
   1 file changed, 14 insertions(+), 2 deletions(-)
tests/kms_color.c index renamed from tests/kms_color.c +0 -0

decf3c2..93560d4 100644

tests/kms_color.c +9 -2
@@ -696,8 +696,15 @@ static bool test_pipe_ctm(data_t *data,
   		igt_assert(fb_modeset_id);
   		igt_plane_set_fb(primary, &fb_modeset);
 
-		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * Don't program LUT's for max CTM cases as limitation of
+		 * representing 1.0 due to ABI limits causes crc mismatch
+		 */
+		if (memcmp(before, after, sizeof(color_t)))
+			set_degamma(data, primary->pipe, degamma_linear);
+			set_gamma(data, primary->pipe, gamma_linear);
+		}
+
   		disable_ctm(primary->pipe);
   		igt_display_commit(&data->display);
 
@@ -1005,6 +1012,11 @@ run_tests_for_pipe(data_t *data, enum pipe p)
   		 * produce with an 8 bits per color framebuffer. */
   		igt_require(!IS_CHERRYVIEW(data->devid));
 
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines

tests/kms_color.c run_tests_for_pipe(data_t *data, enum pipe p) · line 1022

Quoted 8 lines
tests/kms_color.c +5 -0
+		/* Disable and let default luts be applied by kernel */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
+
   		igt_assert(test_pipe_ctm(data, primary, red_green_blue,
   					 full_rgb, ctm));
   	}

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#7 lore raw
Quoted 70 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Monday, March 25, 2019 4:21 PM
To: Shankar, Uma <[email protected]>
Cc: Landwerlin, Lionel G <[email protected]>; igt- [email protected]; Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

Quoted 58 lines · Uma
Quoted 57 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 3:46 PM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

Quoted 25 lines · Uma
Quoted 14 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 7:11 AM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

When degamma & gamma LUTs are disabled & CTM is enabled, i915 programs a linear table in the degamma/gamma LUTs :

Quoted 8 lines

https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n463
https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n495

All the values programmed are in u16 range which is also what userspace can program (this applies to BDW/SKL/KBL). What is it that the kernel is able to program but not userspace?

Hi Lionel,
Issue is with representing 1.0 which needs a 3.16 kind of representation. So directly doing it in Kernel to program linear luts using below:

Quoted 7 lines
for (i = 0; i < lut_size; i++) {
			u32 v = (i * (1 << 16)) / (lut_size - 1);
			I915_WRITE(PRE_CSC_GAMC_DATA(pipe), v);
		}

takes care of the corner case. The ABI is getting extended and we will need higher precision luts, but for now due to lack of it, putting the same to be

done in driver.

Quoted 3 lines

Regards,
Uma Shankar

Hi Uma,

This is for GLK right?
What about the failures on KBL/SKL?

There the hardware doesn't have fixed point values.

Quoted 8 lines
Quoted 6 lines

On Gen9, it uses bdw_load_gamma_lut function. For all values its good, but when it comes to programming GCMAX, ABI fells short:

I915_WRITE(PREC_PAL_GC_MAX(pipe, 0), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 1), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 2), (1 << 16) - 1);

IIRC that's also the wrong set of register we're writing here.

Hmm yeah, it seems these need to be PREC_PAL_EXT_GC_MAX. Somehow writing into PAL_GC_MAX is also working, but yes this needs to be updated.

Quoted 69 lines
Quoted 40 lines

This expects input in U1.16 format. This may be the reason we are seeing this issue on
Gen9 as well.

Regards,
Uma Shankar

Quoted 32 lines

Thanks,

-Lionel

Quoted 27 lines
Quoted 27 lines

-Lionel

Quoted 23 lines · Uma Shankar

Due to Gamma/Degamma limitation with precision (lack of exact 1.0 representation) due to ABI restriction, applying linear gamma affects crc. This patch fixes the same by making ctm tests independant of gamma/degamma.

v2: Disable degamma/gamma programming for ctm max test as it leads to crc mimsmatch. Limiting it to this test case alone as other tests need it to be enabled, hence not touching those scenarios.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108147

---
   tests/kms_color.c | 16 ++++++++++++++--
   1 file changed, 14 insertions(+), 2 deletions(-)
tests/kms_color.c index renamed from tests/kms_color.c +0 -0

decf3c2..93560d4 100644

tests/kms_color.c +0 -0
@@ -696,8 +696,15 @@ static bool test_pipe_ctm(data_t *data,
   		igt_assert(fb_modeset_id);
   		igt_plane_set_fb(primary, &fb_modeset);
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

tests/kms_color.c static bool test_pipe_ctm(data_t *data,

Quoted 8 lines
tests/kms_color.c +6 -2
-		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * Don't program LUT's for max CTM cases as limitation of
+		 * representing 1.0 due to ABI limits causes crc mismatch
+		 */
+		if (memcmp(before, after, sizeof(color_t)))
+			set_degamma(data, primary->pipe,

degamma_linear);

Quoted 20 lines
Quoted 19 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
tests/kms_color.c +8 -0
+			set_gamma(data, primary->pipe, gamma_linear);
+		}
+
   		disable_ctm(primary->pipe);
   		igt_display_commit(&data->display);
 
@@ -1005,6 +1012,11 @@ run_tests_for_pipe(data_t *data, enum pipe p)
   		 * produce with an 8 bits per color framebuffer. */
   		igt_require(!IS_CHERRYVIEW(data->devid));
 
+		/* Disable and let default luts be applied by kernel */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
+
   		igt_assert(test_pipe_ctm(data, primary, red_green_blue,
   					 full_rgb, ctm));
   	}
Quoted 8 lines
Quoted 4 lines

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

--
Ville Syrjälä
Intel

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#8 lore raw
In reply to Shankar, Uma
Quoted 57 lines · Uma
Quoted 44 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 3:46 PM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

Quoted 24 lines · Uma
Quoted 13 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 7:11 AM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

When degamma & gamma LUTs are disabled & CTM is enabled, i915 programs a linear table in the degamma/gamma LUTs :

Quoted 8 lines

https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n463
https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n495

All the values programmed are in u16 range which is also what userspace can program (this applies to BDW/SKL/KBL). What is it that the kernel is able to program but not userspace?

Hi Lionel,
Issue is with representing 1.0 which needs a 3.16 kind of representation. So directly doing it in Kernel to program linear luts using below:

Quoted 6 lines
for (i = 0; i < lut_size; i++) {
			u32 v = (i * (1 << 16)) / (lut_size - 1);
			I915_WRITE(PRE_CSC_GAMC_DATA(pipe), v);
		}

takes care of the corner case. The ABI is getting extended and we will need higher precision luts, but for now due to lack of it, putting the same to be

done in driver.

Quoted 2 lines

Regards,
Uma Shankar

Quoted 6 lines

Hi Uma,

This is for GLK right?
What about the failures on KBL/SKL?

There the hardware doesn't have fixed point values.

On Gen9, it uses bdw_load_gamma_lut function. For all values its good, but when it comes to programming GCMAX, ABI fells short:

I915_WRITE(PREC_PAL_GC_MAX(pipe, 0), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 1), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 2), (1 << 16) - 1);

Quoted 5 lines

This expects input in U1.16 format. This may be the reason we are seeing this issue on Gen9 as well.

Regards,
Uma Shankar

Okay... I started looking into this because I'm pretty sure it use to work on gen9 big cores.

Running the tests on my SKL nuc at this revision :

commit 07118ed9b6ed7eb77382d4eb057b7faf4af74dec (drm-tip/drm-tip)
Author: Jani Nikula <[email protected]>
Date:   Fri Mar 8 13:36:01 2019 +0200

    drm-tip: 2019y-03m-08d-11h-34m-53s UTC integration manifest

All the kms_color tests are passing.

Are you sure there isn't another issue?

-Lionel

Quoted 50 lines
Quoted 50 lines

Thanks,

-Lionel

Quoted 44 lines
Quoted 44 lines

-Lionel

Quoted 41 lines · Uma Shankar

Due to Gamma/Degamma limitation with precision (lack of exact 1.0 representation) due to ABI restriction, applying linear gamma affects crc. This patch fixes the same by making ctm tests independant of gamma/degamma.

v2: Disable degamma/gamma programming for ctm max test as it leads to crc mimsmatch. Limiting it to this test case alone as other tests need it to be enabled, hence not touching those scenarios.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108147

---
    tests/kms_color.c | 16 ++++++++++++++--
    1 file changed, 14 insertions(+), 2 deletions(-)
tests/kms_color.c index renamed from tests/kms_color.c +0 -0

decf3c2..93560d4 100644

tests/kms_color.c +9 -2
@@ -696,8 +696,15 @@ static bool test_pipe_ctm(data_t *data,
    		igt_assert(fb_modeset_id);
    		igt_plane_set_fb(primary, &fb_modeset);
 
-		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * Don't program LUT's for max CTM cases as limitation of
+		 * representing 1.0 due to ABI limits causes crc mismatch
+		 */
+		if (memcmp(before, after, sizeof(color_t)))
+			set_degamma(data, primary->pipe, degamma_linear);
+			set_gamma(data, primary->pipe, gamma_linear);
+		}
+
    		disable_ctm(primary->pipe);
    		igt_display_commit(&data->display);
 
@@ -1005,6 +1012,11 @@ run_tests_for_pipe(data_t *data, enum pipe p)
    		 * produce with an 8 bits per color framebuffer. */
    		igt_require(!IS_CHERRYVIEW(data->devid));
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

tests/kms_color.c run_tests_for_pipe(data_t *data, enum pipe p) · line 1022

Quoted 8 lines
tests/kms_color.c +5 -0
+		/* Disable and let default luts be applied by kernel */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
+
    		igt_assert(test_pipe_ctm(data, primary, red_green_blue,
    					 full_rgb, ctm));
    	}

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#9 lore raw
Quoted 89 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 4:39 PM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

Quoted 60 lines · Uma
Quoted 47 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 3:46 PM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

Quoted 24 lines · Uma
Quoted 13 lines

-----Original Message-----
From: Landwerlin, Lionel G
Sent: Monday, March 25, 2019 7:11 AM
To: Shankar, Uma <[email protected]>; [email protected]
Cc: Syrjala, Ville <[email protected]>; Lankhorst, Maarten <[email protected]>
Subject: Re: [igt-dev] [v2] tests/kms_color: Fix CRC mismatch issues with ctm test

When degamma & gamma LUTs are disabled & CTM is enabled, i915 programs a linear table in the degamma/gamma LUTs :

Quoted 8 lines

https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n463
https://cgit.freedesktop.org/drm/drm-
intel/tree/drivers/gpu/drm/i915/intel_color.c#n495

All the values programmed are in u16 range which is also what userspace can program (this applies to BDW/SKL/KBL). What is it that the kernel is able to program but not userspace?

Hi Lionel,
Issue is with representing 1.0 which needs a 3.16 kind of representation. So directly doing it in Kernel to program linear luts using below:

Quoted 7 lines
for (i = 0; i < lut_size; i++) {
			u32 v = (i * (1 << 16)) / (lut_size - 1);
			I915_WRITE(PRE_CSC_GAMC_DATA(pipe), v);
		}

takes care of the corner case. The ABI is getting extended and we will need higher precision luts, but for now due to lack of it, putting the same to be

done in driver.

Quoted 2 lines

Regards,
Uma Shankar

Quoted 6 lines

Hi Uma,

This is for GLK right?
What about the failures on KBL/SKL?

There the hardware doesn't have fixed point values.

On Gen9, it uses bdw_load_gamma_lut function. For all values its good, but when it comes to programming GCMAX, ABI fells short:

I915_WRITE(PREC_PAL_GC_MAX(pipe, 0), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 1), (1 << 16) - 1); I915_WRITE(PREC_PAL_GC_MAX(pipe, 2), (1 << 16) - 1);

Quoted 6 lines

This expects input in U1.16 format. This may be the reason we are seeing this issue on
Gen9 as well.

Regards,
Uma Shankar

Okay... I started looking into this because I'm pretty sure it use to work on gen9 big cores.

Running the tests on my SKL nuc at this revision :

commit 07118ed9b6ed7eb77382d4eb057b7faf4af74dec (drm-tip/drm-tip)
Author: Jani Nikula <[email protected]>
Date:   Fri Mar 8 13:36:01 2019 +0200

Quoted 7 lines

    drm-tip: 2019y-03m-08d-11h-34m-53s UTC integration manifest

All the kms_color tests are passing.

Are you sure there isn't another issue?

I haven’t checked on Gen9 machine, testing on ICL currently. This also depends on pipe precision and rounding, so not sure but definitely we are not able to write 1.0 to register from user provide luts.

Regards,
Uma Shankar

Quoted 55 lines

-Lionel

Quoted 50 lines
Quoted 50 lines

Thanks,

-Lionel

Quoted 44 lines
Quoted 44 lines

-Lionel

Quoted 41 lines · Uma Shankar

Due to Gamma/Degamma limitation with precision (lack of exact 1.0 representation) due to ABI restriction, applying linear gamma affects crc. This patch fixes the same by making ctm tests independant of gamma/degamma.

v2: Disable degamma/gamma programming for ctm max test as it leads to crc mimsmatch. Limiting it to this test case alone as other tests need it to be enabled, hence not touching those scenarios.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108147

---
    tests/kms_color.c | 16 ++++++++++++++--
    1 file changed, 14 insertions(+), 2 deletions(-)
tests/kms_color.c index renamed from tests/kms_color.c +0 -0

decf3c2..93560d4 100644

tests/kms_color.c +9 -2
@@ -696,8 +696,15 @@ static bool test_pipe_ctm(data_t *data,
    		igt_assert(fb_modeset_id);
    		igt_plane_set_fb(primary, &fb_modeset);
 
-		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * Don't program LUT's for max CTM cases as limitation of
+		 * representing 1.0 due to ABI limits causes crc mismatch
+		 */
+		if (memcmp(before, after, sizeof(color_t)))
+			set_degamma(data, primary->pipe, degamma_linear);
+			set_gamma(data, primary->pipe, gamma_linear);
+		}
+
    		disable_ctm(primary->pipe);
    		igt_display_commit(&data->display);
 
@@ -1005,6 +1012,11 @@ run_tests_for_pipe(data_t *data, enum pipe p)
    		 * produce with an 8 bits per color framebuffer. */
    		igt_require(!IS_CHERRYVIEW(data->devid));
 
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

tests/kms_color.c run_tests_for_pipe(data_t *data, enum pipe p) · line 1022

Quoted 8 lines
tests/kms_color.c +5 -0
+		/* Disable and let default luts be applied by kernel */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
+
    		igt_assert(test_pipe_ctm(data, primary, red_green_blue,
    					 full_rgb, ctm));
    	}

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev