Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests
@ 2021-09-03 16:27 Ville Syrjala
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 1/7] tests/kms_color_chamelium: Remove invalid LUT size tests Ville Syrjala
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Ville Syrjala @ 2021-09-03 16:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Bhanuprakash Modem

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Updated set of 3D LUT tests and associated refactoring/fixes.

Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>

Ville Syrjälä (7):
  tests/kms_color_chamelium: Remove invalid LUT size tests
  tests/kms_color: Refactor invalid LUT size tests
  tests/kms_color: Store r/g/b separately for LUT color tests
  tests/kms_color: Pass pipe to invalid LUT size tests
  tests/kms_color: Run each subtest only for a single connector
  lib/kms: Add GAMMA_LUT_3D support
  tests/kms_color: Add GAMMA_LUT_3D tests

 lib/igt_kms.c               |   5 +
 lib/igt_kms.h               |   2 +
 tests/kms_color.c           | 782 +++++++++++++++++++++---------------
 tests/kms_color_chamelium.c |  11 -
 tests/kms_color_helper.c    | 181 +++++----
 tests/kms_color_helper.h    |  27 +-
 6 files changed, 587 insertions(+), 421 deletions(-)

-- 
2.31.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [igt-dev] [PATCH i-g-t v3 1/7] tests/kms_color_chamelium: Remove invalid LUT size tests
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
@ 2021-09-03 16:27 ` Ville Syrjala
  2021-09-12 15:30   ` Modem, Bhanuprakash
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 2/7] tests/kms_color: Refactor " Ville Syrjala
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Ville Syrjala @ 2021-09-03 16:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Bhanuprakash Modem

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

There is zero point in duplicating the invalid LUT size tests
in the chamelium test. Get rid of them.

Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_color_chamelium.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
index bc4356bfab6a..97741b9c968e 100644
--- a/tests/kms_color_chamelium.c
+++ b/tests/kms_color_chamelium.c
@@ -752,17 +752,6 @@ igt_main
 	for_each_pipe_static(pipe)
 		igt_subtest_group
 			run_tests_for_pipe(&data, pipe);
-	igt_describe("Negative test case gamma lut size");
-	igt_subtest_f("pipe-invalid-gamma-lut-sizes")
-		invalid_gamma_lut_sizes(&data);
-
-	igt_describe("Negative test case degamma lut size");
-	igt_subtest_f("pipe-invalid-degamma-lut-sizes")
-		invalid_degamma_lut_sizes(&data);
-
-	igt_describe("Negative test case ctm matrix size");
-	igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
-		invalid_ctm_matrix_sizes(&data);
 
 	igt_fixture {
 		igt_display_fini(&data.display);
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [igt-dev] [PATCH i-g-t v3 2/7] tests/kms_color: Refactor invalid LUT size tests
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 1/7] tests/kms_color_chamelium: Remove invalid LUT size tests Ville Syrjala
@ 2021-09-03 16:27 ` Ville Syrjala
  2021-09-06  6:37   ` Modem, Bhanuprakash
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 3/7] tests/kms_color: Store r/g/b separately for LUT color tests Ville Syrjala
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Ville Syrjala @ 2021-09-03 16:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Bhanuprakash Modem

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reuse the same code for all invalid LUT size tests.

v2: Drop the pointless return statements in void functions

Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_color_helper.c | 81 +++++++++++++---------------------------
 1 file changed, 26 insertions(+), 55 deletions(-)

diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index 5f223a88129f..68fa5f0e42ea 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -277,77 +277,48 @@ pipe_set_property_blob(igt_pipe_t *pipe,
 				       COMMIT_ATOMIC : COMMIT_LEGACY);
 }
 
-void
-invalid_gamma_lut_sizes(data_t *data)
+static void
+invalid_lut_sizes(data_t *data, enum igt_atomic_crtc_properties prop, int size)
 {
 	igt_display_t *display = &data->display;
 	igt_pipe_t *pipe = &display->pipes[0];
-	size_t gamma_lut_size = data->gamma_lut_size *
-				sizeof(struct drm_color_lut);
-	struct drm_color_lut *gamma_lut;
+	struct drm_color_lut *lut;
+	size_t lut_size = size * sizeof(lut[0]);
 
-	igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_GAMMA_LUT));
+	igt_require(igt_pipe_obj_has_prop(pipe, prop));
 
-	gamma_lut = malloc(gamma_lut_size * 2);
+	lut = malloc(lut_size * 2);
 
 	igt_display_commit2(display,
 			    display->is_atomic ?
 			    COMMIT_ATOMIC : COMMIT_LEGACY);
 
-	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
-					     gamma_lut, 1), -EINVAL);
-	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
-					     gamma_lut, gamma_lut_size + 1),
-					     -EINVAL);
-	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
-					     gamma_lut, gamma_lut_size - 1),
-					     -EINVAL);
-	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
-					     gamma_lut, gamma_lut_size +
-					     sizeof(struct drm_color_lut)),
-					     -EINVAL);
-	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT,
-		      pipe->crtc_id), -EINVAL);
-	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT,
-		      4096 * 4096), -EINVAL);
+	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
+					     1), -EINVAL);
+	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
+					     lut_size + 1), -EINVAL);
+	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
+					     lut_size - 1), -EINVAL);
+	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
+					     lut_size + sizeof(struct drm_color_lut)), -EINVAL);
+	igt_assert_eq(pipe_set_property_blob_id(pipe, prop,
+						pipe->crtc_id), -EINVAL);
+	igt_assert_eq(pipe_set_property_blob_id(pipe, prop,
+						4096 * 4096), -EINVAL);
 
-	free(gamma_lut);
+	free(lut);
+}
+
+void
+invalid_gamma_lut_sizes(data_t *data)
+{
+	invalid_lut_sizes(data, IGT_CRTC_GAMMA_LUT, data->gamma_lut_size);
 }
 
 void
 invalid_degamma_lut_sizes(data_t *data)
 {
-	igt_display_t *display = &data->display;
-	igt_pipe_t *pipe = &display->pipes[0];
-	size_t degamma_lut_size = data->degamma_lut_size *
-				  sizeof(struct drm_color_lut);
-	struct drm_color_lut *degamma_lut;
-
-	igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_DEGAMMA_LUT));
-
-	degamma_lut = malloc(degamma_lut_size * 2);
-
-	igt_display_commit2(display, display->is_atomic ?
-			    COMMIT_ATOMIC : COMMIT_LEGACY);
-
-	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
-					     degamma_lut, 1), -EINVAL);
-	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
-					     degamma_lut, degamma_lut_size + 1),
-					     -EINVAL);
-	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
-					     degamma_lut, degamma_lut_size - 1),
-					     -EINVAL);
-	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
-					     degamma_lut, degamma_lut_size +
-					     sizeof(struct drm_color_lut)),
-					     -EINVAL);
-	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT,
-						pipe->crtc_id), -EINVAL);
-	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT,
-						4096 * 4096), -EINVAL);
-
-	free(degamma_lut);
+	invalid_lut_sizes(data, IGT_CRTC_DEGAMMA_LUT, data->degamma_lut_size);
 }
 
 void invalid_ctm_matrix_sizes(data_t *data)
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [igt-dev] [PATCH i-g-t v3 3/7] tests/kms_color: Store r/g/b separately for LUT color tests
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 1/7] tests/kms_color_chamelium: Remove invalid LUT size tests Ville Syrjala
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 2/7] tests/kms_color: Refactor " Ville Syrjala
@ 2021-09-03 16:27 ` Ville Syrjala
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to invalid LUT size tests Ville Syrjala
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Ville Syrjala @ 2021-09-03 16:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Bhanuprakash Modem

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Store the r/g/b values separately for each LUT. A lot of hw
has a separate 1D LUT for each channel, so with this we can
potentially do more interesting tests. Also needed for 3D LUTs
(if we should ever support them).

Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_color_helper.c | 29 +++++++++++++++++++----------
 tests/kms_color_helper.h |  2 +-
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index 68fa5f0e42ea..8b08cdaeea5f 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -103,14 +103,19 @@ void free_lut(gamma_lut_t *gamma)
 	free(gamma);
 }
 
+static void set_rgb(color_t *coeff, double value)
+{
+	coeff->r = coeff->g = coeff->b = value;
+}
+
 gamma_lut_t *generate_table(int lut_size, double exp)
 {
 	gamma_lut_t *gamma = alloc_lut(lut_size);
 	int i;
 
-	gamma->coeffs[0] = 0.0;
+	set_rgb(&gamma->coeffs[0], 0.0);
 	for (i = 1; i < lut_size; i++)
-		gamma->coeffs[i] = pow(i * 1.0 / (lut_size - 1), exp);
+		set_rgb(&gamma->coeffs[i], pow(i * 1.0 / (lut_size - 1), exp));
 
 	return gamma;
 }
@@ -120,9 +125,9 @@ gamma_lut_t *generate_table_max(int lut_size)
 	gamma_lut_t *gamma = alloc_lut(lut_size);
 	int i;
 
-	gamma->coeffs[0] = 0.0;
+	set_rgb(&gamma->coeffs[0], 0.0);
 	for (i = 1; i < lut_size; i++)
-		gamma->coeffs[i] = 1.0;
+		set_rgb(&gamma->coeffs[i], 1.0);
 
 	return gamma;
 }
@@ -133,7 +138,7 @@ gamma_lut_t *generate_table_zero(int lut_size)
 	int i;
 
 	for (i = 0; i < lut_size; i++)
-		gamma->coeffs[i] = 0.0;
+		set_rgb(&gamma->coeffs[i], 0.0);
 
 	return gamma;
 }
@@ -158,7 +163,9 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
 	if (IS_CHERRYVIEW(data->devid))
 		lut_size -= 1;
 	for (i = 0; i < lut_size; i++) {
-		uint32_t v = (gamma->coeffs[i] * max_value);
+		uint32_t r = gamma->coeffs[i].r * max_value;
+		uint32_t g = gamma->coeffs[i].g * max_value;
+		uint32_t b = gamma->coeffs[i].b * max_value;
 
 		/*
 		 * Hardware might encode colors on a different number of bits
@@ -166,11 +173,13 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
 		 * Mask the lower bits not provided by the framebuffer so we
 		 * can do CRC comparisons.
 		 */
-		v &= mask;
+		r &= mask;
+		g &= mask;
+		b &= mask;
 
-		lut[i].red = v;
-		lut[i].green = v;
-		lut[i].blue = v;
+		lut[i].red = r;
+		lut[i].green = g;
+		lut[i].blue = b;
 	}
 
 	if (IS_CHERRYVIEW(data->devid))
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index 88890724c2e4..3f49e7cae4c0 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -61,7 +61,7 @@ typedef struct {
 
 typedef struct {
 	int size;
-	double coeffs[];
+	color_t coeffs[];
 } gamma_lut_t;
 
 void paint_gradient_rectangles(data_t *data,
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [igt-dev] [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to invalid LUT size tests
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
                   ` (2 preceding siblings ...)
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 3/7] tests/kms_color: Store r/g/b separately for LUT color tests Ville Syrjala
@ 2021-09-03 16:27 ` Ville Syrjala
  2021-09-06  6:37   ` Modem, Bhanuprakash
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a single connector Ville Syrjala
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Ville Syrjala @ 2021-09-03 16:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Bhanuprakash Modem

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Each pipe can have a different LUT sizes, so run the invalid LUT
size tests once for each pipe.

This also makes sure data->(de)gamma_lut_size are properly initialized
prior to running these subtests.

Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_color.c        | 73 +++++++++++++++++++++++++---------------
 tests/kms_color_helper.c | 17 +++++-----
 tests/kms_color_helper.h |  7 ++--
 3 files changed, 58 insertions(+), 39 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 9105076aba4f..dabc6963e9e0 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -638,6 +638,26 @@ static void test_pipe_limited_range_ctm(data_t *data,
 }
 #endif
 
+static void
+prep_pipe(data_t *data, enum pipe p)
+{
+	igt_require_pipe(&data->display, p);
+
+	if (igt_pipe_obj_has_prop(&data->display.pipes[p], IGT_CRTC_DEGAMMA_LUT_SIZE)) {
+		data->degamma_lut_size =
+			igt_pipe_obj_get_prop(&data->display.pipes[p],
+					      IGT_CRTC_DEGAMMA_LUT_SIZE);
+		igt_assert_lt(0, data->degamma_lut_size);
+	}
+
+	if (igt_pipe_obj_has_prop(&data->display.pipes[p], IGT_CRTC_GAMMA_LUT_SIZE)) {
+		data->gamma_lut_size =
+			igt_pipe_obj_get_prop(&data->display.pipes[p],
+					      IGT_CRTC_GAMMA_LUT_SIZE);
+		igt_assert_lt(0, data->gamma_lut_size);
+	}
+}
+
 static void
 run_tests_for_pipe(data_t *data, enum pipe p)
 {
@@ -652,10 +672,10 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 	};
 
 	igt_fixture {
+		prep_pipe(data, p);
+
 		igt_require_pipe_crc(data->drm_fd);
 
-		igt_require_pipe(&data->display, p);
-
 		pipe = &data->display.pipes[p];
 		igt_require(pipe->n_planes >= 0);
 
@@ -665,20 +685,6 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 						  primary->pipe->pipe,
 						  INTEL_PIPE_CRC_SOURCE_AUTO);
 
-		if (igt_pipe_obj_has_prop(&data->display.pipes[p], IGT_CRTC_DEGAMMA_LUT_SIZE)) {
-			data->degamma_lut_size =
-				igt_pipe_obj_get_prop(&data->display.pipes[p],
-						      IGT_CRTC_DEGAMMA_LUT_SIZE);
-			igt_assert_lt(0, data->degamma_lut_size);
-		}
-
-		if (igt_pipe_obj_has_prop(&data->display.pipes[p], IGT_CRTC_GAMMA_LUT_SIZE)) {
-			data->gamma_lut_size =
-				igt_pipe_obj_get_prop(&data->display.pipes[p],
-						      IGT_CRTC_GAMMA_LUT_SIZE);
-			igt_assert_lt(0, data->gamma_lut_size);
-		}
-
 		igt_display_require_output_on_pipe(&data->display, p);
 	}
 
@@ -865,6 +871,25 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 	}
 }
 
+static void
+run_invalid_tests_for_pipe(data_t *data, enum pipe p)
+{
+	igt_fixture
+		prep_pipe(data, p);
+
+	igt_describe("Negative check for invalid gamma lut sizes");
+	igt_subtest_f("pipe-%s-invalid-gamma-lut-sizes", kmstest_pipe_name(p))
+		invalid_gamma_lut_sizes(data, p);
+
+	igt_describe("Negative check for invalid degamma lut sizes");
+	igt_subtest_f("pipe-%s-invalid-degamma-lut-sizes", kmstest_pipe_name(p))
+		invalid_degamma_lut_sizes(data, p);
+
+	igt_describe("Negative check for color tranformation matrix sizes");
+	igt_subtest_f("pipe-%s-invalid-ctm-matrix-sizes", kmstest_pipe_name(p))
+		invalid_ctm_matrix_sizes(data, p);
+}
+
 igt_main
 {
 	data_t data = {};
@@ -879,21 +904,13 @@ igt_main
 		igt_display_require(&data.display, data.drm_fd);
 	}
 
