All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties
@ 2021-06-03 14:40 venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 02/23] kms_color_helper: Add helper functions for plane color mgmt venkata.sai.patnana
                   ` (23 more replies)
  0 siblings, 24 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Mukunda Pramodh Kumar

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

Add support for Plane color management properties.

Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
---
 lib/igt_kms.c | 5 +++++
 lib/igt_kms.h | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index c7c69b6ea0..ae183e822c 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -581,6 +581,11 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 	[IGT_PLANE_ALPHA] = "alpha",
 	[IGT_PLANE_ZPOS] = "zpos",
 	[IGT_PLANE_FB_DAMAGE_CLIPS] = "FB_DAMAGE_CLIPS",
+	[IGT_PLANE_CTM] = "PLANE_CTM",
+	[IGT_PLANE_GAMMA_MODE] = "PLANE_GAMMA_MODE",
+	[IGT_PLANE_GAMMA_LUT] = "PLANE_GAMMA_LUT",
+	[IGT_PLANE_DEGAMMA_MODE] = "PLANE_DEGAMMA_MODE",
+	[IGT_PLANE_DEGAMMA_LUT] = "PLANE_DEGAMMA_LUT",
 };
 
 const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 8cde24b791..41967bf28a 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -301,6 +301,11 @@ enum igt_atomic_plane_properties {
        IGT_PLANE_ALPHA,
        IGT_PLANE_ZPOS,
        IGT_PLANE_FB_DAMAGE_CLIPS,
+       IGT_PLANE_CTM,
+       IGT_PLANE_GAMMA_MODE,
+       IGT_PLANE_GAMMA_LUT,
+       IGT_PLANE_DEGAMMA_MODE,
+       IGT_PLANE_DEGAMMA_LUT,
        IGT_NUM_PLANE_PROPS
 };
 
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 02/23] kms_color_helper: Add helper functions for plane color mgmt
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 03/23] tests/kms_color: New subtests for Plane gamma venkata.sai.patnana
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Mukunda Pramodh Kumar

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

Add helper functions to support Plane color management properties.

v2:
* Fix LUT size calculation logic (Bhanu)
v3:
* Remove redundant checks & drop unnecessary temp variables (Uma)
* Fix the hardcoded precision data (Bhanu)
* Fix the LUT creation logic by obtaining segment data (Uma)
* Restructure the helper functions to update plane props (Uma)
v4:
* Restructure to manage the memory (alloc & free) by the caller (Uma)

Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
---
 tests/kms_color_helper.c | 144 +++++++++++++++++++++++++++++++++++++++
 tests/kms_color_helper.h |  25 +++++++
 2 files changed, 169 insertions(+)

diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index 5f223a8812..a14a97999e 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -232,6 +232,150 @@ void disable_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop)
 		igt_pipe_obj_replace_prop_blob(pipe, prop, NULL, 0);
 }
 
+drmModePropertyPtr get_plane_gamma_degamma_mode(igt_plane_t *plane,
+				enum igt_atomic_plane_properties prop)
+{
+	igt_display_t *display = plane->pipe->display;
+	uint32_t prop_id = plane->props[prop];
+	drmModePropertyPtr drmProp;
+
+	igt_assert(prop_id);
+
+	drmProp = drmModeGetProperty(display->drm_fd, prop_id);
+
+	igt_assert(drmProp);
+	igt_assert(drmProp->count_enums);
+
+	return drmProp;
+}
+
+struct drm_color_lut_ext *create_linear_lut(segment_data_t *info)
+{
+	uint32_t val, segment, entry, index = 0;
+	uint32_t max_val = 0xffffffff;
+	struct drm_color_lut_ext *lut = malloc(sizeof(struct drm_color_lut_ext) * info->entries_count);
+	igt_assert(lut);
+
+	for (segment = 0; segment < info->segment_count; segment++) {
+		uint32_t entry_count = info->segment_data[segment].count;
+		uint32_t start = info->segment_data[segment].start;
+		uint32_t end = info->segment_data[segment].end;
+
+		for (entry = 1; entry <= entry_count; entry++) {
+			val = (index == 0) ? /* First entry is Zero. */
+				0 : start + entry * ((end - start) * 1.0 / entry_count);
+
+			lut[index].red = lut[index].green = lut[index].blue = MIN(val, max_val);
+
+			index++;
+		}
+	}
+
+	return lut;
+}
+
+struct drm_color_lut_ext *create_max_lut(segment_data_t *info)
+{
+	int i;
+	struct drm_color_lut_ext *lut;
+	uint32_t max_val = 0xffffffff;
+
+	lut = malloc(sizeof(struct drm_color_lut_ext) * info->entries_count);
+	igt_assert(lut);
+
+	lut[0].red = lut[0].green = lut[0].blue = 0; /* First entry is Zero. */
+
+	for (i = 1; i < info->entries_count; i++)
+		lut[i].red = lut[i].green = lut[i].blue = max_val;
+
+	return lut;
+}
+
+void clear_segment_data(segment_data_t *info)
+{
+	if (!info)
+		return;
+
+	free(info->segment_data);
+	free(info);
+}
+
+segment_data_t *get_segment_data(data_t *data,
+				uint64_t blob_id, char *mode)
+{
+	drmModePropertyBlobPtr blob;
+	struct drm_color_lut_range *lut_range = NULL;
+	segment_data_t *info = NULL;
+	uint32_t i;
+
+	blob = drmModeGetPropertyBlob(data->drm_fd, blob_id);
+	igt_assert(blob);
+	igt_assert(blob->length);
+
+	info = malloc(sizeof(segment_data_t));
+	igt_assert(info);
+
+	lut_range = (struct drm_color_lut_range *) blob->data;
+	info->segment_count = blob->length / sizeof(lut_range[0]);
+	igt_assert(info->segment_count);
+
+	info->segment_data = malloc(sizeof(struct drm_color_lut_range) * info->segment_count);
+	igt_assert(info->segment_data);
+
+	for (i = 0; i < info->segment_count; i++) {
+		info->entries_count += lut_range[i].count;
+		info->segment_data[i] = lut_range[i];
+	}
+
+	drmModeFreePropertyBlob(blob);
+
+	return info;
+}
+
+void set_plane_gamma(igt_plane_t *plane,
+		char *mode,
+		struct drm_color_lut_ext *lut,
+		uint32_t size)
+{
+	igt_plane_set_prop_enum(plane, IGT_PLANE_GAMMA_MODE, mode);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_GAMMA_LUT, lut, size);
+}
+
+void set_plane_degamma(igt_plane_t *plane,
+		char *mode,
+		struct drm_color_lut_ext *lut,
+		uint32_t size)
+{
+	igt_plane_set_prop_enum(plane, IGT_PLANE_DEGAMMA_MODE, mode);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_DEGAMMA_LUT, lut, size);
+}
+
+void set_plane_ctm(igt_plane_t *plane, const double *coefficients)
+{
+	struct drm_color_ctm ctm;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(ctm.matrix); i++) {
+		if (coefficients[i] < 0) {
+			ctm.matrix[i] =
+				(int64_t) (-coefficients[i] *
+				((int64_t) 1L << 32));
+			ctm.matrix[i] |= 1ULL << 63;
+		} else
+			ctm.matrix[i] =
+				(int64_t) (coefficients[i] *
+				((int64_t) 1L << 32));
+	}
+
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_CTM, &ctm, sizeof(ctm));
+}
+
+void disable_plane_prop(igt_plane_t *plane, enum igt_atomic_plane_properties prop)
+{
+	if (igt_plane_has_prop(plane, prop))
+		igt_plane_replace_prop_blob(plane, prop, NULL, 0);
+}
+
 drmModePropertyBlobPtr
 get_blob(data_t *data, igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop)
 {
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index 88890724c2..945cc475e3 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -64,6 +64,14 @@ typedef struct {
 	double coeffs[];
 } gamma_lut_t;
 
+typedef struct {
+	uint32_t segment_count;
+	struct drm_color_lut_range *segment_data;
+	uint32_t entries_count;
+} segment_data_t;
+
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
 void paint_gradient_rectangles(data_t *data,
 			       drmModeModeInfo *mode,
 			       color_t *colors,
@@ -90,10 +98,27 @@ void set_gamma(data_t *data,
 void set_ctm(igt_pipe_t *pipe, const double *coefficients);
 void disable_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop);
 
+drmModePropertyPtr get_plane_gamma_degamma_mode(igt_plane_t *plane,
+	enum igt_atomic_plane_properties prop);
+void clear_segment_data(segment_data_t *info);
+struct drm_color_lut_ext *create_linear_lut(segment_data_t *info);
+struct drm_color_lut_ext *create_max_lut(segment_data_t *info);
+segment_data_t *get_segment_data(data_t *data, uint64_t blob_id, char *mode);
+void set_plane_gamma(igt_plane_t *plane,
+	char *mode, struct drm_color_lut_ext *lut, uint32_t size);
+void set_plane_degamma(igt_plane_t *plane,
+	char *mode, struct drm_color_lut_ext *lut, uint32_t size);
+void set_plane_ctm(igt_plane_t *plane, const double *coefficients);
+void disable_plane_prop(igt_plane_t *plane, enum igt_atomic_plane_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_ctm(pipe) disable_prop(pipe, IGT_CRTC_CTM)
 
+#define disable_plane_degamma(plane) disable_plane_prop(plane, IGT_PLANE_DEGAMMA_LUT)
+#define disable_plane_gamma(plane) disable_plane_prop(plane, IGT_PLANE_GAMMA_LUT)
+#define disable_plane_ctm(plane) disable_plane_prop(plane, IGT_PLANE_CTM)
+
 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);
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 03/23] tests/kms_color: New subtests for Plane gamma
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 02/23] kms_color_helper: Add helper functions for plane color mgmt venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 04/23] tests/kms_color: New subtests for Plane degamma venkata.sai.patnana
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

To verify Plane gamma, draw 3 gradient rectangles in red, green and blue,
with a maxed out gamma LUT and verify we have the same CRC as drawing solid
color rectangles.

v2:
* Rename function names (Uma)
* Update to use restructured helper functions (Bhanu)
v3:
* Restructure to manage the memory (alloc & free) by the caller (Uma)
v4:
* Clear the gamma before exit (Uma)
v5:
* Ignore "no gamma" from enum list (Bhanu)
v6:
* Search for the enum name, instead of assuming value as 0 (Uma)

Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_color.c | 181 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 180 insertions(+), 1 deletion(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 3a42532a5c..9b5c1d63eb 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -24,7 +24,34 @@
 
 #include "kms_color_helper.h"
 
-IGT_TEST_DESCRIPTION("Test Color Features at Pipe level");
+IGT_TEST_DESCRIPTION("Test Color Features at Pipe & Plane level");
+
+#define MAX_SUPPORTED_PLANES 7
+#define SDR_PLANE_BASE 3
+
+typedef bool (*test_t)(data_t*, igt_plane_t*);
+
+static bool is_hdr_plane(const igt_plane_t *plane)
+{
+	return plane->index >= 0 && plane->index < SDR_PLANE_BASE;
+}
+
+static bool is_valid_plane(igt_plane_t *plane)
+{
+	int index = plane->index;
+
+	if (plane->type != DRM_PLANE_TYPE_PRIMARY)
+		return false;
+
+	/*
+	 * Test 1 HDR plane, 1 SDR plane.
+	 *
+	 * 0,1,2 HDR planes
+	 * 3,4,5,6 SDR planes
+	 *
+	 */
+	return index >= 0 && index < MAX_SUPPORTED_PLANES;
+}
 
 static void test_pipe_degamma(data_t *data,
 			      igt_plane_t *primary)
@@ -638,6 +665,122 @@ static void test_pipe_limited_range_ctm(data_t *data,
 }
 #endif
 
+static bool plane_gamma_test(data_t *data, igt_plane_t *plane)
+{
+	igt_output_t *output;
+	igt_display_t *display = &data->display;
+	drmModeModeInfo *mode;
+	struct igt_fb fb;
+	drmModePropertyPtr gamma_mode = NULL;
+	uint32_t i;
+	bool ret = true;
+	igt_pipe_crc_t *pipe_crc = NULL;
+	igt_crc_t crc_gamma, crc_fullcolors;
+	color_t red_green_blue[] = {
+		{ 1.0, 0.0, 0.0 },
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 }
+	};
+
+	igt_info("Plane gamma test is running on pipe-%s plane-%s(%s)\n",
+			kmstest_pipe_name(plane->pipe->pipe),
+			kmstest_plane_type_name(plane->type),
+			is_hdr_plane(plane) ? "hdr":"sdr");
+
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_GAMMA_MODE));
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_GAMMA_LUT));
+
+	igt_require_pipe_crc(data->drm_fd);
+	pipe_crc = igt_pipe_crc_new(data->drm_fd,
+				  plane->pipe->pipe,
+				  INTEL_PIPE_CRC_SOURCE_AUTO);
+
+	output = igt_get_single_output_for_pipe(display, plane->pipe->pipe);
+	igt_assert(output);
+
+	igt_output_set_pipe(output, plane->pipe->pipe);
+	mode = igt_output_get_mode(output);
+
+	/* Create a framebuffer at the size of the output. */
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &fb));
+
+	igt_plane_set_fb(plane, &fb);
+	disable_ctm(plane->pipe);
+	disable_degamma(plane->pipe);
+	disable_gamma(plane->pipe);
+
+	disable_plane_ctm(plane);
+	disable_plane_degamma(plane);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	gamma_mode = get_plane_gamma_degamma_mode(plane, IGT_PLANE_GAMMA_MODE);
+
+	/* Iterate all supported gamma modes. */
+	for (i = 0; i < gamma_mode->count_enums; i++) {
+		segment_data_t *segment_info = NULL;
+		struct drm_color_lut_ext *lut = NULL;
+		uint32_t lut_size = 0;
+
+		/* Ignore 'no gamma' from enum list. */
+		if (!strcmp(gamma_mode->enums[i].name, "no gamma"))
+			continue;
+
+		igt_info("Trying to use gamma mode: \'%s\'\n", gamma_mode->enums[i].name);
+
+		/* Draw solid colors with no gamma transformation. */
+		disable_plane_gamma(plane);
+		paint_rectangles(data, mode, red_green_blue, &fb);
+		igt_plane_set_fb(plane, &fb);
+		igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+		igt_wait_for_vblank(data->drm_fd,
+			display->pipes[plane->pipe->pipe].crtc_offset);
+		igt_pipe_crc_collect_crc(pipe_crc, &crc_fullcolors);
+
+		/* Draw a gradient with gamma LUT to remap all
+		 * values to max red/green/blue.
+		 */
+		segment_info = get_segment_data(data, gamma_mode->enums[i].value,
+				gamma_mode->enums[i].name);
+		lut_size = sizeof(struct drm_color_lut_ext) * segment_info->entries_count;
+		lut = create_max_lut(segment_info);
+		set_plane_gamma(plane, gamma_mode->enums[i].name, lut, lut_size);
+
+		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
+		igt_plane_set_fb(plane, &fb);
+		igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+		igt_wait_for_vblank(data->drm_fd,
+			display->pipes[plane->pipe->pipe].crtc_offset);
+		igt_pipe_crc_collect_crc(pipe_crc, &crc_gamma);
+
+		/* Verify that the CRC of the software computed output is
+		 * equal to the CRC of the gamma LUT transformation output.
+		 */
+		ret &= crc_equal(&crc_gamma, &crc_fullcolors);
+
+		free(lut);
+		clear_segment_data(segment_info);
+	}
+
+	disable_plane_gamma(plane);
+	igt_plane_set_fb(plane, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	igt_pipe_crc_free(pipe_crc);
+	drmModeFreeProperty(gamma_mode);
+
+	return ret;
+}
+
 static void
 run_tests_for_pipe(data_t *data, enum pipe p)
 {
@@ -865,6 +1008,38 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 	}
 }
 
+static void run_plane_color_test(data_t *data, enum pipe pipe, test_t test)
+{
+	igt_plane_t *plane;
+	int count = 0;
+
+	for_each_plane_on_pipe(&data->display, pipe, plane) {
+		if (!is_valid_plane(plane))
+			continue;
+
+		igt_assert(test(data, plane));
+
+		count++;
+	}
+
+	if (!count)
+		igt_skip("No valid planes found.\n");
+}
+
+static void run_tests_for_plane(data_t *data, enum pipe pipe)
+{
+	igt_fixture {
+		igt_display_require_output_on_pipe(&data->display, pipe);
+		igt_require(data->display.pipes[pipe].n_planes > 0);
+		igt_require(is_i915_device(data->drm_fd));
+	}
+
+	igt_describe("Compare maxed out plane gamma LUT and solid color linear LUT");
+	igt_subtest_f("pipe-%s-plane-gamma",
+			kmstest_pipe_name(pipe))
+		run_plane_color_test(data, pipe, plane_gamma_test);
+}
+
 igt_main
 {
 	data_t data = {};
@@ -895,6 +1070,10 @@ igt_main
 	igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
 		invalid_ctm_matrix_sizes(&data);
 
+	for_each_pipe_static(pipe)
+		igt_subtest_group
+			run_tests_for_plane(&data, pipe);
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 	}
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 04/23] tests/kms_color: New subtests for Plane degamma
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 02/23] kms_color_helper: Add helper functions for plane color mgmt venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 03/23] tests/kms_color: New subtests for Plane gamma venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 05/23] tests/kms_color: New subtests for Plane CTM venkata.sai.patnana
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

To verify Plane degamma, draw 3 gradient rectangles in red, green and blue,
with a maxed out degamma LUT and verify we have the same CRC as drawing solid
color rectangles with linear gamma LUT.

v2:
* Rename function names (Uma)
* Update to use restructured helper functions (Bhanu)
v3:
* Restructure to manage the memory (alloc & free) by the caller (Uma)
v4:
* Remove gamma dependency & clear degamma before exit (Uma)
v5:
* Ignore "no degamma" from enum list (Bhanu)
v6:
* Search for the enum name, instead of assuming value as 0 (Uma)

Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_color.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 123 insertions(+)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 9b5c1d63eb..0874775cd2 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -781,6 +781,124 @@ static bool plane_gamma_test(data_t *data, igt_plane_t *plane)
 	return ret;
 }
 
+static bool plane_degamma_test(data_t *data, igt_plane_t *plane)
+{
+	igt_output_t *output;
+	igt_display_t *display = &data->display;
+	drmModeModeInfo *mode;
+	drmModePropertyPtr degamma_mode;
+	struct igt_fb fb;
+	uint32_t i;
+	bool ret = true;
+	igt_pipe_crc_t *pipe_crc = NULL;
+	igt_crc_t crc_degamma, crc_fullcolors;
+	color_t red_green_blue[] = {
+		{ 1.0, 0.0, 0.0 },
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 }
+	};
+
+	igt_info("Plane degamma test is running on pipe-%s plane-%s(%s)\n",
+			kmstest_pipe_name(plane->pipe->pipe),
+			kmstest_plane_type_name(plane->type),
+			is_hdr_plane(plane) ? "hdr":"sdr");
+
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_DEGAMMA_MODE));
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_DEGAMMA_LUT));
+
+	igt_require_pipe_crc(data->drm_fd);
+	pipe_crc = igt_pipe_crc_new(data->drm_fd,
+				    plane->pipe->pipe,
+				    INTEL_PIPE_CRC_SOURCE_AUTO);
+
+	output = igt_get_single_output_for_pipe(display, plane->pipe->pipe);
+	igt_assert(output);
+
+	igt_output_set_pipe(output, plane->pipe->pipe);
+	mode = igt_output_get_mode(output);
+
+	/* Create a framebuffer at the size of the output. */
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &fb));
+
+	igt_plane_set_fb(plane, &fb);
+	disable_ctm(plane->pipe);
+	disable_degamma(plane->pipe);
+	disable_gamma(plane->pipe);
+
+	disable_plane_ctm(plane);
+	disable_plane_gamma(plane);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	degamma_mode = get_plane_gamma_degamma_mode(plane, IGT_PLANE_DEGAMMA_MODE);
+
+	/* Iterate all supported degamma modes. */
+	for (i = 0; i < degamma_mode->count_enums; i++) {
+		segment_data_t *degamma_segment_info = NULL;
+		struct drm_color_lut_ext *degamma_lut = NULL;
+		uint32_t degamma_lut_size = 0;
+
+		/* Ignore 'no degamma' from enum list. */
+		if (!strcmp(degamma_mode->enums[i].name, "no degamma"))
+			continue;
+
+		degamma_segment_info = get_segment_data(data, degamma_mode->enums[i].value,
+						degamma_mode->enums[i].name);
+		degamma_lut_size = sizeof(struct drm_color_lut_ext) * degamma_segment_info->entries_count;
+		degamma_lut = create_max_lut(degamma_segment_info);
+
+		igt_info("Trying to use degamma mode: \'%s\'\n", degamma_mode->enums[i].name);
+
+		/* Draw solid colors with no degamma. */
+		disable_plane_degamma(plane);
+		paint_rectangles(data, mode, red_green_blue, &fb);
+		igt_plane_set_fb(plane, &fb);
+		igt_display_commit2(display, display->is_atomic ?
+				COMMIT_ATOMIC : COMMIT_LEGACY);
+		igt_wait_for_vblank(data->drm_fd,
+				display->pipes[plane->pipe->pipe].crtc_offset);
+		igt_pipe_crc_collect_crc(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(plane, &fb);
+		set_plane_degamma(plane, degamma_mode->enums[i].name,
+				  degamma_lut, degamma_lut_size);
+		igt_display_commit2(display, display->is_atomic ?
+				COMMIT_ATOMIC : COMMIT_LEGACY);
+		igt_wait_for_vblank(data->drm_fd,
+				display->pipes[plane->pipe->pipe].crtc_offset);
+		igt_pipe_crc_collect_crc(pipe_crc, &crc_degamma);
+
+		/* Verify that the CRC of the software computed output
+		 * is equal to the CRC of the degamma LUT transformation
+		 * output.
+		 */
+		ret &= crc_equal(&crc_degamma, &crc_fullcolors);
+
+		free(degamma_lut);
+		clear_segment_data(degamma_segment_info);
+	}
+
+	disable_plane_degamma(plane);
+	igt_plane_set_fb(plane, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	igt_pipe_crc_free(pipe_crc);
+	drmModeFreeProperty(degamma_mode);
+
+	return ret;
+}
+
 static void
 run_tests_for_pipe(data_t *data, enum pipe p)
 {
@@ -1038,6 +1156,11 @@ static void run_tests_for_plane(data_t *data, enum pipe pipe)
 	igt_subtest_f("pipe-%s-plane-gamma",
 			kmstest_pipe_name(pipe))
 		run_plane_color_test(data, pipe, plane_gamma_test);
+
+	igt_describe("Compare maxed out plane degamma LUT and solid color linear LUT");
+	igt_subtest_f("pipe-%s-plane-degamma",
+			kmstest_pipe_name(pipe))
+		run_plane_color_test(data, pipe, plane_degamma_test);
 }
 
 igt_main
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 05/23] tests/kms_color: New subtests for Plane CTM
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (2 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 04/23] tests/kms_color: New subtests for Plane degamma venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 06/23] tests/kms_color_chamelium: New subtests for Plane gamma venkata.sai.patnana
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

To verify plane CTM, draw 3 rectangles using before colors with the
ctm matrix applied and verify the CRC is equal to using after colors
with an identify ctm matrix.

v2:
* Rename function names (Uma)
* Update to use restructured helper functions (Bhanu)
v3:
* Restructure to manage the memory (alloc & free) by the caller (Uma)

Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_color.c | 224 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 224 insertions(+)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 0874775cd2..0387c9192a 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -53,6 +53,77 @@ static bool is_valid_plane(igt_plane_t *plane)
 	return index >= 0 && index < MAX_SUPPORTED_PLANES;
 }
 
+struct {
+	const char *test_name;
+	int iter;
+	color_t expected_colors[3];
+	double ctm[9];
+} ctm_tests[] = {
+	{"plane-ctm-red-to-blue", 0,
+					{{ 0.0, 0.0, 1.0 },
+					 { 0.0, 1.0, 0.0 },
+					 { 0.0, 0.0, 1.0 }},
+		{ 0.0, 0.0, 0.0,
+		  0.0, 1.0, 0.0,
+		  1.0, 0.0, 1.0 },
+	},
+	{"plane-ctm-green-to-red", 0,
+					{{ 1.0, 0.0, 0.0 },
+					 { 1.0, 0.0, 0.0 },
+					 { 0.0, 0.0, 1.0 }},
+		{ 1.0, 1.0, 0.0,
+		  0.0, 0.0, 0.0,
+		  0.0, 0.0, 1.0 },
+	},
+	{"plane-ctm-blue-to-red", 0,
+					{{ 1.0, 0.0, 0.0 },
+					 { 0.0, 1.0, 0.0 },
+					 { 1.0, 0.0, 0.0 }},
+		{ 1.0, 0.0, 1.0,
+		  0.0, 1.0, 0.0,
+		  0.0, 0.0, 0.0 },
+	},
+	{"plane-ctm-max", 0,
+					{{ 1.0, 0.0, 0.0 },
+					 { 0.0, 1.0, 0.0 },
+					 { 0.0, 0.0, 1.0 }},
+		{ 100.0, 0.0, 0.0,
+		  0.0, 100.0, 0.0,
+		  0.0, 0.0, 100.0 },
+	},
+	{"plane-ctm-negative", 0,
+					{{ 0.0, 0.0, 0.0 },
+					 { 0.0, 0.0, 0.0 },
+					 { 0.0, 0.0, 0.0 }},
+		{ -1.0, 0.0, 0.0,
+		   0.0, -1.0, 0.0,
+		   0.0, 0.0, -1.0 },
+	},
+	/* We tests a few values around the expected result because
+	 * it depends on the hardware we're dealing with, we can
+	 * either get clamped or rounded values and we also need to
+	 * account for odd number of items in the LUTs.
+	 */
+	{"plane-ctm-0-25", 5,
+					{{ 0.0, }, { 0.0, }, { 0.0, }},
+		{ 0.25, 0.0,  0.0,
+		  0.0,  0.25, 0.0,
+		  0.0,  0.0,  0.25 },
+	},
+	{"plane-ctm-0-50", 5,
+					{{ 0.0, }, { 0.0, }, { 0.0, }},
+		{ 0.5,  0.0,  0.0,
+		  0.0,  0.5,  0.0,
+		  0.0,  0.0,  0.5 },
+	},
+	{"plane-ctm-0-75", 7,
+					{{ 0.0, }, { 0.0, }, { 0.0, }},
+		{ 0.75, 0.0,  0.0,
+		  0.0,  0.75, 0.0,
+		  0.0,  0.0,  0.75 },
+	},
+};
+
 static void test_pipe_degamma(data_t *data,
 			      igt_plane_t *primary)
 {
@@ -899,6 +970,99 @@ static bool plane_degamma_test(data_t *data, igt_plane_t *plane)
 	return ret;
 }
 
+static bool test_plane_ctm(data_t *data,
+			  igt_plane_t *plane,
+			  color_t *before,
+			  color_t *after,
+			  double *ctm_matrix)
+{
+	const double ctm_identity[] = {
+		1.0, 0.0, 0.0,
+		0.0, 1.0, 0.0,
+		0.0, 0.0, 1.0
+	};
+	igt_output_t *output;
+	igt_display_t *display = &data->display;
+	drmModeModeInfo *mode;
+	struct igt_fb fb;
+	igt_crc_t crc_software, crc_hardware;
+	igt_pipe_crc_t *pipe_crc = NULL;
+	bool ret = true;
+
+	igt_info("Plane CTM test is running on pipe-%s plane-%s(%s)\n",
+			kmstest_pipe_name(plane->pipe->pipe),
+			kmstest_plane_type_name(plane->type),
+			is_hdr_plane(plane) ? "hdr":"sdr");
+
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_CTM));
+
+	igt_require_pipe_crc(data->drm_fd);
+	pipe_crc = igt_pipe_crc_new(data->drm_fd,
+				  plane->pipe->pipe,
+				  INTEL_PIPE_CRC_SOURCE_AUTO);
+
+	output = igt_get_single_output_for_pipe(display, plane->pipe->pipe);
+	igt_assert(output);
+
+	igt_output_set_pipe(output, plane->pipe->pipe);
+	mode = igt_output_get_mode(output);
+
+	/* Create a framebuffer at the size of the output. */
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &fb));
+
+	igt_plane_set_fb(plane, &fb);
+
+	disable_degamma(plane->pipe);
+	disable_gamma(plane->pipe);
+	disable_ctm(plane->pipe);
+
+	disable_plane_gamma(plane);
+	disable_plane_degamma(plane);
+	igt_display_commit2(display, display->is_atomic ?
+				COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	/* Without CTM transformation. */
+	paint_rectangles(data, mode, after, &fb);
+	igt_plane_set_fb(plane, &fb);
+	set_plane_ctm(plane, ctm_identity);
+	igt_display_commit2(display, display->is_atomic ?
+				COMMIT_ATOMIC : COMMIT_LEGACY);
+	igt_wait_for_vblank(data->drm_fd,
+			display->pipes[plane->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(pipe_crc, &crc_software);
+
+	/* With CTM transformation. */
+	paint_rectangles(data, mode, before, &fb);
+	igt_plane_set_fb(plane, &fb);
+	set_plane_ctm(plane, ctm_matrix);
+	igt_display_commit2(display, display->is_atomic ?
+				COMMIT_ATOMIC : COMMIT_LEGACY);
+	igt_wait_for_vblank(data->drm_fd,
+			display->pipes[plane->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(pipe_crc, &crc_hardware);
+
+	/* Verify that the CRC of the software computed ouutput
+	 * is equal to the CRC of the CTM matrix transformation
+	 * output.
+	 */
+	ret = crc_equal(&crc_software, &crc_hardware);
+
+	disable_plane_ctm(plane);
+	igt_plane_set_fb(plane, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	igt_pipe_crc_free(pipe_crc);
+
+	return ret;
+}
+
 static void
 run_tests_for_pipe(data_t *data, enum pipe p)
 {
@@ -1144,8 +1308,56 @@ static void run_plane_color_test(data_t *data, enum pipe pipe, test_t test)
 		igt_skip("No valid planes found.\n");
 }
 
+static void run_plane_ctm_test(data_t *data,
+				enum pipe pipe,
+				color_t *expected,
+				double *ctm,
+				int iter)
+{
+	igt_plane_t *plane;
+	bool result;
+	int i, count = 0;
+	double delta = 1.0 / (1 << 8);
+	color_t red_green_blue[] = {
+		{ 1.0, 0.0, 0.0 },
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 }
+	};
+
+	for_each_plane_on_pipe(&data->display, pipe, plane) {
+		if (!is_valid_plane(plane))
+			continue;
+
+		result = false;
+
+		if (!iter)
+			result |= test_plane_ctm(data, plane,
+					red_green_blue, expected,
+					ctm);
+
+		for (i = 0; i < iter; i++) {
+			expected[0].r =
+			expected[1].g =
+			expected[2].b =
+				ctm[0] + delta * (i - (iter/2));
+
+			result |= test_plane_ctm(data, plane,
+					red_green_blue,	expected,
+					ctm);
+		}
+
+		igt_assert(result);
+		count++;
+	}
+
+	if (!count)
+		igt_skip("No valid planes found.\n");
+}
+
 static void run_tests_for_plane(data_t *data, enum pipe pipe)
 {
+	int i;
+
 	igt_fixture {
 		igt_display_require_output_on_pipe(&data->display, pipe);
 		igt_require(data->display.pipes[pipe].n_planes > 0);
@@ -1161,6 +1373,18 @@ static void run_tests_for_plane(data_t *data, enum pipe pipe)
 	igt_subtest_f("pipe-%s-plane-degamma",
 			kmstest_pipe_name(pipe))
 		run_plane_color_test(data, pipe, plane_degamma_test);
+
+	for (i = 0; i < ARRAY_SIZE(ctm_tests); i++) {
+		igt_describe("Compare after applying ctm matrix & identity matrix");
+		igt_subtest_f("pipe-%s-%s",
+				kmstest_pipe_name(pipe),
+				ctm_tests[i].test_name) {
+			run_plane_ctm_test(data, pipe,
+					ctm_tests[i].expected_colors,
+					ctm_tests[i].ctm,
+					ctm_tests[i].iter);
+		}
+	}
 }
 
 igt_main
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 06/23] tests/kms_color_chamelium: New subtests for Plane gamma
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (3 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 05/23] tests/kms_color: New subtests for Plane CTM venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 07/23] tests/kms_color_chamelium: New subtests for Plane degamma venkata.sai.patnana
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

To verify Plane gamma, draw 3 gradient rectangles in red, green and blue,
with a maxed out gamma LUT and verify we have the same frame dump as
drawing solid color rectangles.

v2:
* Ignore "no gamma" from enum list (Bhanu)
v3:
* Search for the enum name, instead of assuming value as 0 (Uma)

Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Kunal Joshi <kunal1.joshi@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_color_chamelium.c | 190 +++++++++++++++++++++++++++++++++++-
 1 file changed, 189 insertions(+), 1 deletion(-)

diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
index 30b38b82e3..59afaf0f43 100644
--- a/tests/kms_color_chamelium.c
+++ b/tests/kms_color_chamelium.c
@@ -24,7 +24,34 @@
 
 #include "kms_color_helper.h"
 
-IGT_TEST_DESCRIPTION("Test Color Features at Pipe level using Chamelium to verify instead of CRC");
+IGT_TEST_DESCRIPTION("Test Color Features at Pipe & Plane level using Chamelium to verify instead of CRC");
+
+#define MAX_SUPPORTED_PLANES 7
+#define SDR_PLANE_BASE 3
+
+typedef bool (*test_t)(data_t*, igt_plane_t*);
+
+static bool is_hdr_plane(const igt_plane_t *plane)
+{
+	return plane->index >= 0 && plane->index < SDR_PLANE_BASE;
+}
+
+static bool is_valid_plane(igt_plane_t *plane)
+{
+	int index = plane->index;
+
+	if (plane->type != DRM_PLANE_TYPE_PRIMARY)
+		return false;
+
+	/*
+	 * Test 1 HDR plane, 1 SDR plane.
+	 *
+	 * 0,1,2 HDR planes
+	 * 3,4,5,6 SDR planes
+	 *
+	 */
+	return index >= 0 && index < MAX_SUPPORTED_PLANES;
+}
 
 /*
  * Draw 3 gradient rectangles in red, green and blue, with a maxed out
@@ -721,6 +748,163 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 	}
 }
 
+static bool plane_gamma_test(data_t *data, igt_plane_t *plane)
+{
+	igt_output_t *output;
+	igt_display_t *display = &data->display;
+	drmModeModeInfo *mode;
+	struct igt_fb fb, fbref;
+	drmModePropertyPtr gamma_mode = NULL;
+	uint32_t i;
+	bool ret = true;
+	struct chamelium_port *port = NULL;
+	struct chamelium_frame_dump *frame_fullcolors;
+	color_t red_green_blue[] = {
+		{ 1.0, 0.0, 0.0 },
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 }
+	};
+
+	igt_info("Plane gamma test is running on pipe-%s plane-%s(%s)\n",
+			kmstest_pipe_name(plane->pipe->pipe),
+			kmstest_plane_type_name(plane->type),
+			is_hdr_plane(plane) ? "hdr":"sdr");
+
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_GAMMA_MODE));
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_GAMMA_LUT));
+
+	for_each_valid_output_on_pipe(display, plane->pipe->pipe, output) {
+		for (i = 0; i < data->port_count; i++)
+			if (strcmp(output->name, chamelium_port_get_name(data->ports[i])) == 0) {
+				port = data->ports[i];
+				break;
+			}
+
+		if (port)
+			break;
+	}
+	igt_require(port);
+	igt_assert(output);
+
+	igt_output_set_pipe(output, plane->pipe->pipe);
+	mode = igt_output_get_mode(output);
+
+	/* Create a framebuffer at the size of the output. */
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &fb));
+
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &fbref));
+
+	disable_degamma(plane->pipe);
+	disable_ctm(plane->pipe);
+	disable_gamma(plane->pipe);
+
+	disable_plane_degamma(plane);
+	disable_plane_ctm(plane);
+	disable_plane_gamma(plane);
+
+	igt_plane_set_fb(plane, &fbref);
+	igt_display_commit2(display, display->is_atomic ?
+				COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	gamma_mode = get_plane_gamma_degamma_mode(plane, IGT_PLANE_GAMMA_MODE);
+
+	/* Draw solid colors with no gamma transformation. */
+	paint_rectangles(data, mode, red_green_blue, &fbref);
+
+	/* Iterate all supported gamma modes. */
+	for (i = 0; i < gamma_mode->count_enums; i++) {
+		segment_data_t *segment_info = NULL;
+		struct drm_color_lut_ext *lut = NULL;
+		uint32_t lut_size = 0;
+
+		/* Ignore 'no gamma' from enum list. */
+		if (!strcmp(gamma_mode->enums[i].name, "no gamma"))
+			continue;
+
+		igt_info("Trying to use gamma mode: \'%s\'\n", gamma_mode->enums[i].name);
+
+		segment_info = get_segment_data(data, gamma_mode->enums[i].value,
+				gamma_mode->enums[i].name);
+		lut_size = sizeof(struct drm_color_lut_ext) * segment_info->entries_count;
+		lut = create_max_lut(segment_info);
+		set_plane_gamma(plane, gamma_mode->enums[i].name, lut, lut_size);
+
+		/* 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(plane, &fb);
+		igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+		chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
+		frame_fullcolors =
+			chamelium_read_captured_frame(data->chamelium, 0);
+
+		/* Verify that the framebuffer reference of the software computed
+		 * output is equal to the frame dump of the gamma LUT
+		 * transformation output.
+		 */
+		ret &= chamelium_frame_match_or_dump(data->chamelium, port,
+					      frame_fullcolors, &fbref,
+					      CHAMELIUM_CHECK_ANALOG);
+		free(lut);
+		clear_segment_data(segment_info);
+	}
+
+	disable_plane_gamma(plane);
+	igt_plane_set_fb(plane, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	drmModeFreeProperty(gamma_mode);
+
+	return ret;
+}
+
+static void run_plane_color_test(data_t *data, enum pipe pipe, test_t test)
+{
+	igt_plane_t *plane;
+	int count = 0;
+
+	for_each_plane_on_pipe(&data->display, pipe, plane) {
+		if (!is_valid_plane(plane))
+			continue;
+
+		igt_assert(test(data, plane));
+
+		count++;
+	}
+
+	if (!count)
+		igt_skip("No valid planes found.\n");
+}
+
+static void run_tests_for_plane(data_t *data, enum pipe pipe)
+{
+	igt_fixture {
+		igt_display_require_output_on_pipe(&data->display, pipe);
+		igt_require(data->display.pipes[pipe].n_planes > 0);
+		igt_require(is_i915_device(data->drm_fd));
+	}
+
+	igt_describe("Compare maxed out plane gamma LUT and solid color linear LUT");
+	igt_subtest_f("pipe-%s-plane-gamma",
+			kmstest_pipe_name(pipe))
+		run_plane_color_test(data, pipe, plane_gamma_test);
+}
+
 igt_main
 {
 	data_t data = {};
@@ -764,6 +948,10 @@ igt_main
 	igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
 		invalid_ctm_matrix_sizes(&data);
 
+	for_each_pipe_static(pipe)
+		igt_subtest_group
+			run_tests_for_plane(&data, pipe);
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 	}
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 07/23] tests/kms_color_chamelium: New subtests for Plane degamma
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (4 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 06/23] tests/kms_color_chamelium: New subtests for Plane gamma venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 08/23] tests/kms_color_chamelium: New subtests for Plane CTM venkata.sai.patnana
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

To verify Plane degamma, draw 3 gradient rectangles in red, green and blue,
with a maxed out degamma LUT and verify we have the same frame dump as
drawing solid color rectangles with linear gamma LUT.

v2:
* Ignore "no degamma" from enum list (Bhanu)
v3:
* Search for the enum name, instead of assuming value as 0 (Uma)

Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Kunal Joshi <kunal1.joshi@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_color_chamelium.c | 132 ++++++++++++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)

diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
index 59afaf0f43..17a7baa9a2 100644
--- a/tests/kms_color_chamelium.c
+++ b/tests/kms_color_chamelium.c
@@ -873,6 +873,133 @@ static bool plane_gamma_test(data_t *data, igt_plane_t *plane)
 	return ret;
 }
 
+static bool plane_degamma_test(data_t *data, igt_plane_t *plane)
+{
+	igt_output_t *output;
+	igt_display_t *display = &data->display;
+	drmModeModeInfo *mode;
+	drmModePropertyPtr degamma_mode;
+	struct igt_fb fb, fbref;
+	struct chamelium_port *port;
+	struct chamelium_frame_dump *frame_fullcolors;
+	uint32_t i;
+	bool ret = true;
+	color_t red_green_blue[] = {
+		{ 1.0, 0.0, 0.0 },
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 }
+	};
+
+	igt_info("Plane degamma test is running on pipe-%s plane-%s(%s)\n",
+			kmstest_pipe_name(plane->pipe->pipe),
+			kmstest_plane_type_name(plane->type),
+			is_hdr_plane(plane) ? "hdr":"sdr");
+
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_DEGAMMA_MODE));
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_DEGAMMA_LUT));
+
+	for_each_valid_output_on_pipe(display, plane->pipe->pipe, output) {
+		for (i = 0; i < data->port_count; i++)
+			if (strcmp(output->name, chamelium_port_get_name(data->ports[i])) == 0) {
+				port = data->ports[i];
+				break;
+			}
+
+		if (port)
+			break;
+	}
+	igt_require(port);
+	igt_assert(output);
+
+	igt_output_set_pipe(output, plane->pipe->pipe);
+	mode = igt_output_get_mode(output);
+
+	/* Create a framebuffer at the size of the output. */
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &fb));
+
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &fbref));
+
+	disable_degamma(plane->pipe);
+	disable_ctm(plane->pipe);
+	disable_gamma(plane->pipe);
+
+	disable_plane_degamma(plane);
+	disable_plane_ctm(plane);
+	disable_plane_gamma(plane);
+
+	igt_plane_set_fb(plane, &fbref);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	degamma_mode = get_plane_gamma_degamma_mode(plane, IGT_PLANE_DEGAMMA_MODE);
+
+	/* Draw solid colors with no degamma. */
+	paint_rectangles(data, mode, red_green_blue, &fbref);
+
+	/* Iterate all supported degamma modes. */
+	for (i = 0; i < degamma_mode->count_enums; i++) {
+		segment_data_t *degamma_segment_info = NULL;
+		struct drm_color_lut_ext *degamma_lut = NULL;
+		uint32_t degamma_lut_size = 0;
+
+		/* Ignore 'no degamma' from enum list. */
+		if (!strcmp(degamma_mode->enums[i].name, "no degamma"))
+			continue;
+
+		degamma_segment_info = get_segment_data(data, degamma_mode->enums[i].value,
+						degamma_mode->enums[i].name);
+		degamma_lut_size = sizeof(struct drm_color_lut_ext) * degamma_segment_info->entries_count;
+		degamma_lut = create_max_lut(degamma_segment_info);
+
+		igt_info("Trying to use degamma mode: \'%s\'\n", degamma_mode->enums[i].name);
+
+		/* 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(plane, &fb);
+		set_plane_degamma(plane, degamma_mode->enums[i].name,
+				degamma_lut, degamma_lut_size);
+		igt_display_commit2(display, display->is_atomic ?
+				COMMIT_ATOMIC : COMMIT_LEGACY);
+
+		chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
+		frame_fullcolors =
+			chamelium_read_captured_frame(data->chamelium, 0);
+
+		/* Verify that the framebuffer reference of the software computed
+		 * output is equal to the frame dump of the gamma LUT
+		 * transformation output.
+		 */
+		ret &= chamelium_frame_match_or_dump(data->chamelium, port,
+				frame_fullcolors, &fbref,
+				CHAMELIUM_CHECK_ANALOG);
+
+		free(degamma_lut);
+		clear_segment_data(degamma_segment_info);
+	}
+
+	disable_plane_degamma(plane);
+	igt_plane_set_fb(plane, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	drmModeFreeProperty(degamma_mode);
+
+	return ret;
+}
+
 static void run_plane_color_test(data_t *data, enum pipe pipe, test_t test)
 {
 	igt_plane_t *plane;
@@ -903,6 +1030,11 @@ static void run_tests_for_plane(data_t *data, enum pipe pipe)
 	igt_subtest_f("pipe-%s-plane-gamma",
 			kmstest_pipe_name(pipe))
 		run_plane_color_test(data, pipe, plane_gamma_test);
+
+	igt_describe("Compare maxed out plane degamma LUT and solid color linear LUT");
+	igt_subtest_f("pipe-%s-plane-degamma",
+			kmstest_pipe_name(pipe))
+		run_plane_color_test(data, pipe, plane_degamma_test);
 }
 
 igt_main
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 08/23] tests/kms_color_chamelium: New subtests for Plane CTM
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (5 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 07/23] tests/kms_color_chamelium: New subtests for Plane degamma venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 09/23] lib/igt_kms: Add pipe color mgmt properties venkata.sai.patnana
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

To verify plane CTM, draw 3 rectangles using before colors with the
ctm matrix applied and verify the frame dump is equal to using after
colors with an identify ctm matrix.

V2:
* Fix fb creation logic

Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Kunal Joshi <kunal1.joshi@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_color_chamelium.c | 228 ++++++++++++++++++++++++++++++++++++
 1 file changed, 228 insertions(+)

diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
index 17a7baa9a2..24f25d964c 100644
--- a/tests/kms_color_chamelium.c
+++ b/tests/kms_color_chamelium.c
@@ -53,6 +53,77 @@ static bool is_valid_plane(igt_plane_t *plane)
 	return index >= 0 && index < MAX_SUPPORTED_PLANES;
 }
 
+struct {
+	const char *test_name;
+	int iter;
+	color_t expected_colors[3];
+	double ctm[9];
+} ctm_tests[] = {
+	{"plane-ctm-red-to-blue", 0,
+					{{ 0.0, 0.0, 1.0 },
+					 { 0.0, 1.0, 0.0 },
+					 { 0.0, 0.0, 1.0 }},
+		{ 0.0, 0.0, 0.0,
+		  0.0, 1.0, 0.0,
+		  1.0, 0.0, 1.0 },
+	},
+	{"plane-ctm-green-to-red", 0,
+					{{ 1.0, 0.0, 0.0 },
+					 { 1.0, 0.0, 0.0 },
+					 { 0.0, 0.0, 1.0 }},
+		{ 1.0, 1.0, 0.0,
+		  0.0, 0.0, 0.0,
+		  0.0, 0.0, 1.0 },
+	},
+	{"plane-ctm-blue-to-red", 0,
+					{{ 1.0, 0.0, 0.0 },
+					 { 0.0, 1.0, 0.0 },
+					 { 1.0, 0.0, 0.0 }},
+		{ 1.0, 0.0, 1.0,
+		  0.0, 1.0, 0.0,
+		  0.0, 0.0, 0.0 },
+	},
+	{"plane-ctm-max", 0,
+					{{ 1.0, 0.0, 0.0 },
+					 { 0.0, 1.0, 0.0 },
+					 { 0.0, 0.0, 1.0 }},
+		{ 100.0, 0.0, 0.0,
+		  0.0, 100.0, 0.0,
+		  0.0, 0.0, 100.0 },
+	},
+	{"plane-ctm-negative", 0,
+					{{ 0.0, 0.0, 0.0 },
+					 { 0.0, 0.0, 0.0 },
+					 { 0.0, 0.0, 0.0 }},
+		{ -1.0, 0.0, 0.0,
+		   0.0, -1.0, 0.0,
+		   0.0, 0.0, -1.0 },
+	},
+	/* We tests a few values around the expected result because
+	 * it depends on the hardware we're dealing with, we can
+	 * either get clamped or rounded values and we also need to
+	 * account for odd number of items in the LUTs.
+	 */
+	{"plane-ctm-0-25", 5,
+					{{ 0.0, }, { 0.0, }, { 0.0, }},
+		{ 0.25, 0.0,  0.0,
+		  0.0,  0.25, 0.0,
+		  0.0,  0.0,  0.25 },
+	},
+	{"plane-ctm-0-50", 5,
+					{{ 0.0, }, { 0.0, }, { 0.0, }},
+		{ 0.5,  0.0,  0.0,
+		  0.0,  0.5,  0.0,
+		  0.0,  0.0,  0.5 },
+	},
+	{"plane-ctm-0-75", 7,
+					{{ 0.0, }, { 0.0, }, { 0.0, }},
+		{ 0.75, 0.0,  0.0,
+		  0.0,  0.75, 0.0,
+		  0.0,  0.0,  0.75 },
+	},
+};
+
 /*
  * Draw 3 gradient rectangles in red, green and blue, with a maxed out
  * degamma LUT and verify we have the same frame dump as drawing solid color
@@ -1000,6 +1071,103 @@ static bool plane_degamma_test(data_t *data, igt_plane_t *plane)
 	return ret;
 }
 
+static bool test_plane_ctm(data_t *data,
+			  igt_plane_t *plane,
+			  color_t *before,
+			  color_t *after,
+			  double *ctm_matrix)
+{
+	igt_output_t *output;
+	igt_display_t *display = &data->display;
+	drmModeModeInfo *mode;
+	struct igt_fb fb, fbref;
+	struct chamelium_port *port;
+	struct chamelium_frame_dump *frame_hardware;
+	uint32_t i;
+	bool ret = true;
+
+	igt_info("Plane CTM test is running on pipe-%s plane-%s(%s)\n",
+			kmstest_pipe_name(plane->pipe->pipe),
+			kmstest_plane_type_name(plane->type),
+			is_hdr_plane(plane) ? "hdr":"sdr");
+
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_CTM));
+
+	for_each_valid_output_on_pipe(display, plane->pipe->pipe, output) {
+		for (i = 0; i < data->port_count; i++)
+			if (strcmp(output->name, chamelium_port_get_name(data->ports[i])) == 0) {
+				port = data->ports[i];
+				break;
+			}
+
+		if (port)
+			break;
+	}
+	igt_require(port);
+	igt_assert(output);
+
+	igt_output_set_pipe(output, plane->pipe->pipe);
+	mode = igt_output_get_mode(output);
+
+	/* Create a framebuffer at the size of the output. */
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &fb));
+
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &fbref));
+
+	disable_degamma(plane->pipe);
+	disable_ctm(plane->pipe);
+	disable_gamma(plane->pipe);
+
+	disable_plane_degamma(plane);
+	disable_plane_ctm(plane);
+	disable_plane_gamma(plane);
+
+	igt_plane_set_fb(plane, &fbref);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	/* Without CTM transformation. */
+	paint_rectangles(data, mode, after, &fbref);
+
+	/* With CTM transformation. */
+	paint_rectangles(data, mode, before, &fb);
+	igt_plane_set_fb(plane, &fb);
+	set_plane_ctm(plane, ctm_matrix);
+	igt_display_commit2(display, display->is_atomic ?
+				COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, 1);
+	frame_hardware =
+		chamelium_read_captured_frame(data->chamelium, 0);
+
+	/* Verify that the framebuffer reference of the software
+	 * computed output is equal to the frame dump of the CTM
+	 * matrix transformation output.
+	 */
+	ret = chamelium_frame_match_or_dump(data->chamelium, port,
+					     frame_hardware,
+					     &fbref,
+					     CHAMELIUM_CHECK_ANALOG);
+
+	disable_plane_ctm(plane);
+	igt_plane_set_fb(plane, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit2(display, display->is_atomic ?
+					COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	return ret;
+}
+
 static void run_plane_color_test(data_t *data, enum pipe pipe, test_t test)
 {
 	igt_plane_t *plane;
@@ -1018,8 +1186,56 @@ static void run_plane_color_test(data_t *data, enum pipe pipe, test_t test)
 		igt_skip("No valid planes found.\n");
 }
 
+static void run_plane_ctm_test(data_t *data,
+				enum pipe pipe,
+				color_t *expected,
+				double *ctm,
+				int iter)
+{
+	igt_plane_t *plane;
+	bool result;
+	int i, count = 0;
+	double delta = 1.0 / (1 << 8);
+	color_t red_green_blue[] = {
+		{ 1.0, 0.0, 0.0 },
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 }
+	};
+
+	for_each_plane_on_pipe(&data->display, pipe, plane) {
+		if (!is_valid_plane(plane))
+			continue;
+
+		result = false;
+
+		if (!iter)
+			result |= test_plane_ctm(data, plane,
+					red_green_blue, expected,
+					ctm);
+
+		for (i = 0; i < iter; i++) {
+			expected[0].r =
+			expected[1].g =
+			expected[2].b =
+				ctm[0] + delta * (i - (iter/2));
+
+			result |= test_plane_ctm(data, plane,
+					red_green_blue,	expected,
+					ctm);
+		}
+
+		igt_assert(result);
+		count++;
+	}
+
+	if (!count)
+		igt_skip("No valid planes found.\n");
+}
+
 static void run_tests_for_plane(data_t *data, enum pipe pipe)
 {
+	int i;
+
 	igt_fixture {
 		igt_display_require_output_on_pipe(&data->display, pipe);
 		igt_require(data->display.pipes[pipe].n_planes > 0);
@@ -1035,6 +1251,18 @@ static void run_tests_for_plane(data_t *data, enum pipe pipe)
 	igt_subtest_f("pipe-%s-plane-degamma",
 			kmstest_pipe_name(pipe))
 		run_plane_color_test(data, pipe, plane_degamma_test);
+
+	for (i = 0; i < ARRAY_SIZE(ctm_tests); i++) {
+		igt_describe("Compare after applying ctm matrix & identity matrix");
+		igt_subtest_f("pipe-%s-%s",
+				kmstest_pipe_name(pipe),
+				ctm_tests[i].test_name) {
+			run_plane_ctm_test(data, pipe,
+					ctm_tests[i].expected_colors,
+					ctm_tests[i].ctm,
+					ctm_tests[i].iter);
+		}
+	}
 }
 
 igt_main
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 09/23] lib/igt_kms: Add pipe color mgmt properties
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (6 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 08/23] tests/kms_color_chamelium: New subtests for Plane CTM venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 10/23] kms_color_helper: Add helper functions to support logarithmic gamma mode venkata.sai.patnana
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Mukunda Pramodh Kumar

From: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>

Add support for Pipe color management properties.

Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
---
 lib/igt_kms.c | 1 +
 lib/igt_kms.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index ae183e822c..b11c8c27a6 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -592,6 +592,7 @@ const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
 	[IGT_CRTC_CTM] = "CTM",
 	[IGT_CRTC_GAMMA_LUT] = "GAMMA_LUT",
 	[IGT_CRTC_GAMMA_LUT_SIZE] = "GAMMA_LUT_SIZE",
+	[IGT_CRTC_GAMMA_MODE] = "GAMMA_MODE",
 	[IGT_CRTC_DEGAMMA_LUT] = "DEGAMMA_LUT",
 	[IGT_CRTC_DEGAMMA_LUT_SIZE] = "DEGAMMA_LUT_SIZE",
 	[IGT_CRTC_MODE_ID] = "MODE_ID",
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 41967bf28a..b54f2baf7d 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -119,6 +119,7 @@ enum igt_atomic_crtc_properties {
        IGT_CRTC_CTM = 0,
        IGT_CRTC_GAMMA_LUT,
        IGT_CRTC_GAMMA_LUT_SIZE,
+       IGT_CRTC_GAMMA_MODE,
        IGT_CRTC_DEGAMMA_LUT,
        IGT_CRTC_DEGAMMA_LUT_SIZE,
        IGT_CRTC_MODE_ID,
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 10/23] kms_color_helper: Add helper functions to support logarithmic gamma mode
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (7 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 09/23] lib/igt_kms: Add pipe color mgmt properties venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 11/23] tests/kms_color: Extended IGT tests " venkata.sai.patnana
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Mukunda Pramodh Kumar

From: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>

Add helper functions to support logarithmic gamma mode

v5: Move all compute/set logic to advance gamma mode function
v4: Removed unnecessary code and checks
    Makes the changes more generic
v3: calculate luts using gamma coefficients(Uma Shankar)

Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
---
 tests/kms_color_helper.c | 132 ++++++++++++++++++++++++++++++++++++++-
 tests/kms_color_helper.h |  16 +++++
 2 files changed, 147 insertions(+), 1 deletion(-)

diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index a14a97999e..36a9964cbf 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -24,6 +24,8 @@
 
 #include "kms_color_helper.h"
 
+#define DRM_CLIENT_CAP_ADVANCE_GAMMA_MODES     6
+
 void paint_gradient_rectangles(data_t *data,
 			       drmModeModeInfo *mode,
 			       color_t *colors,
@@ -166,7 +168,8 @@ 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;
+		if (intel_gen(data->devid) < 13)
+			v &= mask;
 
 		lut[i].red = v;
 		lut[i].green = v;
@@ -181,6 +184,33 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
 	return lut;
 }
 
+struct drm_color_lut *coeffs_to_logarithmic_lut(data_t *data,
+						const gamma_lut_t *gamma,
+						uint32_t color_depth,
+						int off)
+{
+	struct drm_color_lut *lut;
+	int i, lut_size = gamma->size;
+	/* This is the maximum value due to 16 bit precision in hardware. */
+	uint32_t max_hw_value = (1 << 16) - 1;
+	uint32_t v;
+	unsigned int max_segment_value = 1 << 24;
+	double scaling_factor;
+
+	lut = malloc(sizeof(struct drm_color_lut) * lut_size);
+
+	for (i = 0; i < lut_size; i++) {
+		scaling_factor = (double)max_hw_value / (double)max_segment_value;
+		v = (double)gamma->coeffs[i] * (double)scaling_factor;
+		v =  MIN(v, max_hw_value);
+		lut[i].red = v;
+		lut[i].green = v;
+		lut[i].blue = v;
+	}
+
+	return lut;
+}
+
 void set_degamma(data_t *data,
 		 igt_pipe_t *pipe,
 		 const gamma_lut_t *gamma)
@@ -194,6 +224,15 @@ void set_degamma(data_t *data,
 	free(lut);
 }
 
+void set_pipe_gamma(igt_pipe_t *pipe,
+		    uint64_t value,
+		    struct drm_color_lut *lut,
+		    uint32_t size)
+{
+	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_GAMMA_MODE, value);
+	igt_pipe_obj_replace_prop_blob(pipe, IGT_CRTC_GAMMA_LUT, lut, size);
+}
+
 void set_gamma(data_t *data,
 	       igt_pipe_t *pipe, const gamma_lut_t *gamma)
 {
@@ -232,6 +271,51 @@ void disable_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop)
 		igt_pipe_obj_replace_prop_blob(pipe, prop, NULL, 0);
 }
 
+drmModePropertyPtr get_pipe_gamma_degamma_mode(igt_pipe_t *pipe,
+					       enum igt_atomic_crtc_properties prop)
+{
+	igt_display_t *display = pipe->display;
+	uint32_t prop_id = pipe->props[prop];
+	drmModePropertyPtr drmProp;
+
+	igt_assert(prop_id);
+
+	drmProp = drmModeGetProperty(display->drm_fd, prop_id);
+
+	igt_assert(drmProp);
+	igt_assert(drmProp->count_enums);
+
+	return drmProp;
+}
+
+gamma_lut_t *pipe_create_linear_lut(segment_data_t *info)
+{
+	uint32_t segment, entry, index = 0;
+	double val;
+	int i = 0;
+	gamma_lut_t *gamma = alloc_lut(info->entries_count);
+
+	igt_assert(gamma);
+
+	gamma->size = info->entries_count;
+	for (segment = 0; segment < info->segment_count; segment++) {
+		uint32_t entry_count = info->segment_data[segment].count;
+		uint32_t start = (segment == 0) ? 0 : (1 << (segment - 1));
+		uint32_t end = 1 << segment;
+
+		for (entry = 0; entry < entry_count; entry++) {
+			val = (index == 0) ? /* First entry is Zero. */
+				0 : start + entry *
+				((end - start) * 1.0 / entry_count);
+
+			gamma->coeffs[i++] = val;
+			index++;
+		}
+	}
+
+	return gamma;
+}
+
 drmModePropertyPtr get_plane_gamma_degamma_mode(igt_plane_t *plane,
 				enum igt_atomic_plane_properties prop)
 {
@@ -322,6 +406,7 @@ segment_data_t *get_segment_data(data_t *data,
 	info->segment_data = malloc(sizeof(struct drm_color_lut_range) * info->segment_count);
 	igt_assert(info->segment_data);
 
+	info->entries_count = 0;
 	for (i = 0; i < info->segment_count; i++) {
 		info->entries_count += lut_range[i].count;
 		info->segment_data[i] = lut_range[i];
@@ -332,6 +417,51 @@ segment_data_t *get_segment_data(data_t *data,
 	return info;
 }
 
+void set_advance_gamma(data_t *data, igt_pipe_t *pipe, enum gamma_type type)
+{
+	igt_display_t *display = &data->display;
+	gamma_lut_t *gamma_log;
+	drmModePropertyPtr gamma_mode = NULL;
+	segment_data_t *segment_info = NULL;
+	struct drm_color_lut *lut = NULL;
+	int lut_size = 0;
+
+	drmSetClientCap(data->drm_fd, DRM_CLIENT_CAP_ADVANCE_GAMMA_MODES, 1);
+	gamma_mode = get_pipe_gamma_degamma_mode(pipe, IGT_CRTC_GAMMA_MODE);
+
+	for (int i = 0; i < gamma_mode->count_enums; i++) {
+		if (!strcmp(gamma_mode->enums[i].name, "logarithmic gamma")) {
+			segment_info = get_segment_data(data,
+							gamma_mode->enums[i].value,
+							gamma_mode->enums[i].name);
+			lut_size = sizeof(struct drm_color_lut) *
+					  segment_info->entries_count;
+			if (type == LINEAR_GAMMA) {
+				gamma_log = pipe_create_linear_lut(segment_info);
+				lut = coeffs_to_logarithmic_lut(data,
+								gamma_log,
+								data->color_depth,
+								0);
+			} else if (type == MAX_GAMMA) {
+				gamma_log = generate_table_max(segment_info->entries_count);
+				gamma_log->size = segment_info->entries_count;
+				lut = coeffs_to_lut(data, gamma_log,
+						    data->color_depth, 0);
+			}
+			set_pipe_gamma(pipe, gamma_mode->enums[i].value,
+				       lut, lut_size);
+			igt_display_commit2(display, display->is_atomic
+					    ? COMMIT_ATOMIC : COMMIT_LEGACY);
+			break;
+		}
+	}
+	drmSetClientCap(data->drm_fd, DRM_CLIENT_CAP_ADVANCE_GAMMA_MODES, 0);
+	free(gamma_log);
+	free(lut);
+	clear_segment_data(segment_info);
+	drmModeFreeProperty(gamma_mode);
+}
+
 void set_plane_gamma(igt_plane_t *plane,
 		char *mode,
 		struct drm_color_lut_ext *lut,
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index 945cc475e3..14d42d29cc 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -70,6 +70,11 @@ typedef struct {
 	uint32_t entries_count;
 } segment_data_t;
 
+enum gamma_type {
+	LINEAR_GAMMA,
+	MAX_GAMMA
+};
+
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 
 void paint_gradient_rectangles(data_t *data,
@@ -89,6 +94,10 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
 				    const gamma_lut_t *gamma,
 				    uint32_t color_depth,
 				    int off);
+struct drm_color_lut *coeffs_to_logarithmic_lut(data_t *data,
+						const gamma_lut_t *gamma,
+						uint32_t color_depth,
+						int off);
 void set_degamma(data_t *data,
 		 igt_pipe_t *pipe,
 		 const gamma_lut_t *gamma);
@@ -98,12 +107,19 @@ void set_gamma(data_t *data,
 void set_ctm(igt_pipe_t *pipe, const double *coefficients);
 void disable_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop);
 
+drmModePropertyPtr get_pipe_gamma_degamma_mode(igt_pipe_t *pipe,
+					       enum igt_atomic_crtc_properties
+					       prop);
 drmModePropertyPtr get_plane_gamma_degamma_mode(igt_plane_t *plane,
 	enum igt_atomic_plane_properties prop);
 void clear_segment_data(segment_data_t *info);
+gamma_lut_t *pipe_create_linear_lut(segment_data_t *info);
 struct drm_color_lut_ext *create_linear_lut(segment_data_t *info);
 struct drm_color_lut_ext *create_max_lut(segment_data_t *info);
 segment_data_t *get_segment_data(data_t *data, uint64_t blob_id, char *mode);
+void set_pipe_gamma(igt_pipe_t *pipe, uint64_t value,
+		    struct drm_color_lut *lut, uint32_t size);
+void set_advance_gamma(data_t *data, igt_pipe_t *pipe, enum gamma_type type);
 void set_plane_gamma(igt_plane_t *plane,
 	char *mode, struct drm_color_lut_ext *lut, uint32_t size);
 void set_plane_degamma(igt_plane_t *plane,
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 11/23] tests/kms_color: Extended IGT tests to support logarithmic gamma mode
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (8 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 10/23] kms_color_helper: Add helper functions to support logarithmic gamma mode venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 12/23] tests/kms_color_chamelium: " venkata.sai.patnana
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Mukunda Pramodh Kumar

From: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>

Extended IGT tests to support logarithmic gamma mode on pipe

v5: Move all compute/set logic to advance gamma mode function
v4: Make the changes more genreric
    Reset the Client caps once done.
v3: Refactor the changes.
    Keep the wrappers remain same.
    Added Client caps support(Uma)
v4: Disable gamma in ctm tests (Bhanu)
    Remove unused variables (Bhanu)
v5: Disable gamma before starting gamma tests.

Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 tests/kms_color.c | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 0387c9192a..f8e0485f75 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -129,7 +129,7 @@ static void test_pipe_degamma(data_t *data,
 {
 	igt_output_t *output;
 	igt_display_t *display = &data->display;
-	gamma_lut_t *degamma_linear, *degamma_full;
+	gamma_lut_t *degamma_full;
 	gamma_lut_t *gamma_linear;
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
@@ -140,9 +140,7 @@ static void test_pipe_degamma(data_t *data,
 	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));
 
-	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
 	degamma_full = generate_table_max(data->degamma_lut_size);
-
 	gamma_linear = generate_table(data->gamma_lut_size, 1.0);
 
 	for_each_valid_output_on_pipe(&data->display, primary->pipe->pipe, output) {
@@ -174,8 +172,13 @@ static void test_pipe_degamma(data_t *data,
 		igt_plane_set_fb(primary, &fb_modeset);
 		disable_ctm(primary->pipe);
 		disable_degamma(primary->pipe);
-		set_gamma(data, primary->pipe, gamma_linear);
-		igt_display_commit(&data->display);
+		if (igt_pipe_obj_has_prop(primary->pipe,
+					  IGT_CRTC_GAMMA_MODE)) {
+			set_advance_gamma(data, primary->pipe, LINEAR_GAMMA);
+		} else {
+			set_gamma(data, primary->pipe, gamma_linear);
+			igt_display_commit(&data->display);
+		}
 
 		/* Draw solid colors with no degamma transformation. */
 		paint_rectangles(data, mode, red_green_blue, &fb);
@@ -207,7 +210,6 @@ static void test_pipe_degamma(data_t *data,
 		igt_remove_fb(data->drm_fd, &fb_modeset);
 	}
 
-	free_lut(degamma_linear);
 	free_lut(degamma_full);
 	free_lut(gamma_linear);
 }
@@ -259,10 +261,22 @@ static void test_pipe_gamma(data_t *data,
 		igt_assert(fb_modeset_id);
 
 		igt_plane_set_fb(primary, &fb_modeset);
+
+		/* Reset Color properties */
 		disable_ctm(primary->pipe);
 		disable_degamma(primary->pipe);
-		set_gamma(data, primary->pipe, gamma_full);
+		disable_gamma(primary->pipe);
 		igt_display_commit(&data->display);
+		igt_wait_for_vblank(data->drm_fd,
+				    display->pipes[primary->pipe->pipe].crtc_offset);
+
+		if (igt_pipe_obj_has_prop(primary->pipe,
+					  IGT_CRTC_GAMMA_MODE)) {
+			set_advance_gamma(data, primary->pipe, MAX_GAMMA);
+		} else {
+			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);
@@ -580,7 +594,10 @@ static bool test_pipe_ctm(data_t *data,
 		 */
 		if (memcmp(before, after, sizeof(color_t))) {
 			set_degamma(data, primary->pipe, degamma_linear);
-			set_gamma(data, primary->pipe, gamma_linear);
+			if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_MODE))
+				disable_gamma(primary->pipe);
+			else
+				set_gamma(data, primary->pipe, gamma_linear);
 		} else {
 			/* Disable Degamma and Gamma for ctm max test */
 			disable_degamma(primary->pipe);
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 12/23] tests/kms_color_chamelium: Extended IGT tests to support logarithmic gamma mode
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (9 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 11/23] tests/kms_color: Extended IGT tests " venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 13/23] tests/kms_color: Optimize plane ctm test venkata.sai.patnana
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi, Mukunda Pramodh Kumar

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

Extended IGT tests to support logarithmic gamma mode on pipe

V2:
* Disable gamma for CTM tests (Bhanu)

v3: Disable the pipe color properties before starting the test,
so that we begin with clean state. Addressed Bhanu's review comments.

Cc: Kunal Joshi <kunal1.joshi@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 tests/kms_color_chamelium.c | 61 +++++++++++++++++++++++++++++++------
 1 file changed, 52 insertions(+), 9 deletions(-)

diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
index 24f25d964c..38c7169737 100644
--- a/tests/kms_color_chamelium.c
+++ b/tests/kms_color_chamelium.c
@@ -133,7 +133,7 @@ static void test_pipe_degamma(data_t *data,
 			      igt_plane_t *primary)
 {
 	igt_output_t *output;
-	gamma_lut_t *degamma_linear, *degamma_full;
+	gamma_lut_t *degamma_full;
 	gamma_lut_t *gamma_linear;
 	color_t red_green_blue[] = {
 		{ 1.0, 0.0, 0.0 },
@@ -152,9 +152,7 @@ static void test_pipe_degamma(data_t *data,
 	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));
 
-	degamma_linear = generate_table(data->degamma_lut_size, 1.0);
 	degamma_full = generate_table_max(data->degamma_lut_size);
-
 	gamma_linear = generate_table(data->gamma_lut_size, 1.0);
 
 	for_each_valid_output_on_pipe(&data->display,
@@ -208,8 +206,12 @@ static void test_pipe_degamma(data_t *data,
 		igt_plane_set_fb(primary, &fb_modeset);
 		disable_ctm(primary->pipe);
 		disable_degamma(primary->pipe);
-		set_gamma(data, primary->pipe, gamma_linear);
-		igt_display_commit(&data->display);
+		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_MODE)) {
+			set_advance_gamma(data, primary->pipe, LINEAR_GAMMA);
+		} else {
+			set_gamma(data, primary->pipe, gamma_linear);
+			igt_display_commit(&data->display);
+		}
 
 		/* Draw solid colors with no degamma transformation. */
 		paint_rectangles(data, mode, red_green_blue, &fbref);
@@ -235,9 +237,13 @@ static void test_pipe_degamma(data_t *data,
 
 		igt_plane_set_fb(primary, NULL);
 		igt_output_set_pipe(output, PIPE_NONE);
+
+		/* Cleanup */
+		disable_gamma(primary->pipe);
+		disable_degamma(primary->pipe);
+		igt_display_commit(&data->display);
 	}
 
-	free_lut(degamma_linear);
 	free_lut(degamma_full);
 	free_lut(gamma_linear);
 }
@@ -319,10 +325,21 @@ static void test_pipe_gamma(data_t *data,
 		igt_assert(fbref_id);
 
 		igt_plane_set_fb(primary, &fb_modeset);
+
+		/* Reset the color properties */
 		disable_ctm(primary->pipe);
 		disable_degamma(primary->pipe);
-		set_gamma(data, primary->pipe, gamma_full);
+		disable_gamma(primary->pipe);
 		igt_display_commit(&data->display);
+		igt_wait_for_vblank(data->drm_fd,
+				    data->display.pipes[primary->pipe->pipe].crtc_offset);
+
+		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_MODE)) {
+			set_advance_gamma(data, primary->pipe, MAX_GAMMA);
+		} else {
+			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, &fbref);
@@ -347,6 +364,10 @@ static void test_pipe_gamma(data_t *data,
 
 		igt_plane_set_fb(primary, NULL);
 		igt_output_set_pipe(output, PIPE_NONE);
+
+		/* Cleanup */
+		disable_gamma(primary->pipe);
+		igt_display_commit(&data->display);
 	}
 
 	free_lut(gamma_full);
@@ -431,7 +452,10 @@ static bool test_pipe_ctm(data_t *data,
 
 		if (memcmp(before, after, sizeof(color_t))) {
 			set_degamma(data, primary->pipe, degamma_linear);
-			set_gamma(data, primary->pipe, gamma_linear);
+			if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_MODE))
+				disable_gamma(primary->pipe);
+			else
+				set_gamma(data, primary->pipe, gamma_linear);
 		} else {
 			/* Disable Degamma and Gamma for ctm max test */
 			disable_degamma(primary->pipe);
@@ -465,6 +489,12 @@ static bool test_pipe_ctm(data_t *data,
 		igt_output_set_pipe(output, PIPE_NONE);
 	}
 
+	/* Cleanup */
+	disable_gamma(primary->pipe);
+	disable_degamma(primary->pipe);
+	disable_ctm(primary->pipe);
+	igt_display_commit(&data->display);
+
 	free_lut(degamma_linear);
 	free_lut(gamma_linear);
 
@@ -559,7 +589,14 @@ static void test_pipe_limited_range_ctm(data_t *data,
 		igt_plane_set_fb(primary, &fb_modeset);
 
 		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		/*
+		 * No need of linear gamma for limited range ctm test
+		 * Not extending for new API interface.
+		 */
+		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_MODE))
+			disable_gamma(primary->pipe);
+		else
+			set_gamma(data, primary->pipe, gamma_linear);
 		set_ctm(primary->pipe, ctm);
 
 		igt_output_set_prop_value(output,
@@ -596,6 +633,12 @@ static void test_pipe_limited_range_ctm(data_t *data,
 
 	}
 
+	/* Cleanup */
+	disable_gamma(primary->pipe);
+	disable_degamma(primary->pipe);
+	disable_ctm(primary->pipe);
+	igt_display_commit(&data->display);
+
 	free_lut(gamma_linear);
 	free_lut(degamma_linear);
 
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 13/23] tests/kms_color: Optimize plane ctm test
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (10 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 12/23] tests/kms_color_chamelium: " venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 14/23] tests/kms_color_chamelium: " venkata.sai.patnana
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi

From: Kunal Joshi <kunal1.joshi@intel.com>

Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 tests/kms_color.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index f8e0485f75..622faf0934 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -1361,6 +1361,8 @@ static void run_plane_ctm_test(data_t *data,
 			result |= test_plane_ctm(data, plane,
 					red_green_blue,	expected,
 					ctm);
+			if (result)
+				break;
 		}
 
 		igt_assert(result);
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 14/23] tests/kms_color_chamelium: Optimize plane ctm test
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (11 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 13/23] tests/kms_color: Optimize plane ctm test venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-04  5:01   ` Modem, Bhanuprakash
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 15/23] tests/kms_dither: New IGT to validate crtc Dithering venkata.sai.patnana
                   ` (10 subsequent siblings)
  23 siblings, 1 reply; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi

From: Kunal Joshi <kunal1.joshi@intel.com>

Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 tests/kms_color_chamelium.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
index 38c7169737..52eef8a66f 100644
--- a/tests/kms_color_chamelium.c
+++ b/tests/kms_color_chamelium.c
@@ -1265,6 +1265,8 @@ static void run_plane_ctm_test(data_t *data,
 			result |= test_plane_ctm(data, plane,
 					red_green_blue,	expected,
 					ctm);
+			if (result)
+				break;
 		}
 
 		igt_assert(result);
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 15/23] tests/kms_dither: New IGT to validate crtc Dithering
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (12 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 14/23] tests/kms_color_chamelium: " venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 16/23] tests/kms_dither: Validate dither after CC blocks venkata.sai.patnana
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Nischal Varide, Petri Latvala

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

Many of the display devices have color format support less than
the color format of the input data (Ex: 8-bit input data and 6-bit
display color depth). Then the input data will be either truncated
or rounded, but this approach usually causes loss of detail and also
produce large banded areas of a single color that significantly
differs from the original image.

Dithering is a technique used to enhance these colors by creating the
illusion of smoothness by adjusting the nearby pixel color.
For Eg: Converting 8-bit to 6-bit by modifying the pixel information.

Dithering should be enabled when a panel color depth is lower than the
color depth of the framebuffer.

Even though feature Dithering is there since legacy, there is no
specific IGT for this. This patch will create New IGT for Dithering.
And below is the truth table for CRTC Dithering.

|----------------|---------|-------------|
|  Frame buffer  |  Panel  |  Dithering  |
|----------------|---------|-------------|
|      8 BPC     |  6 BPC  |     Yes     |
|----------------|---------|-------------|
|      8 BPC     |  8 BPC  |     No      |
|----------------|---------|-------------|
|      8 BPC     | 10 BPC  |     No      |
|----------------|---------|-------------|
|     10 BPC     |  6 BPC  |     Yes     |
|----------------|---------|-------------|
|     10 BPC     |  8 BPC  |     Yes     |
|----------------|---------|-------------|
|     10 BPC     | 10 BPC  |     No      |
|----------------|---------|-------------|
|     16 BPC     |  6 BPC  |     Yes     |
|----------------|---------|-------------|
|     16 BPC     |  8 BPC  |     Yes     |
|----------------|---------|-------------|
|     16 BPC     | 10 BPC  |     Yes     |
|----------------|---------|-------------|

v2:
* Fix commit message (Karthik)
* Add file author (Karthik)
* Dynamic subtests for pipe-output combinations (Karthik)
* Update deprecated pipe name (Karthik)
* Remove redundant fb creation logic (Karthik)

v3:
* Use for_each_pipe_with_valid_output() to simplify the logic (Bhanu)
* Remove magic numbers to create fb (Karthik)
* Fix typos & comments (Swati)

v4:
* Remove explicit igt_require for a valid output found,
  igt_subtest_with_dynamic will handle the SKIP (Petri)
* Limit the execution to a single pipe (Uma)

v5:
* SKIP subtest for HDMI with 6 BPC (Bhanu)
* Fix the usage of valid format to create 8 BPC Framebuffer (Bhanu)
* Add support for suspend/resume tests (Bhanu)
* Add few debug prints (Bhanu)

v6:
* Limit the execution to 8 BPC panels (Uma)
* Remove suspend/resume tests (Bhanu)

v7:
* Drop max_bpc from debugfs (Uma)

v8:
* Run test on all connected outputs (Bhanu)
* Before exiting the test reset the "max bpc" prop (Bhanu)
* Before computing the result check that the crtc bpc is updated
  with the requested one (Bhanu)

Cc: Swati Sharma <swati2.sharma@intel.com>
Cc: Karthik B S <karthik.b.s@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Nischal Varide <nischal.varide@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_dither.c | 250 +++++++++++++++++++++++++++++++++++++++++++++
 tests/meson.build  |   1 +
 2 files changed, 251 insertions(+)
 create mode 100644 tests/kms_dither.c

diff --git a/tests/kms_dither.c b/tests/kms_dither.c
new file mode 100644
index 0000000000..c25d623f81
--- /dev/null
+++ b/tests/kms_dither.c
@@ -0,0 +1,250 @@
+/*
+ * Copyright © 2020 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *     Bhanuprakash Modem <bhanuprakash.modem@intel.com>
+ *
+ */
+
+#include "igt.h"
+#include <fcntl.h>
+#include <termios.h>
+#include <unistd.h>
+
+IGT_TEST_DESCRIPTION("Test Dithering block status");
+
+/* Connector BPC */
+#define IGT_CONNECTOR_BPC_6		6
+#define IGT_CONNECTOR_BPC_8		8
+#define IGT_CONNECTOR_BPC_10		10
+#define IGT_CONNECTOR_BPC_12		12
+
+/* Framebuffer BPC */
+#define IGT_FRAME_BUFFER_BPC_8		8
+#define IGT_FRAME_BUFFER_BPC_10		10
+#define IGT_FRAME_BUFFER_BPC_16		16
+
+/* Common test data. */
+typedef struct data {
+	igt_display_t display;
+	igt_plane_t *primary;
+	igt_output_t *output;
+	igt_pipe_t *pipe;
+	drmModeModeInfo *mode;
+	enum pipe pipe_id;
+	int drm_fd;
+	igt_fb_t fb;
+} data_t;
+
+typedef struct {
+	unsigned int bpc;
+	unsigned int dither;
+} dither_status_t;
+
+/* Prepare test data. */
+static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
+{
+	igt_display_t *display = &data->display;
+
+	data->pipe_id = pipe;
+	data->pipe = &data->display.pipes[data->pipe_id];
+	igt_assert(data->pipe);
+
+	igt_display_reset(display);
+
+	data->output = output;
+	igt_assert(data->output);
+
+	data->mode = igt_output_get_mode(data->output);
+	igt_assert(data->mode);
+
+	data->primary =
+		igt_pipe_get_plane_type(data->pipe, DRM_PLANE_TYPE_PRIMARY);
+
+	igt_output_set_pipe(data->output, data->pipe_id);
+}
+
+/* Returns the current state of dithering from the crtc debugfs. */
+static dither_status_t get_dither_state(data_t *data)
+{
+	char buf[256];
+	char crtc_name[7];
+	char *start_loc;
+	int fd, res;
+	dither_status_t status;
+
+	snprintf(crtc_name, 7, "crtc-%d", data->pipe_id);
+	fd = igt_debugfs_open(data->drm_fd, crtc_name, O_RDONLY);
+	igt_assert(fd >= 0);
+
+	res = igt_debugfs_simple_read(fd, "dither", buf, sizeof(buf));
+	igt_require(res > 0);
+	close(fd);
+
+	igt_assert(start_loc = strstr(buf, "bpc: "));
+	igt_assert_eq(sscanf(start_loc, "bpc: %u", &status.bpc), 1);
+
+	igt_assert(start_loc = strstr(buf, "Dither: "));
+	igt_assert_eq(sscanf(start_loc, "Dither: %u", &status.dither), 1);
+
+	return status;
+}
+
+static void test_dithering(data_t *data, enum pipe pipe,
+			   igt_output_t *output,
+			   int fb_bpc, int fb_format,
+			   int output_bpc)
+{
+	igt_display_t *display = &data->display;
+	dither_status_t status;
+	int bpc;
+
+	igt_info("Dithering test execution on %s PIPE_%s\n",
+			output->name, kmstest_pipe_name(pipe));
+	prepare_test(data, output, pipe);
+
+	igt_assert(igt_create_fb(data->drm_fd, data->mode->hdisplay,
+				 data->mode->vdisplay, fb_format,
+				 LOCAL_DRM_FORMAT_MOD_NONE, &data->fb));
+	igt_plane_set_fb(data->primary, &data->fb);
+	igt_plane_set_size(data->primary, data->mode->hdisplay, data->mode->vdisplay);
+
+	bpc = igt_output_get_prop(output, IGT_CONNECTOR_MAX_BPC);
+	igt_output_set_prop_value(data->output, IGT_CONNECTOR_MAX_BPC, output_bpc);
+	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+
+	/*
+	 * Check the status of Dithering block:
+	 *
+	 * Preserve the result & compute later (after clean-up).
+	 * If fb_bpc is greater than output_bpc, Dithering should be enabled
+	 * Else disabled
+	 */
+	status = get_dither_state(data);
+
+	igt_debug("FB BPC:%d, Panel BPC:%d, Pipe BPC:%d, Expected Dither:%s, Actual result:%s\n",
+		  fb_bpc, output_bpc, status.bpc,
+		  (fb_bpc > output_bpc) ? "Enable": "Disable",
+		  status.dither ? "Enable": "Disable");
+
+       /*
+	* We must update the Connector max_bpc property back
+	* Otherwise, previously updated value will stay forever and
+	* may cause the failures for next/other subtests.
+	*/
+	igt_output_set_prop_value(data->output, IGT_CONNECTOR_MAX_BPC, bpc);
+	igt_plane_set_fb(data->primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+	igt_remove_fb(data->drm_fd, &data->fb);
+
+	/* Check if crtc bpc is updated with requested one. */
+	igt_require_f((status.bpc == output_bpc),
+			"%s can support max %u-bpc, but requested %d-bpc\n",
+				output->name, status.bpc, output_bpc);
+
+	/* Compute the result. */
+	if (fb_bpc > output_bpc)
+		igt_assert_f(status.dither, "(fb_%dbpc > output_%dbpc): Dither should be enabled\n",
+				fb_bpc, output_bpc);
+	else
+		igt_assert_f(!status.dither, "(fb_%dbpc <= output_%dbpc): Dither should be disabled\n",
+				fb_bpc, output_bpc);
+
+	return;
+}
+
+/* Returns true if an output supports max bpc property & max_bpc >= requested. */
+static bool is_supported(igt_output_t *output, int bpc)
+{
+        return igt_output_has_prop(output, IGT_CONNECTOR_MAX_BPC) &&
+		(igt_output_get_prop(output, IGT_CONNECTOR_MAX_BPC) >= bpc);
+}
+
+static void
+run_dither_test(data_t *data, int fb_bpc, int fb_format, int output_bpc)
+{
+	igt_output_t *output;
+	igt_display_t *display = &data->display;
+
+	for_each_connected_output(display, output) {
+		enum pipe pipe;
+
+		if (!is_supported(output, output_bpc))
+			continue;
+
+		if ((strstr(output->name, "HDMI") != NULL) &&
+		    (output_bpc == IGT_CONNECTOR_BPC_6))
+			continue;
+
+		for_each_pipe(display, pipe) {
+			if (igt_pipe_connector_valid(pipe, output)) {
+				igt_dynamic_f("%s-pipe-%s", output->name, kmstest_pipe_name(pipe))
+					test_dithering(data, pipe, output, fb_bpc,
+							fb_format, output_bpc);
+
+				/* One pipe is enough */
+				break;
+			}
+		}
+	}
+}
+
+igt_main
+{
+	struct {
+		int fb_bpc;
+		int format;
+		int output_bpc;
+	} tests[] = {
+		{ IGT_FRAME_BUFFER_BPC_8, DRM_FORMAT_XRGB8888, IGT_CONNECTOR_BPC_6 },
+		{ IGT_FRAME_BUFFER_BPC_8, DRM_FORMAT_XRGB8888, IGT_CONNECTOR_BPC_8 },
+	};
+	int i;
+	data_t data = { 0 };
+
+	igt_fixture {
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		kmstest_set_vt_graphics_mode();
+
+		igt_display_require(&data.display, data.drm_fd);
+		igt_display_require_output(&data.display);
+	}
+
+	for (i = 0; i < ARRAY_SIZE(tests); i++) {
+		igt_describe_f("Framebuffer BPC:%d, Panel BPC:%d, Expected Dither:%s\n",
+			       tests[i].fb_bpc, tests[i].output_bpc,
+			       (tests[i].fb_bpc > tests[i].output_bpc) ?
+							"Enable": "Disable");
+
+		igt_subtest_with_dynamic_f("FB-%dBPC-Vs-Panel-%dBPC",
+				tests[i].fb_bpc, tests[i].output_bpc)
+			run_dither_test(&data,
+					tests[i].fb_bpc,
+					tests[i].format,
+					tests[i].output_bpc);
+	}
+
+	igt_fixture {
+		igt_display_fini(&data.display);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index 19cc4ebe0d..ff3979207d 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -28,6 +28,7 @@ test_progs = [
 	'kms_cursor_crc',
 	'kms_cursor_edge_walk',
 	'kms_cursor_legacy',
+	'kms_dither',
 	'kms_dp_aux_dev',
 	'kms_dp_dsc',
 	'kms_dp_tiled_display',
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 16/23] tests/kms_dither: Validate dither after CC blocks
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (13 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 15/23] tests/kms_dither: New IGT to validate crtc Dithering venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 17/23] tests/kms_dither: Dont assert if debugfs is not present venkata.sai.patnana
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Nischal Varide, Petri Latvala

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

Dithering after all CC blocks will be enabled only if the panel
supports 12 BPC (or more) and the Framebuffer BPC is greater than
12 BPC. And legacy dither block (at the end of PIPE) should be
disabled to avoid double dithering.

This patch will extend the support to validate Dither after all
color conversion (CC) blocks.

V2:
* Identify the dithering block, then check the status (Uma)

Cc: Swati Sharma <swati2.sharma@intel.com>
Cc: Karthik B S <karthik.b.s@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Nischal Varide <nischal.varide@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_dither.c | 40 +++++++++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/tests/kms_dither.c b/tests/kms_dither.c
index c25d623f81..1ff07914f4 100644
--- a/tests/kms_dither.c
+++ b/tests/kms_dither.c
@@ -57,7 +57,8 @@ typedef struct data {
 
 typedef struct {
 	unsigned int bpc;
-	unsigned int dither;
+	unsigned int legacy;
+	unsigned int cc1;
 } dither_status_t;
 
 /* Prepare test data. */
@@ -104,7 +105,10 @@ static dither_status_t get_dither_state(data_t *data)
 	igt_assert_eq(sscanf(start_loc, "bpc: %u", &status.bpc), 1);
 
 	igt_assert(start_loc = strstr(buf, "Dither: "));
-	igt_assert_eq(sscanf(start_loc, "Dither: %u", &status.dither), 1);
+	igt_assert_eq(sscanf(start_loc, "Dither: %u", &status.legacy), 1);
+
+	igt_assert(start_loc = strstr(buf, "Dither_CC1: "));
+	igt_assert_eq(sscanf(start_loc, "Dither_CC1: %u", &status.cc1), 1);
 
 	return status;
 }
@@ -141,10 +145,10 @@ static void test_dithering(data_t *data, enum pipe pipe,
 	 */
 	status = get_dither_state(data);
 
-	igt_debug("FB BPC:%d, Panel BPC:%d, Pipe BPC:%d, Expected Dither:%s, Actual result:%s\n",
-		  fb_bpc, output_bpc, status.bpc,
-		  (fb_bpc > output_bpc) ? "Enable": "Disable",
-		  status.dither ? "Enable": "Disable");
+	igt_debug("FB BPC:%d, Panel BPC:%d, Pipe BPC:%d, "
+		  "Dither at end of the pipe:%u, Dither after CC1:%u\n",
+			fb_bpc, output_bpc, status.bpc,
+			status.legacy, status.cc1);
 
        /*
 	* We must update the Connector max_bpc property back
@@ -163,12 +167,25 @@ static void test_dithering(data_t *data, enum pipe pipe,
 				output->name, status.bpc, output_bpc);
 
 	/* Compute the result. */
-	if (fb_bpc > output_bpc)
-		igt_assert_f(status.dither, "(fb_%dbpc > output_%dbpc): Dither should be enabled\n",
-				fb_bpc, output_bpc);
-	else
-		igt_assert_f(!status.dither, "(fb_%dbpc <= output_%dbpc): Dither should be disabled\n",
+	if (fb_bpc > output_bpc) {
+		if (output_bpc < IGT_CONNECTOR_BPC_12)
+			igt_assert_f((status.legacy && !status.cc1),
+					"(fb_%dbpc > output_%dbpc): Dither should be "
+					"enabled at end of the PIPE & "
+					"disbaled at the CC1.\n",
+					fb_bpc, output_bpc);
+		else
+			igt_assert_f((!status.legacy && status.cc1),
+					"(fb_%dbpc > output_%dbpc): Dither should be "
+					"disabled at end of the PIPE & "
+					"enabled at the CC1.\n",
+					fb_bpc, output_bpc);
+	} else {
+		igt_assert_f((!status.legacy && !status.cc1),
+				"(fb_%dbpc <= output_%dbpc): Dither should be "
+				"disabled at both places (end of the PIPE & CC1).\n",
 				fb_bpc, output_bpc);
+	}
 
 	return;
 }
@@ -218,6 +235,7 @@ igt_main
 	} tests[] = {
 		{ IGT_FRAME_BUFFER_BPC_8, DRM_FORMAT_XRGB8888, IGT_CONNECTOR_BPC_6 },
 		{ IGT_FRAME_BUFFER_BPC_8, DRM_FORMAT_XRGB8888, IGT_CONNECTOR_BPC_8 },
+		{ IGT_FRAME_BUFFER_BPC_16, DRM_FORMAT_XRGB16161616F, IGT_CONNECTOR_BPC_12 },
 	};
 	int i;
 	data_t data = { 0 };
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 17/23] tests/kms_dither: Dont assert if debugfs is not present
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (14 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 16/23] tests/kms_dither: Validate dither after CC blocks venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 18/23] tests/device_reset: Unload snd driver before i915 unbind venkata.sai.patnana
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Nischal Varide, Petri Latvala

From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>

As Dither_CC1 debugfs changes are not preset on older platforms, we need
not to abort the test. So if the debugfs is not present, just consider
the value as zero.

Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Nischal Varide <nischal.varide@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_dither.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/kms_dither.c b/tests/kms_dither.c
index 1ff07914f4..b1f0503a6c 100644
--- a/tests/kms_dither.c
+++ b/tests/kms_dither.c
@@ -107,8 +107,11 @@ static dither_status_t get_dither_state(data_t *data)
 	igt_assert(start_loc = strstr(buf, "Dither: "));
 	igt_assert_eq(sscanf(start_loc, "Dither: %u", &status.legacy), 1);
 
-	igt_assert(start_loc = strstr(buf, "Dither_CC1: "));
-	igt_assert_eq(sscanf(start_loc, "Dither_CC1: %u", &status.cc1), 1);
+	start_loc = strstr(buf, "Dither_CC1: ");
+	if (!start_loc)
+		status.cc1 = 0;
+	else
+		igt_assert_eq(sscanf(start_loc, "Dither_CC1: %u", &status.cc1), 1);
 
 	return status;
 }
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 18/23] tests/device_reset: Unload snd driver before i915 unbind
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (15 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 17/23] tests/kms_dither: Dont assert if debugfs is not present venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 19/23] tests/core_hotunplug: " venkata.sai.patnana
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Kai Vehmanen

From: Uma Shankar <uma.shankar@intel.com>

Unload the snd module before unbinding i915. Audio holds a wakeref which
triggers a warning otherwise, resulting in below warning and test failure.
Currently HSW/BDW and DG1 are the platforms affected, can be extended to
other platforms as well.

<4> [137.001006] ------------[ cut here ]------------
<4> [137.001010] i915 0000:00:02.0: i915 raw-wakerefs=1 wakelocks=1 on cleanup
<4> [137.001076] WARNING: CPU: 0 PID: 1417 at drivers/gpu/drm/i915/intel_runtime_pm.c:619 intel_runtime_pm_driver_release+0x56/0x60 [i915]
<4> [137.001078] Modules linked in: snd_hda_intel i915 snd_hda_codec_hdmi mei_hdcp intel_pmt_telemetry intel_pmt_core x86_pkg_temp_thermal coretemp smsc75xx crct10dif_pclmul usbnet crc32_pclmul mii ghash_clmulni_intel kvm_intel e1000e snd_intel_dspcfg snd_hda_codec snd_hwdep snd_hda_core ptp pps_core mei_me snd_pcm mei prime_numbers intel_pmt [last unloaded: i915]
<4> [137.001095] CPU: 0 PID: 1417 Comm: kworker/u16:7 Tainted: G U 5.9.0-g79478e23b1878-DII_3204+ #1
<4> [137.001097] Hardware name: Intel Corporation Tiger Lake Client Platform/TigerLake U DDR4 SODIMM RVP, BIOS TGLSFWI1.R00.3197.A00.2005110542 05/11/2020
<4> [137.001102] Workqueue: events_unbound async_run_entry_fn
<4> [137.001140] RIP: 0010:intel_runtime_pm_driver_release+0x56/0x60 [i915]
<4> [137.001142] Code: fd 10 4c 8b 67 50 4d 85 e4 75 03 4c 8b 27 e8 91 59 58 e1 45 89 e8 89 e9 4c 89 e2 48 89 c6 48 c7 c7 b0 f3 48 a0 e8 55 25 ef e0 <0f> 0b eb b5 66 0f 1f 44 00 00 48 8b 87 88 45 ff ff b9 02 00 00 00
<4> [137.001144] RSP: 0018:ffffc900007dbd68 EFLAGS: 00010286
<4> [137.001147] RAX: 0000000000000000 RBX: ffff88847338bea8 RCX: 0000000000000001
<4> [137.001148] RDX: 0000000080000001 RSI: ffffffff823efa86 RDI: 00000000ffffffff
<4> [137.001150] RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000001
<4> [137.001152] R10: 000000009bda34df R11: 00000000e2a8a89a R12: ffff88849b209880
<4> [137.001153] R13: 0000000000000001 R14: ffff88847338bea8 R15: ffff88847338fcc0
<4> [137.001155] FS: 0000000000000000(0000) GS:ffff8884a0600000(0000) knlGS:0000000000000000
<4> [137.001157] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
<4> [137.001159] CR2: 00007fc03597dd88 CR3: 0000000006610005 CR4: 0000000000770ef0
<4> [137.001160] PKRU: 55555554
<4> [137.001162] Call Trace:
<4> [137.001199] i915_drm_suspend_late+0x102/0x120 [i915]
<4> [137.001204] ? pci_pm_poweroff_late+0x30/0x30
<4> [137.001209] dpm_run_callback+0x61/0x270
<4> [137.001214] __device_suspend_late+0x8b/0x180
<4> [137.001217] async_suspend_late+0x15/0x90
<4> [137.001220] async_run_entry_fn+0x34/0x160
<4> [137.001224] process_one_work+0x26c/0x5c0
<4> [137.001231] worker_thread+0x37/0x380
<4> [137.001235] ? process_one_work+0x5c0/0x5c0
<4> [137.001238] kthread+0x149/0x170
<4> [137.001241] ? kthread_park+0x80/0x80
<4> [137.001246] ret_from_fork+0x1f/0x30
<4> [137.001256] irq event stamp: 2329

v2: Addressed Janusz review comment, added a DG1 platform check
and skip if module unload for audio fails.

v3: Extended the WA to HSW/BDW, added an igt  warning on unload to keep
visibility on the issue as suggested by Janusz

v4: Merged the revert of earlier WA within this patch and added
a flag to track the WA, as suggested by Janusz.

Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 tests/device_reset.c | 61 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 46 insertions(+), 15 deletions(-)

diff --git a/tests/device_reset.c b/tests/device_reset.c
index eef707330c..e6a468e6fa 100644
--- a/tests/device_reset.c
+++ b/tests/device_reset.c
@@ -5,11 +5,13 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <signal.h>
 
 #include "i915/gem.h"
 #include "igt.h"
 #include "igt_device_scan.h"
 #include "igt_sysfs.h"
+#include "igt_kmod.h"
 
 IGT_TEST_DESCRIPTION("Examine behavior of a driver on device sysfs reset");
 
@@ -28,6 +30,7 @@ struct device_fds {
 		int drv_dir;
 	} fds;
 	char dev_bus_addr[DEV_BUS_ADDR_LEN];
+	bool snd_unload;
 };
 
 static int __open_sysfs_dir(int fd, const char* path)
@@ -82,6 +85,7 @@ static void init_device_fds(struct device_fds *dev)
 {
 	char dev_path[PATH_MAX];
 	char *addr_pos;
+	uint32_t devid;
 
 	igt_debug("open device\n");
 	/**
@@ -91,9 +95,18 @@ static void init_device_fds(struct device_fds *dev)
 	 */
 	dev->fds.dev = __drm_open_driver(DRIVER_ANY);
 	igt_assert_fd(dev->fds.dev);
-	if (is_i915_device(dev->fds.dev))
+	if (is_i915_device(dev->fds.dev)) {
 		igt_require_gem(dev->fds.dev);
 
+		devid = intel_get_drm_devid(dev->fds.dev);
+		if ((IS_HASWELL(devid) || IS_BROADWELL(devid) ||
+		     IS_DG1(devid)) &&
+		     (igt_kmod_is_loaded("snd_hda_intel"))) {
+			igt_debug("Enable WA to unload snd driver\n");
+			dev->snd_unload = true;
+		}
+	}
+
 	igt_assert(device_sysfs_path(dev->fds.dev, dev_path));
 	addr_pos = strrchr(dev_path, '/');
 	igt_assert(addr_pos);
@@ -164,6 +177,34 @@ static bool is_sysfs_reset_supported(int fd)
 /* Unbind the driver from the device */
 static void driver_unbind(struct device_fds *dev)
 {
+	/**
+	 * FIXME: Unbinding the i915 driver on affected platforms with
+	 * audio results in a kernel WARN on "i915 raw-wakerefs=1
+	 * wakelocks=1 on cleanup". The below CI friendly user level
+	 * workaround to unload and de-couple audio from IGT testing,
+	 * prevents the warning from appearing. Drop this hack as soon
+	 * as this is fixed in the kernel. unbind/re-bind validation
+	 * on audio side is not robust and we could have potential
+	 * failures blocking display CI, currently this seems to the
+	 * safest and easiest way out.
+	 */
+	if (dev->snd_unload) {
+		igt_terminate_process(SIGTERM, "alsactl");
+
+		/* unbind snd_hda_intel */
+		kick_snd_hda_intel();
+
+		if (igt_kmod_unload("snd_hda_intel", 0)) {
+			dev->snd_unload = false;
+			igt_warn("Could not unload snd_hda_intel\n");
+			igt_kmod_list_loaded();
+			igt_lsof("/dev/snd");
+			igt_skip("Audio is in use, skipping\n");
+		} else {
+			igt_warn("Preventively unloaded snd_hda_intel\n");
+		}
+	}
+
 	igt_debug("unbind the driver from the device\n");
 	igt_assert(igt_sysfs_set(dev->fds.drv_dir, "unbind",
 		   dev->dev_bus_addr));
@@ -175,6 +216,9 @@ static void driver_bind(struct device_fds *dev)
 	igt_debug("rebind the driver to the device\n");
 	igt_abort_on_f(!igt_sysfs_set(dev->fds.drv_dir, "bind",
 		       dev->dev_bus_addr), "driver rebind failed");
+
+	if (dev->snd_unload)
+		igt_kmod_load("snd_hda_intel", NULL);
 }
 
 /* Initiate device reset */
@@ -235,19 +279,6 @@ static void unbind_reset_rebind(struct device_fds *dev)
 	igt_debug("close the device\n");
 	close_if_opened(&dev->fds.dev);
 
-	/**
-	 * FIXME: Unbinding the i915 driver on some platforms with Azalia audio
-	 * results in a kernel WARN on "i915 raw-wakerefs=1 wakelocks=1 on cleanup".
-	 * The below CI friendly user level workaround prevents the warning from
-	 * appearing. Drop this hack as soon as this is fixed in the kernel.
-	 */
-	if (is_i915_device(dev->fds.dev)) {
-		uint32_t devid = intel_get_drm_devid(dev->fds.dev);
-		if (igt_warn_on_f(IS_HASWELL(devid) || IS_BROADWELL(devid),
-		    "Manually enabling audio PM to work around a kernel WARN\n"))
-			igt_pm_enable_audio_runtime_pm();
-	}
-
 	driver_unbind(dev);
 
 	initiate_device_reset(dev);
@@ -257,7 +288,7 @@ static void unbind_reset_rebind(struct device_fds *dev)
 
 igt_main
 {
-	struct device_fds dev = { .fds = {-1, -1, -1}, .dev_bus_addr = {0}};
+	struct device_fds dev = { .fds = {-1, -1, -1}, .dev_bus_addr = {0}, };
 
 	igt_fixture {
 		char dev_path[PATH_MAX];
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 19/23] tests/core_hotunplug: Unload snd driver before i915 unbind
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (16 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 18/23] tests/device_reset: Unload snd driver before i915 unbind venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 20/23] tests/kms_force_connector_basic: Skip prune stale mode venkata.sai.patnana
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Kai Vehmanen

From: Uma Shankar <uma.shankar@intel.com>

Unload the snd module before unbinding i915. Audio holds a wakeref
which triggers a warning otherwise, resulting in below warning and
test failure. Currently HSW/BDW and DG1 are the platforms affected,
can be extended to other platforms as well.

<4> [137.001006] ------------[ cut here ]------------
<4> [137.001010] i915 0000:00:02.0: i915 raw-wakerefs=1 wakelocks=1 on cleanup
<4> [137.001076] WARNING: CPU: 0 PID: 1417 at drivers/gpu/drm/i915/intel_runtime_pm.c:619 intel_runtime_pm_driver_release+0x56/0x60 [i915]
<4> [137.001078] Modules linked in: snd_hda_intel i915 snd_hda_codec_hdmi mei_hdcp intel_pmt_telemetry intel_pmt_core x86_pkg_temp_thermal coretemp smsc75xx crct10dif_pclmul usbnet crc32_pclmul mii ghash_clmulni_intel kvm_intel e1000e snd_intel_dspcfg snd_hda_codec snd_hwdep snd_hda_core ptp pps_core mei_me snd_pcm mei prime_numbers intel_pmt [last unloaded: i915]
<4> [137.001095] CPU: 0 PID: 1417 Comm: kworker/u16:7 Tainted: G U 5.9.0-g79478e23b1878-DII_3204+ #1
<4> [137.001097] Hardware name: Intel Corporation Tiger Lake Client Platform/TigerLake U DDR4 SODIMM RVP, BIOS TGLSFWI1.R00.3197.A00.2005110542 05/11/2020
<4> [137.001102] Workqueue: events_unbound async_run_entry_fn
<4> [137.001140] RIP: 0010:intel_runtime_pm_driver_release+0x56/0x60 [i915]
<4> [137.001142] Code: fd 10 4c 8b 67 50 4d 85 e4 75 03 4c 8b 27 e8 91 59 58 e1 45 89 e8 89 e9 4c 89 e2 48 89 c6 48 c7 c7 b0 f3 48 a0 e8 55 25 ef e0 <0f> 0b eb b5 66 0f 1f 44 00 00 48 8b 87 88 45 ff ff b9 02 00 00 00
<4> [137.001144] RSP: 0018:ffffc900007dbd68 EFLAGS: 00010286
<4> [137.001147] RAX: 0000000000000000 RBX: ffff88847338bea8 RCX: 0000000000000001
<4> [137.001148] RDX: 0000000080000001 RSI: ffffffff823efa86 RDI: 00000000ffffffff
<4> [137.001150] RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000001
<4> [137.001152] R10: 000000009bda34df R11: 00000000e2a8a89a R12: ffff88849b209880
<4> [137.001153] R13: 0000000000000001 R14: ffff88847338bea8 R15: ffff88847338fcc0
<4> [137.001155] FS: 0000000000000000(0000) GS:ffff8884a0600000(0000) knlGS:0000000000000000
<4> [137.001157] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
<4> [137.001159] CR2: 00007fc03597dd88 CR3: 0000000006610005 CR4: 0000000000770ef0
<4> [137.001160] PKRU: 55555554
<4> [137.001162] Call Trace:
<4> [137.001199] i915_drm_suspend_late+0x102/0x120 [i915]
<4> [137.001204] ? pci_pm_poweroff_late+0x30/0x30
<4> [137.001209] dpm_run_callback+0x61/0x270
<4> [137.001214] __device_suspend_late+0x8b/0x180
<4> [137.001217] async_suspend_late+0x15/0x90
<4> [137.001220] async_run_entry_fn+0x34/0x160
<4> [137.001224] process_one_work+0x26c/0x5c0
<4> [137.001231] worker_thread+0x37/0x380
<4> [137.001235] ? process_one_work+0x5c0/0x5c0
<4> [137.001238] kthread+0x149/0x170
<4> [137.001241] ? kthread_park+0x80/0x80
<4> [137.001246] ret_from_fork+0x1f/0x30
<4> [137.001256] irq event stamp: 2329

v2: Extended the WA to HSW/BDW, added an igt warning on unload to keep
visibility on the issue as suggested by Janusz

v3: Merged the revert of earlier WA within this patch and added
a flag to track the WA, as suggested by Janusz.

Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 tests/core_hotunplug.c | 53 +++++++++++++++++++++++++++++++-----------
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index a639cfb4b4..878efcc7bf 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <signal.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
@@ -53,6 +54,7 @@ struct hotunplug {
 	const char *failure;
 	bool need_healthcheck;
 	bool has_intel_perf;
+	bool snd_unload;
 };
 
 /* Helpers */
@@ -138,6 +140,34 @@ static void prepare(struct hotunplug *priv)
 static void driver_unbind(struct hotunplug *priv, const char *prefix,
 			  int timeout)
 {
+	/**
+	 * FIXME: Unbinding the i915 driver on affected platforms with
+	 * audio results in a kernel WARN on "i915 raw-wakerefs=1
+	 * wakelocks=1 on cleanup". The below CI friendly user level
+	 * workaround to unload and de-couple audio from IGT testing,
+	 * prevents the warning from appearing. Drop this hack as soon
+	 * as this is fixed in the kernel. unbind/re-bind validation
+	 * on audio side is not robust and we could have potential
+	 * failures blocking display CI, currently this seems to the
+	 * safest and easiest way out.
+	 */
+	if (priv->snd_unload) {
+		igt_terminate_process(SIGTERM, "alsactl");
+
+		/* unbind snd_hda_intel */
+		kick_snd_hda_intel();
+
+		if (igt_kmod_unload("snd_hda_intel", 0)) {
+			priv->snd_unload = false;
+			igt_warn("Could not unload snd_hda_intel\n");
+			igt_kmod_list_loaded();
+			igt_lsof("/dev/snd");
+			igt_skip("Audio is in use, skipping\n");
+		} else {
+			igt_warn("Preventively unloaded snd_hda_intel\n");
+		}
+	}
+
 	local_debug("%sunbinding the driver from the device\n", prefix);
 	priv->failure = "Driver unbind failure!";
 
@@ -166,6 +196,9 @@ static void driver_bind(struct hotunplug *priv, int timeout)
 	igt_fail_on_f(faccessat(priv->fd.sysfs_drv, priv->dev_bus_addr,
 				F_OK, 0),
 		      "Rebound device not present!\n");
+
+	if (priv->snd_unload)
+		igt_kmod_load("snd_hda_intel", NULL);
 }
 
 /* Remove (virtually unplug) the device from its bus */
@@ -574,6 +607,7 @@ igt_main
 		.failure	= NULL,
 		.need_healthcheck = true,
 		.has_intel_perf = false,
+		.snd_unload	= false,
 	};
 
 	igt_fixture {
@@ -585,23 +619,16 @@ igt_main
 		if (is_i915_device(fd_drm)) {
 			uint32_t devid = intel_get_drm_devid(fd_drm);
 
+			if ((IS_HASWELL(devid) || IS_BROADWELL(devid) ||
+			     IS_DG1(devid)) && (igt_kmod_is_loaded("snd_hda_intel"))) {
+				igt_debug("Enable WA to unload snd driver\n");
+				priv.snd_unload = true;
+			}
+
 			gem_quiescent_gpu(fd_drm);
 			igt_require_gem(fd_drm);
 
 			priv.has_intel_perf = local_i915_perf_healthcheck(fd_drm);
-
-			/**
-			 * FIXME: Unbinding the i915 driver on some Haswell
-			 * platforms with Azalia audio results in a kernel WARN
-			 * on "i915 raw-wakerefs=1 wakelocks=1 on cleanup".  The
-			 * below CI friendly user level workaround prevents the
-			 * warning from appearing.  Drop this hack as soon as
-			 * this is fixed in the kernel.
-			 */
-			if (igt_warn_on_f(IS_HASWELL(devid) ||
-					  IS_BROADWELL(devid),
-			    "Manually enabling audio PM to work around a kernel WARN\n"))
-				igt_pm_enable_audio_runtime_pm();
 		}
 
 		/* Make sure subtests always reopen the same device */
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 20/23] tests/kms_force_connector_basic: Skip prune stale mode
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (17 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 19/23] tests/core_hotunplug: " venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 21/23] tests/kms: Create buffer object from LMEM for discrete venkata.sai.patnana
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Mohammed Khajapasha, Petri Latvala

From: Mohammed Khajapasha <mohammed.khajapasha@intel.com>

Skip prune stale mode test when 1400x1050 mode is not set
in mode list for pruning. Some platforms have PLL programming
restrictions that will force the driver to prune modes
using less-common link rates.

Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Mohammed Khajapasha <mohammed.khajapasha@intel.com>
---
 tests/kms_force_connector_basic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_force_connector_basic.c b/tests/kms_force_connector_basic.c
index a79cad03ab..3b0146fe97 100644
--- a/tests/kms_force_connector_basic.c
+++ b/tests/kms_force_connector_basic.c
@@ -316,7 +316,7 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
 			    temp->modes[i].vdisplay == 1050)
 				break;
 		}
-		igt_assert_f(i != temp->count_modes, "1400x1050 not on mode list\n");
+		igt_require_f(i != temp->count_modes, "1400x1050 not on mode list\n");
 
 		drmModeFreeConnector(temp);
 
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 21/23] tests/kms: Create buffer object from LMEM for discrete
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (18 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 20/23] tests/kms_force_connector_basic: Skip prune stale mode venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 22/23] tests/kms_addfb_basic: Add invalid buffer object test " venkata.sai.patnana
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Mohammed Khajapasha

From: Mohammed Khajapasha <mohammed.khajapasha@intel.com>

Create framebuffer object from lmem for discrete file descriptor
The framebuffer backing object should be from local memory for discrete.

v1: Allocate framebuffer objects from lmem for discrete
v2: Removed duplication code <Ruhl, Michael J>
v3: correction in parameter passing
v4: Moved gem_buffer_create() to lib,
    updated kms_getfb with gem_buffer_create() fn
v5: rename gem_buffer_create() to
    gem_buffer_create_fb_obj (Ruhl Michael J, Petri)

Cc: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mohammed Khajapasha <mohammed.khajapasha@intel.com>
---
 lib/ioctl_wrappers.c | 22 ++++++++++++++++++++++
 lib/ioctl_wrappers.h |  1 +
 tests/kms_big_fb.c   |  7 ++++---
 tests/kms_getfb.c    |  2 +-
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 0c1b5e3230..274ab0a3e5 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -593,6 +593,28 @@ void gem_sync(int fd, uint32_t handle)
 	errno = 0;
 }
 
+/**
+ * gem_buffer_create_fb_obj:
+ * @fd: open i915 drm file descriptor
+ * @size: desired size of the buffer
+ *
+ * This wraps the GEM_CREATE ioctl, which allocates a new gem buffer object of
+ * @size from file descriptor specific region
+ *
+ * Returns: The file-private handle of the created buffer object
+ */
+uint32_t gem_buffer_create_fb_obj(int fd, uint64_t size)
+{
+	uint32_t handle;
+
+	if (gem_has_lmem(fd))
+		handle = gem_create_in_memory_regions(fd, size, REGION_LMEM(0));
+	else
+		handle = gem_create(fd, size);
+
+	return handle;
+}
+
 /**
  * __gem_execbuf:
  * @fd: open i915 drm file descriptor
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 36640e302f..a8274a3f48 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -79,6 +79,7 @@ int __gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write);
 void gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write);
 int gem_wait(int fd, uint32_t handle, int64_t *timeout_ns);
 void gem_sync(int fd, uint32_t handle);
+uint32_t gem_buffer_create_fb_obj(int fd, uint64_t size);
 void gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf);
 int __gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf);
 void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf);
diff --git a/tests/kms_big_fb.c b/tests/kms_big_fb.c
index b35727a09b..039a62d1d9 100644
--- a/tests/kms_big_fb.c
+++ b/tests/kms_big_fb.c
@@ -470,7 +470,8 @@ test_size_overflow(data_t *data)
 	igt_require(data->max_fb_width >= 16383 &&
 		    data->max_fb_height >= 16383);
 
-	bo = gem_create(data->drm_fd, (1ULL << 32) - 4096);
+	bo = gem_buffer_create_fb_obj(data->drm_fd, (1ULL << 32) - 4096);
+
 	igt_require(bo);
 
 	ret = __kms_addfb(data->drm_fd, bo,
@@ -508,7 +509,7 @@ test_size_offset_overflow(data_t *data)
 					       DRM_FORMAT_NV12,
 					       data->modifier));
 
-	bo = gem_create(data->drm_fd, (1ULL << 32) - 4096);
+	bo = gem_buffer_create_fb_obj(data->drm_fd, (1ULL << 32) - 4096);
 	igt_require(bo);
 
 	offsets[0] = 0;
@@ -567,7 +568,7 @@ test_addfb(data_t *data)
 			 format, data->modifier,
 			 &size, &strides[0]);
 
-	bo = gem_create(data->drm_fd, size);
+	bo = gem_buffer_create_fb_obj(data->drm_fd, size);
 	igt_require(bo);
 
 	if (intel_gen(data->devid) < 4)
diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c
index 917b57bb98..8b6c4c1caa 100644
--- a/tests/kms_getfb.c
+++ b/tests/kms_getfb.c
@@ -128,7 +128,7 @@ static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret)
 		size += add.pitches[1] * ALIGN(ALIGN(add.height, 16) / 16, 32);
 	}
 
-	add.handles[0] = gem_create(fd, size);
+	add.handles[0] = gem_buffer_create_fb_obj(fd, size);
 	igt_require(add.handles[0] != 0);
 	add.handles[1] = add.handles[0];
 
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 22/23] tests/kms_addfb_basic: Add invalid buffer object test for discrete
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (19 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 21/23] tests/kms: Create buffer object from LMEM for discrete venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 23/23] tests/kms_dp_dsc: Read the debugfs only once venkata.sai.patnana
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Mohammed Khajapasha, Petri, Latvala

From: Mohammed Khajapasha <mohammed.khajapasha@intel.com>

Add invalid buffer object test case for discrete, to validate
IOCTL_MODE_ADDFB2 ioctl for LMEM, the framebuffer backing
gem objects should be from local memory for discrete.

v1: Add invalid-bo test case for LMEM framebuffer object
v2: Correcting error value comparing
v3: Addressed review comments <Petri>
v4: Using do_ioctl_err() for addfb2 ioctl <Petri>
v5: Addressed review comments <Modem, Bhanuprakash>
v6: Using size to allocate buffer object
v7: Updated error check value for testcase

Cc: Latvala, Petri <petri.latvala@intel.com>
Cc: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mohammed Khajapasha <mohammed.khajapasha@intel.com>
---
 tests/kms_addfb_basic.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 1fb18d668f..c2afa0703e 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -40,6 +40,7 @@
 
 #include "igt_rand.h"
 #include "igt_device.h"
+#include "i915/intel_memory_region.h"
 
 uint32_t gem_bo;
 uint32_t gem_bo_small;
@@ -146,6 +147,21 @@ static void invalid_tests(int fd)
 		igt_assert(f.modifier[0] == 0);
 	}
 
+	igt_subtest("invalid-smem-bo-on-discrete") {
+		int devid;
+		uint32_t handle, stride;
+		uint64_t size;
+
+		igt_require_intel(fd);
+		devid = intel_get_drm_devid(fd);
+		igt_require(HAS_LMEM(devid));
+		igt_calc_fb_size(fd, f.width, f.height,
+				DRM_FORMAT_XRGB8888, 0, &size, &stride);
+		handle = gem_create_in_memory_regions(fd, size, REGION_SMEM);
+		f.handles[0] = handle;
+		do_ioctl_err(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f, EREMOTE);
+	}
+
 	igt_describe("Check if addfb2 call works for legacy formats");
 	igt_subtest("legacy-format") {
 		struct {
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH v2 i-g-t 23/23] tests/kms_dp_dsc: Read the debugfs only once
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (20 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 22/23] tests/kms_addfb_basic: Add invalid buffer object test " venkata.sai.patnana
@ 2021-06-03 14:40 ` venkata.sai.patnana
  2021-06-03 15:20 ` [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [v2,i-g-t,01/23] lib/igt_kms: Add plane color mgmt properties Patchwork
  2021-06-03 15:25 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork
  23 siblings, 0 replies; 26+ messages in thread
From: venkata.sai.patnana @ 2021-06-03 14:40 UTC (permalink / raw)
  To: igt-dev

From: Patnana Venkata Sai <venkata.sai.patnana@intel.com>

Instead of doing a debugfs_simple_read and then
a debugfs_read(), lets read the debugfs node just once.
We anyway get the suitable return from the following
strstr operation

v2: using igt_debugfs_simple_read instead igt_debugfs_read (karthik)
v3: using igt_debugfs_read to instead igt_debugfs_simple_read

Signed-off-by: Patnana Venkata Sai <venkata.sai.patnana@intel.com>
Cc: Karthik B S <karthik.b.s@intel.com>
Cc: Vandita Kulkarni <vandita.kulkarni@intel.com>
Cc: Navare Manasi D <manasi.d.navare@intel.com>
---
 tests/kms_dp_dsc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/kms_dp_dsc.c b/tests/kms_dp_dsc.c
index 2446fd82bb..8bd2102447 100644
--- a/tests/kms_dp_dsc.c
+++ b/tests/kms_dp_dsc.c
@@ -80,8 +80,6 @@ static bool is_dp_dsc_supported(data_t *data)
 
 	strcpy(file_name, data->conn_name);
 	strcat(file_name, "/i915_dsc_fec_support");
-	igt_require(igt_debugfs_simple_read(data->debugfs_fd, file_name, buf,
-					    sizeof(buf)) > 0);
 	igt_debugfs_read(data->drm_fd, file_name, buf);
 
 	return strstr(buf, "DSC_Sink_Support: yes");
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [v2,i-g-t,01/23] lib/igt_kms: Add plane color mgmt properties
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (21 preceding siblings ...)
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 23/23] tests/kms_dp_dsc: Read the debugfs only once venkata.sai.patnana
@ 2021-06-03 15:20 ` Patchwork
  2021-06-03 15:25 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork
  23 siblings, 0 replies; 26+ messages in thread
