[igt-dev] [i-g-t V2 2/8] Revert "tests/kms: Fix to use max_bpc constraint helper"

Bhanuprakash Modem bhanuprakash.modem at intel.com
Thu Sep 22 05:11:36 UTC 2022


This reverts commit a37df4b538ae7b5bb1bb47be4804b4787410325d.
---
 tests/kms_color.c  | 24 +++++++++++++++++++++++-
 tests/kms_dither.c | 25 ++++++++++++++++++++++++-
 tests/kms_hdr.c    | 44 +++++++++++++++++++++++++++++---------------
 3 files changed, 76 insertions(+), 17 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index c202547e..8c15c7be 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -660,6 +660,28 @@ static void test_pipe_limited_range_ctm(data_t *data,
 }
 #endif
 
+static bool i915_clock_constraint(data_t *data, enum pipe pipe, int bpc)
+{
+	igt_output_t *output = data->output;
+	drmModeConnector *connector = output->config.connector;
+
+	igt_sort_connector_modes(connector, sort_drm_modes_by_clk_dsc);
+
+	for_each_connector_mode(output) {
+		igt_output_override_mode(output, &connector->modes[j__]);
+		igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+
+		if (!igt_check_output_bpc_equal(data->drm_fd, pipe,
+						data->output->name, bpc))
+			continue;
+
+		return true;
+	}
+
+	igt_output_override_mode(output, NULL);
+	return false;
+}
+
 static void
 prep_pipe(data_t *data, enum pipe p)
 {
@@ -823,7 +845,7 @@ run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
 		igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 
 		if (is_i915_device(data->drm_fd) &&
-		    !igt_max_bpc_constraint(&data->display, p, output, 10))
+		    !i915_clock_constraint(data, p, 10))
 			continue;
 
 		data->color_depth = 10;
diff --git a/tests/kms_dither.c b/tests/kms_dither.c
index 43a25e20..3a44e797 100644
--- a/tests/kms_dither.c
+++ b/tests/kms_dither.c
@@ -97,6 +97,29 @@ static dither_status_t get_dither_state(data_t *data, enum pipe pipe)
 	return status;
 }
 
+static bool i915_clock_constraint(data_t *data, enum pipe pipe,
+				  igt_output_t *output, int bpc)
+{
+	drmModeConnector *connector = output->config.connector;
+	igt_display_t *display = &data->display;
+
+	igt_sort_connector_modes(connector, sort_drm_modes_by_clk_dsc);
+
+	for_each_connector_mode(output) {
+		igt_output_override_mode(output, &connector->modes[j__]);
+		igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+
+		if (!igt_check_output_bpc_equal(data->drm_fd, pipe,
+						output->name, bpc))
+			continue;
+
+		return true;
+	}
+
+	igt_output_override_mode(output, NULL);
+	return false;
+}
+
 static void test_dithering(data_t *data, enum pipe pipe,
 			   igt_output_t *output,
 			   int fb_bpc, int fb_format,
@@ -129,7 +152,7 @@ static void test_dithering(data_t *data, enum pipe pipe,
 	if (ret)
 		goto cleanup;
 
-	constraint = igt_max_bpc_constraint(display, pipe, output, output_bpc);
+	constraint = i915_clock_constraint(data, pipe, output, output_bpc);
 	if (!constraint)
 		goto cleanup;
 
diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
index e2650f51..6790f26f 100644
--- a/tests/kms_hdr.c
+++ b/tests/kms_hdr.c
@@ -130,7 +130,6 @@ static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
 					  INTEL_PIPE_CRC_SOURCE_AUTO);
 
 	igt_output_set_pipe(data->output, data->pipe_id);
-	igt_output_set_prop_value(data->output, IGT_CONNECTOR_MAX_BPC, 10);
 
 	data->w = data->mode->hdisplay;
 	data->h = data->mode->vdisplay;
@@ -205,6 +204,33 @@ static bool has_max_bpc(igt_output_t *output)
 	       igt_output_get_prop(output, IGT_CONNECTOR_MAX_BPC);
 }
 
+static bool i915_clock_constraint(data_t *data, int bpc)
+{
+	igt_output_t *output = data->output;
+	drmModeConnector *connector = output->config.connector;
+
+	igt_output_set_prop_value(data->output, IGT_CONNECTOR_MAX_BPC, bpc);
+	igt_sort_connector_modes(connector, sort_drm_modes_by_clk_dsc);
+
+	for_each_connector_mode(output) {
+		igt_output_override_mode(output, &connector->modes[j__]);
+		igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+
+		if (!igt_check_output_bpc_equal(data->fd, data->pipe_id,
+						data->output->name, bpc))
+			continue;
+
+		data->mode = igt_output_get_mode(output);
+		data->w = data->mode->hdisplay;
+		data->h = data->mode->vdisplay;
+
+		return true;
+	}
+
+	test_fini(data);
+	return false;
+}
+
 static void test_bpc_switch(data_t *data, uint32_t flags)
 {
 	igt_display_t *display = &data->display;
@@ -224,14 +250,8 @@ static void test_bpc_switch(data_t *data, uint32_t flags)
 				prepare_test(data, output, pipe);
 
 				if (is_i915_device(data->fd) &&
-				    !igt_max_bpc_constraint(display, pipe, output, 10)) {
-					test_fini(data);
+				    !i915_clock_constraint(data, 10))
 					break;
-				}
-
-				data->mode = igt_output_get_mode(output);
-				data->w = data->mode->hdisplay;
-				data->h = data->mode->vdisplay;
 
 				igt_dynamic_f("pipe-%s-%s",
 					      kmstest_pipe_name(pipe), output->name)
@@ -550,14 +570,8 @@ static void test_hdr(data_t *data, uint32_t flags)
 				prepare_test(data, output, pipe);
 
 				if (is_i915_device(data->fd) &&
-				    !igt_max_bpc_constraint(display, pipe, output, 10)) {
-					test_fini(data);
+				    !i915_clock_constraint(data, 10))
 					break;
-				}
-
-				data->mode = igt_output_get_mode(output);
-				data->w = data->mode->hdisplay;
-				data->h = data->mode->vdisplay;
 
 				igt_dynamic_f("pipe-%s-%s",
 					      kmstest_pipe_name(pipe), output->name) {
-- 
2.37.3



More information about the igt-dev mailing list