-	for_each_pipe_static(pipe)
+	for_each_pipe_static(pipe) {
 		igt_subtest_group
 			run_tests_for_pipe(&data, pipe);
 
-	igt_describe("Negative check for invalid gamma lut sizes");
-	igt_subtest_f("pipe-invalid-gamma-lut-sizes")
-		invalid_gamma_lut_sizes(&data);
-
-	igt_describe("Negative check for invalid degamma lut sizes");
-	igt_subtest_f("pipe-invalid-degamma-lut-sizes")
-		invalid_degamma_lut_sizes(&data);
-
-	igt_describe("Negative check for color tranformation matrix sizes");
-	igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
-		invalid_ctm_matrix_sizes(&data);
+		igt_subtest_group
+			run_invalid_tests_for_pipe(&data, pipe);
+	}
 
 	igt_fixture {
 		igt_display_fini(&data.display);
diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index 8b08cdaeea5f..d71e7bb2e6f9 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -287,10 +287,11 @@ pipe_set_property_blob(igt_pipe_t *pipe,
 }
 
 static void
-invalid_lut_sizes(data_t *data, enum igt_atomic_crtc_properties prop, int size)
+invalid_lut_sizes(data_t *data, enum pipe p,
+		  enum igt_atomic_crtc_properties prop, int size)
 {
 	igt_display_t *display = &data->display;
-	igt_pipe_t *pipe = &display->pipes[0];
+	igt_pipe_t *pipe = &display->pipes[p];
 	struct drm_color_lut *lut;
 	size_t lut_size = size * sizeof(lut[0]);
 
@@ -319,21 +320,21 @@ invalid_lut_sizes(data_t *data, enum igt_atomic_crtc_properties prop, int size)
 }
 
 void
-invalid_gamma_lut_sizes(data_t *data)
+invalid_gamma_lut_sizes(data_t *data, enum pipe p)
 {
-	invalid_lut_sizes(data, IGT_CRTC_GAMMA_LUT, data->gamma_lut_size);
+	invalid_lut_sizes(data, p, IGT_CRTC_GAMMA_LUT, data->gamma_lut_size);
 }
 
 void
-invalid_degamma_lut_sizes(data_t *data)
+invalid_degamma_lut_sizes(data_t *data, enum pipe p)
 {
-	invalid_lut_sizes(data, IGT_CRTC_DEGAMMA_LUT, data->degamma_lut_size);
+	invalid_lut_sizes(data, p, IGT_CRTC_DEGAMMA_LUT, data->degamma_lut_size);
 }
 
-void invalid_ctm_matrix_sizes(data_t *data)
+void invalid_ctm_matrix_sizes(data_t *data, enum pipe p)
 {
 	igt_display_t *display = &data->display;
-	igt_pipe_t *pipe = &display->pipes[0];
+	igt_pipe_t *pipe = &display->pipes[p];
 	void *ptr;
 
 	igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_CTM));
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index 3f49e7cae4c0..bb6f0054f388 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -103,8 +103,9 @@ int pipe_set_property_blob_id(igt_pipe_t *pipe,
 int pipe_set_property_blob(igt_pipe_t *pipe,
 			   enum igt_atomic_crtc_properties prop,
 			   void *ptr, size_t length);
-void invalid_gamma_lut_sizes(data_t *data);
-void invalid_degamma_lut_sizes(data_t *data);
-void invalid_ctm_matrix_sizes(data_t *data);
+void invalid_gamma_lut_sizes(data_t *data, enum pipe p);
+void invalid_degamma_lut_sizes(data_t *data, enum pipe p);
+void invalid_ctm_matrix_sizes(data_t *data, enum pipe p);
+
 #endif
 
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [igt-dev] [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a single connector
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
                   ` (3 preceding siblings ...)
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to invalid LUT size tests Ville Syrjala
@ 2021-09-03 16:27 ` Ville Syrjala
  2021-09-06  6:38   ` Modem, Bhanuprakash
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 6/7] lib/kms: Add GAMMA_LUT_3D support Ville Syrjala
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Ville Syrjala @ 2021-09-03 16:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Bhanuprakash Modem

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

For most of the subtests the used connector should not matter,
so run each subtest just for a single connector.

Suggested-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_color.c | 612 +++++++++++++++++++++++-----------------------
 1 file changed, 306 insertions(+), 306 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index dabc6963e9e0..d78c7e211511 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -37,6 +37,10 @@ static void test_pipe_degamma(data_t *data,
 		{ 0.0, 1.0, 0.0 },
 		{ 0.0, 0.0, 1.0 }
 	};
+	drmModeModeInfo *mode;
+	struct igt_fb fb_modeset, fb;
+	igt_crc_t crc_fullgamma, crc_fullcolors;
+	int fb_id, fb_modeset_id;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT));
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
@@ -44,69 +48,65 @@ static void test_pipe_degamma(data_t *data,
 	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
 	degamma_full = generate_table_max(data->degamma_lut_size);
 
-	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe, output) {
-		drmModeModeInfo *mode;
-		struct igt_fb fb_modeset, fb;
-		igt_crc_t crc_fullgamma, crc_fullcolors;
-		int fb_id, fb_modeset_id;
+	output = igt_get_single_output_for_pipe(&data->display, primary->pipe->pipe);
+	igt_require(output);
 
-		igt_output_set_pipe(output, primary->pipe->pipe);
-		mode = igt_output_get_mode(output);
+	igt_output_set_pipe(output, primary->pipe->pipe);
+	mode = igt_output_get_mode(output);
 
-		/* Create a framebuffer at the size of the output. */
-		fb_id = igt_create_fb(data->drm_fd,
+	/* Create a framebuffer at the size of the output. */
+	fb_id = igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      DRM_FORMAT_MOD_NONE,
+			      &fb);
+	igt_assert(fb_id);
+
+	fb_modeset_id = igt_create_fb(data->drm_fd,
 				      mode->hdisplay,
 				      mode->vdisplay,
 				      DRM_FORMAT_XRGB8888,
 				      DRM_FORMAT_MOD_NONE,
-				      &fb);
-		igt_assert(fb_id);
+				      &fb_modeset);
+	igt_assert(fb_modeset_id);
 
-		fb_modeset_id = igt_create_fb(data->drm_fd,
-					      mode->hdisplay,
-					      mode->vdisplay,
-					      DRM_FORMAT_XRGB8888,
-					      DRM_FORMAT_MOD_NONE,
-					      &fb_modeset);
-		igt_assert(fb_modeset_id);
+	igt_plane_set_fb(primary, &fb_modeset);
+	disable_ctm(primary->pipe);
+	disable_gamma(primary->pipe);
+	set_degamma(data, primary->pipe, degamma_linear);
+	igt_display_commit(&data->display);
 
-		igt_plane_set_fb(primary, &fb_modeset);
-		disable_ctm(primary->pipe);
-		disable_gamma(primary->pipe);
-		set_degamma(data, primary->pipe, degamma_linear);
-		igt_display_commit(&data->display);
+	/* Draw solid colors with linear degamma transformation. */
+	paint_rectangles(data, mode, red_green_blue, &fb);
+	igt_plane_set_fb(primary, &fb);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
 
-		/* Draw solid colors with linear degamma transformation. */
-		paint_rectangles(data, mode, red_green_blue, &fb);
-		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
-		igt_wait_for_vblank(data->drm_fd,
-				display->pipes[primary->pipe->pipe].crtc_offset);
-		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
+	/* Draw a gradient with degamma LUT to remap all
+	 * values to max red/green/blue.
+	 */
+	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	igt_plane_set_fb(primary, &fb);
+	set_degamma(data, primary->pipe, degamma_full);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
 
-		/* Draw a gradient with degamma LUT to remap all
-		 * values to max red/green/blue.
-		 */
-		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
-		igt_plane_set_fb(primary, &fb);
-		set_degamma(data, primary->pipe, degamma_full);
-		igt_display_commit(&data->display);
-		igt_wait_for_vblank(data->drm_fd,
-				display->pipes[primary->pipe->pipe].crtc_offset);
-		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
+	/* Verify that the CRC of the software computed output is
+	 * equal to the CRC of the degamma LUT transformation output.
+	 */
+	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
 
-		/* Verify that the CRC of the software computed output is
-		 * equal to the CRC of the degamma LUT transformation output.
-		 */
-		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
-
-		disable_degamma(primary->pipe);
-		igt_plane_set_fb(primary, NULL);
-		igt_output_set_pipe(output, PIPE_NONE);
-		igt_display_commit(&data->display);
-		igt_remove_fb(data->drm_fd, &fb);
-		igt_remove_fb(data->drm_fd, &fb_modeset);
-	}
+	disable_degamma(primary->pipe);
+	igt_plane_set_fb(primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit(&data->display);
+	igt_remove_fb(data->drm_fd, &fb);
+	igt_remove_fb(data->drm_fd, &fb_modeset);
 
 	free_lut(degamma_linear);
 	free_lut(degamma_full);
@@ -127,73 +127,73 @@ static void test_pipe_gamma(data_t *data,
 		{ 0.0, 1.0, 0.0 },
 		{ 0.0, 0.0, 1.0 }
 	};
+	drmModeModeInfo *mode;
+	struct igt_fb fb_modeset, fb;
+	igt_crc_t crc_fullgamma, crc_fullcolors;
+	int fb_id, fb_modeset_id;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
 
 	gamma_full = generate_table_max(data->gamma_lut_size);
 
-	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe, output) {
-		drmModeModeInfo *mode;
-		struct igt_fb fb_modeset, fb;
-		igt_crc_t crc_fullgamma, crc_fullcolors;
-		int fb_id, fb_modeset_id;
+	output = igt_get_single_output_for_pipe(&data->display, primary->pipe->pipe);
+	igt_require(output);
 
-		igt_output_set_pipe(output, primary->pipe->pipe);
-		mode = igt_output_get_mode(output);
+	igt_output_set_pipe(output, primary->pipe->pipe);
+	mode = igt_output_get_mode(output);
 
-		/* Create a framebuffer at the size of the output. */
-		fb_id = igt_create_fb(data->drm_fd,
+	/* Create a framebuffer at the size of the output. */
+	fb_id = igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      DRM_FORMAT_MOD_NONE,
+			      &fb);
+	igt_assert(fb_id);
+
+	fb_modeset_id = igt_create_fb(data->drm_fd,
 				      mode->hdisplay,
 				      mode->vdisplay,
 				      DRM_FORMAT_XRGB8888,
 				      DRM_FORMAT_MOD_NONE,
-				      &fb);
-		igt_assert(fb_id);
+				      &fb_modeset);
+	igt_assert(fb_modeset_id);
 
-		fb_modeset_id = igt_create_fb(data->drm_fd,
-					      mode->hdisplay,
-					      mode->vdisplay,
-					      DRM_FORMAT_XRGB8888,
-					      DRM_FORMAT_MOD_NONE,
-					      &fb_modeset);
-		igt_assert(fb_modeset_id);
+	igt_plane_set_fb(primary, &fb_modeset);
+	disable_ctm(primary->pipe);
+	disable_degamma(primary->pipe);
+	set_gamma(data, primary->pipe, gamma_full);
+	igt_display_commit(&data->display);
 
-		igt_plane_set_fb(primary, &fb_modeset);
-		disable_ctm(primary->pipe);
-		disable_degamma(primary->pipe);
-		set_gamma(data, primary->pipe, gamma_full);
-		igt_display_commit(&data->display);
+	/* Draw solid colors with no gamma transformation. */
+	paint_rectangles(data, mode, red_green_blue, &fb);
+	igt_plane_set_fb(primary, &fb);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
 
-		/* Draw solid colors with no gamma transformation. */
-		paint_rectangles(data, mode, red_green_blue, &fb);
-		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
-		igt_wait_for_vblank(data->drm_fd,
-				display->pipes[primary->pipe->pipe].crtc_offset);
-		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
+	/* Draw a gradient with gamma LUT to remap all values
+	 * to max red/green/blue.
+	 */
+	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	igt_plane_set_fb(primary, &fb);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
 
-		/* Draw a gradient with gamma LUT to remap all values
-		 * to max red/green/blue.
-		 */
-		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
-		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
-		igt_wait_for_vblank(data->drm_fd,
-				display->pipes[primary->pipe->pipe].crtc_offset);
-		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
+	/* Verify that the CRC of the software computed output is
+	 * equal to the CRC of the gamma LUT transformation output.
+	 */
+	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
 
-		/* Verify that the CRC of the software computed output is
-		 * equal to the CRC of the gamma LUT transformation output.
-		 */
-		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
-
-		disable_gamma(primary->pipe);
-		igt_plane_set_fb(primary, NULL);
-		igt_output_set_pipe(output, PIPE_NONE);
-		igt_display_commit(&data->display);
-		igt_remove_fb(data->drm_fd, &fb);
-		igt_remove_fb(data->drm_fd, &fb_modeset);
-	}
+	disable_gamma(primary->pipe);
+	igt_plane_set_fb(primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit(&data->display);
+	igt_remove_fb(data->drm_fd, &fb);
+	igt_remove_fb(data->drm_fd, &fb_modeset);
 
 	free_lut(gamma_full);
 }
@@ -216,6 +216,10 @@ static void test_pipe_legacy_gamma(data_t *data,
 	drmModeCrtc *kms_crtc;
 	uint32_t i, legacy_lut_size;
 	uint16_t *red_lut, *green_lut, *blue_lut;
+	drmModeModeInfo *mode;
+	struct igt_fb fb_modeset, fb;
+	igt_crc_t crc_fullgamma, crc_fullcolors;
+	int fb_id, fb_modeset_id;
 
 	kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
 	legacy_lut_size = kms_crtc->gamma_size;
@@ -225,80 +229,76 @@ static void test_pipe_legacy_gamma(data_t *data,
 	green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
 	blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
 
-	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe, output) {
-		drmModeModeInfo *mode;
-		struct igt_fb fb_modeset, fb;
-		igt_crc_t crc_fullgamma, crc_fullcolors;
-		int fb_id, fb_modeset_id;
+	output = igt_get_single_output_for_pipe(&data->display, primary->pipe->pipe);
+	igt_require(output);
 
-		igt_output_set_pipe(output, primary->pipe->pipe);
-		mode = igt_output_get_mode(output);
+	igt_output_set_pipe(output, primary->pipe->pipe);
+	mode = igt_output_get_mode(output);
 
-		/* Create a framebuffer at the size of the output. */
-		fb_id = igt_create_fb(data->drm_fd,
+	/* Create a framebuffer at the size of the output. */
+	fb_id = igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      DRM_FORMAT_MOD_NONE,
+			      &fb);
+	igt_assert(fb_id);
+
+	fb_modeset_id = igt_create_fb(data->drm_fd,
 				      mode->hdisplay,
 				      mode->vdisplay,
 				      DRM_FORMAT_XRGB8888,
 				      DRM_FORMAT_MOD_NONE,
-				      &fb);
-		igt_assert(fb_id);
-
-		fb_modeset_id = igt_create_fb(data->drm_fd,
-					      mode->hdisplay,
-					      mode->vdisplay,
-					      DRM_FORMAT_XRGB8888,
-					      DRM_FORMAT_MOD_NONE,
-					      &fb_modeset);
-		igt_assert(fb_modeset_id);
-
-		igt_plane_set_fb(primary, &fb_modeset);
-		disable_degamma(primary->pipe);
-		disable_gamma(primary->pipe);
-		disable_ctm(primary->pipe);
-		igt_display_commit(&data->display);
-
-		/* Draw solid colors with no gamma transformation. */
-		paint_rectangles(data, mode, red_green_blue, &fb);
-		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
-		igt_wait_for_vblank(data->drm_fd,
-				display->pipes[primary->pipe->pipe].crtc_offset);
-		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
-
-		/* Draw a gradient with gamma LUT to remap all values
-		 * to max red/green/blue.
-		 */
-		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
-		igt_plane_set_fb(primary, &fb);
-
-		red_lut[0] = green_lut[0] = blue_lut[0] = 0;
-		for (i = 1; i < legacy_lut_size; i++)
-			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
-		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
-						  legacy_lut_size, red_lut, green_lut, blue_lut), 0);
-		igt_display_commit(&data->display);
-		igt_wait_for_vblank(data->drm_fd,
-				display->pipes[primary->pipe->pipe].crtc_offset);
-		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
-
-		/* Verify that the CRC of the software computed output is
-		 * equal to the CRC of the gamma LUT transformation output.
-		 */
-		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
-
-		/* Reset output. */
-		for (i = 1; i < legacy_lut_size; i++)
-			red_lut[i] = green_lut[i] = blue_lut[i] = i << 8;
-
-		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
-						  legacy_lut_size, red_lut, green_lut, blue_lut), 0);
-		igt_display_commit(&data->display);
-
-		igt_plane_set_fb(primary, NULL);
-		igt_output_set_pipe(output, PIPE_NONE);
-		igt_remove_fb(data->drm_fd, &fb);
-		igt_remove_fb(data->drm_fd, &fb_modeset);
-	}
+				      &fb_modeset);
+	igt_assert(fb_modeset_id);
+
+	igt_plane_set_fb(primary, &fb_modeset);
+	disable_degamma(primary->pipe);
+	disable_gamma(primary->pipe);
+	disable_ctm(primary->pipe);
+	igt_display_commit(&data->display);
+
+	/* Draw solid colors with no gamma transformation. */
+	paint_rectangles(data, mode, red_green_blue, &fb);
+	igt_plane_set_fb(primary, &fb);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
+
+	/* Draw a gradient with gamma LUT to remap all values
+	 * to max red/green/blue.
+	 */
+	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	igt_plane_set_fb(primary, &fb);
+
+	red_lut[0] = green_lut[0] = blue_lut[0] = 0;
+	for (i = 1; i < legacy_lut_size; i++)
+		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
+	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
+					  legacy_lut_size, red_lut, green_lut, blue_lut), 0);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
+
+	/* Verify that the CRC of the software computed output is
+	 * equal to the CRC of the gamma LUT transformation output.
+	 */
+	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
+
+	/* Reset output. */
+	for (i = 1; i < legacy_lut_size; i++)
+		red_lut[i] = green_lut[i] = blue_lut[i] = i << 8;
+
+	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
+					  legacy_lut_size, red_lut, green_lut, blue_lut), 0);
+	igt_display_commit(&data->display);
+
+	igt_plane_set_fb(primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_remove_fb(data->drm_fd, &fb);
+	igt_remove_fb(data->drm_fd, &fb_modeset);
 
 	free(red_lut);
 	free(green_lut);
@@ -331,93 +331,93 @@ static void test_pipe_legacy_gamma_reset(data_t *data,
 		degamma_linear = generate_table(data->degamma_lut_size, 1.0);
 	gamma_zero = generate_table_zero(data->gamma_lut_size);
 
-	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe, output) {
-		igt_output_set_pipe(output, primary->pipe->pipe);
+	output = igt_get_single_output_for_pipe(&data->display, primary->pipe->pipe);
+	igt_require(output);
 
-		/* Ensure we have a clean state to start with. */
-		disable_degamma(primary->pipe);
-		disable_ctm(primary->pipe);
-		disable_gamma(primary->pipe);
-		igt_display_commit(&data->display);
+	igt_output_set_pipe(output, primary->pipe->pipe);
 
-		/* Set a degama & gamma LUT and a CTM using the
-		 * properties and verify the content of the
-		 * properties. */
-		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
-			set_degamma(data, primary->pipe, degamma_linear);
-		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
-			set_ctm(primary->pipe, ctm_identity);
-		set_gamma(data, primary->pipe, gamma_zero);
-		igt_display_commit(&data->display);
+	/* Ensure we have a clean state to start with. */
+	disable_degamma(primary->pipe);
+	disable_ctm(primary->pipe);
+	disable_gamma(primary->pipe);
+	igt_display_commit(&data->display);
 
-		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT)) {
-			blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
-			igt_assert(blob &&
-				   blob->length == (sizeof(struct drm_color_lut) *
-						    data->degamma_lut_size));
-			drmModeFreePropertyBlob(blob);
-		}
+	/* Set a degama & gamma LUT and a CTM using the
+	 * properties and verify the content of the
+	 * properties. */
+	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
+		set_degamma(data, primary->pipe, degamma_linear);
+	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
+		set_ctm(primary->pipe, ctm_identity);
+	set_gamma(data, primary->pipe, gamma_zero);
+	igt_display_commit(&data->display);
 
-		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM)) {
-			blob = get_blob(data, primary->pipe, IGT_CRTC_CTM);
-			igt_assert(blob &&
-				   blob->length == sizeof(struct drm_color_ctm));
-			drmModeFreePropertyBlob(blob);
-		}
-
-		blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
+	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT)) {
+		blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
 		igt_assert(blob &&
 			   blob->length == (sizeof(struct drm_color_lut) *
-					    data->gamma_lut_size));
-		lut = (struct drm_color_lut *) blob->data;
-		for (i = 0; i < data->gamma_lut_size; i++)
-			igt_assert(lut[i].red == 0 &&
-				   lut[i].green == 0 &&
-				   lut[i].blue == 0);
+					    data->degamma_lut_size));
 		drmModeFreePropertyBlob(blob);
+	}
 
-		/* Set a gamma LUT using the legacy ioctl and verify
-		 * the content of the GAMMA_LUT property is changed
-		 * and that CTM and DEGAMMA_LUT are empty. */
-		kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
-		legacy_lut_size = kms_crtc->gamma_size;
-		drmModeFreeCrtc(kms_crtc);
+	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM)) {
+		blob = get_blob(data, primary->pipe, IGT_CRTC_CTM);
+		igt_assert(blob &&
+			   blob->length == sizeof(struct drm_color_ctm));
+		drmModeFreePropertyBlob(blob);
+	}
 
-		red_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
-		green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
-		blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
+	blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
+	igt_assert(blob &&
+		   blob->length == (sizeof(struct drm_color_lut) *
+				    data->gamma_lut_size));
+	lut = (struct drm_color_lut *) blob->data;
+	for (i = 0; i < data->gamma_lut_size; i++)
+		igt_assert(lut[i].red == 0 &&
+			   lut[i].green == 0 &&
+			   lut[i].blue == 0);
+	drmModeFreePropertyBlob(blob);
 
-		for (i = 0; i < legacy_lut_size; i++)
-			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
+	/* Set a gamma LUT using the legacy ioctl and verify
+	 * the content of the GAMMA_LUT property is changed
+	 * and that CTM and DEGAMMA_LUT are empty. */
+	kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
+	legacy_lut_size = kms_crtc->gamma_size;
+	drmModeFreeCrtc(kms_crtc);
 
-		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd,
-						  primary->pipe->crtc_id,
-						  legacy_lut_size,
-						  red_lut, green_lut, blue_lut),
-			      0);
-		igt_display_commit(&data->display);
+	red_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
+	green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
+	blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
 
-		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
-			igt_assert(get_blob(data, primary->pipe,
-					    IGT_CRTC_DEGAMMA_LUT) == NULL);
+	for (i = 0; i < legacy_lut_size; i++)
+		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
 
-		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
-			igt_assert(get_blob(data, primary->pipe, IGT_CRTC_CTM) == NULL);
+	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd,
+					  primary->pipe->crtc_id,
+					  legacy_lut_size,
+					  red_lut, green_lut, blue_lut), 0);
+	igt_display_commit(&data->display);
 
-		blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
-		igt_assert(blob &&
-			   blob->length == (sizeof(struct drm_color_lut) *
-					    legacy_lut_size));
-		lut = (struct drm_color_lut *) blob->data;
-		for (i = 0; i < legacy_lut_size; i++)
-			igt_assert(lut[i].red == 0xffff &&
-				   lut[i].green == 0xffff &&
-				   lut[i].blue == 0xffff);
-		drmModeFreePropertyBlob(blob);
+	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
+		igt_assert(get_blob(data, primary->pipe,
+				    IGT_CRTC_DEGAMMA_LUT) == NULL);
 
-		igt_plane_set_fb(primary, NULL);
-		igt_output_set_pipe(output, PIPE_NONE);
-	}
+	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
+		igt_assert(get_blob(data, primary->pipe, IGT_CRTC_CTM) == NULL);
+
+	blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
+	igt_assert(blob &&
+		   blob->length == (sizeof(struct drm_color_lut) *
+				    legacy_lut_size));
+	lut = (struct drm_color_lut *) blob->data;
+	for (i = 0; i < legacy_lut_size; i++)
+		igt_assert(lut[i].red == 0xffff &&
+			   lut[i].green == 0xffff &&
+			   lut[i].blue == 0xffff);
+	drmModeFreePropertyBlob(blob);
+
+	igt_plane_set_fb(primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
 
 	free_lut(degamma_linear);
 	free_lut(gamma_zero);
@@ -442,84 +442,84 @@ static bool test_pipe_ctm(data_t *data,
 	igt_output_t *output;
 	bool ret = true;
 	igt_display_t *display = &data->display;
+	drmModeModeInfo *mode;
+	struct igt_fb fb_modeset, fb;
+	igt_crc_t crc_software, crc_hardware;
+	int fb_id, fb_modeset_id;
 
 	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM));
 
 	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
 	gamma_linear = generate_table(data->gamma_lut_size, 1.0);
 
-	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe, output) {
-		drmModeModeInfo *mode;
-		struct igt_fb fb_modeset, fb;
-		igt_crc_t crc_software, crc_hardware;
-		int fb_id, fb_modeset_id;
+	output = igt_get_single_output_for_pipe(&data->display, primary->pipe->pipe);
+	igt_require(output);
 
-		igt_output_set_pipe(output, primary->pipe->pipe);
-		mode = igt_output_get_mode(output);
+	igt_output_set_pipe(output, primary->pipe->pipe);
+	mode = igt_output_get_mode(output);
 
-		/* Create a framebuffer at the size of the output. */
-		fb_id = igt_create_fb(data->drm_fd,
+	/* Create a framebuffer at the size of the output. */
+	fb_id = igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      DRM_FORMAT_MOD_NONE,
+			      &fb);
+	igt_assert(fb_id);
+
+	fb_modeset_id = igt_create_fb(data->drm_fd,
 				      mode->hdisplay,
 				      mode->vdisplay,
 				      DRM_FORMAT_XRGB8888,
 				      DRM_FORMAT_MOD_NONE,
-				      &fb);
-		igt_assert(fb_id);
+				      &fb_modeset);
+	igt_assert(fb_modeset_id);
+	igt_plane_set_fb(primary, &fb_modeset);
 
-		fb_modeset_id = igt_create_fb(data->drm_fd,
-					      mode->hdisplay,
-					      mode->vdisplay,
-					      DRM_FORMAT_XRGB8888,
-					      DRM_FORMAT_MOD_NONE,
-					      &fb_modeset);
-		igt_assert(fb_modeset_id);
-		igt_plane_set_fb(primary, &fb_modeset);
-
-		/*
-		 * Don't program LUT's for max CTM cases, as limitation of
-		 * representing intermediate values between 0 and 1.0 causes
-		 * rounding issues and inaccuracies leading to crc mismatch.
-		 */
-		if (memcmp(before, after, sizeof(color_t))) {
-			set_degamma(data, primary->pipe, degamma_linear);
-			set_gamma(data, primary->pipe, gamma_linear);
-		} else {
-			/* Disable Degamma and Gamma for ctm max test */
-			disable_degamma(primary->pipe);
-			disable_gamma(primary->pipe);
-		}
-
-		disable_ctm(primary->pipe);
-		igt_display_commit(&data->display);
-
-		paint_rectangles(data, mode, after, &fb);
-		igt_plane_set_fb(primary, &fb);
-		set_ctm(primary->pipe, ctm_identity);
-		igt_display_commit(&data->display);
-		igt_wait_for_vblank(data->drm_fd,
-				display->pipes[primary->pipe->pipe].crtc_offset);
-		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
-
-		/* With CTM transformation. */
-		paint_rectangles(data, mode, before, &fb);
-		igt_plane_set_fb(primary, &fb);
-		set_ctm(primary->pipe, ctm_matrix);
-		igt_display_commit(&data->display);
-		igt_wait_for_vblank(data->drm_fd,
-				display->pipes[primary->pipe->pipe].crtc_offset);
-		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
-
-		/* Verify that the CRC of the software computed output is
-		 * equal to the CRC of the CTM matrix transformation output.
-		 */
-		ret &= !igt_skip_crc_compare || igt_check_crc_equal(&crc_software, &crc_hardware);
-
-		igt_plane_set_fb(primary, NULL);
-		igt_output_set_pipe(output, PIPE_NONE);
-		igt_remove_fb(data->drm_fd, &fb);
-		igt_remove_fb(data->drm_fd, &fb_modeset);
+	/*
+	 * Don't program LUT's for max CTM cases, as limitation of
+	 * representing intermediate values between 0 and 1.0 causes
+	 * rounding issues and inaccuracies leading to crc mismatch.
+	 */
+	if (memcmp(before, after, sizeof(color_t))) {
+		set_degamma(data, primary->pipe, degamma_linear);
+		set_gamma(data, primary->pipe, gamma_linear);
+	} else {
+		/* Disable Degamma and Gamma for ctm max test */
+		disable_degamma(primary->pipe);
+		disable_gamma(primary->pipe);
 	}
 
+	disable_ctm(primary->pipe);
+	igt_display_commit(&data->display);
+
+	paint_rectangles(data, mode, after, &fb);
+	igt_plane_set_fb(primary, &fb);
+	set_ctm(primary->pipe, ctm_identity);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
+
+	/* With CTM transformation. */
+	paint_rectangles(data, mode, before, &fb);
+	igt_plane_set_fb(primary, &fb);
+	set_ctm(primary->pipe, ctm_matrix);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
+
+	/* Verify that the CRC of the software computed output is
+	 * equal to the CRC of the CTM matrix transformation output.
+	 */
+	ret &= !igt_skip_crc_compare || igt_check_crc_equal(&crc_software, &crc_hardware);
+
+	igt_plane_set_fb(primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_remove_fb(data->drm_fd, &fb);
+	igt_remove_fb(data->drm_fd, &fb_modeset);
+
 	free_lut(degamma_linear);
 	free_lut(gamma_linear);
 
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [igt-dev] [PATCH i-g-t v3 6/7] lib/kms: Add GAMMA_LUT_3D support
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
                   ` (4 preceding siblings ...)
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a single connector Ville Syrjala
@ 2021-09-03 16:27 ` Ville Syrjala
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 7/7] tests/kms_color: Add GAMMA_LUT_3D tests Ville Syrjala
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Ville Syrjala @ 2021-09-03 16:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Bhanuprakash Modem

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add basic plumbing for the GAMMA_LUT_3D/GAMMA_LUT_3D_SIZE crtc props.

Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_kms.c | 5 +++++
 lib/igt_kms.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index cc38f5a25334..5b1f55a50840 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -589,6 +589,8 @@ const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
 	[IGT_CRTC_GAMMA_LUT_SIZE] = "GAMMA_LUT_SIZE",
 	[IGT_CRTC_DEGAMMA_LUT] = "DEGAMMA_LUT",
 	[IGT_CRTC_DEGAMMA_LUT_SIZE] = "DEGAMMA_LUT_SIZE",
+	[IGT_CRTC_GAMMA_LUT_3D] = "GAMMA_LUT_3D",
+	[IGT_CRTC_GAMMA_LUT_3D_SIZE] = "GAMMA_LUT_3D_SIZE",
 	[IGT_CRTC_MODE_ID] = "MODE_ID",
 	[IGT_CRTC_ACTIVE] = "ACTIVE",
 	[IGT_CRTC_OUT_FENCE_PTR] = "OUT_FENCE_PTR",
@@ -1983,6 +1985,9 @@ static void igt_pipe_reset(igt_pipe_t *pipe)
 	if (igt_pipe_obj_has_prop(pipe, IGT_CRTC_DEGAMMA_LUT))
 		igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_DEGAMMA_LUT, 0);
 
+	if (igt_pipe_obj_has_prop(pipe, IGT_CRTC_GAMMA_LUT_3D))
+		igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_GAMMA_LUT_3D, 0);
+
 	pipe->out_fence_fd = -1;
 }
 
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index ed598f164a59..9608097142bd 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -121,6 +121,8 @@ enum igt_atomic_crtc_properties {
        IGT_CRTC_GAMMA_LUT_SIZE,
        IGT_CRTC_DEGAMMA_LUT,
        IGT_CRTC_DEGAMMA_LUT_SIZE,
+       IGT_CRTC_GAMMA_LUT_3D,
+       IGT_CRTC_GAMMA_LUT_3D_SIZE,
        IGT_CRTC_MODE_ID,
        IGT_CRTC_ACTIVE,
        IGT_CRTC_OUT_FENCE_PTR,
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [igt-dev] [PATCH i-g-t v3 7/7] tests/kms_color: Add GAMMA_LUT_3D tests
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
                   ` (5 preceding siblings ...)
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 6/7] lib/kms: Add GAMMA_LUT_3D support Ville Syrjala
@ 2021-09-03 16:27 ` Ville Syrjala
  2021-09-06  6:38   ` Modem, Bhanuprakash
  2021-09-03 17:25 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_color: 3D LUT tests (rev5) Patchwork
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Ville Syrjala @ 2021-09-03 16:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Bhanuprakash Modem

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add some basic tests for 3D LUTs.

v2: Add missing igt_describe()s
    s/degamma/3D LUT/ in some comments
    Run the test for a single connector only
    Run the invalid LUT size test for each pipe

Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_color.c        | 97 ++++++++++++++++++++++++++++++++++++++++
 tests/kms_color_helper.c | 58 +++++++++++++++++++++++-
 tests/kms_color_helper.h | 18 ++++++++
 3 files changed, 172 insertions(+), 1 deletion(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index d78c7e211511..2e250ffe8ae8 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -198,6 +198,88 @@ static void test_pipe_gamma(data_t *data,
 	free_lut(gamma_full);
 }
 
+static void test_pipe_gamma_lut_3d(data_t *data,
+				   igt_plane_t *primary)
+{
+	igt_output_t *output;
+	igt_display_t *display = &data->display;
+	gamma_lut_t *gamma_lut_3d_linear, *gamma_lut_3d_full;
+	color_t red_green_blue[] = {
+		{ 1.0, 0.0, 0.0 },
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 }
+	};
+	drmModeModeInfo *mode;
+	struct igt_fb fb_modeset, fb;
+	igt_crc_t crc_fulllut3d, crc_fullcolors;
+	int fb_id, fb_modeset_id;
+
+	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT_3D));
+
+	gamma_lut_3d_linear = generate_lut_3d(data->gamma_lut_3d_size, 1.0);
+	gamma_lut_3d_full = generate_lut_3d_max(data->gamma_lut_3d_size);
+
+	output = igt_get_single_output_for_pipe(&data->display, primary->pipe->pipe);
+	igt_require(output);
+
+	igt_output_set_pipe(output, primary->pipe->pipe);
+	mode = igt_output_get_mode(output);
+
+	/* Create a framebuffer at the size of the output. */
+	fb_id = igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      DRM_FORMAT_MOD_NONE,
+			      &fb);
+	igt_assert(fb_id);
+
+	fb_modeset_id = igt_create_fb(data->drm_fd,
+				      mode->hdisplay,
+				      mode->vdisplay,
+				      DRM_FORMAT_XRGB8888,
+				      DRM_FORMAT_MOD_NONE,
+				      &fb_modeset);
+	igt_assert(fb_modeset_id);
+
+	igt_plane_set_fb(primary, &fb_modeset);
+	disable_ctm(primary->pipe);
+	disable_degamma(primary->pipe);
+	disable_gamma(primary->pipe);
+	set_gamma_lut_3d(data, primary->pipe, gamma_lut_3d_linear);
+	igt_display_commit(&data->display);
+
+	/* Draw solid colors with no 3D LUT transformation. */
+	paint_rectangles(data, mode, red_green_blue, &fb);
+	igt_plane_set_fb(primary, &fb);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
+
+	/* Draw a gradient with 3D LUT to remap all
+	 * values to max red/green/blue.
+	 */
+	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+	igt_plane_set_fb(primary, &fb);
+	set_gamma_lut_3d(data, primary->pipe, gamma_lut_3d_full);
+	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    display->pipes[primary->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fulllut3d);
+
+	/* Verify that the CRC of the software computed output is
+	 * equal to the CRC of the 3D LUT transformation output.
+	 */
+	igt_assert_crc_equal(&crc_fulllut3d, &crc_fullcolors);
+
+	igt_plane_set_fb(primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+
+	free_lut(gamma_lut_3d_linear);
+	free_lut(gamma_lut_3d_full);
+}
+
 /*
  * Draw 3 gradient rectangles in red, green and blue, with a maxed out legacy
  * gamma LUT and verify we have the same CRC as drawing solid color rectangles
@@ -656,6 +738,13 @@ prep_pipe(data_t *data, enum pipe p)
 					      IGT_CRTC_GAMMA_LUT_SIZE);
 		igt_assert_lt(0, data->gamma_lut_size);
 	}
+
+	if (igt_pipe_obj_has_prop(&data->display.pipes[p], IGT_CRTC_GAMMA_LUT_3D_SIZE)) {
+		data->gamma_lut_3d_size =
+			igt_pipe_obj_get_prop(&data->display.pipes[p],
+					      IGT_CRTC_GAMMA_LUT_3D_SIZE);
+		igt_assert_lt(0, data->gamma_lut_3d_size);
+	}
 }
 
 static void
@@ -860,6 +949,10 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 	igt_subtest_f("pipe-%s-legacy-gamma-reset", kmstest_pipe_name(p))
 		test_pipe_legacy_gamma_reset(data, primary);
 
+	igt_describe("Verify that gamma LUT 3D transformation works correctly");
+	igt_subtest_f("pipe-%s-gamma-lut-3d", kmstest_pipe_name(p))
+		test_pipe_gamma_lut_3d(data, primary);
+
 	igt_fixture {
 		disable_degamma(primary->pipe);
 		disable_gamma(primary->pipe);
@@ -888,6 +981,10 @@ run_invalid_tests_for_pipe(data_t *data, enum pipe p)
 	igt_describe("Negative check for color tranformation matrix sizes");
 	igt_subtest_f("pipe-%s-invalid-ctm-matrix-sizes", kmstest_pipe_name(p))
 		invalid_ctm_matrix_sizes(data, p);
+
+	igt_describe("Negative check for invalid gamma lut 3D sizes");
+	igt_subtest_f("pipe-%s-invalid-gamma-lut-3d-sizes", kmstest_pipe_name(p))
+		invalid_gamma_lut_3d_sizes(data, p);
 }
 
 igt_main
diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index d71e7bb2e6f9..38e388c54ee8 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -143,6 +143,44 @@ gamma_lut_t *generate_table_zero(int lut_size)
 	return gamma;
 }
 
+gamma_lut_t *generate_lut_3d(int lut_size, double exp)
+{
+	gamma_lut_t *gamma = alloc_lut(lut_3d_size(lut_size));
+
+	for (int r = 0; r < lut_size; r++) {
+		for (int g = 0; g < lut_size; g++) {
+			for (int b = 0; b < lut_size; b++) {
+				int i = lut_3d_index(r, g, b, lut_size);
+
+				gamma->coeffs[i].r = pow(r * 1.0 / (lut_size - 1), exp);
+				gamma->coeffs[i].g = pow(g * 1.0 / (lut_size - 1), exp);
+				gamma->coeffs[i].b = pow(b * 1.0 / (lut_size - 1), exp);
+			}
+		}
+	}
+
+	return gamma;
+}
+
+gamma_lut_t *generate_lut_3d_max(int lut_size)
+{
+	gamma_lut_t *gamma = alloc_lut(lut_3d_size(lut_size));
+
+	for (int r = 0; r < lut_size; r++) {
+		for (int g = 0; g < lut_size; g++) {
+			for (int b = 0; b < lut_size; b++) {
+				int i = lut_3d_index(r, g, b, lut_size);
+
+				gamma->coeffs[i].r = r == 0 ? 0.0 : 1.0;
+				gamma->coeffs[i].g = g == 0 ? 0.0 : 1.0;
+				gamma->coeffs[i].b = b == 0 ? 0.0 : 1.0;
+			}
+		}
+	}
+
+	return gamma;
+}
+
 struct drm_color_lut *coeffs_to_lut(data_t *data,
 				    const gamma_lut_t *gamma,
 				    uint32_t color_depth,
@@ -215,6 +253,19 @@ void set_gamma(data_t *data,
 	free(lut);
 }
 
+void set_gamma_lut_3d(data_t *data,
+		      igt_pipe_t *pipe,
+		      const gamma_lut_t *gamma_lut_3d)
+{
+	size_t size = sizeof(struct drm_color_lut) * gamma_lut_3d->size;
+	struct drm_color_lut *lut = coeffs_to_lut(data, gamma_lut_3d,
+						  data->color_depth, 0);
+
+	igt_pipe_obj_replace_prop_blob(pipe, IGT_CRTC_GAMMA_LUT_3D, lut, size);
+
+	free(lut);
+}
+
 void set_ctm(igt_pipe_t *pipe, const double *coefficients)
 {
 	struct drm_color_ctm ctm;
@@ -331,6 +382,12 @@ invalid_degamma_lut_sizes(data_t *data, enum pipe p)
 	invalid_lut_sizes(data, p, IGT_CRTC_DEGAMMA_LUT, data->degamma_lut_size);
 }
 
+void
+invalid_gamma_lut_3d_sizes(data_t *data, enum pipe p)
+{
+	invalid_lut_sizes(data, p, IGT_CRTC_GAMMA_LUT_3D, lut_3d_size(data->gamma_lut_3d_size));
+}
+
 void invalid_ctm_matrix_sizes(data_t *data, enum pipe p)
 {
 	igt_display_t *display = &data->display;
@@ -359,4 +416,3 @@ void invalid_ctm_matrix_sizes(data_t *data, enum pipe p)
 
 	free(ptr);
 }
-
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index bb6f0054f388..7406820b6955 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -52,6 +52,7 @@ typedef struct {
 	uint32_t color_depth;
 	uint64_t degamma_lut_size;
 	uint64_t gamma_lut_size;
+	uint64_t gamma_lut_3d_size;
 	#ifdef HAVE_CHAMELIUM
 	struct chamelium *chamelium;
 	struct chamelium_port **ports;
@@ -77,6 +78,8 @@ void free_lut(gamma_lut_t *gamma);
 gamma_lut_t *generate_table(int lut_size, double exp);
 gamma_lut_t *generate_table_max(int lut_size);
 gamma_lut_t *generate_table_zero(int lut_size);
+gamma_lut_t *generate_lut_3d(int lut_size, double exp);
+gamma_lut_t *generate_lut_3d_max(int lut_size);
 struct drm_color_lut *coeffs_to_lut(data_t *data,
 				    const gamma_lut_t *gamma,
 				    uint32_t color_depth,
@@ -87,13 +90,27 @@ void set_degamma(data_t *data,
 void set_gamma(data_t *data,
 	       igt_pipe_t *pipe,
 	       const gamma_lut_t *gamma);
+void set_gamma_lut_3d(data_t *data,
+		      igt_pipe_t *pipe,
+		      const gamma_lut_t *gamma);
 void set_ctm(igt_pipe_t *pipe, const double *coefficients);
 void disable_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop);
 
 #define disable_degamma(pipe) disable_prop(pipe, IGT_CRTC_DEGAMMA_LUT)
 #define disable_gamma(pipe) disable_prop(pipe, IGT_CRTC_GAMMA_LUT)
+#define disable_lut_3d(pipe) disable_prop(pipe, IGT_CRTC_LUT_3D)
 #define disable_ctm(pipe) disable_prop(pipe, IGT_CRTC_CTM)
 
+static inline int lut_3d_size(int lut_size)
+{
+	return lut_size * lut_size * lut_size;
+}
+
+static inline int lut_3d_index(int r, int g, int b, int lut_size)
+{
+	return r * lut_size * lut_size + g * lut_size + b;
+}
+
 drmModePropertyBlobPtr get_blob(data_t *data, igt_pipe_t *pipe,
 				enum igt_atomic_crtc_properties prop);
 bool crc_equal(igt_crc_t *a, igt_crc_t *b);
@@ -105,6 +122,7 @@ int pipe_set_property_blob(igt_pipe_t *pipe,
 			   void *ptr, size_t length);
 void invalid_gamma_lut_sizes(data_t *data, enum pipe p);
 void invalid_degamma_lut_sizes(data_t *data, enum pipe p);
+void invalid_gamma_lut_3d_sizes(data_t *data, enum pipe p);
 void invalid_ctm_matrix_sizes(data_t *data, enum pipe p);
 
 #endif
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_color: 3D LUT tests (rev5)
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
                   ` (6 preceding siblings ...)
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 7/7] tests/kms_color: Add GAMMA_LUT_3D tests Ville Syrjala
@ 2021-09-03 17:25 ` Patchwork
  2021-09-03 19:46 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2021-09-06  6:37 ` [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Modem, Bhanuprakash
  9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2021-09-03 17:25 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 4079 bytes --]

== Series Details ==

Series: tests/kms_color: 3D LUT tests (rev5)
URL   : https://patchwork.freedesktop.org/series/90165/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10550 -> IGTPW_6197
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/index.html

Known issues
------------

  Here are the changes found in IGTPW_6197 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_suspend@basic-s0:
    - fi-kbl-soraka:      [PASS][1] -> [INCOMPLETE][2] ([i915#155])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/fi-kbl-soraka/igt@gem_exec_suspend@basic-s0.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/fi-kbl-soraka/igt@gem_exec_suspend@basic-s0.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@execlists:
    - fi-icl-y:           [DMESG-FAIL][3] ([i915#1993]) -> [PASS][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/fi-icl-y/igt@i915_selftest@live@execlists.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/fi-icl-y/igt@i915_selftest@live@execlists.html

  * igt@kms_chamelium@hdmi-edid-read:
    - fi-kbl-7500u:       [FAIL][5] ([i915#3449]) -> [PASS][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/fi-kbl-7500u/igt@kms_chamelium@hdmi-edid-read.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/fi-kbl-7500u/igt@kms_chamelium@hdmi-edid-read.html

  
  [i915#155]: https://gitlab.freedesktop.org/drm/intel/issues/155
  [i915#1993]: https://gitlab.freedesktop.org/drm/intel/issues/1993
  [i915#3449]: https://gitlab.freedesktop.org/drm/intel/issues/3449


Participating hosts (45 -> 39)
------------------------------

  Missing    (6): bat-adls-5 bat-dg1-5 fi-bsw-cyan bat-adlp-4 fi-bdw-samus bat-jsl-1 


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_6197 -> IGTPW_6197

  CI-20190529: 20190529
  CI_DRM_10550: 07f6ce3dba287a2aa8a62cdd3b7d46ea0676007f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_6197: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/index.html
  IGT_6197: 40888f97a6ad219f4ed48a1830d0ef3c9617d006 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git



== Testlist changes ==

+igt@kms_color@pipe-a-gamma-lut-3d
+igt@kms_color@pipe-a-invalid-ctm-matrix-sizes
+igt@kms_color@pipe-a-invalid-degamma-lut-sizes
+igt@kms_color@pipe-a-invalid-gamma-lut-3d-sizes
+igt@kms_color@pipe-a-invalid-gamma-lut-sizes
+igt@kms_color@pipe-b-gamma-lut-3d
+igt@kms_color@pipe-b-invalid-ctm-matrix-sizes
+igt@kms_color@pipe-b-invalid-degamma-lut-sizes
+igt@kms_color@pipe-b-invalid-gamma-lut-3d-sizes
+igt@kms_color@pipe-b-invalid-gamma-lut-sizes
+igt@kms_color@pipe-c-gamma-lut-3d
+igt@kms_color@pipe-c-invalid-ctm-matrix-sizes
+igt@kms_color@pipe-c-invalid-degamma-lut-sizes
+igt@kms_color@pipe-c-invalid-gamma-lut-3d-sizes
+igt@kms_color@pipe-c-invalid-gamma-lut-sizes
+igt@kms_color@pipe-d-gamma-lut-3d
+igt@kms_color@pipe-d-invalid-ctm-matrix-sizes
+igt@kms_color@pipe-d-invalid-degamma-lut-sizes
+igt@kms_color@pipe-d-invalid-gamma-lut-3d-sizes
+igt@kms_color@pipe-d-invalid-gamma-lut-sizes
+igt@kms_color@pipe-e-gamma-lut-3d
+igt@kms_color@pipe-e-invalid-ctm-matrix-sizes
+igt@kms_color@pipe-e-invalid-degamma-lut-sizes
+igt@kms_color@pipe-e-invalid-gamma-lut-3d-sizes
+igt@kms_color@pipe-e-invalid-gamma-lut-sizes
+igt@kms_color@pipe-f-gamma-lut-3d
+igt@kms_color@pipe-f-invalid-ctm-matrix-sizes
+igt@kms_color@pipe-f-invalid-degamma-lut-sizes
+igt@kms_color@pipe-f-invalid-gamma-lut-3d-sizes
+igt@kms_color@pipe-f-invalid-gamma-lut-sizes
-igt@kms_color@pipe-invalid-ctm-matrix-sizes
-igt@kms_color@pipe-invalid-degamma-lut-sizes
-igt@kms_color@pipe-invalid-gamma-lut-sizes
-igt@kms_color_chamelium@pipe-invalid-ctm-matrix-sizes
-igt@kms_color_chamelium@pipe-invalid-degamma-lut-sizes
-igt@kms_color_chamelium@pipe-invalid-gamma-lut-sizes

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/index.html

[-- Attachment #2: Type: text/html, Size: 4948 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for tests/kms_color: 3D LUT tests (rev5)
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
                   ` (7 preceding siblings ...)
  2021-09-03 17:25 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_color: 3D LUT tests (rev5) Patchwork
@ 2021-09-03 19:46 ` Patchwork
  2021-09-06  6:37 ` [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Modem, Bhanuprakash
  9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2021-09-03 19:46 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 30252 bytes --]

== Series Details ==

Series: tests/kms_color: 3D LUT tests (rev5)
URL   : https://patchwork.freedesktop.org/series/90165/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10550_full -> IGTPW_6197_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/index.html

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_6197_full:

### IGT changes ###

#### Possible regressions ####

  * {igt@kms_color@pipe-d-gamma-lut-3d} (NEW):
    - shard-tglb:         NOTRUN -> [SKIP][1] +6 similar issues
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb1/igt@kms_color@pipe-d-gamma-lut-3d.html

  
New tests
---------

  New tests have been introduced between CI_DRM_10550_full and IGTPW_6197_full:

### New IGT tests (20) ###

  * igt@kms_color@pipe-a-gamma-lut-3d:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_color@pipe-a-invalid-ctm-matrix-sizes:
    - Statuses : 4 pass(s) 1 skip(s)
    - Exec time: [0.0, 0.00] s

  * igt@kms_color@pipe-a-invalid-degamma-lut-sizes:
    - Statuses : 4 pass(s) 1 skip(s)
    - Exec time: [0.0, 0.01] s

  * igt@kms_color@pipe-a-invalid-gamma-lut-3d-sizes:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  * igt@kms_color@pipe-a-invalid-gamma-lut-sizes:
    - Statuses : 6 pass(s)
    - Exec time: [0.00] s

  * igt@kms_color@pipe-b-gamma-lut-3d:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  * igt@kms_color@pipe-b-invalid-ctm-matrix-sizes:
    - Statuses : 5 pass(s) 1 skip(s)
    - Exec time: [0.0, 0.00] s

  * igt@kms_color@pipe-b-invalid-degamma-lut-sizes:
    - Statuses : 4 pass(s) 1 skip(s)
    - Exec time: [0.0, 0.00] s

  * igt@kms_color@pipe-b-invalid-gamma-lut-3d-sizes:
    - Statuses : 4 skip(s)
    - Exec time: [0.0] s

  * igt@kms_color@pipe-b-invalid-gamma-lut-sizes:
    - Statuses : 5 pass(s)
    - Exec time: [0.00, 0.01] s

  * igt@kms_color@pipe-c-gamma-lut-3d:
    - Statuses :
    - Exec time: [None] s

  * igt@kms_color@pipe-c-invalid-ctm-matrix-sizes:
    - Statuses : 5 pass(s) 1 skip(s)
    - Exec time: [0.0, 0.00] s

  * igt@kms_color@pipe-c-invalid-degamma-lut-sizes:
    - Statuses : 5 pass(s)
    - Exec time: [0.00] s

  * igt@kms_color@pipe-c-invalid-gamma-lut-3d-sizes:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  * igt@kms_color@pipe-c-invalid-gamma-lut-sizes:
    - Statuses : 3 pass(s) 1 skip(s)
    - Exec time: [0.0, 0.00] s

  * igt@kms_color@pipe-d-gamma-lut-3d:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_color@pipe-d-invalid-ctm-matrix-sizes:
    - Statuses : 1 pass(s) 4 skip(s)
    - Exec time: [0.0, 0.00] s

  * igt@kms_color@pipe-d-invalid-degamma-lut-sizes:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 0.00] s

  * igt@kms_color@pipe-d-invalid-gamma-lut-3d-sizes:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_color@pipe-d-invalid-gamma-lut-sizes:
    - Statuses : 1 pass(s) 3 skip(s)
    - Exec time: [0.0, 0.00] s

  

Known issues
------------

  Here are the changes found in IGTPW_6197_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@feature_discovery@chamelium:
    - shard-tglb:         NOTRUN -> [SKIP][2] ([fdo#111827])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb1/igt@feature_discovery@chamelium.html

  * igt@feature_discovery@display-2x:
    - shard-iclb:         NOTRUN -> [SKIP][3] ([i915#1839])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb3/igt@feature_discovery@display-2x.html

  * igt@gem_create@create-massive:
    - shard-snb:          NOTRUN -> [DMESG-WARN][4] ([i915#3002])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-snb5/igt@gem_create@create-massive.html
    - shard-apl:          NOTRUN -> [DMESG-WARN][5] ([i915#3002])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl2/igt@gem_create@create-massive.html

  * igt@gem_ctx_persistence@smoketest:
    - shard-snb:          NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#1099]) +5 similar issues
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-snb7/igt@gem_ctx_persistence@smoketest.html

  * igt@gem_eio@unwedge-stress:
    - shard-iclb:         [PASS][7] -> [TIMEOUT][8] ([i915#2369] / [i915#2481] / [i915#3070])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-iclb6/igt@gem_eio@unwedge-stress.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb1/igt@gem_eio@unwedge-stress.html

  * igt@gem_exec_fair@basic-deadline:
    - shard-kbl:          [PASS][9] -> [FAIL][10] ([i915#2846])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-kbl7/igt@gem_exec_fair@basic-deadline.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl4/igt@gem_exec_fair@basic-deadline.html
    - shard-glk:          [PASS][11] -> [FAIL][12] ([i915#2846])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-glk2/igt@gem_exec_fair@basic-deadline.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk9/igt@gem_exec_fair@basic-deadline.html

  * igt@gem_exec_fair@basic-none-rrul@rcs0:
    - shard-glk:          NOTRUN -> [FAIL][13] ([i915#2842])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk2/igt@gem_exec_fair@basic-none-rrul@rcs0.html

  * igt@gem_exec_fair@basic-pace@vecs0:
    - shard-glk:          [PASS][14] -> [FAIL][15] ([i915#2842]) +2 similar issues
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-glk4/igt@gem_exec_fair@basic-pace@vecs0.html
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk7/igt@gem_exec_fair@basic-pace@vecs0.html

  * igt@gem_exec_fair@basic-throttle@rcs0:
    - shard-iclb:         [PASS][16] -> [FAIL][17] ([i915#2849])
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-iclb8/igt@gem_exec_fair@basic-throttle@rcs0.html
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb7/igt@gem_exec_fair@basic-throttle@rcs0.html

  * igt@gem_exec_params@secure-non-master:
    - shard-iclb:         NOTRUN -> [SKIP][18] ([fdo#112283])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb5/igt@gem_exec_params@secure-non-master.html

  * igt@gem_exec_whisper@basic-contexts-all:
    - shard-glk:          [PASS][19] -> [DMESG-WARN][20] ([i915#118] / [i915#95])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-glk5/igt@gem_exec_whisper@basic-contexts-all.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk5/igt@gem_exec_whisper@basic-contexts-all.html

  * igt@gem_pread@exhaustion:
    - shard-apl:          NOTRUN -> [WARN][21] ([i915#2658]) +1 similar issue
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl6/igt@gem_pread@exhaustion.html

  * igt@gem_pwrite@basic-exhaustion:
    - shard-kbl:          NOTRUN -> [WARN][22] ([i915#2658]) +1 similar issue
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl4/igt@gem_pwrite@basic-exhaustion.html

  * igt@gem_render_copy@yf-tiled-mc-ccs-to-vebox-yf-tiled:
    - shard-iclb:         NOTRUN -> [SKIP][23] ([i915#768]) +3 similar issues
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb3/igt@gem_render_copy@yf-tiled-mc-ccs-to-vebox-yf-tiled.html

  * igt@gem_softpin@evict-snoop:
    - shard-iclb:         NOTRUN -> [SKIP][24] ([fdo#109312])
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb3/igt@gem_softpin@evict-snoop.html

  * igt@gen3_render_tiledy_blits:
    - shard-tglb:         NOTRUN -> [SKIP][25] ([fdo#109289]) +1 similar issue
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb5/igt@gen3_render_tiledy_blits.html
    - shard-iclb:         NOTRUN -> [SKIP][26] ([fdo#109289]) +1 similar issue
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb7/igt@gen3_render_tiledy_blits.html

  * igt@gen9_exec_parse@batch-invalid-length:
    - shard-snb:          NOTRUN -> [SKIP][27] ([fdo#109271]) +370 similar issues
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-snb5/igt@gen9_exec_parse@batch-invalid-length.html

  * igt@gen9_exec_parse@bb-oversize:
    - shard-tglb:         NOTRUN -> [SKIP][28] ([i915#2856])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb1/igt@gen9_exec_parse@bb-oversize.html
    - shard-iclb:         NOTRUN -> [SKIP][29] ([i915#2856])
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb4/igt@gen9_exec_parse@bb-oversize.html

  * igt@i915_pm_rc6_residency@rc6-fence:
    - shard-tglb:         NOTRUN -> [WARN][30] ([i915#2681])
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb7/igt@i915_pm_rc6_residency@rc6-fence.html
    - shard-iclb:         NOTRUN -> [WARN][31] ([i915#1804] / [i915#2684])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb3/igt@i915_pm_rc6_residency@rc6-fence.html

  * igt@i915_suspend@sysfs-reader:
    - shard-apl:          [PASS][32] -> [DMESG-WARN][33] ([i915#180])
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-apl6/igt@i915_suspend@sysfs-reader.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl8/igt@i915_suspend@sysfs-reader.html

  * igt@kms_atomic@plane-primary-overlay-mutable-zpos:
    - shard-tglb:         NOTRUN -> [SKIP][34] ([i915#404])
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb7/igt@kms_atomic@plane-primary-overlay-mutable-zpos.html
    - shard-iclb:         NOTRUN -> [SKIP][35] ([i915#404])
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb3/igt@kms_atomic@plane-primary-overlay-mutable-zpos.html

  * igt@kms_big_fb@linear-32bpp-rotate-180:
    - shard-glk:          NOTRUN -> [DMESG-WARN][36] ([i915#118] / [i915#95])
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk7/igt@kms_big_fb@linear-32bpp-rotate-180.html

  * igt@kms_big_fb@x-tiled-64bpp-rotate-270:
    - shard-iclb:         NOTRUN -> [SKIP][37] ([fdo#110725] / [fdo#111614]) +2 similar issues
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb5/igt@kms_big_fb@x-tiled-64bpp-rotate-270.html

  * igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-180-hflip:
    - shard-glk:          NOTRUN -> [SKIP][38] ([fdo#109271] / [i915#3777])
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk5/igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-180-hflip.html

  * igt@kms_big_fb@y-tiled-64bpp-rotate-270:
    - shard-tglb:         NOTRUN -> [SKIP][39] ([fdo#111614]) +1 similar issue
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb5/igt@kms_big_fb@y-tiled-64bpp-rotate-270.html

  * igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-0-hflip:
    - shard-kbl:          NOTRUN -> [SKIP][40] ([fdo#109271] / [i915#3777]) +1 similar issue
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl6/igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-0-hflip.html

  * igt@kms_big_fb@yf-tiled-64bpp-rotate-0:
    - shard-tglb:         NOTRUN -> [SKIP][41] ([fdo#111615]) +2 similar issues
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb2/igt@kms_big_fb@yf-tiled-64bpp-rotate-0.html

  * igt@kms_big_fb@yf-tiled-max-hw-stride-32bpp-rotate-0-hflip:
    - shard-apl:          NOTRUN -> [SKIP][42] ([fdo#109271] / [i915#3777]) +2 similar issues
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl1/igt@kms_big_fb@yf-tiled-max-hw-stride-32bpp-rotate-0-hflip.html

  * igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-0-hflip-async-flip:
    - shard-iclb:         NOTRUN -> [SKIP][43] ([fdo#110723]) +2 similar issues
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb5/igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-0-hflip-async-flip.html

  * igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_rc_ccs_cc:
    - shard-iclb:         NOTRUN -> [SKIP][44] ([fdo#109278] / [i915#3886]) +8 similar issues
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb5/igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_rc_ccs_cc.html

  * igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs:
    - shard-tglb:         NOTRUN -> [SKIP][45] ([i915#3689] / [i915#3886]) +2 similar issues
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb8/igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs.html

  * igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_mc_ccs:
    - shard-kbl:          NOTRUN -> [SKIP][46] ([fdo#109271] / [i915#3886]) +10 similar issues
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl2/igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_mc_ccs.html

  * igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_mc_ccs:
    - shard-glk:          NOTRUN -> [SKIP][47] ([fdo#109271] / [i915#3886]) +6 similar issues
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk2/igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_mc_ccs.html

  * igt@kms_ccs@pipe-c-bad-rotation-90-y_tiled_gen12_mc_ccs:
    - shard-apl:          NOTRUN -> [SKIP][48] ([fdo#109271] / [i915#3886]) +12 similar issues
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl7/igt@kms_ccs@pipe-c-bad-rotation-90-y_tiled_gen12_mc_ccs.html

  * igt@kms_ccs@pipe-d-bad-aux-stride-y_tiled_gen12_mc_ccs:
    - shard-tglb:         NOTRUN -> [SKIP][49] ([i915#3689]) +8 similar issues
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb3/igt@kms_ccs@pipe-d-bad-aux-stride-y_tiled_gen12_mc_ccs.html

  * igt@kms_chamelium@hdmi-cmp-planar-formats:
    - shard-iclb:         NOTRUN -> [SKIP][50] ([fdo#109284] / [fdo#111827]) +5 similar issues
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb6/igt@kms_chamelium@hdmi-cmp-planar-formats.html

  * igt@kms_chamelium@vga-edid-read:
    - shard-glk:          NOTRUN -> [SKIP][51] ([fdo#109271] / [fdo#111827]) +6 similar issues
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk7/igt@kms_chamelium@vga-edid-read.html

  * igt@kms_color_chamelium@pipe-a-ctm-0-75:
    - shard-kbl:          NOTRUN -> [SKIP][52] ([fdo#109271] / [fdo#111827]) +12 similar issues
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl1/igt@kms_color_chamelium@pipe-a-ctm-0-75.html

  * igt@kms_color_chamelium@pipe-a-ctm-blue-to-red:
    - shard-snb:          NOTRUN -> [SKIP][53] ([fdo#109271] / [fdo#111827]) +15 similar issues
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-snb5/igt@kms_color_chamelium@pipe-a-ctm-blue-to-red.html

  * igt@kms_color_chamelium@pipe-a-ctm-limited-range:
    - shard-apl:          NOTRUN -> [SKIP][54] ([fdo#109271] / [fdo#111827]) +18 similar issues
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl1/igt@kms_color_chamelium@pipe-a-ctm-limited-range.html

  * igt@kms_color_chamelium@pipe-b-ctm-negative:
    - shard-tglb:         NOTRUN -> [SKIP][55] ([fdo#109284] / [fdo#111827]) +5 similar issues
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb3/igt@kms_color_chamelium@pipe-b-ctm-negative.html

  * igt@kms_content_protection@dp-mst-type-0:
    - shard-iclb:         NOTRUN -> [SKIP][56] ([i915#3116])
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb7/igt@kms_content_protection@dp-mst-type-0.html

  * igt@kms_content_protection@lic:
    - shard-apl:          NOTRUN -> [TIMEOUT][57] ([i915#1319])
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl7/igt@kms_content_protection@lic.html

  * igt@kms_cursor_crc@pipe-a-cursor-512x170-offscreen:
    - shard-iclb:         NOTRUN -> [SKIP][58] ([fdo#109278] / [fdo#109279]) +3 similar issues
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb8/igt@kms_cursor_crc@pipe-a-cursor-512x170-offscreen.html

  * igt@kms_cursor_crc@pipe-a-cursor-512x512-onscreen:
    - shard-tglb:         NOTRUN -> [SKIP][59] ([fdo#109279] / [i915#3359]) +3 similar issues
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb8/igt@kms_cursor_crc@pipe-a-cursor-512x512-onscreen.html

  * igt@kms_cursor_crc@pipe-a-cursor-suspend:
    - shard-kbl:          [PASS][60] -> [DMESG-WARN][61] ([i915#180])
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-kbl2/igt@kms_cursor_crc@pipe-a-cursor-suspend.html
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl4/igt@kms_cursor_crc@pipe-a-cursor-suspend.html

  * igt@kms_cursor_crc@pipe-b-cursor-32x32-sliding:
    - shard-tglb:         NOTRUN -> [SKIP][62] ([i915#3319]) +1 similar issue
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb1/igt@kms_cursor_crc@pipe-b-cursor-32x32-sliding.html

  * igt@kms_cursor_crc@pipe-b-cursor-max-size-sliding:
    - shard-tglb:         NOTRUN -> [SKIP][63] ([i915#3359]) +1 similar issue
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb2/igt@kms_cursor_crc@pipe-b-cursor-max-size-sliding.html

  * igt@kms_cursor_crc@pipe-b-cursor-size-change:
    - shard-glk:          [PASS][64] -> [FAIL][65] ([i915#3444])
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-glk8/igt@kms_cursor_crc@pipe-b-cursor-size-change.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk1/igt@kms_cursor_crc@pipe-b-cursor-size-change.html

  * igt@kms_cursor_crc@pipe-c-cursor-suspend:
    - shard-apl:          NOTRUN -> [DMESG-WARN][66] ([i915#180])
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl2/igt@kms_cursor_crc@pipe-c-cursor-suspend.html

  * igt@kms_cursor_legacy@cursorb-vs-flipa-atomic-transitions-varying-size:
    - shard-iclb:         NOTRUN -> [SKIP][67] ([fdo#109274] / [fdo#109278]) +1 similar issue
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb3/igt@kms_cursor_legacy@cursorb-vs-flipa-atomic-transitions-varying-size.html

  * igt@kms_cursor_legacy@pipe-d-single-bo:
    - shard-glk:          NOTRUN -> [SKIP][68] ([fdo#109271] / [i915#533]) +1 similar issue
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk7/igt@kms_cursor_legacy@pipe-d-single-bo.html
    - shard-apl:          NOTRUN -> [SKIP][69] ([fdo#109271] / [i915#533])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl7/igt@kms_cursor_legacy@pipe-d-single-bo.html

  * igt@kms_cursor_legacy@pipe-d-single-move:
    - shard-iclb:         NOTRUN -> [SKIP][70] ([fdo#109278]) +35 similar issues
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb6/igt@kms_cursor_legacy@pipe-d-single-move.html

  * igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
    - shard-iclb:         NOTRUN -> [SKIP][71] ([fdo#109274]) +2 similar issues
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb2/igt@kms_flip@2x-plain-flip-fb-recreate-interruptible.html

  * igt@kms_flip@flip-vs-suspend@a-dp1:
    - shard-kbl:          [PASS][72] -> [INCOMPLETE][73] ([i915#155])
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-kbl7/igt@kms_flip@flip-vs-suspend@a-dp1.html
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl3/igt@kms_flip@flip-vs-suspend@a-dp1.html

  * igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs:
    - shard-kbl:          NOTRUN -> [SKIP][74] ([fdo#109271] / [i915#2672])
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl3/igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-mmap-cpu:
    - shard-glk:          NOTRUN -> [SKIP][75] ([fdo#109271]) +103 similar issues
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk2/igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-mmap-cpu.html

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-indfb-plflip-blt:
    - shard-tglb:         NOTRUN -> [SKIP][76] ([fdo#111825]) +27 similar issues
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb2/igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-indfb-plflip-blt.html

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-shrfb-plflip-blt:
    - shard-iclb:         NOTRUN -> [SKIP][77] ([fdo#109280]) +22 similar issues
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb7/igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-shrfb-plflip-blt.html

  * igt@kms_frontbuffer_tracking@psr-rgb101010-draw-mmap-wc:
    - shard-kbl:          NOTRUN -> [SKIP][78] ([fdo#109271]) +203 similar issues
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl7/igt@kms_frontbuffer_tracking@psr-rgb101010-draw-mmap-wc.html

  * igt@kms_hdr@static-swap:
    - shard-tglb:         NOTRUN -> [SKIP][79] ([i915#1187])
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb3/igt@kms_hdr@static-swap.html
    - shard-iclb:         NOTRUN -> [SKIP][80] ([i915#1187])
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb8/igt@kms_hdr@static-swap.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
    - shard-kbl:          NOTRUN -> [SKIP][81] ([fdo#109271] / [i915#533])
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl7/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html

  * igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
    - shard-kbl:          NOTRUN -> [FAIL][82] ([fdo#108145] / [i915#265]) +1 similar issue
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl6/igt@kms_plane_alpha_blend@pipe-c-alpha-7efc.html
    - shard-apl:          NOTRUN -> [FAIL][83] ([fdo#108145] / [i915#265]) +1 similar issue
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl1/igt@kms_plane_alpha_blend@pipe-c-alpha-7efc.html

  * igt@kms_plane_lowres@pipe-b-tiling-yf:
    - shard-tglb:         NOTRUN -> [SKIP][84] ([fdo#112054])
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb1/igt@kms_plane_lowres@pipe-b-tiling-yf.html

  * igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping:
    - shard-kbl:          NOTRUN -> [SKIP][85] ([fdo#109271] / [i915#2733])
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl7/igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping.html

  * igt@kms_prime@basic-crc@first-to-second:
    - shard-iclb:         NOTRUN -> [SKIP][86] ([i915#1836])
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb6/igt@kms_prime@basic-crc@first-to-second.html

  * igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-1:
    - shard-apl:          NOTRUN -> [SKIP][87] ([fdo#109271] / [i915#658]) +2 similar issues
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl2/igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-1.html

  * igt@kms_psr2_sf@plane-move-sf-dmg-area-0:
    - shard-tglb:         NOTRUN -> [SKIP][88] ([i915#2920]) +1 similar issue
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb5/igt@kms_psr2_sf@plane-move-sf-dmg-area-0.html
    - shard-iclb:         NOTRUN -> [SKIP][89] ([i915#658]) +1 similar issue
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb6/igt@kms_psr2_sf@plane-move-sf-dmg-area-0.html

  * igt@kms_psr2_sf@plane-move-sf-dmg-area-2:
    - shard-glk:          NOTRUN -> [SKIP][90] ([fdo#109271] / [i915#658]) +3 similar issues
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk5/igt@kms_psr2_sf@plane-move-sf-dmg-area-2.html

  * igt@kms_psr2_sf@plane-move-sf-dmg-area-3:
    - shard-iclb:         NOTRUN -> [SKIP][91] ([i915#2920])
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb2/igt@kms_psr2_sf@plane-move-sf-dmg-area-3.html

  * igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1:
    - shard-kbl:          NOTRUN -> [SKIP][92] ([fdo#109271] / [i915#658]) +1 similar issue
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl1/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1.html

  * igt@kms_psr@psr2_sprite_mmap_gtt:
    - shard-iclb:         NOTRUN -> [SKIP][93] ([fdo#109441])
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb5/igt@kms_psr@psr2_sprite_mmap_gtt.html

  * igt@kms_vblank@pipe-c-ts-continuation-suspend:
    - shard-kbl:          NOTRUN -> [DMESG-WARN][94] ([i915#180])
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl3/igt@kms_vblank@pipe-c-ts-continuation-suspend.html

  * igt@kms_vrr@flip-dpms:
    - shard-iclb:         NOTRUN -> [SKIP][95] ([fdo#109502])
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb3/igt@kms_vrr@flip-dpms.html

  * igt@kms_writeback@writeback-check-output:
    - shard-apl:          NOTRUN -> [SKIP][96] ([fdo#109271] / [i915#2437]) +1 similar issue
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl6/igt@kms_writeback@writeback-check-output.html
    - shard-iclb:         NOTRUN -> [SKIP][97] ([i915#2437])
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb8/igt@kms_writeback@writeback-check-output.html
    - shard-kbl:          NOTRUN -> [SKIP][98] ([fdo#109271] / [i915#2437])
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl2/igt@kms_writeback@writeback-check-output.html
    - shard-tglb:         NOTRUN -> [SKIP][99] ([i915#2437])
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb6/igt@kms_writeback@writeback-check-output.html
    - shard-glk:          NOTRUN -> [SKIP][100] ([fdo#109271] / [i915#2437])
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk1/igt@kms_writeback@writeback-check-output.html

  * igt@nouveau_crc@pipe-b-ctx-flip-skip-current-frame:
    - shard-apl:          NOTRUN -> [SKIP][101] ([fdo#109271]) +234 similar issues
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl2/igt@nouveau_crc@pipe-b-ctx-flip-skip-current-frame.html

  * igt@nouveau_crc@pipe-c-ctx-flip-skip-current-frame:
    - shard-tglb:         NOTRUN -> [SKIP][102] ([i915#2530])
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb3/igt@nouveau_crc@pipe-c-ctx-flip-skip-current-frame.html

  * igt@nouveau_crc@pipe-c-source-rg:
    - shard-iclb:         NOTRUN -> [SKIP][103] ([i915#2530]) +1 similar issue
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb2/igt@nouveau_crc@pipe-c-source-rg.html

  * igt@prime_nv_pcopy@test3_2:
    - shard-tglb:         NOTRUN -> [SKIP][104] ([fdo#109291]) +3 similar issues
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb8/igt@prime_nv_pcopy@test3_2.html

  * igt@prime_udl:
    - shard-iclb:         NOTRUN -> [SKIP][105] ([fdo#109291]) +1 similar issue
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb4/igt@prime_udl.html

  * igt@sysfs_clients@fair-0:
    - shard-glk:          NOTRUN -> [SKIP][106] ([fdo#109271] / [i915#2994])
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk5/igt@sysfs_clients@fair-0.html

  * igt@sysfs_clients@fair-7:
    - shard-apl:          NOTRUN -> [SKIP][107] ([fdo#109271] / [i915#2994]) +2 similar issues
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl1/igt@sysfs_clients@fair-7.html

  * igt@sysfs_clients@split-10:
    - shard-iclb:         NOTRUN -> [SKIP][108] ([i915#2994])
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb2/igt@sysfs_clients@split-10.html

  * igt@sysfs_clients@split-25:
    - shard-kbl:          NOTRUN -> [SKIP][109] ([fdo#109271] / [i915#2994]) +1 similar issue
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl6/igt@sysfs_clients@split-25.html

  * igt@sysfs_timeslice_duration@timeout@vecs0:
    - shard-iclb:         [PASS][110] -> [FAIL][111] ([i915#1755])
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-iclb3/igt@sysfs_timeslice_duration@timeout@vecs0.html
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb3/igt@sysfs_timeslice_duration@timeout@vecs0.html
    - shard-glk:          [PASS][112] -> [FAIL][113] ([i915#1755])
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-glk7/igt@sysfs_timeslice_duration@timeout@vecs0.html
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-glk4/igt@sysfs_timeslice_duration@timeout@vecs0.html
    - shard-apl:          NOTRUN -> [FAIL][114] ([i915#1755])
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-apl3/igt@sysfs_timeslice_duration@timeout@vecs0.html
    - shard-tglb:         [PASS][115] -> [FAIL][116] ([i915#1755])
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-tglb1/igt@sysfs_timeslice_duration@timeout@vecs0.html
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb7/igt@sysfs_timeslice_duration@timeout@vecs0.html

  
#### Possible fixes ####

  * igt@feature_discovery@psr2:
    - shard-iclb:         [SKIP][117] ([i915#658]) -> [PASS][118]
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-iclb4/igt@feature_discovery@psr2.html
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-iclb2/igt@feature_discovery@psr2.html

  * igt@gem_exec_fair@basic-pace@rcs0:
    - shard-kbl:          [FAIL][119] ([i915#2842]) -> [PASS][120]
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-kbl2/igt@gem_exec_fair@basic-pace@rcs0.html
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-kbl6/igt@gem_exec_fair@basic-pace@rcs0.html

  * igt@gem_exec_fair@basic-pace@vcs0:
    - shard-tglb:         [FAIL][121] ([i915#2842]) -> [PASS][122]
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10550/shard-tglb3/igt@gem_exec_fair@basic-pace@vcs0.html
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/shard-tglb8/igt@gem_exec_fair@basic-pace@vcs0.html

  * igt@gem_exec_fair@basic-throttle@rcs0:

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6197/index.html

[-- Attachment #2: Type: text/html, Size: 34296 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests
  2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
                   ` (8 preceding siblings ...)
  2021-09-03 19:46 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2021-09-06  6:37 ` Modem, Bhanuprakash
  9 siblings, 0 replies; 19+ messages in thread
From: Modem, Bhanuprakash @ 2021-09-06  6:37 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev@lists.freedesktop.org

> From: Ville Syrjala <ville.syrjala@linux.intel.com>
> Sent: Friday, September 3, 2021 9:58 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Subject: [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Updated set of 3D LUT tests and associated refactoring/fixes.
> 
> Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> 
> Ville Syrjälä (7):
>   tests/kms_color_chamelium: Remove invalid LUT size tests
>   tests/kms_color: Refactor invalid LUT size tests
>   tests/kms_color: Store r/g/b separately for LUT color tests
>   tests/kms_color: Pass pipe to invalid LUT size tests
>   tests/kms_color: Run each subtest only for a single connector
>   lib/kms: Add GAMMA_LUT_3D support
>   tests/kms_color: Add GAMMA_LUT_3D tests
 
Except few minor comments, overall this series is looks good to me.

-Bhanu

> 
>  lib/igt_kms.c               |   5 +
>  lib/igt_kms.h               |   2 +
>  tests/kms_color.c           | 782 +++++++++++++++++++++---------------
>  tests/kms_color_chamelium.c |  11 -
>  tests/kms_color_helper.c    | 181 +++++----
>  tests/kms_color_helper.h    |  27 +-
>  6 files changed, 587 insertions(+), 421 deletions(-)
> 
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 2/7] tests/kms_color: Refactor invalid LUT size tests
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 2/7] tests/kms_color: Refactor " Ville Syrjala
@ 2021-09-06  6:37   ` Modem, Bhanuprakash
  0 siblings, 0 replies; 19+ messages in thread
From: Modem, Bhanuprakash @ 2021-09-06  6:37 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev@lists.freedesktop.org

> From: Ville Syrjala <ville.syrjala@linux.intel.com>
> Sent: Friday, September 3, 2021 9:58 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Subject: [PATCH i-g-t v3 2/7] tests/kms_color: Refactor invalid LUT size tests
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Reuse the same code for all invalid LUT size tests.
> 
> v2: Drop the pointless return statements in void functions
> 
> Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

LGTM
Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>

> ---
>  tests/kms_color_helper.c | 81 +++++++++++++---------------------------
>  1 file changed, 26 insertions(+), 55 deletions(-)
> 
> diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
> index 5f223a88129f..68fa5f0e42ea 100644
> --- a/tests/kms_color_helper.c
> +++ b/tests/kms_color_helper.c
> @@ -277,77 +277,48 @@ pipe_set_property_blob(igt_pipe_t *pipe,
>  				       COMMIT_ATOMIC : COMMIT_LEGACY);
>  }
> 
> -void
> -invalid_gamma_lut_sizes(data_t *data)
> +static void
> +invalid_lut_sizes(data_t *data, enum igt_atomic_crtc_properties prop, int
> size)
>  {
>  	igt_display_t *display = &data->display;
>  	igt_pipe_t *pipe = &display->pipes[0];
> -	size_t gamma_lut_size = data->gamma_lut_size *
> -				sizeof(struct drm_color_lut);
> -	struct drm_color_lut *gamma_lut;
> +	struct drm_color_lut *lut;
> +	size_t lut_size = size * sizeof(lut[0]);
> 
> -	igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_GAMMA_LUT));
> +	igt_require(igt_pipe_obj_has_prop(pipe, prop));
> 
> -	gamma_lut = malloc(gamma_lut_size * 2);
> +	lut = malloc(lut_size * 2);
> 
>  	igt_display_commit2(display,
>  			    display->is_atomic ?
>  			    COMMIT_ATOMIC : COMMIT_LEGACY);
> 
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> -					     gamma_lut, 1), -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> -					     gamma_lut, gamma_lut_size + 1),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> -					     gamma_lut, gamma_lut_size - 1),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> -					     gamma_lut, gamma_lut_size +
> -					     sizeof(struct drm_color_lut)),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT,
> -		      pipe->crtc_id), -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT,
> -		      4096 * 4096), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
> +					     1), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
> +					     lut_size + 1), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
> +					     lut_size - 1), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob(pipe, prop, lut,
> +					     lut_size + sizeof(struct drm_color_lut)), -
> EINVAL);
> +	igt_assert_eq(pipe_set_property_blob_id(pipe, prop,
> +						pipe->crtc_id), -EINVAL);
> +	igt_assert_eq(pipe_set_property_blob_id(pipe, prop,
> +						4096 * 4096), -EINVAL);
> 
> -	free(gamma_lut);
> +	free(lut);
> +}
> +
> +void
> +invalid_gamma_lut_sizes(data_t *data)
> +{
> +	invalid_lut_sizes(data, IGT_CRTC_GAMMA_LUT, data->gamma_lut_size);
>  }
> 
>  void
>  invalid_degamma_lut_sizes(data_t *data)
>  {
> -	igt_display_t *display = &data->display;
> -	igt_pipe_t *pipe = &display->pipes[0];
> -	size_t degamma_lut_size = data->degamma_lut_size *
> -				  sizeof(struct drm_color_lut);
> -	struct drm_color_lut *degamma_lut;
> -
> -	igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_DEGAMMA_LUT));
> -
> -	degamma_lut = malloc(degamma_lut_size * 2);
> -
> -	igt_display_commit2(display, display->is_atomic ?
> -			    COMMIT_ATOMIC : COMMIT_LEGACY);
> -
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> -					     degamma_lut, 1), -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> -					     degamma_lut, degamma_lut_size + 1),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> -					     degamma_lut, degamma_lut_size - 1),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> -					     degamma_lut, degamma_lut_size +
> -					     sizeof(struct drm_color_lut)),
> -					     -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT,
> -						pipe->crtc_id), -EINVAL);
> -	igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT,
> -						4096 * 4096), -EINVAL);
> -
> -	free(degamma_lut);
> +	invalid_lut_sizes(data, IGT_CRTC_DEGAMMA_LUT, data->degamma_lut_size);
>  }
> 
>  void invalid_ctm_matrix_sizes(data_t *data)
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to invalid LUT size tests
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to invalid LUT size tests Ville Syrjala
@ 2021-09-06  6:37   ` Modem, Bhanuprakash
  2021-09-07 17:26     ` Ville Syrjälä
  0 siblings, 1 reply; 19+ messages in thread
From: Modem, Bhanuprakash @ 2021-09-06  6:37 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev@lists.freedesktop.org

> From: Ville Syrjala <ville.syrjala@linux.intel.com>
> Sent: Friday, September 3, 2021 9:58 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Subject: [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to invalid LUT size
> tests
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Each pipe can have a different LUT sizes, so run the invalid LUT
> size tests once for each pipe.
> 
> This also makes sure data->(de)gamma_lut_size are properly initialized
> prior to running these subtests.
> 
> Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_color.c        | 73 +++++++++++++++++++++++++---------------
>  tests/kms_color_helper.c | 17 +++++-----
>  tests/kms_color_helper.h |  7 ++--
>  3 files changed, 58 insertions(+), 39 deletions(-)
> 
> diff --git a/tests/kms_color.c b/tests/kms_color.c
> index 9105076aba4f..dabc6963e9e0 100644
> --- a/tests/kms_color.c
> +++ b/tests/kms_color.c
> @@ -638,6 +638,26 @@ static void test_pipe_limited_range_ctm(data_t *data,
>  }
>  #endif
> 
> +static void
> +prep_pipe(data_t *data, enum pipe p)
> +{
> +	igt_require_pipe(&data->display, p);
> +
> +	if (igt_pipe_obj_has_prop(&data->display.pipes[p],
> IGT_CRTC_DEGAMMA_LUT_SIZE)) {
> +		data->degamma_lut_size =
> +			igt_pipe_obj_get_prop(&data->display.pipes[p],
> +					      IGT_CRTC_DEGAMMA_LUT_SIZE);
> +		igt_assert_lt(0, data->degamma_lut_size);
> +	}
> +
> +	if (igt_pipe_obj_has_prop(&data->display.pipes[p],
> IGT_CRTC_GAMMA_LUT_SIZE)) {
> +		data->gamma_lut_size =
> +			igt_pipe_obj_get_prop(&data->display.pipes[p],
> +					      IGT_CRTC_GAMMA_LUT_SIZE);
> +		igt_assert_lt(0, data->gamma_lut_size);
> +	}
> +}
> +
>  static void
>  run_tests_for_pipe(data_t *data, enum pipe p)
>  {
> @@ -652,10 +672,10 @@ run_tests_for_pipe(data_t *data, enum pipe p)
>  	};
> 
>  	igt_fixture {
> +		prep_pipe(data, p);
> +
>  		igt_require_pipe_crc(data->drm_fd);
> 
> -		igt_require_pipe(&data->display, p);
> -
>  		pipe = &data->display.pipes[p];
>  		igt_require(pipe->n_planes >= 0);
> 
> @@ -665,20 +685,6 @@ run_tests_for_pipe(data_t *data, enum pipe p)
>  						  primary->pipe->pipe,
>  						  INTEL_PIPE_CRC_SOURCE_AUTO);
> 
> -		if (igt_pipe_obj_has_prop(&data->display.pipes[p],
> IGT_CRTC_DEGAMMA_LUT_SIZE)) {
> -			data->degamma_lut_size =
> -				igt_pipe_obj_get_prop(&data->display.pipes[p],
> -						      IGT_CRTC_DEGAMMA_LUT_SIZE);
> -			igt_assert_lt(0, data->degamma_lut_size);
> -		}
> -
> -		if (igt_pipe_obj_has_prop(&data->display.pipes[p],
> IGT_CRTC_GAMMA_LUT_SIZE)) {
> -			data->gamma_lut_size =
> -				igt_pipe_obj_get_prop(&data->display.pipes[p],
> -						      IGT_CRTC_GAMMA_LUT_SIZE);
> -			igt_assert_lt(0, data->gamma_lut_size);
> -		}
> -
>  		igt_display_require_output_on_pipe(&data->display, p);
>  	}
> 
> @@ -865,6 +871,25 @@ run_tests_for_pipe(data_t *data, enum pipe p)
>  	}
>  }
> 
> +static void
> +run_invalid_tests_for_pipe(data_t *data, enum pipe p)
> +{
> +	igt_fixture
> +		prep_pipe(data, p);
> +
> +	igt_describe("Negative check for invalid gamma lut sizes");
> +	igt_subtest_f("pipe-%s-invalid-gamma-lut-sizes", kmstest_pipe_name(p))
> +		invalid_gamma_lut_sizes(data, p);
> +
> +	igt_describe("Negative check for invalid degamma lut sizes");
> +	igt_subtest_f("pipe-%s-invalid-degamma-lut-sizes", kmstest_pipe_name(p))
> +		invalid_degamma_lut_sizes(data, p);
> +
> +	igt_describe("Negative check for color tranformation matrix sizes");
> +	igt_subtest_f("pipe-%s-invalid-ctm-matrix-sizes", kmstest_pipe_name(p))
> +		invalid_ctm_matrix_sizes(data, p);
> +}
> +
>  igt_main
>  {
>  	data_t data = {};
> @@ -879,21 +904,13 @@ igt_main
>  		igt_display_require(&data.display, data.drm_fd);
>  	}
> 
> -	for_each_pipe_static(pipe)
> +	for_each_pipe_static(pipe) {
>  		igt_subtest_group
>  			run_tests_for_pipe(&data, pipe);
> 
> -	igt_describe("Negative check for invalid gamma lut sizes");
> -	igt_subtest_f("pipe-invalid-gamma-lut-sizes")
> -		invalid_gamma_lut_sizes(&data);
> -
> -	igt_describe("Negative check for invalid degamma lut sizes");
> -	igt_subtest_f("pipe-invalid-degamma-lut-sizes")
> -		invalid_degamma_lut_sizes(&data);
> -
> -	igt_describe("Negative check for color tranformation matrix sizes");
> -	igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
> -		invalid_ctm_matrix_sizes(&data);
> +		igt_subtest_group
> +			run_invalid_tests_for_pipe(&data, pipe);
> +	}
> 
>  	igt_fixture {
>  		igt_display_fini(&data.display);
> diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
> index 8b08cdaeea5f..d71e7bb2e6f9 100644
> --- a/tests/kms_color_helper.c
> +++ b/tests/kms_color_helper.c
> @@ -287,10 +287,11 @@ pipe_set_property_blob(igt_pipe_t *pipe,
>  }
> 
>  static void
> -invalid_lut_sizes(data_t *data, enum igt_atomic_crtc_properties prop, int
> size)
> +invalid_lut_sizes(data_t *data, enum pipe p,
> +		  enum igt_atomic_crtc_properties prop, int size)
>  {
>  	igt_display_t *display = &data->display;
> -	igt_pipe_t *pipe = &display->pipes[0];
> +	igt_pipe_t *pipe = &display->pipes[p];
>  	struct drm_color_lut *lut;
>  	size_t lut_size = size * sizeof(lut[0]);
> 
> @@ -319,21 +320,21 @@ invalid_lut_sizes(data_t *data, enum
> igt_atomic_crtc_properties prop, int size)
>  }
> 
>  void
> -invalid_gamma_lut_sizes(data_t *data)
> +invalid_gamma_lut_sizes(data_t *data, enum pipe p)
>  {
> -	invalid_lut_sizes(data, IGT_CRTC_GAMMA_LUT, data->gamma_lut_size);
> +	invalid_lut_sizes(data, p, IGT_CRTC_GAMMA_LUT, data->gamma_lut_size);
 
Still, it is possible to get data->gamma_lut_size as NULL, b'coz prep_pipe()
will not initialize if GAMMA_LUT_SIZE prop is not present.

`igt_require(data->gamma_lut_size);` or
`igt_require(igt_pipe_obj_has_prop(p, IGT_CRTC_GAMMA_LUT_SIZE));` before
calling invalid_lut_sizes() can fix this.

>  }
> 
>  void
> -invalid_degamma_lut_sizes(data_t *data)
> +invalid_degamma_lut_sizes(data_t *data, enum pipe p)
>  {
> -	invalid_lut_sizes(data, IGT_CRTC_DEGAMMA_LUT, data->degamma_lut_size);
> +	invalid_lut_sizes(data, p, IGT_CRTC_DEGAMMA_LUT, data-
> >degamma_lut_size);
 
Please consider the above comment.

With above change, this patch is
Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>

- Bhanu

>  }
> 
> -void invalid_ctm_matrix_sizes(data_t *data)
> +void invalid_ctm_matrix_sizes(data_t *data, enum pipe p)
>  {
>  	igt_display_t *display = &data->display;
> -	igt_pipe_t *pipe = &display->pipes[0];
> +	igt_pipe_t *pipe = &display->pipes[p];
>  	void *ptr;
> 
>  	igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_CTM));
> diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
> index 3f49e7cae4c0..bb6f0054f388 100644
> --- a/tests/kms_color_helper.h
> +++ b/tests/kms_color_helper.h
> @@ -103,8 +103,9 @@ int pipe_set_property_blob_id(igt_pipe_t *pipe,
>  int pipe_set_property_blob(igt_pipe_t *pipe,
>  			   enum igt_atomic_crtc_properties prop,
>  			   void *ptr, size_t length);
> -void invalid_gamma_lut_sizes(data_t *data);
> -void invalid_degamma_lut_sizes(data_t *data);
> -void invalid_ctm_matrix_sizes(data_t *data);
> +void invalid_gamma_lut_sizes(data_t *data, enum pipe p);
> +void invalid_degamma_lut_sizes(data_t *data, enum pipe p);
> +void invalid_ctm_matrix_sizes(data_t *data, enum pipe p);
> +
>  #endif
> 
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a single connector
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a single connector Ville Syrjala
@ 2021-09-06  6:38   ` Modem, Bhanuprakash
  2021-09-07 17:34     ` Ville Syrjälä
  0 siblings, 1 reply; 19+ messages in thread
From: Modem, Bhanuprakash @ 2021-09-06  6:38 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev@lists.freedesktop.org

> From: Ville Syrjala <ville.syrjala@linux.intel.com>
> Sent: Friday, September 3, 2021 9:58 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Subject: [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a
> single connector
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> For most of the subtests the used connector should not matter,
> so run each subtest just for a single connector.
> 
> Suggested-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_color.c | 612 +++++++++++++++++++++++-----------------------
>  1 file changed, 306 insertions(+), 306 deletions(-)
> 
> diff --git a/tests/kms_color.c b/tests/kms_color.c
> index dabc6963e9e0..d78c7e211511 100644
> --- a/tests/kms_color.c
> +++ b/tests/kms_color.c
> @@ -37,6 +37,10 @@ static void test_pipe_degamma(data_t *data,
>  		{ 0.0, 1.0, 0.0 },
>  		{ 0.0, 0.0, 1.0 }
>  	};
> +	drmModeModeInfo *mode;
> +	struct igt_fb fb_modeset, fb;
> +	igt_crc_t crc_fullgamma, crc_fullcolors;
> +	int fb_id, fb_modeset_id;
> 
>  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT));
>  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
> @@ -44,69 +48,65 @@ static void test_pipe_degamma(data_t *data,
>  	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
>  	degamma_full = generate_table_max(data->degamma_lut_size);
> 
> -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> output) {
> -		drmModeModeInfo *mode;
> -		struct igt_fb fb_modeset, fb;
> -		igt_crc_t crc_fullgamma, crc_fullcolors;
> -		int fb_id, fb_modeset_id;
> +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> >pipe);
> +	igt_require(output);
> 
> -		igt_output_set_pipe(output, primary->pipe->pipe);
> -		mode = igt_output_get_mode(output);
> +	igt_output_set_pipe(output, primary->pipe->pipe);
> +	mode = igt_output_get_mode(output);
> 
> -		/* Create a framebuffer at the size of the output. */
> -		fb_id = igt_create_fb(data->drm_fd,
> +	/* Create a framebuffer at the size of the output. */
> +	fb_id = igt_create_fb(data->drm_fd,
> +			      mode->hdisplay,
> +			      mode->vdisplay,
> +			      DRM_FORMAT_XRGB8888,
> +			      DRM_FORMAT_MOD_NONE,
> +			      &fb);
> +	igt_assert(fb_id);
 
Minor: we can get rid of extra variables by updating like
`igt_assert(igt_create_fb());`

And this is applicable for all the places.

> +
> +	fb_modeset_id = igt_create_fb(data->drm_fd,
>  				      mode->hdisplay,
>  				      mode->vdisplay,
>  				      DRM_FORMAT_XRGB8888,
>  				      DRM_FORMAT_MOD_NONE,
> -				      &fb);
> -		igt_assert(fb_id);
> +				      &fb_modeset);
> +	igt_assert(fb_modeset_id);
> 
> -		fb_modeset_id = igt_create_fb(data->drm_fd,
> -					      mode->hdisplay,
> -					      mode->vdisplay,
> -					      DRM_FORMAT_XRGB8888,
> -					      DRM_FORMAT_MOD_NONE,
> -					      &fb_modeset);
> -		igt_assert(fb_modeset_id);
> +	igt_plane_set_fb(primary, &fb_modeset);
> +	disable_ctm(primary->pipe);
> +	disable_gamma(primary->pipe);
> +	set_degamma(data, primary->pipe, degamma_linear);
> +	igt_display_commit(&data->display);
> 
> -		igt_plane_set_fb(primary, &fb_modeset);
> -		disable_ctm(primary->pipe);
> -		disable_gamma(primary->pipe);
> -		set_degamma(data, primary->pipe, degamma_linear);
> -		igt_display_commit(&data->display);
> +	/* Draw solid colors with linear degamma transformation. */
> +	paint_rectangles(data, mode, red_green_blue, &fb);
> +	igt_plane_set_fb(primary, &fb);
> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> 
> -		/* Draw solid colors with linear degamma transformation. */
> -		paint_rectangles(data, mode, red_green_blue, &fb);
> -		igt_plane_set_fb(primary, &fb);
> -		igt_display_commit(&data->display);
> -		igt_wait_for_vblank(data->drm_fd,
> -				display->pipes[primary->pipe->pipe].crtc_offset);
> -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> +	/* Draw a gradient with degamma LUT to remap all
> +	 * values to max red/green/blue.
> +	 */
> +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> +	igt_plane_set_fb(primary, &fb);
> +	set_degamma(data, primary->pipe, degamma_full);
> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> 
> -		/* Draw a gradient with degamma LUT to remap all
> -		 * values to max red/green/blue.
> -		 */
> -		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> -		igt_plane_set_fb(primary, &fb);
> -		set_degamma(data, primary->pipe, degamma_full);
> -		igt_display_commit(&data->display);
> -		igt_wait_for_vblank(data->drm_fd,
> -				display->pipes[primary->pipe->pipe].crtc_offset);
> -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> +	/* Verify that the CRC of the software computed output is
> +	 * equal to the CRC of the degamma LUT transformation output.
> +	 */
> +	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> 
> -		/* Verify that the CRC of the software computed output is
> -		 * equal to the CRC of the degamma LUT transformation output.
> -		 */
> -		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> -
> -		disable_degamma(primary->pipe);
> -		igt_plane_set_fb(primary, NULL);
> -		igt_output_set_pipe(output, PIPE_NONE);
> -		igt_display_commit(&data->display);
> -		igt_remove_fb(data->drm_fd, &fb);
> -		igt_remove_fb(data->drm_fd, &fb_modeset);
> -	}
> +	disable_degamma(primary->pipe);
> +	igt_plane_set_fb(primary, NULL);
> +	igt_output_set_pipe(output, PIPE_NONE);
> +	igt_display_commit(&data->display);
> +	igt_remove_fb(data->drm_fd, &fb);
> +	igt_remove_fb(data->drm_fd, &fb_modeset);
> 
>  	free_lut(degamma_linear);
>  	free_lut(degamma_full);
> @@ -127,73 +127,73 @@ static void test_pipe_gamma(data_t *data,
>  		{ 0.0, 1.0, 0.0 },
>  		{ 0.0, 0.0, 1.0 }
>  	};
> +	drmModeModeInfo *mode;
> +	struct igt_fb fb_modeset, fb;
> +	igt_crc_t crc_fullgamma, crc_fullcolors;
> +	int fb_id, fb_modeset_id;
> 
>  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
> 
>  	gamma_full = generate_table_max(data->gamma_lut_size);
> 
> -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> output) {
> -		drmModeModeInfo *mode;
> -		struct igt_fb fb_modeset, fb;
> -		igt_crc_t crc_fullgamma, crc_fullcolors;
> -		int fb_id, fb_modeset_id;
> +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> >pipe);
> +	igt_require(output);
> 
> -		igt_output_set_pipe(output, primary->pipe->pipe);
> -		mode = igt_output_get_mode(output);
> +	igt_output_set_pipe(output, primary->pipe->pipe);
> +	mode = igt_output_get_mode(output);
> 
> -		/* Create a framebuffer at the size of the output. */
> -		fb_id = igt_create_fb(data->drm_fd,
> +	/* Create a framebuffer at the size of the output. */
> +	fb_id = igt_create_fb(data->drm_fd,
> +			      mode->hdisplay,
> +			      mode->vdisplay,
> +			      DRM_FORMAT_XRGB8888,
> +			      DRM_FORMAT_MOD_NONE,
> +			      &fb);
> +	igt_assert(fb_id);
> +
> +	fb_modeset_id = igt_create_fb(data->drm_fd,
>  				      mode->hdisplay,
>  				      mode->vdisplay,
>  				      DRM_FORMAT_XRGB8888,
>  				      DRM_FORMAT_MOD_NONE,
> -				      &fb);
> -		igt_assert(fb_id);
> +				      &fb_modeset);
> +	igt_assert(fb_modeset_id);
> 
> -		fb_modeset_id = igt_create_fb(data->drm_fd,
> -					      mode->hdisplay,
> -					      mode->vdisplay,
> -					      DRM_FORMAT_XRGB8888,
> -					      DRM_FORMAT_MOD_NONE,
> -					      &fb_modeset);
> -		igt_assert(fb_modeset_id);
> +	igt_plane_set_fb(primary, &fb_modeset);
> +	disable_ctm(primary->pipe);
> +	disable_degamma(primary->pipe);
> +	set_gamma(data, primary->pipe, gamma_full);
 