From: Patchwork @ 2021-06-03 15:20 UTC (permalink / raw)
  To: venkata.sai.patnana; +Cc: igt-dev

== Series Details ==

Series: series starting with [v2,i-g-t,01/23] lib/igt_kms: Add plane color mgmt properties
URL   : https://patchwork.freedesktop.org/series/90945/
State : failure

== Summary ==

IGT patchset build failed on latest successful build
1fbc1e7d602f96a7f4e2b95057eef994656b8e74 i915/gem_exec_schedule: Check for timeslicing

[93/810] Linking target lib/tests/igt_fork.
[94/810] Linking target lib/tests/igt_list_only.
[95/810] Linking target lib/tests/igt_invalid_subtest_name.
[96/810] Linking target lib/tests/igt_no_exit.
[97/810] Linking target lib/tests/igt_nesting.
[98/810] Linking target lib/tests/igt_segfault.
[99/810] Linking target lib/tests/igt_simulation.
[100/810] Linking target lib/tests/igt_stats.
[101/810] Linking target lib/tests/igt_subtest_group.
[102/810] Linking target lib/tests/igt_thread.
[103/810] Linking target lib/tests/i915_perf_data_alignment.
[104/810] Linking target lib/tests/igt_audio.
[105/810] Linking target lib/tests/igt_no_subtest.
[106/810] Linking target lib/tests/igt_simple_test_subtests.
[107/810] Linking target tests/core_getstats.
[108/810] Linking target lib/tests/igt_timeout.
[109/810] Linking target tests/core_auth.
[110/810] Linking target tests/core_getclient.
[111/810] Linking target tests/core_getversion.
[112/810] Linking target tests/core_setmaster.
[113/810] Linking target tests/core_setmaster_vs_auth.
[114/810] Linking target tests/dmabuf.
[115/810] Linking target tests/debugfs_test.
[116/810] Linking target tests/drm_mm.
[117/810] Linking target tests/device_reset.
[118/810] Linking target tests/drm_import_export.
[119/810] Linking target tests/fbdev.
[120/810] Linking target tests/feature_discovery.
[121/810] Linking target tests/drm_read.
[122/810] Compiling C object 'tests/tests@@kms_addfb_basic@exe/kms_addfb_basic.c.o'.
FAILED: tests/tests@@kms_addfb_basic@exe/kms_addfb_basic.c.o 
ccache cc -Itests/tests@@kms_addfb_basic@exe -Itests -I../tests -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/x86_64-linux-gnu -I/usr/include/alsa -I/usr/include -I/home/cidrm/kernel_headers/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread  -MD -MQ 'tests/tests@@kms_addfb_basic@exe/kms_addfb_basic.c.o' -MF 'tests/tests@@kms_addfb_basic@exe/kms_addfb_basic.c.o.d' -o 'tests/tests@@kms_addfb_basic@exe/kms_addfb_basic.c.o' -c ../tests/kms_addfb_basic.c
In file included from ../lib/drmtest.h:39,
                 from ../lib/igt.h:27,
                 from ../tests/kms_addfb_basic.c:28:
../tests/kms_addfb_basic.c: In function ‘invalid_tests’:
../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function ‘HAS_LMEM’; did you mean ‘HAS_LPT’? [-Werror=implicit-function-declaration]
   igt_require(HAS_LMEM(devid));
               ^~~~~~~~
../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
  if (!(expr)) igt_skip_check(#expr , NULL); \
        ^~~~
../tests/kms_addfb_basic.c:157:15: warning: nested extern declaration of ‘HAS_LMEM’ [-Wnested-externs]
   igt_require(HAS_LMEM(devid));
               ^~~~~~~~
../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
  if (!(expr)) igt_skip_check(#expr , NULL); \
        ^~~~
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.


_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [v2,i-g-t,01/23] lib/igt_kms: Add plane color mgmt properties
  2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
                   ` (22 preceding siblings ...)
  2021-06-03 15:20 ` [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [v2,i-g-t,01/23] lib/igt_kms: Add plane color mgmt properties Patchwork
@ 2021-06-03 15:25 ` Patchwork
  23 siblings, 0 replies; 26+ messages in thread
From: Patchwork @ 2021-06-03 15:25 UTC (permalink / raw)
  To: venkata.sai.patnana; +Cc: igt-dev

== Series Details ==

Series: series starting with [v2,i-g-t,01/23] lib/igt_kms: Add plane color mgmt properties
URL   : https://patchwork.freedesktop.org/series/90945/
State : warning

== Summary ==

Pipeline status: FAILED.

see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/331807 for the overview.

build:tests-debian-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/10435679):
  ../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function ‘HAS_LMEM’; did you mean ‘HAS_LPT’? [-Werror=implicit-function-declaration]
     igt_require(HAS_LMEM(devid));
                 ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    if (!(expr)) igt_skip_check(#expr , NULL); \
          ^~~~
  ../tests/kms_addfb_basic.c:157:15: warning: nested extern declaration of ‘HAS_LMEM’ [-Wnested-externs]
     igt_require(HAS_LMEM(devid));
                 ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    if (!(expr)) igt_skip_check(#expr , NULL); \
          ^~~~
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1622733694:step_script
  section_start:1622733694:cleanup_file_variables
  Cleaning up file based variables
  section_end:1622733695:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-debian-meson-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/10435682):
  ../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function ‘HAS_LMEM’; did you mean ‘HAS_LPT’? [-Werror=implicit-function-declaration]
     igt_require(HAS_LMEM(devid));
                 ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    if (!(expr)) igt_skip_check(#expr , NULL); \
          ^~~~
  ../tests/kms_addfb_basic.c:157:15: warning: nested extern declaration of ‘HAS_LMEM’ [-Wnested-externs]
     igt_require(HAS_LMEM(devid));
                 ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    if (!(expr)) igt_skip_check(#expr , NULL); \
          ^~~~
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1622733694:step_script
  section_start:1622733694:cleanup_file_variables
  Cleaning up file based variables
  section_end:1622733696:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-debian-meson-armhf has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/10435681):
  ../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function ‘HAS_LMEM’; did you mean ‘HAS_LPT’? [-Werror=implicit-function-declaration]
     igt_require(HAS_LMEM(devid));
                 ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    if (!(expr)) igt_skip_check(#expr , NULL); \
          ^~~~
  ../tests/kms_addfb_basic.c:157:15: warning: nested extern declaration of ‘HAS_LMEM’ [-Wnested-externs]
     igt_require(HAS_LMEM(devid));
                 ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    if (!(expr)) igt_skip_check(#expr , NULL); \
          ^~~~
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1622733688:step_script
  section_start:1622733688:cleanup_file_variables
  Cleaning up file based variables
  section_end:1622733689:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-debian-meson-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/10435683):
  ../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function ‘HAS_LMEM’; did you mean ‘HAS_LPT’? [-Werror=implicit-function-declaration]
     igt_require(HAS_LMEM(devid));
                 ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    if (!(expr)) igt_skip_check(#expr , NULL); \
          ^~~~
  ../tests/kms_addfb_basic.c:157:15: warning: nested extern declaration of ‘HAS_LMEM’ [-Wnested-externs]
     igt_require(HAS_LMEM(devid));
                 ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    if (!(expr)) igt_skip_check(#expr , NULL); \
          ^~~~
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1622733700:step_script
  section_start:1622733700:cleanup_file_variables
  Cleaning up file based variables
  section_end:1622733701:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/10435674):
  ../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function ‘HAS_LMEM’ [-Werror=implicit-function-declaration]
    157 |   igt_require(HAS_LMEM(devid));
        |               ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    987 |  if (!(expr)) igt_skip_check(#expr , NULL); \
        |        ^~~~
  ../tests/kms_addfb_basic.c:157:15: warning: nested extern declaration of ‘HAS_LMEM’ [-Wnested-externs]
    157 |   igt_require(HAS_LMEM(devid));
        |               ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    987 |  if (!(expr)) igt_skip_check(#expr , NULL); \
        |        ^~~~
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1622733775:step_script
  section_start:1622733775:cleanup_file_variables
  Cleaning up file based variables
  section_end:1622733776:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/10435678):
  [235/945] Linking target tests/device_reset.
  [236/945] Linking target tests/drm_import_export.
  [237/945] Linking target tests/drm_mm.
  [238/945] Linking target tests/drm_read.
  [239/945] Linking target tests/fbdev.
  [240/945] Linking target tests/feature_discovery.
  [241/945] Compiling C object 'tests/59830eb@@kms_addfb_basic@exe/kms_addfb_basic.c.o'.
  FAILED: tests/59830eb@@kms_addfb_basic@exe/kms_addfb_basic.c.o 
  clang -Itests/59830eb@@kms_addfb_basic@exe -Itests -I../tests -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/valgrind -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/59830eb@@kms_addfb_basic@exe/kms_addfb_basic.c.o' -MF 'tests/59830eb@@kms_addfb_basic@exe/kms_addfb_basic.c.o.d' -o 'tests/59830eb@@kms_addfb_basic@exe/kms_addfb_basic.c.o' -c ../tests/kms_addfb_basic.c
  ../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function 'HAS_LMEM' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                  igt_require(HAS_LMEM(devid));
                              ^
  1 error generated.
  ninja: build stopped: subcommand failed.
  section_end:1622733775:step_script
  section_start:1622733775:cleanup_file_variables
  Cleaning up file based variables
  section_end:1622733776:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora-no-libdrm-nouveau has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/10435677):
  ../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function ‘HAS_LMEM’ [-Werror=implicit-function-declaration]
    157 |   igt_require(HAS_LMEM(devid));
        |               ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    987 |  if (!(expr)) igt_skip_check(#expr , NULL); \
        |        ^~~~
  ../tests/kms_addfb_basic.c:157:15: warning: nested extern declaration of ‘HAS_LMEM’ [-Wnested-externs]
    157 |   igt_require(HAS_LMEM(devid));
        |               ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    987 |  if (!(expr)) igt_skip_check(#expr , NULL); \
        |        ^~~~
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1622733730:step_script
  section_start:1622733730:cleanup_file_variables
  Cleaning up file based variables
  section_end:1622733731:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora-no-libunwind has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/10435675):
  ../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function ‘HAS_LMEM’ [-Werror=implicit-function-declaration]
    157 |   igt_require(HAS_LMEM(devid));
        |               ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    987 |  if (!(expr)) igt_skip_check(#expr , NULL); \
        |        ^~~~
  ../tests/kms_addfb_basic.c:157:15: warning: nested extern declaration of ‘HAS_LMEM’ [-Wnested-externs]
    157 |   igt_require(HAS_LMEM(devid));
        |               ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    987 |  if (!(expr)) igt_skip_check(#expr , NULL); \
        |        ^~~~
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1622733755:step_script
  section_start:1622733755:cleanup_file_variables
  Cleaning up file based variables
  section_end:1622733757:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora-oldest-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/10435676):
  ../tests/kms_addfb_basic.c:157:15: error: implicit declaration of function ‘HAS_LMEM’ [-Werror=implicit-function-declaration]
    157 |   igt_require(HAS_LMEM(devid));
        |               ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    987 |  if (!(expr)) igt_skip_check(#expr , NULL); \
        |        ^~~~
  ../tests/kms_addfb_basic.c:157:15: warning: nested extern declaration of ‘HAS_LMEM’ [-Wnested-externs]
    157 |   igt_require(HAS_LMEM(devid));
        |               ^~~~~~~~
  ../lib/igt_core.h:987:8: note: in definition of macro ‘igt_require’
    987 |  if (!(expr)) igt_skip_check(#expr , NULL); \
        |        ^~~~
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1622733700:step_script
  section_start:1622733700:cleanup_file_variables
  Cleaning up file based variables
  section_end:1622733701:cleanup_file_variables
  ERROR: Job failed: exit code 1

== Logs ==

For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/331807
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH v2 i-g-t 14/23] tests/kms_color_chamelium: Optimize plane ctm test
  2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 14/23] tests/kms_color_chamelium: " venkata.sai.patnana
@ 2021-06-04  5:01   ` Modem, Bhanuprakash
  0 siblings, 0 replies; 26+ messages in thread
From: Modem, Bhanuprakash @ 2021-06-04  5:01 UTC (permalink / raw)
  To: Patnana, Venkata Sai, igt-dev; +Cc: Joshi, Kunal1

> From: Patnana, Venkata Sai <venkata.sai.patnana@intel.com>
> Sent: Thursday, June 3, 2021 8:10 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Patnana, Venkata Sai <venkata.sai.patnana@intel.com>; Joshi, Kunal1
> <kunal1.joshi@intel.com>; Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Subject: [PATCH v2 i-g-t 14/23] tests/kms_color_chamelium: Optimize plane ctm
> test
> 
> From: Kunal Joshi <kunal1.joshi@intel.com>
> 
> Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
> ---
>  tests/kms_color_chamelium.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
> index 38c7169737..52eef8a66f 100644
> --- a/tests/kms_color_chamelium.c
> +++ b/tests/kms_color_chamelium.c
> @@ -1265,6 +1265,8 @@ static void run_plane_ctm_test(data_t *data,
>  			result |= test_plane_ctm(data, plane,
>  					red_green_blue,	expected,
>  					ctm);
> +			if (result)
> +				break;

I think we need to squash this commit to 
[v2,i-g-t] tests/kms_color: New subtests for Plane CTM
and add Kunal's Signed-off-by

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

>  		}
> 
>  		igt_assert(result);
> --
> 2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2021-06-04  5:01 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 14:40 [igt-dev] [PATCH v2 i-g-t 01/23] lib/igt_kms: Add plane color mgmt properties venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 02/23] kms_color_helper: Add helper functions for plane color mgmt venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 03/23] tests/kms_color: New subtests for Plane gamma venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 04/23] tests/kms_color: New subtests for Plane degamma venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 05/23] tests/kms_color: New subtests for Plane CTM venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 06/23] tests/kms_color_chamelium: New subtests for Plane gamma venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 07/23] tests/kms_color_chamelium: New subtests for Plane degamma venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 08/23] tests/kms_color_chamelium: New subtests for Plane CTM venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 09/23] lib/igt_kms: Add pipe color mgmt properties venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 10/23] kms_color_helper: Add helper functions to support logarithmic gamma mode venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 11/23] tests/kms_color: Extended IGT tests " venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 12/23] tests/kms_color_chamelium: " venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 13/23] tests/kms_color: Optimize plane ctm test venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 14/23] tests/kms_color_chamelium: " venkata.sai.patnana
2021-06-04  5:01   ` Modem, Bhanuprakash
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 15/23] tests/kms_dither: New IGT to validate crtc Dithering venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 16/23] tests/kms_dither: Validate dither after CC blocks venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 17/23] tests/kms_dither: Dont assert if debugfs is not present venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 18/23] tests/device_reset: Unload snd driver before i915 unbind venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 19/23] tests/core_hotunplug: " venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 20/23] tests/kms_force_connector_basic: Skip prune stale mode venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 21/23] tests/kms: Create buffer object from LMEM for discrete venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 22/23] tests/kms_addfb_basic: Add invalid buffer object test " venkata.sai.patnana
2021-06-03 14:40 ` [igt-dev] [PATCH v2 i-g-t 23/23] tests/kms_dp_dsc: Read the debugfs only once venkata.sai.patnana
2021-06-03 15:20 ` [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [v2,i-g-t,01/23] lib/igt_kms: Add plane color mgmt properties Patchwork
2021-06-03 15:25 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.