This could be disable_gamma(), right?

> +	igt_display_commit(&data->display);
> 
> -		igt_plane_set_fb(primary, &fb_modeset);
> -		disable_ctm(primary->pipe);
> -		disable_degamma(primary->pipe);
> -		set_gamma(data, primary->pipe, gamma_full);
> -		igt_display_commit(&data->display);
> +	/* Draw solid colors with no gamma transformation. */
> +	paint_rectangles(data, mode, red_green_blue, &fb);
> +	igt_plane_set_fb(primary, &fb);
> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> 
> -		/* Draw solid colors with no gamma transformation. */
> -		paint_rectangles(data, mode, red_green_blue, &fb);
> -		igt_plane_set_fb(primary, &fb);
> -		igt_display_commit(&data->display);
> -		igt_wait_for_vblank(data->drm_fd,
> -				display->pipes[primary->pipe->pipe].crtc_offset);
> -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> +	/* Draw a gradient with gamma LUT to remap all values
> +	 * to max red/green/blue.
> +	 */
> +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> +	igt_plane_set_fb(primary, &fb);
 
And here we need to set the gamma: set_gamma(gamma_max)

With these changes, this patch is
Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>

- Bhanu

> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> 
> -		/* Draw a gradient with gamma LUT to remap all values
> -		 * to max red/green/blue.
> -		 */
> -		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> -		igt_plane_set_fb(primary, &fb);
> -		igt_display_commit(&data->display);
> -		igt_wait_for_vblank(data->drm_fd,
> -				display->pipes[primary->pipe->pipe].crtc_offset);
> -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> +	/* Verify that the CRC of the software computed output is
> +	 * equal to the CRC of the gamma LUT transformation output.
> +	 */
> +	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> 
> -		/* Verify that the CRC of the software computed output is
> -		 * equal to the CRC of the gamma LUT transformation output.
> -		 */
> -		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> -
> -		disable_gamma(primary->pipe);
> -		igt_plane_set_fb(primary, NULL);
> -		igt_output_set_pipe(output, PIPE_NONE);
> -		igt_display_commit(&data->display);
> -		igt_remove_fb(data->drm_fd, &fb);
> -		igt_remove_fb(data->drm_fd, &fb_modeset);
> -	}
> +	disable_gamma(primary->pipe);
> +	igt_plane_set_fb(primary, NULL);
> +	igt_output_set_pipe(output, PIPE_NONE);
> +	igt_display_commit(&data->display);
> +	igt_remove_fb(data->drm_fd, &fb);
> +	igt_remove_fb(data->drm_fd, &fb_modeset);
> 
>  	free_lut(gamma_full);
>  }
> @@ -216,6 +216,10 @@ static void test_pipe_legacy_gamma(data_t *data,
>  	drmModeCrtc *kms_crtc;
>  	uint32_t i, legacy_lut_size;
>  	uint16_t *red_lut, *green_lut, *blue_lut;
> +	drmModeModeInfo *mode;
> +	struct igt_fb fb_modeset, fb;
> +	igt_crc_t crc_fullgamma, crc_fullcolors;
> +	int fb_id, fb_modeset_id;
> 
>  	kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
>  	legacy_lut_size = kms_crtc->gamma_size;
> @@ -225,80 +229,76 @@ static void test_pipe_legacy_gamma(data_t *data,
>  	green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
>  	blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> 
> -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> output) {
> -		drmModeModeInfo *mode;
> -		struct igt_fb fb_modeset, fb;
> -		igt_crc_t crc_fullgamma, crc_fullcolors;
> -		int fb_id, fb_modeset_id;
> +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> >pipe);
> +	igt_require(output);
> 
> -		igt_output_set_pipe(output, primary->pipe->pipe);
> -		mode = igt_output_get_mode(output);
> +	igt_output_set_pipe(output, primary->pipe->pipe);
> +	mode = igt_output_get_mode(output);
> 
> -		/* Create a framebuffer at the size of the output. */
> -		fb_id = igt_create_fb(data->drm_fd,
> +	/* Create a framebuffer at the size of the output. */
> +	fb_id = igt_create_fb(data->drm_fd,
> +			      mode->hdisplay,
> +			      mode->vdisplay,
> +			      DRM_FORMAT_XRGB8888,
> +			      DRM_FORMAT_MOD_NONE,
> +			      &fb);
> +	igt_assert(fb_id);
> +
> +	fb_modeset_id = igt_create_fb(data->drm_fd,
>  				      mode->hdisplay,
>  				      mode->vdisplay,
>  				      DRM_FORMAT_XRGB8888,
>  				      DRM_FORMAT_MOD_NONE,
> -				      &fb);
> -		igt_assert(fb_id);
> -
> -		fb_modeset_id = igt_create_fb(data->drm_fd,
> -					      mode->hdisplay,
> -					      mode->vdisplay,
> -					      DRM_FORMAT_XRGB8888,
> -					      DRM_FORMAT_MOD_NONE,
> -					      &fb_modeset);
> -		igt_assert(fb_modeset_id);
> -
> -		igt_plane_set_fb(primary, &fb_modeset);
> -		disable_degamma(primary->pipe);
> -		disable_gamma(primary->pipe);
> -		disable_ctm(primary->pipe);
> -		igt_display_commit(&data->display);
> -
> -		/* Draw solid colors with no gamma transformation. */
> -		paint_rectangles(data, mode, red_green_blue, &fb);
> -		igt_plane_set_fb(primary, &fb);
> -		igt_display_commit(&data->display);
> -		igt_wait_for_vblank(data->drm_fd,
> -				display->pipes[primary->pipe->pipe].crtc_offset);
> -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> -
> -		/* Draw a gradient with gamma LUT to remap all values
> -		 * to max red/green/blue.
> -		 */
> -		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> -		igt_plane_set_fb(primary, &fb);
> -
> -		red_lut[0] = green_lut[0] = blue_lut[0] = 0;
> -		for (i = 1; i < legacy_lut_size; i++)
> -			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> -		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe-
> >crtc_id,
> -						  legacy_lut_size, red_lut, green_lut,
> blue_lut), 0);
> -		igt_display_commit(&data->display);
> -		igt_wait_for_vblank(data->drm_fd,
> -				display->pipes[primary->pipe->pipe].crtc_offset);
> -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> -
> -		/* Verify that the CRC of the software computed output is
> -		 * equal to the CRC of the gamma LUT transformation output.
> -		 */
> -		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> -
> -		/* Reset output. */
> -		for (i = 1; i < legacy_lut_size; i++)
> -			red_lut[i] = green_lut[i] = blue_lut[i] = i << 8;
> -
> -		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe-
> >crtc_id,
> -						  legacy_lut_size, red_lut, green_lut,
> blue_lut), 0);
> -		igt_display_commit(&data->display);
> -
> -		igt_plane_set_fb(primary, NULL);
> -		igt_output_set_pipe(output, PIPE_NONE);
> -		igt_remove_fb(data->drm_fd, &fb);
> -		igt_remove_fb(data->drm_fd, &fb_modeset);
> -	}
> +				      &fb_modeset);
> +	igt_assert(fb_modeset_id);
> +
> +	igt_plane_set_fb(primary, &fb_modeset);
> +	disable_degamma(primary->pipe);
> +	disable_gamma(primary->pipe);
> +	disable_ctm(primary->pipe);
> +	igt_display_commit(&data->display);
> +
> +	/* Draw solid colors with no gamma transformation. */
> +	paint_rectangles(data, mode, red_green_blue, &fb);
> +	igt_plane_set_fb(primary, &fb);
> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> +
> +	/* Draw a gradient with gamma LUT to remap all values
> +	 * to max red/green/blue.
> +	 */
> +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> +	igt_plane_set_fb(primary, &fb);
> +
> +	red_lut[0] = green_lut[0] = blue_lut[0] = 0;
> +	for (i = 1; i < legacy_lut_size; i++)
> +		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
> +					  legacy_lut_size, red_lut, green_lut, blue_lut),
> 0);
> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> +
> +	/* Verify that the CRC of the software computed output is
> +	 * equal to the CRC of the gamma LUT transformation output.
> +	 */
> +	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> +
> +	/* Reset output. */
> +	for (i = 1; i < legacy_lut_size; i++)
> +		red_lut[i] = green_lut[i] = blue_lut[i] = i << 8;
> +
> +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
> +					  legacy_lut_size, red_lut, green_lut, blue_lut),
> 0);
> +	igt_display_commit(&data->display);
> +
> +	igt_plane_set_fb(primary, NULL);
> +	igt_output_set_pipe(output, PIPE_NONE);
> +	igt_remove_fb(data->drm_fd, &fb);
> +	igt_remove_fb(data->drm_fd, &fb_modeset);
> 
>  	free(red_lut);
>  	free(green_lut);
> @@ -331,93 +331,93 @@ static void test_pipe_legacy_gamma_reset(data_t *data,
>  		degamma_linear = generate_table(data->degamma_lut_size, 1.0);
>  	gamma_zero = generate_table_zero(data->gamma_lut_size);
> 
> -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> output) {
> -		igt_output_set_pipe(output, primary->pipe->pipe);
> +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> >pipe);
> +	igt_require(output);
> 
> -		/* Ensure we have a clean state to start with. */
> -		disable_degamma(primary->pipe);
> -		disable_ctm(primary->pipe);
> -		disable_gamma(primary->pipe);
> -		igt_display_commit(&data->display);
> +	igt_output_set_pipe(output, primary->pipe->pipe);
> 
> -		/* Set a degama & gamma LUT and a CTM using the
> -		 * properties and verify the content of the
> -		 * properties. */
> -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> -			set_degamma(data, primary->pipe, degamma_linear);
> -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> -			set_ctm(primary->pipe, ctm_identity);
> -		set_gamma(data, primary->pipe, gamma_zero);
> -		igt_display_commit(&data->display);
> +	/* Ensure we have a clean state to start with. */
> +	disable_degamma(primary->pipe);
> +	disable_ctm(primary->pipe);
> +	disable_gamma(primary->pipe);
> +	igt_display_commit(&data->display);
> 
> -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT)) {
> -			blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
> -			igt_assert(blob &&
> -				   blob->length == (sizeof(struct drm_color_lut) *
> -						    data->degamma_lut_size));
> -			drmModeFreePropertyBlob(blob);
> -		}
> +	/* Set a degama & gamma LUT and a CTM using the
> +	 * properties and verify the content of the
> +	 * properties. */
> +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> +		set_degamma(data, primary->pipe, degamma_linear);
> +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> +		set_ctm(primary->pipe, ctm_identity);
> +	set_gamma(data, primary->pipe, gamma_zero);
> +	igt_display_commit(&data->display);
> 
> -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM)) {
> -			blob = get_blob(data, primary->pipe, IGT_CRTC_CTM);
> -			igt_assert(blob &&
> -				   blob->length == sizeof(struct drm_color_ctm));
> -			drmModeFreePropertyBlob(blob);
> -		}
> -
> -		blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT)) {
> +		blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
>  		igt_assert(blob &&
>  			   blob->length == (sizeof(struct drm_color_lut) *
> -					    data->gamma_lut_size));
> -		lut = (struct drm_color_lut *) blob->data;
> -		for (i = 0; i < data->gamma_lut_size; i++)
> -			igt_assert(lut[i].red == 0 &&
> -				   lut[i].green == 0 &&
> -				   lut[i].blue == 0);
> +					    data->degamma_lut_size));
>  		drmModeFreePropertyBlob(blob);
> +	}
> 
> -		/* Set a gamma LUT using the legacy ioctl and verify
> -		 * the content of the GAMMA_LUT property is changed
> -		 * and that CTM and DEGAMMA_LUT are empty. */
> -		kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
> -		legacy_lut_size = kms_crtc->gamma_size;
> -		drmModeFreeCrtc(kms_crtc);
> +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM)) {
> +		blob = get_blob(data, primary->pipe, IGT_CRTC_CTM);
> +		igt_assert(blob &&
> +			   blob->length == sizeof(struct drm_color_ctm));
> +		drmModeFreePropertyBlob(blob);
> +	}
> 
> -		red_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> -		green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> -		blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> +	blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> +	igt_assert(blob &&
> +		   blob->length == (sizeof(struct drm_color_lut) *
> +				    data->gamma_lut_size));
> +	lut = (struct drm_color_lut *) blob->data;
> +	for (i = 0; i < data->gamma_lut_size; i++)
> +		igt_assert(lut[i].red == 0 &&
> +			   lut[i].green == 0 &&
> +			   lut[i].blue == 0);
> +	drmModeFreePropertyBlob(blob);
> 
> -		for (i = 0; i < legacy_lut_size; i++)
> -			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> +	/* Set a gamma LUT using the legacy ioctl and verify
> +	 * the content of the GAMMA_LUT property is changed
> +	 * and that CTM and DEGAMMA_LUT are empty. */
> +	kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
> +	legacy_lut_size = kms_crtc->gamma_size;
> +	drmModeFreeCrtc(kms_crtc);
> 
> -		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd,
> -						  primary->pipe->crtc_id,
> -						  legacy_lut_size,
> -						  red_lut, green_lut, blue_lut),
> -			      0);
> -		igt_display_commit(&data->display);
> +	red_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> +	green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> +	blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> 
> -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> -			igt_assert(get_blob(data, primary->pipe,
> -					    IGT_CRTC_DEGAMMA_LUT) == NULL);
> +	for (i = 0; i < legacy_lut_size; i++)
> +		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> 
> -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> -			igt_assert(get_blob(data, primary->pipe, IGT_CRTC_CTM) ==
> NULL);
> +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd,
> +					  primary->pipe->crtc_id,
> +					  legacy_lut_size,
> +					  red_lut, green_lut, blue_lut), 0);
> +	igt_display_commit(&data->display);
> 
> -		blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> -		igt_assert(blob &&
> -			   blob->length == (sizeof(struct drm_color_lut) *
> -					    legacy_lut_size));
> -		lut = (struct drm_color_lut *) blob->data;
> -		for (i = 0; i < legacy_lut_size; i++)
> -			igt_assert(lut[i].red == 0xffff &&
> -				   lut[i].green == 0xffff &&
> -				   lut[i].blue == 0xffff);
> -		drmModeFreePropertyBlob(blob);
> +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> +		igt_assert(get_blob(data, primary->pipe,
> +				    IGT_CRTC_DEGAMMA_LUT) == NULL);
> 
> -		igt_plane_set_fb(primary, NULL);
> -		igt_output_set_pipe(output, PIPE_NONE);
> -	}
> +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> +		igt_assert(get_blob(data, primary->pipe, IGT_CRTC_CTM) == NULL);
> +
> +	blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> +	igt_assert(blob &&
> +		   blob->length == (sizeof(struct drm_color_lut) *
> +				    legacy_lut_size));
> +	lut = (struct drm_color_lut *) blob->data;
> +	for (i = 0; i < legacy_lut_size; i++)
> +		igt_assert(lut[i].red == 0xffff &&
> +			   lut[i].green == 0xffff &&
> +			   lut[i].blue == 0xffff);
> +	drmModeFreePropertyBlob(blob);
> +
> +	igt_plane_set_fb(primary, NULL);
> +	igt_output_set_pipe(output, PIPE_NONE);
> 
>  	free_lut(degamma_linear);
>  	free_lut(gamma_zero);
> @@ -442,84 +442,84 @@ static bool test_pipe_ctm(data_t *data,
>  	igt_output_t *output;
>  	bool ret = true;
>  	igt_display_t *display = &data->display;
> +	drmModeModeInfo *mode;
> +	struct igt_fb fb_modeset, fb;
> +	igt_crc_t crc_software, crc_hardware;
> +	int fb_id, fb_modeset_id;
> 
>  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM));
> 
>  	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
>  	gamma_linear = generate_table(data->gamma_lut_size, 1.0);
> 
> -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> output) {
> -		drmModeModeInfo *mode;
> -		struct igt_fb fb_modeset, fb;
> -		igt_crc_t crc_software, crc_hardware;
> -		int fb_id, fb_modeset_id;
> +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> >pipe);
> +	igt_require(output);
> 
> -		igt_output_set_pipe(output, primary->pipe->pipe);
> -		mode = igt_output_get_mode(output);
> +	igt_output_set_pipe(output, primary->pipe->pipe);
> +	mode = igt_output_get_mode(output);
> 
> -		/* Create a framebuffer at the size of the output. */
> -		fb_id = igt_create_fb(data->drm_fd,
> +	/* Create a framebuffer at the size of the output. */
> +	fb_id = igt_create_fb(data->drm_fd,
> +			      mode->hdisplay,
> +			      mode->vdisplay,
> +			      DRM_FORMAT_XRGB8888,
> +			      DRM_FORMAT_MOD_NONE,
> +			      &fb);
> +	igt_assert(fb_id);
> +
> +	fb_modeset_id = igt_create_fb(data->drm_fd,
>  				      mode->hdisplay,
>  				      mode->vdisplay,
>  				      DRM_FORMAT_XRGB8888,
>  				      DRM_FORMAT_MOD_NONE,
> -				      &fb);
> -		igt_assert(fb_id);
> +				      &fb_modeset);
> +	igt_assert(fb_modeset_id);
> +	igt_plane_set_fb(primary, &fb_modeset);
> 
> -		fb_modeset_id = igt_create_fb(data->drm_fd,
> -					      mode->hdisplay,
> -					      mode->vdisplay,
> -					      DRM_FORMAT_XRGB8888,
> -					      DRM_FORMAT_MOD_NONE,
> -					      &fb_modeset);
> -		igt_assert(fb_modeset_id);
> -		igt_plane_set_fb(primary, &fb_modeset);
> -
> -		/*
> -		 * Don't program LUT's for max CTM cases, as limitation of
> -		 * representing intermediate values between 0 and 1.0 causes
> -		 * rounding issues and inaccuracies leading to crc mismatch.
> -		 */
> -		if (memcmp(before, after, sizeof(color_t))) {
> -			set_degamma(data, primary->pipe, degamma_linear);
> -			set_gamma(data, primary->pipe, gamma_linear);
> -		} else {
> -			/* Disable Degamma and Gamma for ctm max test */
> -			disable_degamma(primary->pipe);
> -			disable_gamma(primary->pipe);
> -		}
> -
> -		disable_ctm(primary->pipe);
> -		igt_display_commit(&data->display);
> -
> -		paint_rectangles(data, mode, after, &fb);
> -		igt_plane_set_fb(primary, &fb);
> -		set_ctm(primary->pipe, ctm_identity);
> -		igt_display_commit(&data->display);
> -		igt_wait_for_vblank(data->drm_fd,
> -				display->pipes[primary->pipe->pipe].crtc_offset);
> -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
> -
> -		/* With CTM transformation. */
> -		paint_rectangles(data, mode, before, &fb);
> -		igt_plane_set_fb(primary, &fb);
> -		set_ctm(primary->pipe, ctm_matrix);
> -		igt_display_commit(&data->display);
> -		igt_wait_for_vblank(data->drm_fd,
> -				display->pipes[primary->pipe->pipe].crtc_offset);
> -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
> -
> -		/* Verify that the CRC of the software computed output is
> -		 * equal to the CRC of the CTM matrix transformation output.
> -		 */
> -		ret &= !igt_skip_crc_compare || igt_check_crc_equal(&crc_software,
> &crc_hardware);
> -
> -		igt_plane_set_fb(primary, NULL);
> -		igt_output_set_pipe(output, PIPE_NONE);
> -		igt_remove_fb(data->drm_fd, &fb);
> -		igt_remove_fb(data->drm_fd, &fb_modeset);
> +	/*
> +	 * Don't program LUT's for max CTM cases, as limitation of
> +	 * representing intermediate values between 0 and 1.0 causes
> +	 * rounding issues and inaccuracies leading to crc mismatch.
> +	 */
> +	if (memcmp(before, after, sizeof(color_t))) {
> +		set_degamma(data, primary->pipe, degamma_linear);
> +		set_gamma(data, primary->pipe, gamma_linear);
> +	} else {
> +		/* Disable Degamma and Gamma for ctm max test */
> +		disable_degamma(primary->pipe);
> +		disable_gamma(primary->pipe);
>  	}
> 
> +	disable_ctm(primary->pipe);
> +	igt_display_commit(&data->display);
> +
> +	paint_rectangles(data, mode, after, &fb);
> +	igt_plane_set_fb(primary, &fb);
> +	set_ctm(primary->pipe, ctm_identity);
> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
> +
> +	/* With CTM transformation. */
> +	paint_rectangles(data, mode, before, &fb);
> +	igt_plane_set_fb(primary, &fb);
> +	set_ctm(primary->pipe, ctm_matrix);
> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
> +
> +	/* Verify that the CRC of the software computed output is
> +	 * equal to the CRC of the CTM matrix transformation output.
> +	 */
> +	ret &= !igt_skip_crc_compare || igt_check_crc_equal(&crc_software,
> &crc_hardware);
> +
> +	igt_plane_set_fb(primary, NULL);
> +	igt_output_set_pipe(output, PIPE_NONE);
> +	igt_remove_fb(data->drm_fd, &fb);
> +	igt_remove_fb(data->drm_fd, &fb_modeset);
> +
>  	free_lut(degamma_linear);
>  	free_lut(gamma_linear);
> 
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 7/7] tests/kms_color: Add GAMMA_LUT_3D tests
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 7/7] tests/kms_color: Add GAMMA_LUT_3D tests Ville Syrjala
@ 2021-09-06  6:38   ` Modem, Bhanuprakash
  0 siblings, 0 replies; 19+ messages in thread
From: Modem, Bhanuprakash @ 2021-09-06  6:38 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev@lists.freedesktop.org

> From: Ville Syrjala <ville.syrjala@linux.intel.com>
> Sent: Friday, September 3, 2021 9:58 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Subject: [PATCH i-g-t v3 7/7] tests/kms_color: Add GAMMA_LUT_3D tests
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add some basic tests for 3D LUTs.
> 
> v2: Add missing igt_describe()s
>     s/degamma/3D LUT/ in some comments
>     Run the test for a single connector only
>     Run the invalid LUT size test for each pipe
> 
> Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  tests/kms_color.c        | 97 ++++++++++++++++++++++++++++++++++++++++
>  tests/kms_color_helper.c | 58 +++++++++++++++++++++++-
>  tests/kms_color_helper.h | 18 ++++++++
>  3 files changed, 172 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_color.c b/tests/kms_color.c
> index d78c7e211511..2e250ffe8ae8 100644
> --- a/tests/kms_color.c
> +++ b/tests/kms_color.c
> @@ -198,6 +198,88 @@ static void test_pipe_gamma(data_t *data,
>  	free_lut(gamma_full);
>  }
> 
> +static void test_pipe_gamma_lut_3d(data_t *data,
> +				   igt_plane_t *primary)
> +{
> +	igt_output_t *output;
> +	igt_display_t *display = &data->display;
> +	gamma_lut_t *gamma_lut_3d_linear, *gamma_lut_3d_full;
> +	color_t red_green_blue[] = {
> +		{ 1.0, 0.0, 0.0 },
> +		{ 0.0, 1.0, 0.0 },
> +		{ 0.0, 0.0, 1.0 }
> +	};
> +	drmModeModeInfo *mode;
> +	struct igt_fb fb_modeset, fb;
> +	igt_crc_t crc_fulllut3d, crc_fullcolors;
> +	int fb_id, fb_modeset_id;
> +
> +	igt_require(igt_pipe_obj_has_prop(primary->pipe,
> IGT_CRTC_GAMMA_LUT_3D));
> +
> +	gamma_lut_3d_linear = generate_lut_3d(data->gamma_lut_3d_size, 1.0);
> +	gamma_lut_3d_full = generate_lut_3d_max(data->gamma_lut_3d_size);
> +
> +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> >pipe);
> +	igt_require(output);
> +
> +	igt_output_set_pipe(output, primary->pipe->pipe);
> +	mode = igt_output_get_mode(output);
> +
> +	/* Create a framebuffer at the size of the output. */
> +	fb_id = igt_create_fb(data->drm_fd,
> +			      mode->hdisplay,
> +			      mode->vdisplay,
> +			      DRM_FORMAT_XRGB8888,
> +			      DRM_FORMAT_MOD_NONE,
> +			      &fb);
> +	igt_assert(fb_id);
 
We can get rid of these variables:
igt_assert(igt_create_fb());

> +
> +	fb_modeset_id = igt_create_fb(data->drm_fd,
> +				      mode->hdisplay,
> +				      mode->vdisplay,
> +				      DRM_FORMAT_XRGB8888,
> +				      DRM_FORMAT_MOD_NONE,
> +				      &fb_modeset);
> +	igt_assert(fb_modeset_id);
> +
> +	igt_plane_set_fb(primary, &fb_modeset);
> +	disable_ctm(primary->pipe);
> +	disable_degamma(primary->pipe);
> +	disable_gamma(primary->pipe);
> +	set_gamma_lut_3d(data, primary->pipe, gamma_lut_3d_linear);
> +	igt_display_commit(&data->display);
> +
> +	/* Draw solid colors with no 3D LUT transformation. */
> +	paint_rectangles(data, mode, red_green_blue, &fb);
> +	igt_plane_set_fb(primary, &fb);
> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> +
> +	/* Draw a gradient with 3D LUT to remap all
> +	 * values to max red/green/blue.
> +	 */
> +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> +	igt_plane_set_fb(primary, &fb);
> +	set_gamma_lut_3d(data, primary->pipe, gamma_lut_3d_full);
> +	igt_display_commit(&data->display);
> +	igt_wait_for_vblank(data->drm_fd,
> +			    display->pipes[primary->pipe->pipe].crtc_offset);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fulllut3d);
> +
> +	/* Verify that the CRC of the software computed output is
> +	 * equal to the CRC of the 3D LUT transformation output.
> +	 */
> +	igt_assert_crc_equal(&crc_fulllut3d, &crc_fullcolors);
> +
> +	igt_plane_set_fb(primary, NULL);
> +	igt_output_set_pipe(output, PIPE_NONE);
> +
> +	free_lut(gamma_lut_3d_linear);
> +	free_lut(gamma_lut_3d_full);
> +}
> +
>  /*
>   * Draw 3 gradient rectangles in red, green and blue, with a maxed out legacy
>   * gamma LUT and verify we have the same CRC as drawing solid color
> rectangles
> @@ -656,6 +738,13 @@ prep_pipe(data_t *data, enum pipe p)
>  					      IGT_CRTC_GAMMA_LUT_SIZE);
>  		igt_assert_lt(0, data->gamma_lut_size);
>  	}
> +
> +	if (igt_pipe_obj_has_prop(&data->display.pipes[p],
> IGT_CRTC_GAMMA_LUT_3D_SIZE)) {
> +		data->gamma_lut_3d_size =
> +			igt_pipe_obj_get_prop(&data->display.pipes[p],
> +					      IGT_CRTC_GAMMA_LUT_3D_SIZE);
> +		igt_assert_lt(0, data->gamma_lut_3d_size);
> +	}
>  }
> 
>  static void
> @@ -860,6 +949,10 @@ run_tests_for_pipe(data_t *data, enum pipe p)
>  	igt_subtest_f("pipe-%s-legacy-gamma-reset", kmstest_pipe_name(p))
>  		test_pipe_legacy_gamma_reset(data, primary);
> 
> +	igt_describe("Verify that gamma LUT 3D transformation works correctly");
> +	igt_subtest_f("pipe-%s-gamma-lut-3d", kmstest_pipe_name(p))
> +		test_pipe_gamma_lut_3d(data, primary);
> +
>  	igt_fixture {
>  		disable_degamma(primary->pipe);
>  		disable_gamma(primary->pipe);
> @@ -888,6 +981,10 @@ run_invalid_tests_for_pipe(data_t *data, enum pipe p)
>  	igt_describe("Negative check for color tranformation matrix sizes");
>  	igt_subtest_f("pipe-%s-invalid-ctm-matrix-sizes", kmstest_pipe_name(p))
>  		invalid_ctm_matrix_sizes(data, p);
> +
> +	igt_describe("Negative check for invalid gamma lut 3D sizes");
> +	igt_subtest_f("pipe-%s-invalid-gamma-lut-3d-sizes",
> kmstest_pipe_name(p))
> +		invalid_gamma_lut_3d_sizes(data, p);
>  }
> 
>  igt_main
> diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
> index d71e7bb2e6f9..38e388c54ee8 100644
> --- a/tests/kms_color_helper.c
> +++ b/tests/kms_color_helper.c
> @@ -143,6 +143,44 @@ gamma_lut_t *generate_table_zero(int lut_size)
>  	return gamma;
>  }
> 
> +gamma_lut_t *generate_lut_3d(int lut_size, double exp)
> +{
> +	gamma_lut_t *gamma = alloc_lut(lut_3d_size(lut_size));
> +
> +	for (int r = 0; r < lut_size; r++) {
> +		for (int g = 0; g < lut_size; g++) {
> +			for (int b = 0; b < lut_size; b++) {
> +				int i = lut_3d_index(r, g, b, lut_size);
> +
> +				gamma->coeffs[i].r = pow(r * 1.0 / (lut_size - 1), exp);
> +				gamma->coeffs[i].g = pow(g * 1.0 / (lut_size - 1), exp);
> +				gamma->coeffs[i].b = pow(b * 1.0 / (lut_size - 1), exp);
> +			}
> +		}
> +	}
> +
> +	return gamma;
> +}
> +
> +gamma_lut_t *generate_lut_3d_max(int lut_size)
> +{
> +	gamma_lut_t *gamma = alloc_lut(lut_3d_size(lut_size));
> +
> +	for (int r = 0; r < lut_size; r++) {
> +		for (int g = 0; g < lut_size; g++) {
> +			for (int b = 0; b < lut_size; b++) {
> +				int i = lut_3d_index(r, g, b, lut_size);
> +
> +				gamma->coeffs[i].r = r == 0 ? 0.0 : 1.0;
> +				gamma->coeffs[i].g = g == 0 ? 0.0 : 1.0;
> +				gamma->coeffs[i].b = b == 0 ? 0.0 : 1.0;
> +			}
> +		}
> +	}
> +
> +	return gamma;
> +}
> +
>  struct drm_color_lut *coeffs_to_lut(data_t *data,
>  				    const gamma_lut_t *gamma,
>  				    uint32_t color_depth,
> @@ -215,6 +253,19 @@ void set_gamma(data_t *data,
>  	free(lut);
>  }
> 
> +void set_gamma_lut_3d(data_t *data,
> +		      igt_pipe_t *pipe,
> +		      const gamma_lut_t *gamma_lut_3d)
> +{
> +	size_t size = sizeof(struct drm_color_lut) * gamma_lut_3d->size;
> +	struct drm_color_lut *lut = coeffs_to_lut(data, gamma_lut_3d,
> +						  data->color_depth, 0);
> +
> +	igt_pipe_obj_replace_prop_blob(pipe, IGT_CRTC_GAMMA_LUT_3D, lut, size);
> +
> +	free(lut);
> +}
> +
>  void set_ctm(igt_pipe_t *pipe, const double *coefficients)
>  {
>  	struct drm_color_ctm ctm;
> @@ -331,6 +382,12 @@ invalid_degamma_lut_sizes(data_t *data, enum pipe p)
>  	invalid_lut_sizes(data, p, IGT_CRTC_DEGAMMA_LUT, data-
> >degamma_lut_size);
>  }
> 
> +void
> +invalid_gamma_lut_3d_sizes(data_t *data, enum pipe p)
> +{

Please check the comments in Patch 4/7 in this series:

We need
`igt_require(data->gamma_lut_3d_size);` or
`igt_require(igt_pipe_obj_has_prop(p, IGT_CRTC_GAMMA_LUT_3D_SIZE));` here

With above changes, this patch is
Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>

- Bhanu

> +	invalid_lut_sizes(data, p, IGT_CRTC_GAMMA_LUT_3D, lut_3d_size(data-
> >gamma_lut_3d_size));
> +}
> +
>  void invalid_ctm_matrix_sizes(data_t *data, enum pipe p)
>  {
>  	igt_display_t *display = &data->display;
> @@ -359,4 +416,3 @@ void invalid_ctm_matrix_sizes(data_t *data, enum pipe p)
> 
>  	free(ptr);
>  }
> -
> diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
> index bb6f0054f388..7406820b6955 100644
> --- a/tests/kms_color_helper.h
> +++ b/tests/kms_color_helper.h
> @@ -52,6 +52,7 @@ typedef struct {
>  	uint32_t color_depth;
>  	uint64_t degamma_lut_size;
>  	uint64_t gamma_lut_size;
> +	uint64_t gamma_lut_3d_size;
>  	#ifdef HAVE_CHAMELIUM
>  	struct chamelium *chamelium;
>  	struct chamelium_port **ports;
> @@ -77,6 +78,8 @@ void free_lut(gamma_lut_t *gamma);
>  gamma_lut_t *generate_table(int lut_size, double exp);
>  gamma_lut_t *generate_table_max(int lut_size);
>  gamma_lut_t *generate_table_zero(int lut_size);
> +gamma_lut_t *generate_lut_3d(int lut_size, double exp);
> +gamma_lut_t *generate_lut_3d_max(int lut_size);
>  struct drm_color_lut *coeffs_to_lut(data_t *data,
>  				    const gamma_lut_t *gamma,
>  				    uint32_t color_depth,
> @@ -87,13 +90,27 @@ void set_degamma(data_t *data,
>  void set_gamma(data_t *data,
>  	       igt_pipe_t *pipe,
>  	       const gamma_lut_t *gamma);
> +void set_gamma_lut_3d(data_t *data,
> +		      igt_pipe_t *pipe,
> +		      const gamma_lut_t *gamma);
>  void set_ctm(igt_pipe_t *pipe, const double *coefficients);
>  void disable_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop);
> 
>  #define disable_degamma(pipe) disable_prop(pipe, IGT_CRTC_DEGAMMA_LUT)
>  #define disable_gamma(pipe) disable_prop(pipe, IGT_CRTC_GAMMA_LUT)
> +#define disable_lut_3d(pipe) disable_prop(pipe, IGT_CRTC_LUT_3D)
>  #define disable_ctm(pipe) disable_prop(pipe, IGT_CRTC_CTM)
> 
> +static inline int lut_3d_size(int lut_size)
> +{
> +	return lut_size * lut_size * lut_size;
> +}
> +
> +static inline int lut_3d_index(int r, int g, int b, int lut_size)
> +{
> +	return r * lut_size * lut_size + g * lut_size + b;
> +}
> +
>  drmModePropertyBlobPtr get_blob(data_t *data, igt_pipe_t *pipe,
>  				enum igt_atomic_crtc_properties prop);
>  bool crc_equal(igt_crc_t *a, igt_crc_t *b);
> @@ -105,6 +122,7 @@ int pipe_set_property_blob(igt_pipe_t *pipe,
>  			   void *ptr, size_t length);
>  void invalid_gamma_lut_sizes(data_t *data, enum pipe p);
>  void invalid_degamma_lut_sizes(data_t *data, enum pipe p);
> +void invalid_gamma_lut_3d_sizes(data_t *data, enum pipe p);
>  void invalid_ctm_matrix_sizes(data_t *data, enum pipe p);
> 
>  #endif
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to invalid LUT size tests
  2021-09-06  6:37   ` Modem, Bhanuprakash
@ 2021-09-07 17:26     ` Ville Syrjälä
  0 siblings, 0 replies; 19+ messages in thread
From: Ville Syrjälä @ 2021-09-07 17:26 UTC (permalink / raw)
  To: Modem, Bhanuprakash; +Cc: igt-dev@lists.freedesktop.org

On Mon, Sep 06, 2021 at 06:37:39AM +0000, Modem, Bhanuprakash wrote:
> > From: Ville Syrjala <ville.syrjala@linux.intel.com>
> > Sent: Friday, September 3, 2021 9:58 PM
> > To: igt-dev@lists.freedesktop.org
> > Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> > Subject: [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to invalid LUT size
> > tests
> > 
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Each pipe can have a different LUT sizes, so run the invalid LUT
> > size tests once for each pipe.
> > 
> > This also makes sure data->(de)gamma_lut_size are properly initialized
> > prior to running these subtests.
> > 
> > Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  tests/kms_color.c        | 73 +++++++++++++++++++++++++---------------
> >  tests/kms_color_helper.c | 17 +++++-----
> >  tests/kms_color_helper.h |  7 ++--
> >  3 files changed, 58 insertions(+), 39 deletions(-)
> > 
> > diff --git a/tests/kms_color.c b/tests/kms_color.c
> > index 9105076aba4f..dabc6963e9e0 100644
> > --- a/tests/kms_color.c
> > +++ b/tests/kms_color.c
> > @@ -638,6 +638,26 @@ static void test_pipe_limited_range_ctm(data_t *data,
> >  }
> >  #endif
> > 
> > +static void
> > +prep_pipe(data_t *data, enum pipe p)
> > +{
> > +	igt_require_pipe(&data->display, p);
> > +
> > +	if (igt_pipe_obj_has_prop(&data->display.pipes[p],
> > IGT_CRTC_DEGAMMA_LUT_SIZE)) {
> > +		data->degamma_lut_size =
> > +			igt_pipe_obj_get_prop(&data->display.pipes[p],
> > +					      IGT_CRTC_DEGAMMA_LUT_SIZE);
> > +		igt_assert_lt(0, data->degamma_lut_size);
> > +	}
> > +
> > +	if (igt_pipe_obj_has_prop(&data->display.pipes[p],
> > IGT_CRTC_GAMMA_LUT_SIZE)) {
> > +		data->gamma_lut_size =
> > +			igt_pipe_obj_get_prop(&data->display.pipes[p],
> > +					      IGT_CRTC_GAMMA_LUT_SIZE);
> > +		igt_assert_lt(0, data->gamma_lut_size);
> > +	}
> > +}
> > +
> >  static void
> >  run_tests_for_pipe(data_t *data, enum pipe p)
> >  {
> > @@ -652,10 +672,10 @@ run_tests_for_pipe(data_t *data, enum pipe p)
> >  	};
> > 
> >  	igt_fixture {
> > +		prep_pipe(data, p);
> > +
> >  		igt_require_pipe_crc(data->drm_fd);
> > 
> > -		igt_require_pipe(&data->display, p);
> > -
> >  		pipe = &data->display.pipes[p];
> >  		igt_require(pipe->n_planes >= 0);
> > 
> > @@ -665,20 +685,6 @@ run_tests_for_pipe(data_t *data, enum pipe p)
> >  						  primary->pipe->pipe,
> >  						  INTEL_PIPE_CRC_SOURCE_AUTO);
> > 
> > -		if (igt_pipe_obj_has_prop(&data->display.pipes[p],
> > IGT_CRTC_DEGAMMA_LUT_SIZE)) {
> > -			data->degamma_lut_size =
> > -				igt_pipe_obj_get_prop(&data->display.pipes[p],
> > -						      IGT_CRTC_DEGAMMA_LUT_SIZE);
> > -			igt_assert_lt(0, data->degamma_lut_size);
> > -		}
> > -
> > -		if (igt_pipe_obj_has_prop(&data->display.pipes[p],
> > IGT_CRTC_GAMMA_LUT_SIZE)) {
> > -			data->gamma_lut_size =
> > -				igt_pipe_obj_get_prop(&data->display.pipes[p],
> > -						      IGT_CRTC_GAMMA_LUT_SIZE);
> > -			igt_assert_lt(0, data->gamma_lut_size);
> > -		}
> > -
> >  		igt_display_require_output_on_pipe(&data->display, p);
> >  	}
> > 
> > @@ -865,6 +871,25 @@ run_tests_for_pipe(data_t *data, enum pipe p)
> >  	}
> >  }
> > 
> > +static void
> > +run_invalid_tests_for_pipe(data_t *data, enum pipe p)
> > +{
> > +	igt_fixture
> > +		prep_pipe(data, p);
> > +
> > +	igt_describe("Negative check for invalid gamma lut sizes");
> > +	igt_subtest_f("pipe-%s-invalid-gamma-lut-sizes", kmstest_pipe_name(p))
> > +		invalid_gamma_lut_sizes(data, p);
> > +
> > +	igt_describe("Negative check for invalid degamma lut sizes");
> > +	igt_subtest_f("pipe-%s-invalid-degamma-lut-sizes", kmstest_pipe_name(p))
> > +		invalid_degamma_lut_sizes(data, p);
> > +
> > +	igt_describe("Negative check for color tranformation matrix sizes");
> > +	igt_subtest_f("pipe-%s-invalid-ctm-matrix-sizes", kmstest_pipe_name(p))
> > +		invalid_ctm_matrix_sizes(data, p);
> > +}
> > +
> >  igt_main
> >  {
> >  	data_t data = {};
> > @@ -879,21 +904,13 @@ igt_main
> >  		igt_display_require(&data.display, data.drm_fd);
> >  	}
> > 
> > -	for_each_pipe_static(pipe)
> > +	for_each_pipe_static(pipe) {
> >  		igt_subtest_group
> >  			run_tests_for_pipe(&data, pipe);
> > 
> > -	igt_describe("Negative check for invalid gamma lut sizes");
> > -	igt_subtest_f("pipe-invalid-gamma-lut-sizes")
> > -		invalid_gamma_lut_sizes(&data);
> > -
> > -	igt_describe("Negative check for invalid degamma lut sizes");
> > -	igt_subtest_f("pipe-invalid-degamma-lut-sizes")
> > -		invalid_degamma_lut_sizes(&data);
> > -
> > -	igt_describe("Negative check for color tranformation matrix sizes");
> > -	igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
> > -		invalid_ctm_matrix_sizes(&data);
> > +		igt_subtest_group
> > +			run_invalid_tests_for_pipe(&data, pipe);
> > +	}
> > 
> >  	igt_fixture {
> >  		igt_display_fini(&data.display);
> > diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
> > index 8b08cdaeea5f..d71e7bb2e6f9 100644
> > --- a/tests/kms_color_helper.c
> > +++ b/tests/kms_color_helper.c
> > @@ -287,10 +287,11 @@ pipe_set_property_blob(igt_pipe_t *pipe,
> >  }
> > 
> >  static void
> > -invalid_lut_sizes(data_t *data, enum igt_atomic_crtc_properties prop, int
> > size)
> > +invalid_lut_sizes(data_t *data, enum pipe p,
> > +		  enum igt_atomic_crtc_properties prop, int size)
> >  {
> >  	igt_display_t *display = &data->display;
> > -	igt_pipe_t *pipe = &display->pipes[0];
> > +	igt_pipe_t *pipe = &display->pipes[p];
> >  	struct drm_color_lut *lut;
> >  	size_t lut_size = size * sizeof(lut[0]);
> > 
> > @@ -319,21 +320,21 @@ invalid_lut_sizes(data_t *data, enum
> > igt_atomic_crtc_properties prop, int size)
> >  }
> > 
> >  void
> > -invalid_gamma_lut_sizes(data_t *data)
> > +invalid_gamma_lut_sizes(data_t *data, enum pipe p)
> >  {
> > -	invalid_lut_sizes(data, IGT_CRTC_GAMMA_LUT, data->gamma_lut_size);
> > +	invalid_lut_sizes(data, p, IGT_CRTC_GAMMA_LUT, data->gamma_lut_size);
>  
> Still, it is possible to get data->gamma_lut_size as NULL, b'coz prep_pipe()
> will not initialize if GAMMA_LUT_SIZE prop is not present.
> 
> `igt_require(data->gamma_lut_size);` or
> `igt_require(igt_pipe_obj_has_prop(p, IGT_CRTC_GAMMA_LUT_SIZE));` before
> calling invalid_lut_sizes() can fix this.

invalid_lut_sizes() already has the necessary igt_require().

> 
> >  }
> > 
> >  void
> > -invalid_degamma_lut_sizes(data_t *data)
> > +invalid_degamma_lut_sizes(data_t *data, enum pipe p)
> >  {
> > -	invalid_lut_sizes(data, IGT_CRTC_DEGAMMA_LUT, data->degamma_lut_size);
> > +	invalid_lut_sizes(data, p, IGT_CRTC_DEGAMMA_LUT, data-
> > >degamma_lut_size);
>  
> Please consider the above comment.
> 
> With above change, this patch is
> Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> 
> - Bhanu
> 
> >  }
> > 
> > -void invalid_ctm_matrix_sizes(data_t *data)
> > +void invalid_ctm_matrix_sizes(data_t *data, enum pipe p)
> >  {
> >  	igt_display_t *display = &data->display;
> > -	igt_pipe_t *pipe = &display->pipes[0];
> > +	igt_pipe_t *pipe = &display->pipes[p];
> >  	void *ptr;
> > 
> >  	igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_CTM));
> > diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
> > index 3f49e7cae4c0..bb6f0054f388 100644
> > --- a/tests/kms_color_helper.h
> > +++ b/tests/kms_color_helper.h
> > @@ -103,8 +103,9 @@ int pipe_set_property_blob_id(igt_pipe_t *pipe,
> >  int pipe_set_property_blob(igt_pipe_t *pipe,
> >  			   enum igt_atomic_crtc_properties prop,
> >  			   void *ptr, size_t length);
> > -void invalid_gamma_lut_sizes(data_t *data);
> > -void invalid_degamma_lut_sizes(data_t *data);
> > -void invalid_ctm_matrix_sizes(data_t *data);
> > +void invalid_gamma_lut_sizes(data_t *data, enum pipe p);
> > +void invalid_degamma_lut_sizes(data_t *data, enum pipe p);
> > +void invalid_ctm_matrix_sizes(data_t *data, enum pipe p);
> > +
> >  #endif
> > 
> > --
> > 2.31.1
> 

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a single connector
  2021-09-06  6:38   ` Modem, Bhanuprakash
@ 2021-09-07 17:34     ` Ville Syrjälä
  2021-09-12 15:36       ` Modem, Bhanuprakash
  0 siblings, 1 reply; 19+ messages in thread
From: Ville Syrjälä @ 2021-09-07 17:34 UTC (permalink / raw)
  To: Modem, Bhanuprakash; +Cc: igt-dev@lists.freedesktop.org

On Mon, Sep 06, 2021 at 06:38:26AM +0000, Modem, Bhanuprakash wrote:
> > From: Ville Syrjala <ville.syrjala@linux.intel.com>
> > Sent: Friday, September 3, 2021 9:58 PM
> > To: igt-dev@lists.freedesktop.org
> > Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> > Subject: [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a
> > single connector
> > 
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > For most of the subtests the used connector should not matter,
> > so run each subtest just for a single connector.
> > 
> > Suggested-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  tests/kms_color.c | 612 +++++++++++++++++++++++-----------------------
> >  1 file changed, 306 insertions(+), 306 deletions(-)
> > 
> > diff --git a/tests/kms_color.c b/tests/kms_color.c
> > index dabc6963e9e0..d78c7e211511 100644
> > --- a/tests/kms_color.c
> > +++ b/tests/kms_color.c
> > @@ -37,6 +37,10 @@ static void test_pipe_degamma(data_t *data,
> >  		{ 0.0, 1.0, 0.0 },
> >  		{ 0.0, 0.0, 1.0 }
> >  	};
> > +	drmModeModeInfo *mode;
> > +	struct igt_fb fb_modeset, fb;
> > +	igt_crc_t crc_fullgamma, crc_fullcolors;
> > +	int fb_id, fb_modeset_id;
> > 
> >  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT));
> >  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
> > @@ -44,69 +48,65 @@ static void test_pipe_degamma(data_t *data,
> >  	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
> >  	degamma_full = generate_table_max(data->degamma_lut_size);
> > 
> > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > output) {
> > -		drmModeModeInfo *mode;
> > -		struct igt_fb fb_modeset, fb;
> > -		igt_crc_t crc_fullgamma, crc_fullcolors;
> > -		int fb_id, fb_modeset_id;
> > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > >pipe);
> > +	igt_require(output);
> > 
> > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > -		mode = igt_output_get_mode(output);
> > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > +	mode = igt_output_get_mode(output);
> > 
> > -		/* Create a framebuffer at the size of the output. */
> > -		fb_id = igt_create_fb(data->drm_fd,
> > +	/* Create a framebuffer at the size of the output. */
> > +	fb_id = igt_create_fb(data->drm_fd,
> > +			      mode->hdisplay,
> > +			      mode->vdisplay,
> > +			      DRM_FORMAT_XRGB8888,
> > +			      DRM_FORMAT_MOD_NONE,
> > +			      &fb);
> > +	igt_assert(fb_id);
>  
> Minor: we can get rid of extra variables by updating like
> `igt_assert(igt_create_fb());`

I'm not going to be doing any unrelated changes in this
patch. The indentation change alone is already bad enough
to review.

> 
> And this is applicable for all the places.
> 
> > +
> > +	fb_modeset_id = igt_create_fb(data->drm_fd,
> >  				      mode->hdisplay,
> >  				      mode->vdisplay,
> >  				      DRM_FORMAT_XRGB8888,
> >  				      DRM_FORMAT_MOD_NONE,
> > -				      &fb);
> > -		igt_assert(fb_id);
> > +				      &fb_modeset);
> > +	igt_assert(fb_modeset_id);
> > 
> > -		fb_modeset_id = igt_create_fb(data->drm_fd,
> > -					      mode->hdisplay,
> > -					      mode->vdisplay,
> > -					      DRM_FORMAT_XRGB8888,
> > -					      DRM_FORMAT_MOD_NONE,
> > -					      &fb_modeset);
> > -		igt_assert(fb_modeset_id);
> > +	igt_plane_set_fb(primary, &fb_modeset);
> > +	disable_ctm(primary->pipe);
> > +	disable_gamma(primary->pipe);
> > +	set_degamma(data, primary->pipe, degamma_linear);
> > +	igt_display_commit(&data->display);
> > 
> > -		igt_plane_set_fb(primary, &fb_modeset);
> > -		disable_ctm(primary->pipe);
> > -		disable_gamma(primary->pipe);
> > -		set_degamma(data, primary->pipe, degamma_linear);
> > -		igt_display_commit(&data->display);
> > +	/* Draw solid colors with linear degamma transformation. */
> > +	paint_rectangles(data, mode, red_green_blue, &fb);
> > +	igt_plane_set_fb(primary, &fb);
> > +	igt_display_commit(&data->display);
> > +	igt_wait_for_vblank(data->drm_fd,
> > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > 
> > -		/* Draw solid colors with linear degamma transformation. */
> > -		paint_rectangles(data, mode, red_green_blue, &fb);
> > -		igt_plane_set_fb(primary, &fb);
> > -		igt_display_commit(&data->display);
> > -		igt_wait_for_vblank(data->drm_fd,
> > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > +	/* Draw a gradient with degamma LUT to remap all
> > +	 * values to max red/green/blue.
> > +	 */
> > +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > +	igt_plane_set_fb(primary, &fb);
> > +	set_degamma(data, primary->pipe, degamma_full);
> > +	igt_display_commit(&data->display);
> > +	igt_wait_for_vblank(data->drm_fd,
> > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > 
> > -		/* Draw a gradient with degamma LUT to remap all
> > -		 * values to max red/green/blue.
> > -		 */
> > -		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > -		igt_plane_set_fb(primary, &fb);
> > -		set_degamma(data, primary->pipe, degamma_full);
> > -		igt_display_commit(&data->display);
> > -		igt_wait_for_vblank(data->drm_fd,
> > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > +	/* Verify that the CRC of the software computed output is
> > +	 * equal to the CRC of the degamma LUT transformation output.
> > +	 */
> > +	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > 
> > -		/* Verify that the CRC of the software computed output is
> > -		 * equal to the CRC of the degamma LUT transformation output.
> > -		 */
> > -		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > -
> > -		disable_degamma(primary->pipe);
> > -		igt_plane_set_fb(primary, NULL);
> > -		igt_output_set_pipe(output, PIPE_NONE);
> > -		igt_display_commit(&data->display);
> > -		igt_remove_fb(data->drm_fd, &fb);
> > -		igt_remove_fb(data->drm_fd, &fb_modeset);
> > -	}
> > +	disable_degamma(primary->pipe);
> > +	igt_plane_set_fb(primary, NULL);
> > +	igt_output_set_pipe(output, PIPE_NONE);
> > +	igt_display_commit(&data->display);
> > +	igt_remove_fb(data->drm_fd, &fb);
> > +	igt_remove_fb(data->drm_fd, &fb_modeset);
> > 
> >  	free_lut(degamma_linear);
> >  	free_lut(degamma_full);
> > @@ -127,73 +127,73 @@ static void test_pipe_gamma(data_t *data,
> >  		{ 0.0, 1.0, 0.0 },
> >  		{ 0.0, 0.0, 1.0 }
> >  	};
> > +	drmModeModeInfo *mode;
> > +	struct igt_fb fb_modeset, fb;
> > +	igt_crc_t crc_fullgamma, crc_fullcolors;
> > +	int fb_id, fb_modeset_id;
> > 
> >  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
> > 
> >  	gamma_full = generate_table_max(data->gamma_lut_size);
> > 
> > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > output) {
> > -		drmModeModeInfo *mode;
> > -		struct igt_fb fb_modeset, fb;
> > -		igt_crc_t crc_fullgamma, crc_fullcolors;
> > -		int fb_id, fb_modeset_id;
> > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > >pipe);
> > +	igt_require(output);
> > 
> > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > -		mode = igt_output_get_mode(output);
> > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > +	mode = igt_output_get_mode(output);
> > 
> > -		/* Create a framebuffer at the size of the output. */
> > -		fb_id = igt_create_fb(data->drm_fd,
> > +	/* Create a framebuffer at the size of the output. */
> > +	fb_id = igt_create_fb(data->drm_fd,
> > +			      mode->hdisplay,
> > +			      mode->vdisplay,
> > +			      DRM_FORMAT_XRGB8888,
> > +			      DRM_FORMAT_MOD_NONE,
> > +			      &fb);
> > +	igt_assert(fb_id);
> > +
> > +	fb_modeset_id = igt_create_fb(data->drm_fd,
> >  				      mode->hdisplay,
> >  				      mode->vdisplay,
> >  				      DRM_FORMAT_XRGB8888,
> >  				      DRM_FORMAT_MOD_NONE,
> > -				      &fb);
> > -		igt_assert(fb_id);
> > +				      &fb_modeset);
> > +	igt_assert(fb_modeset_id);
> > 
> > -		fb_modeset_id = igt_create_fb(data->drm_fd,
> > -					      mode->hdisplay,
> > -					      mode->vdisplay,
> > -					      DRM_FORMAT_XRGB8888,
> > -					      DRM_FORMAT_MOD_NONE,
> > -					      &fb_modeset);
> > -		igt_assert(fb_modeset_id);
> > +	igt_plane_set_fb(primary, &fb_modeset);
> > +	disable_ctm(primary->pipe);
> > +	disable_degamma(primary->pipe);
> > +	set_gamma(data, primary->pipe, gamma_full);
>  
> This could be disable_gamma(), right?

Getting matching crcs has been rather problematic in this
test. I don't recall the specifics on which LUT is needed
in each case to guarantee that.

> 
> > +	igt_display_commit(&data->display);
> > 
> > -		igt_plane_set_fb(primary, &fb_modeset);
> > -		disable_ctm(primary->pipe);
> > -		disable_degamma(primary->pipe);
> > -		set_gamma(data, primary->pipe, gamma_full);
> > -		igt_display_commit(&data->display);
> > +	/* Draw solid colors with no gamma transformation. */
> > +	paint_rectangles(data, mode, red_green_blue, &fb);
> > +	igt_plane_set_fb(primary, &fb);
> > +	igt_display_commit(&data->display);
> > +	igt_wait_for_vblank(data->drm_fd,
> > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > 
> > -		/* Draw solid colors with no gamma transformation. */
> > -		paint_rectangles(data, mode, red_green_blue, &fb);
> > -		igt_plane_set_fb(primary, &fb);
> > -		igt_display_commit(&data->display);
> > -		igt_wait_for_vblank(data->drm_fd,
> > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > +	/* Draw a gradient with gamma LUT to remap all values
> > +	 * to max red/green/blue.
> > +	 */
> > +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > +	igt_plane_set_fb(primary, &fb);
>  
> And here we need to set the gamma: set_gamma(gamma_max)

Also a totally unrelated change. If you think there's a bug here
pls submit a separate patch.

> 
> With these changes, this patch is
> Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> 
> - Bhanu
> 
> > +	igt_display_commit(&data->display);
> > +	igt_wait_for_vblank(data->drm_fd,
> > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > 
> > -		/* Draw a gradient with gamma LUT to remap all values
> > -		 * to max red/green/blue.
> > -		 */
> > -		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > -		igt_plane_set_fb(primary, &fb);
> > -		igt_display_commit(&data->display);
> > -		igt_wait_for_vblank(data->drm_fd,
> > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > +	/* Verify that the CRC of the software computed output is
> > +	 * equal to the CRC of the gamma LUT transformation output.
> > +	 */
> > +	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > 
> > -		/* Verify that the CRC of the software computed output is
> > -		 * equal to the CRC of the gamma LUT transformation output.
> > -		 */
> > -		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > -
> > -		disable_gamma(primary->pipe);
> > -		igt_plane_set_fb(primary, NULL);
> > -		igt_output_set_pipe(output, PIPE_NONE);
> > -		igt_display_commit(&data->display);
> > -		igt_remove_fb(data->drm_fd, &fb);
> > -		igt_remove_fb(data->drm_fd, &fb_modeset);
> > -	}
> > +	disable_gamma(primary->pipe);
> > +	igt_plane_set_fb(primary, NULL);
> > +	igt_output_set_pipe(output, PIPE_NONE);
> > +	igt_display_commit(&data->display);
> > +	igt_remove_fb(data->drm_fd, &fb);
> > +	igt_remove_fb(data->drm_fd, &fb_modeset);
> > 
> >  	free_lut(gamma_full);
> >  }
> > @@ -216,6 +216,10 @@ static void test_pipe_legacy_gamma(data_t *data,
> >  	drmModeCrtc *kms_crtc;
> >  	uint32_t i, legacy_lut_size;
> >  	uint16_t *red_lut, *green_lut, *blue_lut;
> > +	drmModeModeInfo *mode;
> > +	struct igt_fb fb_modeset, fb;
> > +	igt_crc_t crc_fullgamma, crc_fullcolors;
> > +	int fb_id, fb_modeset_id;
> > 
> >  	kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
> >  	legacy_lut_size = kms_crtc->gamma_size;
> > @@ -225,80 +229,76 @@ static void test_pipe_legacy_gamma(data_t *data,
> >  	green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> >  	blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > 
> > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > output) {
> > -		drmModeModeInfo *mode;
> > -		struct igt_fb fb_modeset, fb;
> > -		igt_crc_t crc_fullgamma, crc_fullcolors;
> > -		int fb_id, fb_modeset_id;
> > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > >pipe);
> > +	igt_require(output);
> > 
> > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > -		mode = igt_output_get_mode(output);
> > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > +	mode = igt_output_get_mode(output);
> > 
> > -		/* Create a framebuffer at the size of the output. */
> > -		fb_id = igt_create_fb(data->drm_fd,
> > +	/* Create a framebuffer at the size of the output. */
> > +	fb_id = igt_create_fb(data->drm_fd,
> > +			      mode->hdisplay,
> > +			      mode->vdisplay,
> > +			      DRM_FORMAT_XRGB8888,
> > +			      DRM_FORMAT_MOD_NONE,
> > +			      &fb);
> > +	igt_assert(fb_id);
> > +
> > +	fb_modeset_id = igt_create_fb(data->drm_fd,
> >  				      mode->hdisplay,
> >  				      mode->vdisplay,
> >  				      DRM_FORMAT_XRGB8888,
> >  				      DRM_FORMAT_MOD_NONE,
> > -				      &fb);
> > -		igt_assert(fb_id);
> > -
> > -		fb_modeset_id = igt_create_fb(data->drm_fd,
> > -					      mode->hdisplay,
> > -					      mode->vdisplay,
> > -					      DRM_FORMAT_XRGB8888,
> > -					      DRM_FORMAT_MOD_NONE,
> > -					      &fb_modeset);
> > -		igt_assert(fb_modeset_id);
> > -
> > -		igt_plane_set_fb(primary, &fb_modeset);
> > -		disable_degamma(primary->pipe);
> > -		disable_gamma(primary->pipe);
> > -		disable_ctm(primary->pipe);
> > -		igt_display_commit(&data->display);
> > -
> > -		/* Draw solid colors with no gamma transformation. */
> > -		paint_rectangles(data, mode, red_green_blue, &fb);
> > -		igt_plane_set_fb(primary, &fb);
> > -		igt_display_commit(&data->display);
> > -		igt_wait_for_vblank(data->drm_fd,
> > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > -
> > -		/* Draw a gradient with gamma LUT to remap all values
> > -		 * to max red/green/blue.
> > -		 */
> > -		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > -		igt_plane_set_fb(primary, &fb);
> > -
> > -		red_lut[0] = green_lut[0] = blue_lut[0] = 0;
> > -		for (i = 1; i < legacy_lut_size; i++)
> > -			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> > -		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe-
> > >crtc_id,
> > -						  legacy_lut_size, red_lut, green_lut,
> > blue_lut), 0);
> > -		igt_display_commit(&data->display);
> > -		igt_wait_for_vblank(data->drm_fd,
> > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > -
> > -		/* Verify that the CRC of the software computed output is
> > -		 * equal to the CRC of the gamma LUT transformation output.
> > -		 */
> > -		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > -
> > -		/* Reset output. */
> > -		for (i = 1; i < legacy_lut_size; i++)
> > -			red_lut[i] = green_lut[i] = blue_lut[i] = i << 8;
> > -
> > -		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe-
> > >crtc_id,
> > -						  legacy_lut_size, red_lut, green_lut,
> > blue_lut), 0);
> > -		igt_display_commit(&data->display);
> > -
> > -		igt_plane_set_fb(primary, NULL);
> > -		igt_output_set_pipe(output, PIPE_NONE);
> > -		igt_remove_fb(data->drm_fd, &fb);
> > -		igt_remove_fb(data->drm_fd, &fb_modeset);
> > -	}
> > +				      &fb_modeset);
> > +	igt_assert(fb_modeset_id);
> > +
> > +	igt_plane_set_fb(primary, &fb_modeset);
> > +	disable_degamma(primary->pipe);
> > +	disable_gamma(primary->pipe);
> > +	disable_ctm(primary->pipe);
> > +	igt_display_commit(&data->display);
> > +
> > +	/* Draw solid colors with no gamma transformation. */
> > +	paint_rectangles(data, mode, red_green_blue, &fb);
> > +	igt_plane_set_fb(primary, &fb);
> > +	igt_display_commit(&data->display);
> > +	igt_wait_for_vblank(data->drm_fd,
> > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > +
> > +	/* Draw a gradient with gamma LUT to remap all values
> > +	 * to max red/green/blue.
> > +	 */
> > +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > +	igt_plane_set_fb(primary, &fb);
> > +
> > +	red_lut[0] = green_lut[0] = blue_lut[0] = 0;
> > +	for (i = 1; i < legacy_lut_size; i++)
> > +		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> > +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
> > +					  legacy_lut_size, red_lut, green_lut, blue_lut),
> > 0);
> > +	igt_display_commit(&data->display);
> > +	igt_wait_for_vblank(data->drm_fd,
> > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > +
> > +	/* Verify that the CRC of the software computed output is
> > +	 * equal to the CRC of the gamma LUT transformation output.
> > +	 */
> > +	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > +
> > +	/* Reset output. */
> > +	for (i = 1; i < legacy_lut_size; i++)
> > +		red_lut[i] = green_lut[i] = blue_lut[i] = i << 8;
> > +
> > +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
> > +					  legacy_lut_size, red_lut, green_lut, blue_lut),
> > 0);
> > +	igt_display_commit(&data->display);
> > +
> > +	igt_plane_set_fb(primary, NULL);
> > +	igt_output_set_pipe(output, PIPE_NONE);
> > +	igt_remove_fb(data->drm_fd, &fb);
> > +	igt_remove_fb(data->drm_fd, &fb_modeset);
> > 
> >  	free(red_lut);
> >  	free(green_lut);
> > @@ -331,93 +331,93 @@ static void test_pipe_legacy_gamma_reset(data_t *data,
> >  		degamma_linear = generate_table(data->degamma_lut_size, 1.0);
> >  	gamma_zero = generate_table_zero(data->gamma_lut_size);
> > 
> > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > output) {
> > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > >pipe);
> > +	igt_require(output);
> > 
> > -		/* Ensure we have a clean state to start with. */
> > -		disable_degamma(primary->pipe);
> > -		disable_ctm(primary->pipe);
> > -		disable_gamma(primary->pipe);
> > -		igt_display_commit(&data->display);
> > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > 
> > -		/* Set a degama & gamma LUT and a CTM using the
> > -		 * properties and verify the content of the
> > -		 * properties. */
> > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> > -			set_degamma(data, primary->pipe, degamma_linear);
> > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> > -			set_ctm(primary->pipe, ctm_identity);
> > -		set_gamma(data, primary->pipe, gamma_zero);
> > -		igt_display_commit(&data->display);
> > +	/* Ensure we have a clean state to start with. */
> > +	disable_degamma(primary->pipe);
> > +	disable_ctm(primary->pipe);
> > +	disable_gamma(primary->pipe);
> > +	igt_display_commit(&data->display);
> > 
> > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT)) {
> > -			blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
> > -			igt_assert(blob &&
> > -				   blob->length == (sizeof(struct drm_color_lut) *
> > -						    data->degamma_lut_size));
> > -			drmModeFreePropertyBlob(blob);
> > -		}
> > +	/* Set a degama & gamma LUT and a CTM using the
> > +	 * properties and verify the content of the
> > +	 * properties. */
> > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> > +		set_degamma(data, primary->pipe, degamma_linear);
> > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> > +		set_ctm(primary->pipe, ctm_identity);
> > +	set_gamma(data, primary->pipe, gamma_zero);
> > +	igt_display_commit(&data->display);
> > 
> > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM)) {
> > -			blob = get_blob(data, primary->pipe, IGT_CRTC_CTM);
> > -			igt_assert(blob &&
> > -				   blob->length == sizeof(struct drm_color_ctm));
> > -			drmModeFreePropertyBlob(blob);
> > -		}
> > -
> > -		blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT)) {
> > +		blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
> >  		igt_assert(blob &&
> >  			   blob->length == (sizeof(struct drm_color_lut) *
> > -					    data->gamma_lut_size));
> > -		lut = (struct drm_color_lut *) blob->data;
> > -		for (i = 0; i < data->gamma_lut_size; i++)
> > -			igt_assert(lut[i].red == 0 &&
> > -				   lut[i].green == 0 &&
> > -				   lut[i].blue == 0);
> > +					    data->degamma_lut_size));
> >  		drmModeFreePropertyBlob(blob);
> > +	}
> > 
> > -		/* Set a gamma LUT using the legacy ioctl and verify
> > -		 * the content of the GAMMA_LUT property is changed
> > -		 * and that CTM and DEGAMMA_LUT are empty. */
> > -		kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
> > -		legacy_lut_size = kms_crtc->gamma_size;
> > -		drmModeFreeCrtc(kms_crtc);
> > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM)) {
> > +		blob = get_blob(data, primary->pipe, IGT_CRTC_CTM);
> > +		igt_assert(blob &&
> > +			   blob->length == sizeof(struct drm_color_ctm));
> > +		drmModeFreePropertyBlob(blob);
> > +	}
> > 
> > -		red_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > -		green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > -		blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > +	blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> > +	igt_assert(blob &&
> > +		   blob->length == (sizeof(struct drm_color_lut) *
> > +				    data->gamma_lut_size));
> > +	lut = (struct drm_color_lut *) blob->data;
> > +	for (i = 0; i < data->gamma_lut_size; i++)
> > +		igt_assert(lut[i].red == 0 &&
> > +			   lut[i].green == 0 &&
> > +			   lut[i].blue == 0);
> > +	drmModeFreePropertyBlob(blob);
> > 
> > -		for (i = 0; i < legacy_lut_size; i++)
> > -			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> > +	/* Set a gamma LUT using the legacy ioctl and verify
> > +	 * the content of the GAMMA_LUT property is changed
> > +	 * and that CTM and DEGAMMA_LUT are empty. */
> > +	kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
> > +	legacy_lut_size = kms_crtc->gamma_size;
> > +	drmModeFreeCrtc(kms_crtc);
> > 
> > -		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd,
> > -						  primary->pipe->crtc_id,
> > -						  legacy_lut_size,
> > -						  red_lut, green_lut, blue_lut),
> > -			      0);
> > -		igt_display_commit(&data->display);
> > +	red_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > +	green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > +	blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > 
> > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> > -			igt_assert(get_blob(data, primary->pipe,
> > -					    IGT_CRTC_DEGAMMA_LUT) == NULL);
> > +	for (i = 0; i < legacy_lut_size; i++)
> > +		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> > 
> > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> > -			igt_assert(get_blob(data, primary->pipe, IGT_CRTC_CTM) ==
> > NULL);
> > +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd,
> > +					  primary->pipe->crtc_id,
> > +					  legacy_lut_size,
> > +					  red_lut, green_lut, blue_lut), 0);
> > +	igt_display_commit(&data->display);
> > 
> > -		blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> > -		igt_assert(blob &&
> > -			   blob->length == (sizeof(struct drm_color_lut) *
> > -					    legacy_lut_size));
> > -		lut = (struct drm_color_lut *) blob->data;
> > -		for (i = 0; i < legacy_lut_size; i++)
> > -			igt_assert(lut[i].red == 0xffff &&
> > -				   lut[i].green == 0xffff &&
> > -				   lut[i].blue == 0xffff);
> > -		drmModeFreePropertyBlob(blob);
> > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> > +		igt_assert(get_blob(data, primary->pipe,
> > +				    IGT_CRTC_DEGAMMA_LUT) == NULL);
> > 
> > -		igt_plane_set_fb(primary, NULL);
> > -		igt_output_set_pipe(output, PIPE_NONE);
> > -	}
> > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> > +		igt_assert(get_blob(data, primary->pipe, IGT_CRTC_CTM) == NULL);
> > +
> > +	blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> > +	igt_assert(blob &&
> > +		   blob->length == (sizeof(struct drm_color_lut) *
> > +				    legacy_lut_size));
> > +	lut = (struct drm_color_lut *) blob->data;
> > +	for (i = 0; i < legacy_lut_size; i++)
> > +		igt_assert(lut[i].red == 0xffff &&
> > +			   lut[i].green == 0xffff &&
> > +			   lut[i].blue == 0xffff);
> > +	drmModeFreePropertyBlob(blob);
> > +
> > +	igt_plane_set_fb(primary, NULL);
> > +	igt_output_set_pipe(output, PIPE_NONE);
> > 
> >  	free_lut(degamma_linear);
> >  	free_lut(gamma_zero);
> > @@ -442,84 +442,84 @@ static bool test_pipe_ctm(data_t *data,
> >  	igt_output_t *output;
> >  	bool ret = true;
> >  	igt_display_t *display = &data->display;
> > +	drmModeModeInfo *mode;
> > +	struct igt_fb fb_modeset, fb;
> > +	igt_crc_t crc_software, crc_hardware;
> > +	int fb_id, fb_modeset_id;
> > 
> >  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM));
> > 
> >  	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
> >  	gamma_linear = generate_table(data->gamma_lut_size, 1.0);
> > 
> > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > output) {
> > -		drmModeModeInfo *mode;
> > -		struct igt_fb fb_modeset, fb;
> > -		igt_crc_t crc_software, crc_hardware;
> > -		int fb_id, fb_modeset_id;
> > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > >pipe);
> > +	igt_require(output);
> > 
> > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > -		mode = igt_output_get_mode(output);
> > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > +	mode = igt_output_get_mode(output);
> > 
> > -		/* Create a framebuffer at the size of the output. */
> > -		fb_id = igt_create_fb(data->drm_fd,
> > +	/* Create a framebuffer at the size of the output. */
> > +	fb_id = igt_create_fb(data->drm_fd,
> > +			      mode->hdisplay,
> > +			      mode->vdisplay,
> > +			      DRM_FORMAT_XRGB8888,
> > +			      DRM_FORMAT_MOD_NONE,
> > +			      &fb);
> > +	igt_assert(fb_id);
> > +
> > +	fb_modeset_id = igt_create_fb(data->drm_fd,
> >  				      mode->hdisplay,
> >  				      mode->vdisplay,
> >  				      DRM_FORMAT_XRGB8888,
> >  				      DRM_FORMAT_MOD_NONE,
> > -				      &fb);
> > -		igt_assert(fb_id);
> > +				      &fb_modeset);
> > +	igt_assert(fb_modeset_id);
> > +	igt_plane_set_fb(primary, &fb_modeset);
> > 
> > -		fb_modeset_id = igt_create_fb(data->drm_fd,
> > -					      mode->hdisplay,
> > -					      mode->vdisplay,
> > -					      DRM_FORMAT_XRGB8888,
> > -					      DRM_FORMAT_MOD_NONE,
> > -					      &fb_modeset);
> > -		igt_assert(fb_modeset_id);
> > -		igt_plane_set_fb(primary, &fb_modeset);
> > -
> > -		/*
> > -		 * Don't program LUT's for max CTM cases, as limitation of
> > -		 * representing intermediate values between 0 and 1.0 causes
> > -		 * rounding issues and inaccuracies leading to crc mismatch.
> > -		 */
> > -		if (memcmp(before, after, sizeof(color_t))) {
> > -			set_degamma(data, primary->pipe, degamma_linear);
> > -			set_gamma(data, primary->pipe, gamma_linear);
> > -		} else {
> > -			/* Disable Degamma and Gamma for ctm max test */
> > -			disable_degamma(primary->pipe);
> > -			disable_gamma(primary->pipe);
> > -		}
> > -
> > -		disable_ctm(primary->pipe);
> > -		igt_display_commit(&data->display);
> > -
> > -		paint_rectangles(data, mode, after, &fb);
> > -		igt_plane_set_fb(primary, &fb);
> > -		set_ctm(primary->pipe, ctm_identity);
> > -		igt_display_commit(&data->display);
> > -		igt_wait_for_vblank(data->drm_fd,
> > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
> > -
> > -		/* With CTM transformation. */
> > -		paint_rectangles(data, mode, before, &fb);
> > -		igt_plane_set_fb(primary, &fb);
> > -		set_ctm(primary->pipe, ctm_matrix);
> > -		igt_display_commit(&data->display);
> > -		igt_wait_for_vblank(data->drm_fd,
> > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
> > -
> > -		/* Verify that the CRC of the software computed output is
> > -		 * equal to the CRC of the CTM matrix transformation output.
> > -		 */
> > -		ret &= !igt_skip_crc_compare || igt_check_crc_equal(&crc_software,
> > &crc_hardware);
> > -
> > -		igt_plane_set_fb(primary, NULL);
> > -		igt_output_set_pipe(output, PIPE_NONE);
> > -		igt_remove_fb(data->drm_fd, &fb);
> > -		igt_remove_fb(data->drm_fd, &fb_modeset);
> > +	/*
> > +	 * Don't program LUT's for max CTM cases, as limitation of
> > +	 * representing intermediate values between 0 and 1.0 causes
> > +	 * rounding issues and inaccuracies leading to crc mismatch.
> > +	 */
> > +	if (memcmp(before, after, sizeof(color_t))) {
> > +		set_degamma(data, primary->pipe, degamma_linear);
> > +		set_gamma(data, primary->pipe, gamma_linear);
> > +	} else {
> > +		/* Disable Degamma and Gamma for ctm max test */
> > +		disable_degamma(primary->pipe);
> > +		disable_gamma(primary->pipe);
> >  	}
> > 
> > +	disable_ctm(primary->pipe);
> > +	igt_display_commit(&data->display);
> > +
> > +	paint_rectangles(data, mode, after, &fb);
> > +	igt_plane_set_fb(primary, &fb);
> > +	set_ctm(primary->pipe, ctm_identity);
> > +	igt_display_commit(&data->display);
> > +	igt_wait_for_vblank(data->drm_fd,
> > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
> > +
> > +	/* With CTM transformation. */
> > +	paint_rectangles(data, mode, before, &fb);
> > +	igt_plane_set_fb(primary, &fb);
> > +	set_ctm(primary->pipe, ctm_matrix);
> > +	igt_display_commit(&data->display);
> > +	igt_wait_for_vblank(data->drm_fd,
> > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
> > +
> > +	/* Verify that the CRC of the software computed output is
> > +	 * equal to the CRC of the CTM matrix transformation output.
> > +	 */
> > +	ret &= !igt_skip_crc_compare || igt_check_crc_equal(&crc_software,
> > &crc_hardware);
> > +
> > +	igt_plane_set_fb(primary, NULL);
> > +	igt_output_set_pipe(output, PIPE_NONE);
> > +	igt_remove_fb(data->drm_fd, &fb);
> > +	igt_remove_fb(data->drm_fd, &fb_modeset);
> > +
> >  	free_lut(degamma_linear);
> >  	free_lut(gamma_linear);
> > 
> > --
> > 2.31.1
> 

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 1/7] tests/kms_color_chamelium: Remove invalid LUT size tests
  2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 1/7] tests/kms_color_chamelium: Remove invalid LUT size tests Ville Syrjala
@ 2021-09-12 15:30   ` Modem, Bhanuprakash
  0 siblings, 0 replies; 19+ messages in thread
From: Modem, Bhanuprakash @ 2021-09-12 15:30 UTC (permalink / raw)
  To: Ville Syrjala, igt-dev@lists.freedesktop.org

> From: Ville Syrjala <ville.syrjala@linux.intel.com>
> Sent: Friday, September 3, 2021 9:58 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Subject: [PATCH i-g-t v3 1/7] tests/kms_color_chamelium: Remove invalid LUT
> size tests
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> There is zero point in duplicating the invalid LUT size tests
> in the chamelium test. Get rid of them.
> 
> Cc: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

LGTM 
Reviewed-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

-Bhanu

> ---
>  tests/kms_color_chamelium.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
> index bc4356bfab6a..97741b9c968e 100644
> --- a/tests/kms_color_chamelium.c
> +++ b/tests/kms_color_chamelium.c
> @@ -752,17 +752,6 @@ igt_main
>  	for_each_pipe_static(pipe)
>  		igt_subtest_group
>  			run_tests_for_pipe(&data, pipe);
> -	igt_describe("Negative test case gamma lut size");
> -	igt_subtest_f("pipe-invalid-gamma-lut-sizes")
> -		invalid_gamma_lut_sizes(&data);
> -
> -	igt_describe("Negative test case degamma lut size");
> -	igt_subtest_f("pipe-invalid-degamma-lut-sizes")
> -		invalid_degamma_lut_sizes(&data);
> -
> -	igt_describe("Negative test case ctm matrix size");
> -	igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
> -		invalid_ctm_matrix_sizes(&data);
> 
>  	igt_fixture {
>  		igt_display_fini(&data.display);
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a single connector
  2021-09-07 17:34     ` Ville Syrjälä
@ 2021-09-12 15:36       ` Modem, Bhanuprakash
  0 siblings, 0 replies; 19+ messages in thread
From: Modem, Bhanuprakash @ 2021-09-12 15:36 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: igt-dev@lists.freedesktop.org

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Sent: Tuesday, September 7, 2021 11:05 PM
> To: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Cc: igt-dev@lists.freedesktop.org
> Subject: Re: [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a
> single connector
> 
> On Mon, Sep 06, 2021 at 06:38:26AM +0000, Modem, Bhanuprakash wrote:
> > > From: Ville Syrjala <ville.syrjala@linux.intel.com>
> > > Sent: Friday, September 3, 2021 9:58 PM
> > > To: igt-dev@lists.freedesktop.org
> > > Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> > > Subject: [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a
> > > single connector
> > >
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > >
> > > For most of the subtests the used connector should not matter,
> > > so run each subtest just for a single connector.
> > >
> > > Suggested-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  tests/kms_color.c | 612 +++++++++++++++++++++++-----------------------
> > >  1 file changed, 306 insertions(+), 306 deletions(-)
> > >
> > > diff --git a/tests/kms_color.c b/tests/kms_color.c
> > > index dabc6963e9e0..d78c7e211511 100644
> > > --- a/tests/kms_color.c
> > > +++ b/tests/kms_color.c
> > > @@ -37,6 +37,10 @@ static void test_pipe_degamma(data_t *data,
> > >  		{ 0.0, 1.0, 0.0 },
> > >  		{ 0.0, 0.0, 1.0 }
> > >  	};
> > > +	drmModeModeInfo *mode;
> > > +	struct igt_fb fb_modeset, fb;
> > > +	igt_crc_t crc_fullgamma, crc_fullcolors;
> > > +	int fb_id, fb_modeset_id;
> > >
> > >  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT));
> > >  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
> > > @@ -44,69 +48,65 @@ static void test_pipe_degamma(data_t *data,
> > >  	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
> > >  	degamma_full = generate_table_max(data->degamma_lut_size);
> > >
> > > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > > output) {
> > > -		drmModeModeInfo *mode;
> > > -		struct igt_fb fb_modeset, fb;
> > > -		igt_crc_t crc_fullgamma, crc_fullcolors;
> > > -		int fb_id, fb_modeset_id;
> > > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > > >pipe);
> > > +	igt_require(output);
> > >
> > > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > > -		mode = igt_output_get_mode(output);
> > > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > > +	mode = igt_output_get_mode(output);
> > >
> > > -		/* Create a framebuffer at the size of the output. */
> > > -		fb_id = igt_create_fb(data->drm_fd,
> > > +	/* Create a framebuffer at the size of the output. */
> > > +	fb_id = igt_create_fb(data->drm_fd,
> > > +			      mode->hdisplay,
> > > +			      mode->vdisplay,
> > > +			      DRM_FORMAT_XRGB8888,
> > > +			      DRM_FORMAT_MOD_NONE,
> > > +			      &fb);
> > > +	igt_assert(fb_id);
> >
> > Minor: we can get rid of extra variables by updating like
> > `igt_assert(igt_create_fb());`
> 
> I'm not going to be doing any unrelated changes in this
> patch. The indentation change alone is already bad enough
> to review.
> 
> >
> > And this is applicable for all the places.
> >
> > > +
> > > +	fb_modeset_id = igt_create_fb(data->drm_fd,
> > >  				      mode->hdisplay,
> > >  				      mode->vdisplay,
> > >  				      DRM_FORMAT_XRGB8888,
> > >  				      DRM_FORMAT_MOD_NONE,
> > > -				      &fb);
> > > -		igt_assert(fb_id);
> > > +				      &fb_modeset);
> > > +	igt_assert(fb_modeset_id);
> > >
> > > -		fb_modeset_id = igt_create_fb(data->drm_fd,
> > > -					      mode->hdisplay,
> > > -					      mode->vdisplay,
> > > -					      DRM_FORMAT_XRGB8888,
> > > -					      DRM_FORMAT_MOD_NONE,
> > > -					      &fb_modeset);
> > > -		igt_assert(fb_modeset_id);
> > > +	igt_plane_set_fb(primary, &fb_modeset);
> > > +	disable_ctm(primary->pipe);
> > > +	disable_gamma(primary->pipe);
> > > +	set_degamma(data, primary->pipe, degamma_linear);
> > > +	igt_display_commit(&data->display);
> > >
> > > -		igt_plane_set_fb(primary, &fb_modeset);
> > > -		disable_ctm(primary->pipe);
> > > -		disable_gamma(primary->pipe);
> > > -		set_degamma(data, primary->pipe, degamma_linear);
> > > -		igt_display_commit(&data->display);
> > > +	/* Draw solid colors with linear degamma transformation. */
> > > +	paint_rectangles(data, mode, red_green_blue, &fb);
> > > +	igt_plane_set_fb(primary, &fb);
> > > +	igt_display_commit(&data->display);
> > > +	igt_wait_for_vblank(data->drm_fd,
> > > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > >
> > > -		/* Draw solid colors with linear degamma transformation. */
> > > -		paint_rectangles(data, mode, red_green_blue, &fb);
> > > -		igt_plane_set_fb(primary, &fb);
> > > -		igt_display_commit(&data->display);
> > > -		igt_wait_for_vblank(data->drm_fd,
> > > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > > +	/* Draw a gradient with degamma LUT to remap all
> > > +	 * values to max red/green/blue.
> > > +	 */
> > > +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > > +	igt_plane_set_fb(primary, &fb);
> > > +	set_degamma(data, primary->pipe, degamma_full);
> > > +	igt_display_commit(&data->display);
> > > +	igt_wait_for_vblank(data->drm_fd,
> > > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > >
> > > -		/* Draw a gradient with degamma LUT to remap all
> > > -		 * values to max red/green/blue.
> > > -		 */
> > > -		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > > -		igt_plane_set_fb(primary, &fb);
> > > -		set_degamma(data, primary->pipe, degamma_full);
> > > -		igt_display_commit(&data->display);
> > > -		igt_wait_for_vblank(data->drm_fd,
> > > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > > +	/* Verify that the CRC of the software computed output is
> > > +	 * equal to the CRC of the degamma LUT transformation output.
> > > +	 */
> > > +	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > >
> > > -		/* Verify that the CRC of the software computed output is
> > > -		 * equal to the CRC of the degamma LUT transformation output.
> > > -		 */
> > > -		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > > -
> > > -		disable_degamma(primary->pipe);
> > > -		igt_plane_set_fb(primary, NULL);
> > > -		igt_output_set_pipe(output, PIPE_NONE);
> > > -		igt_display_commit(&data->display);
> > > -		igt_remove_fb(data->drm_fd, &fb);
> > > -		igt_remove_fb(data->drm_fd, &fb_modeset);
> > > -	}
> > > +	disable_degamma(primary->pipe);
> > > +	igt_plane_set_fb(primary, NULL);
> > > +	igt_output_set_pipe(output, PIPE_NONE);
> > > +	igt_display_commit(&data->display);
> > > +	igt_remove_fb(data->drm_fd, &fb);
> > > +	igt_remove_fb(data->drm_fd, &fb_modeset);
> > >
> > >  	free_lut(degamma_linear);
> > >  	free_lut(degamma_full);
> > > @@ -127,73 +127,73 @@ static void test_pipe_gamma(data_t *data,
> > >  		{ 0.0, 1.0, 0.0 },
> > >  		{ 0.0, 0.0, 1.0 }
> > >  	};
> > > +	drmModeModeInfo *mode;
> > > +	struct igt_fb fb_modeset, fb;
> > > +	igt_crc_t crc_fullgamma, crc_fullcolors;
> > > +	int fb_id, fb_modeset_id;
> > >
> > >  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_LUT));
> > >
> > >  	gamma_full = generate_table_max(data->gamma_lut_size);
> > >
> > > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > > output) {
> > > -		drmModeModeInfo *mode;
> > > -		struct igt_fb fb_modeset, fb;
> > > -		igt_crc_t crc_fullgamma, crc_fullcolors;
> > > -		int fb_id, fb_modeset_id;
> > > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > > >pipe);
> > > +	igt_require(output);
> > >
> > > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > > -		mode = igt_output_get_mode(output);
> > > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > > +	mode = igt_output_get_mode(output);
> > >
> > > -		/* Create a framebuffer at the size of the output. */
> > > -		fb_id = igt_create_fb(data->drm_fd,
> > > +	/* Create a framebuffer at the size of the output. */
> > > +	fb_id = igt_create_fb(data->drm_fd,
> > > +			      mode->hdisplay,
> > > +			      mode->vdisplay,
> > > +			      DRM_FORMAT_XRGB8888,
> > > +			      DRM_FORMAT_MOD_NONE,
> > > +			      &fb);
> > > +	igt_assert(fb_id);
> > > +
> > > +	fb_modeset_id = igt_create_fb(data->drm_fd,
> > >  				      mode->hdisplay,
> > >  				      mode->vdisplay,
> > >  				      DRM_FORMAT_XRGB8888,
> > >  				      DRM_FORMAT_MOD_NONE,
> > > -				      &fb);
> > > -		igt_assert(fb_id);
> > > +				      &fb_modeset);
> > > +	igt_assert(fb_modeset_id);
> > >
> > > -		fb_modeset_id = igt_create_fb(data->drm_fd,
> > > -					      mode->hdisplay,
> > > -					      mode->vdisplay,
> > > -					      DRM_FORMAT_XRGB8888,
> > > -					      DRM_FORMAT_MOD_NONE,
> > > -					      &fb_modeset);
> > > -		igt_assert(fb_modeset_id);
> > > +	igt_plane_set_fb(primary, &fb_modeset);
> > > +	disable_ctm(primary->pipe);
> > > +	disable_degamma(primary->pipe);
> > > +	set_gamma(data, primary->pipe, gamma_full);
> >
> > This could be disable_gamma(), right?
> 
> Getting matching crcs has been rather problematic in this
> test. I don't recall the specifics on which LUT is needed
> in each case to guarantee that.
> 
> >
> > > +	igt_display_commit(&data->display);
> > >
> > > -		igt_plane_set_fb(primary, &fb_modeset);
> > > -		disable_ctm(primary->pipe);
> > > -		disable_degamma(primary->pipe);
> > > -		set_gamma(data, primary->pipe, gamma_full);
> > > -		igt_display_commit(&data->display);
> > > +	/* Draw solid colors with no gamma transformation. */
> > > +	paint_rectangles(data, mode, red_green_blue, &fb);
> > > +	igt_plane_set_fb(primary, &fb);
> > > +	igt_display_commit(&data->display);
> > > +	igt_wait_for_vblank(data->drm_fd,
> > > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > >
> > > -		/* Draw solid colors with no gamma transformation. */
> > > -		paint_rectangles(data, mode, red_green_blue, &fb);
> > > -		igt_plane_set_fb(primary, &fb);
> > > -		igt_display_commit(&data->display);
> > > -		igt_wait_for_vblank(data->drm_fd,
> > > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > > +	/* Draw a gradient with gamma LUT to remap all values
> > > +	 * to max red/green/blue.
> > > +	 */
> > > +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > > +	igt_plane_set_fb(primary, &fb);
> >
> > And here we need to set the gamma: set_gamma(gamma_max)
> 
> Also a totally unrelated change. If you think there's a bug here
> pls submit a separate patch.

Sure I'll submit a new patch, I Think we are in good shape to merge
this series (I already reviewed remaining patches in this series).

- Bhanu

> 
> >
> > With these changes, this patch is
> > Reviewed-by: Bhanuprakash Modem <Bhanuprakash.modem@intel.com>
> >
> > - Bhanu
> >
> > > +	igt_display_commit(&data->display);
> > > +	igt_wait_for_vblank(data->drm_fd,
> > > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > >
> > > -		/* Draw a gradient with gamma LUT to remap all values
> > > -		 * to max red/green/blue.
> > > -		 */
> > > -		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > > -		igt_plane_set_fb(primary, &fb);
> > > -		igt_display_commit(&data->display);
> > > -		igt_wait_for_vblank(data->drm_fd,
> > > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > > +	/* Verify that the CRC of the software computed output is
> > > +	 * equal to the CRC of the gamma LUT transformation output.
> > > +	 */
> > > +	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > >
> > > -		/* Verify that the CRC of the software computed output is
> > > -		 * equal to the CRC of the gamma LUT transformation output.
> > > -		 */
> > > -		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > > -
> > > -		disable_gamma(primary->pipe);
> > > -		igt_plane_set_fb(primary, NULL);
> > > -		igt_output_set_pipe(output, PIPE_NONE);
> > > -		igt_display_commit(&data->display);
> > > -		igt_remove_fb(data->drm_fd, &fb);
> > > -		igt_remove_fb(data->drm_fd, &fb_modeset);
> > > -	}
> > > +	disable_gamma(primary->pipe);
> > > +	igt_plane_set_fb(primary, NULL);
> > > +	igt_output_set_pipe(output, PIPE_NONE);
> > > +	igt_display_commit(&data->display);
> > > +	igt_remove_fb(data->drm_fd, &fb);
> > > +	igt_remove_fb(data->drm_fd, &fb_modeset);
> > >
> > >  	free_lut(gamma_full);
> > >  }
> > > @@ -216,6 +216,10 @@ static void test_pipe_legacy_gamma(data_t *data,
> > >  	drmModeCrtc *kms_crtc;
> > >  	uint32_t i, legacy_lut_size;
> > >  	uint16_t *red_lut, *green_lut, *blue_lut;
> > > +	drmModeModeInfo *mode;
> > > +	struct igt_fb fb_modeset, fb;
> > > +	igt_crc_t crc_fullgamma, crc_fullcolors;
> > > +	int fb_id, fb_modeset_id;
> > >
> > >  	kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
> > >  	legacy_lut_size = kms_crtc->gamma_size;
> > > @@ -225,80 +229,76 @@ static void test_pipe_legacy_gamma(data_t *data,
> > >  	green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > >  	blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > >
> > > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > > output) {
> > > -		drmModeModeInfo *mode;
> > > -		struct igt_fb fb_modeset, fb;
> > > -		igt_crc_t crc_fullgamma, crc_fullcolors;
> > > -		int fb_id, fb_modeset_id;
> > > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > > >pipe);
> > > +	igt_require(output);
> > >
> > > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > > -		mode = igt_output_get_mode(output);
> > > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > > +	mode = igt_output_get_mode(output);
> > >
> > > -		/* Create a framebuffer at the size of the output. */
> > > -		fb_id = igt_create_fb(data->drm_fd,
> > > +	/* Create a framebuffer at the size of the output. */
> > > +	fb_id = igt_create_fb(data->drm_fd,
> > > +			      mode->hdisplay,
> > > +			      mode->vdisplay,
> > > +			      DRM_FORMAT_XRGB8888,
> > > +			      DRM_FORMAT_MOD_NONE,
> > > +			      &fb);
> > > +	igt_assert(fb_id);
> > > +
> > > +	fb_modeset_id = igt_create_fb(data->drm_fd,
> > >  				      mode->hdisplay,
> > >  				      mode->vdisplay,
> > >  				      DRM_FORMAT_XRGB8888,
> > >  				      DRM_FORMAT_MOD_NONE,
> > > -				      &fb);
> > > -		igt_assert(fb_id);
> > > -
> > > -		fb_modeset_id = igt_create_fb(data->drm_fd,
> > > -					      mode->hdisplay,
> > > -					      mode->vdisplay,
> > > -					      DRM_FORMAT_XRGB8888,
> > > -					      DRM_FORMAT_MOD_NONE,
> > > -					      &fb_modeset);
> > > -		igt_assert(fb_modeset_id);
> > > -
> > > -		igt_plane_set_fb(primary, &fb_modeset);
> > > -		disable_degamma(primary->pipe);
> > > -		disable_gamma(primary->pipe);
> > > -		disable_ctm(primary->pipe);
> > > -		igt_display_commit(&data->display);
> > > -
> > > -		/* Draw solid colors with no gamma transformation. */
> > > -		paint_rectangles(data, mode, red_green_blue, &fb);
> > > -		igt_plane_set_fb(primary, &fb);
> > > -		igt_display_commit(&data->display);
> > > -		igt_wait_for_vblank(data->drm_fd,
> > > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > > -
> > > -		/* Draw a gradient with gamma LUT to remap all values
> > > -		 * to max red/green/blue.
> > > -		 */
> > > -		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > > -		igt_plane_set_fb(primary, &fb);
> > > -
> > > -		red_lut[0] = green_lut[0] = blue_lut[0] = 0;
> > > -		for (i = 1; i < legacy_lut_size; i++)
> > > -			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> > > -		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe-
> > > >crtc_id,
> > > -						  legacy_lut_size, red_lut, green_lut,
> > > blue_lut), 0);
> > > -		igt_display_commit(&data->display);
> > > -		igt_wait_for_vblank(data->drm_fd,
> > > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > > -
> > > -		/* Verify that the CRC of the software computed output is
> > > -		 * equal to the CRC of the gamma LUT transformation output.
> > > -		 */
> > > -		igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > > -
> > > -		/* Reset output. */
> > > -		for (i = 1; i < legacy_lut_size; i++)
> > > -			red_lut[i] = green_lut[i] = blue_lut[i] = i << 8;
> > > -
> > > -		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe-
> > > >crtc_id,
> > > -						  legacy_lut_size, red_lut, green_lut,
> > > blue_lut), 0);
> > > -		igt_display_commit(&data->display);
> > > -
> > > -		igt_plane_set_fb(primary, NULL);
> > > -		igt_output_set_pipe(output, PIPE_NONE);
> > > -		igt_remove_fb(data->drm_fd, &fb);
> > > -		igt_remove_fb(data->drm_fd, &fb_modeset);
> > > -	}
> > > +				      &fb_modeset);
> > > +	igt_assert(fb_modeset_id);
> > > +
> > > +	igt_plane_set_fb(primary, &fb_modeset);
> > > +	disable_degamma(primary->pipe);
> > > +	disable_gamma(primary->pipe);
> > > +	disable_ctm(primary->pipe);
> > > +	igt_display_commit(&data->display);
> > > +
> > > +	/* Draw solid colors with no gamma transformation. */
> > > +	paint_rectangles(data, mode, red_green_blue, &fb);
> > > +	igt_plane_set_fb(primary, &fb);
> > > +	igt_display_commit(&data->display);
> > > +	igt_wait_for_vblank(data->drm_fd,
> > > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
> > > +
> > > +	/* Draw a gradient with gamma LUT to remap all values
> > > +	 * to max red/green/blue.
> > > +	 */
> > > +	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
> > > +	igt_plane_set_fb(primary, &fb);
> > > +
> > > +	red_lut[0] = green_lut[0] = blue_lut[0] = 0;
> > > +	for (i = 1; i < legacy_lut_size; i++)
> > > +		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> > > +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
> > > +					  legacy_lut_size, red_lut, green_lut, blue_lut),
> > > 0);
> > > +	igt_display_commit(&data->display);
> > > +	igt_wait_for_vblank(data->drm_fd,
> > > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
> > > +
> > > +	/* Verify that the CRC of the software computed output is
> > > +	 * equal to the CRC of the gamma LUT transformation output.
> > > +	 */
> > > +	igt_assert_crc_equal(&crc_fullgamma, &crc_fullcolors);
> > > +
> > > +	/* Reset output. */
> > > +	for (i = 1; i < legacy_lut_size; i++)
> > > +		red_lut[i] = green_lut[i] = blue_lut[i] = i << 8;
> > > +
> > > +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
> > > +					  legacy_lut_size, red_lut, green_lut, blue_lut),
> > > 0);
> > > +	igt_display_commit(&data->display);
> > > +
> > > +	igt_plane_set_fb(primary, NULL);
> > > +	igt_output_set_pipe(output, PIPE_NONE);
> > > +	igt_remove_fb(data->drm_fd, &fb);
> > > +	igt_remove_fb(data->drm_fd, &fb_modeset);
> > >
> > >  	free(red_lut);
> > >  	free(green_lut);
> > > @@ -331,93 +331,93 @@ static void test_pipe_legacy_gamma_reset(data_t
> *data,
> > >  		degamma_linear = generate_table(data->degamma_lut_size, 1.0);
> > >  	gamma_zero = generate_table_zero(data->gamma_lut_size);
> > >
> > > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > > output) {
> > > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > > >pipe);
> > > +	igt_require(output);
> > >
> > > -		/* Ensure we have a clean state to start with. */
> > > -		disable_degamma(primary->pipe);
> > > -		disable_ctm(primary->pipe);
> > > -		disable_gamma(primary->pipe);
> > > -		igt_display_commit(&data->display);
> > > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > >
> > > -		/* Set a degama & gamma LUT and a CTM using the
> > > -		 * properties and verify the content of the
> > > -		 * properties. */
> > > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> > > -			set_degamma(data, primary->pipe, degamma_linear);
> > > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> > > -			set_ctm(primary->pipe, ctm_identity);
> > > -		set_gamma(data, primary->pipe, gamma_zero);
> > > -		igt_display_commit(&data->display);
> > > +	/* Ensure we have a clean state to start with. */
> > > +	disable_degamma(primary->pipe);
> > > +	disable_ctm(primary->pipe);
> > > +	disable_gamma(primary->pipe);
> > > +	igt_display_commit(&data->display);
> > >
> > > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT)) {
> > > -			blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
> > > -			igt_assert(blob &&
> > > -				   blob->length == (sizeof(struct drm_color_lut) *
> > > -						    data->degamma_lut_size));
> > > -			drmModeFreePropertyBlob(blob);
> > > -		}
> > > +	/* Set a degama & gamma LUT and a CTM using the
> > > +	 * properties and verify the content of the
> > > +	 * properties. */
> > > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> > > +		set_degamma(data, primary->pipe, degamma_linear);
> > > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> > > +		set_ctm(primary->pipe, ctm_identity);
> > > +	set_gamma(data, primary->pipe, gamma_zero);
> > > +	igt_display_commit(&data->display);
> > >
> > > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM)) {
> > > -			blob = get_blob(data, primary->pipe, IGT_CRTC_CTM);
> > > -			igt_assert(blob &&
> > > -				   blob->length == sizeof(struct drm_color_ctm));
> > > -			drmModeFreePropertyBlob(blob);
> > > -		}
> > > -
> > > -		blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> > > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT)) {
> > > +		blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
> > >  		igt_assert(blob &&
> > >  			   blob->length == (sizeof(struct drm_color_lut) *
> > > -					    data->gamma_lut_size));
> > > -		lut = (struct drm_color_lut *) blob->data;
> > > -		for (i = 0; i < data->gamma_lut_size; i++)
> > > -			igt_assert(lut[i].red == 0 &&
> > > -				   lut[i].green == 0 &&
> > > -				   lut[i].blue == 0);
> > > +					    data->degamma_lut_size));
> > >  		drmModeFreePropertyBlob(blob);
> > > +	}
> > >
> > > -		/* Set a gamma LUT using the legacy ioctl and verify
> > > -		 * the content of the GAMMA_LUT property is changed
> > > -		 * and that CTM and DEGAMMA_LUT are empty. */
> > > -		kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
> > > -		legacy_lut_size = kms_crtc->gamma_size;
> > > -		drmModeFreeCrtc(kms_crtc);
> > > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM)) {
> > > +		blob = get_blob(data, primary->pipe, IGT_CRTC_CTM);
> > > +		igt_assert(blob &&
> > > +			   blob->length == sizeof(struct drm_color_ctm));
> > > +		drmModeFreePropertyBlob(blob);
> > > +	}
> > >
> > > -		red_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > > -		green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > > -		blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > > +	blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> > > +	igt_assert(blob &&
> > > +		   blob->length == (sizeof(struct drm_color_lut) *
> > > +				    data->gamma_lut_size));
> > > +	lut = (struct drm_color_lut *) blob->data;
> > > +	for (i = 0; i < data->gamma_lut_size; i++)
> > > +		igt_assert(lut[i].red == 0 &&
> > > +			   lut[i].green == 0 &&
> > > +			   lut[i].blue == 0);
> > > +	drmModeFreePropertyBlob(blob);
> > >
> > > -		for (i = 0; i < legacy_lut_size; i++)
> > > -			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> > > +	/* Set a gamma LUT using the legacy ioctl and verify
> > > +	 * the content of the GAMMA_LUT property is changed
> > > +	 * and that CTM and DEGAMMA_LUT are empty. */
> > > +	kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
> > > +	legacy_lut_size = kms_crtc->gamma_size;
> > > +	drmModeFreeCrtc(kms_crtc);
> > >
> > > -		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd,
> > > -						  primary->pipe->crtc_id,
> > > -						  legacy_lut_size,
> > > -						  red_lut, green_lut, blue_lut),
> > > -			      0);
> > > -		igt_display_commit(&data->display);
> > > +	red_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > > +	green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > > +	blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> > >
> > > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> > > -			igt_assert(get_blob(data, primary->pipe,
> > > -					    IGT_CRTC_DEGAMMA_LUT) == NULL);
> > > +	for (i = 0; i < legacy_lut_size; i++)
> > > +		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> > >
> > > -		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> > > -			igt_assert(get_blob(data, primary->pipe, IGT_CRTC_CTM) ==
> > > NULL);
> > > +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd,
> > > +					  primary->pipe->crtc_id,
> > > +					  legacy_lut_size,
> > > +					  red_lut, green_lut, blue_lut), 0);
> > > +	igt_display_commit(&data->display);
> > >
> > > -		blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> > > -		igt_assert(blob &&
> > > -			   blob->length == (sizeof(struct drm_color_lut) *
> > > -					    legacy_lut_size));
> > > -		lut = (struct drm_color_lut *) blob->data;
> > > -		for (i = 0; i < legacy_lut_size; i++)
> > > -			igt_assert(lut[i].red == 0xffff &&
> > > -				   lut[i].green == 0xffff &&
> > > -				   lut[i].blue == 0xffff);
> > > -		drmModeFreePropertyBlob(blob);
> > > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
> > > +		igt_assert(get_blob(data, primary->pipe,
> > > +				    IGT_CRTC_DEGAMMA_LUT) == NULL);
> > >
> > > -		igt_plane_set_fb(primary, NULL);
> > > -		igt_output_set_pipe(output, PIPE_NONE);
> > > -	}
> > > +	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
> > > +		igt_assert(get_blob(data, primary->pipe, IGT_CRTC_CTM) == NULL);
> > > +
> > > +	blob = get_blob(data, primary->pipe, IGT_CRTC_GAMMA_LUT);
> > > +	igt_assert(blob &&
> > > +		   blob->length == (sizeof(struct drm_color_lut) *
> > > +				    legacy_lut_size));
> > > +	lut = (struct drm_color_lut *) blob->data;
> > > +	for (i = 0; i < legacy_lut_size; i++)
> > > +		igt_assert(lut[i].red == 0xffff &&
> > > +			   lut[i].green == 0xffff &&
> > > +			   lut[i].blue == 0xffff);
> > > +	drmModeFreePropertyBlob(blob);
> > > +
> > > +	igt_plane_set_fb(primary, NULL);
> > > +	igt_output_set_pipe(output, PIPE_NONE);
> > >
> > >  	free_lut(degamma_linear);
> > >  	free_lut(gamma_zero);
> > > @@ -442,84 +442,84 @@ static bool test_pipe_ctm(data_t *data,
> > >  	igt_output_t *output;
> > >  	bool ret = true;
> > >  	igt_display_t *display = &data->display;
> > > +	drmModeModeInfo *mode;
> > > +	struct igt_fb fb_modeset, fb;
> > > +	igt_crc_t crc_software, crc_hardware;
> > > +	int fb_id, fb_modeset_id;
> > >
> > >  	igt_require(igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM));
> > >
> > >  	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
> > >  	gamma_linear = generate_table(data->gamma_lut_size, 1.0);
> > >
> > > -	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe,
> > > output) {
> > > -		drmModeModeInfo *mode;
> > > -		struct igt_fb fb_modeset, fb;
> > > -		igt_crc_t crc_software, crc_hardware;
> > > -		int fb_id, fb_modeset_id;
> > > +	output = igt_get_single_output_for_pipe(&data->display, primary->pipe-
> > > >pipe);
> > > +	igt_require(output);
> > >
> > > -		igt_output_set_pipe(output, primary->pipe->pipe);
> > > -		mode = igt_output_get_mode(output);
> > > +	igt_output_set_pipe(output, primary->pipe->pipe);
> > > +	mode = igt_output_get_mode(output);
> > >
> > > -		/* Create a framebuffer at the size of the output. */
> > > -		fb_id = igt_create_fb(data->drm_fd,
> > > +	/* Create a framebuffer at the size of the output. */
> > > +	fb_id = igt_create_fb(data->drm_fd,
> > > +			      mode->hdisplay,
> > > +			      mode->vdisplay,
> > > +			      DRM_FORMAT_XRGB8888,
> > > +			      DRM_FORMAT_MOD_NONE,
> > > +			      &fb);
> > > +	igt_assert(fb_id);
> > > +
> > > +	fb_modeset_id = igt_create_fb(data->drm_fd,
> > >  				      mode->hdisplay,
> > >  				      mode->vdisplay,
> > >  				      DRM_FORMAT_XRGB8888,
> > >  				      DRM_FORMAT_MOD_NONE,
> > > -				      &fb);
> > > -		igt_assert(fb_id);
> > > +				      &fb_modeset);
> > > +	igt_assert(fb_modeset_id);
> > > +	igt_plane_set_fb(primary, &fb_modeset);
> > >
> > > -		fb_modeset_id = igt_create_fb(data->drm_fd,
> > > -					      mode->hdisplay,
> > > -					      mode->vdisplay,
> > > -					      DRM_FORMAT_XRGB8888,
> > > -					      DRM_FORMAT_MOD_NONE,
> > > -					      &fb_modeset);
> > > -		igt_assert(fb_modeset_id);
> > > -		igt_plane_set_fb(primary, &fb_modeset);
> > > -
> > > -		/*
> > > -		 * Don't program LUT's for max CTM cases, as limitation of
> > > -		 * representing intermediate values between 0 and 1.0 causes
> > > -		 * rounding issues and inaccuracies leading to crc mismatch.
> > > -		 */
> > > -		if (memcmp(before, after, sizeof(color_t))) {
> > > -			set_degamma(data, primary->pipe, degamma_linear);
> > > -			set_gamma(data, primary->pipe, gamma_linear);
> > > -		} else {
> > > -			/* Disable Degamma and Gamma for ctm max test */
> > > -			disable_degamma(primary->pipe);
> > > -			disable_gamma(primary->pipe);
> > > -		}
> > > -
> > > -		disable_ctm(primary->pipe);
> > > -		igt_display_commit(&data->display);
> > > -
> > > -		paint_rectangles(data, mode, after, &fb);
> > > -		igt_plane_set_fb(primary, &fb);
> > > -		set_ctm(primary->pipe, ctm_identity);
> > > -		igt_display_commit(&data->display);
> > > -		igt_wait_for_vblank(data->drm_fd,
> > > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
> > > -
> > > -		/* With CTM transformation. */
> > > -		paint_rectangles(data, mode, before, &fb);
> > > -		igt_plane_set_fb(primary, &fb);
> > > -		set_ctm(primary->pipe, ctm_matrix);
> > > -		igt_display_commit(&data->display);
> > > -		igt_wait_for_vblank(data->drm_fd,
> > > -				display->pipes[primary->pipe->pipe].crtc_offset);
> > > -		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
> > > -
> > > -		/* Verify that the CRC of the software computed output is
> > > -		 * equal to the CRC of the CTM matrix transformation output.
> > > -		 */
> > > -		ret &= !igt_skip_crc_compare || igt_check_crc_equal(&crc_software,
> > > &crc_hardware);
> > > -
> > > -		igt_plane_set_fb(primary, NULL);
> > > -		igt_output_set_pipe(output, PIPE_NONE);
> > > -		igt_remove_fb(data->drm_fd, &fb);
> > > -		igt_remove_fb(data->drm_fd, &fb_modeset);
> > > +	/*
> > > +	 * Don't program LUT's for max CTM cases, as limitation of
> > > +	 * representing intermediate values between 0 and 1.0 causes
> > > +	 * rounding issues and inaccuracies leading to crc mismatch.
> > > +	 */
> > > +	if (memcmp(before, after, sizeof(color_t))) {
> > > +		set_degamma(data, primary->pipe, degamma_linear);
> > > +		set_gamma(data, primary->pipe, gamma_linear);
> > > +	} else {
> > > +		/* Disable Degamma and Gamma for ctm max test */
> > > +		disable_degamma(primary->pipe);
> > > +		disable_gamma(primary->pipe);
> > >  	}
> > >
> > > +	disable_ctm(primary->pipe);
> > > +	igt_display_commit(&data->display);
> > > +
> > > +	paint_rectangles(data, mode, after, &fb);
> > > +	igt_plane_set_fb(primary, &fb);
> > > +	set_ctm(primary->pipe, ctm_identity);
> > > +	igt_display_commit(&data->display);
> > > +	igt_wait_for_vblank(data->drm_fd,
> > > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
> > > +
> > > +	/* With CTM transformation. */
> > > +	paint_rectangles(data, mode, before, &fb);
> > > +	igt_plane_set_fb(primary, &fb);
> > > +	set_ctm(primary->pipe, ctm_matrix);
> > > +	igt_display_commit(&data->display);
> > > +	igt_wait_for_vblank(data->drm_fd,
> > > +			    display->pipes[primary->pipe->pipe].crtc_offset);
> > > +	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
> > > +
> > > +	/* Verify that the CRC of the software computed output is
> > > +	 * equal to the CRC of the CTM matrix transformation output.
> > > +	 */
> > > +	ret &= !igt_skip_crc_compare || igt_check_crc_equal(&crc_software,
> > > &crc_hardware);
> > > +
> > > +	igt_plane_set_fb(primary, NULL);
> > > +	igt_output_set_pipe(output, PIPE_NONE);
> > > +	igt_remove_fb(data->drm_fd, &fb);
> > > +	igt_remove_fb(data->drm_fd, &fb_modeset);
> > > +
> > >  	free_lut(degamma_linear);
> > >  	free_lut(gamma_linear);
> > >
> > > --
> > > 2.31.1
> >
> 
> --
> Ville Syrjälä
> Intel

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-09-12 15:36 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-03 16:27 [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Ville Syrjala
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 1/7] tests/kms_color_chamelium: Remove invalid LUT size tests Ville Syrjala
2021-09-12 15:30   ` Modem, Bhanuprakash
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 2/7] tests/kms_color: Refactor " Ville Syrjala
2021-09-06  6:37   ` Modem, Bhanuprakash
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 3/7] tests/kms_color: Store r/g/b separately for LUT color tests Ville Syrjala
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 4/7] tests/kms_color: Pass pipe to invalid LUT size tests Ville Syrjala
2021-09-06  6:37   ` Modem, Bhanuprakash
2021-09-07 17:26     ` Ville Syrjälä
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 5/7] tests/kms_color: Run each subtest only for a single connector Ville Syrjala
2021-09-06  6:38   ` Modem, Bhanuprakash
2021-09-07 17:34     ` Ville Syrjälä
2021-09-12 15:36       ` Modem, Bhanuprakash
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 6/7] lib/kms: Add GAMMA_LUT_3D support Ville Syrjala
2021-09-03 16:27 ` [igt-dev] [PATCH i-g-t v3 7/7] tests/kms_color: Add GAMMA_LUT_3D tests Ville Syrjala
2021-09-06  6:38   ` Modem, Bhanuprakash
2021-09-03 17:25 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_color: 3D LUT tests (rev5) Patchwork
2021-09-03 19:46 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-09-06  6:37 ` [igt-dev] [PATCH i-g-t v3 0/7] tests/kms_color: 3D LUT tests Modem, Bhanuprakash

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox