[V2 i-g-t 5/6] tests/kms_color: Skip if current & requested BPC doesn't match

Bhanuprakash Modem bhanuprakash.modem at intel.com
Tue May 31 09:09:40 UTC 2022


The "max bpc" property only ensures that the bpc will not go beyond
the value set through this property. It does not guarantee that the
same bpc will be used for the given mode.

If clock/bandwidth constraints permit, the max bpc will be used to
show the mode, otherwise the bpc will be reduced. So, if we really
want a particular bpc set, we can try reducing the resolution, till
we get the bpc that we set in max bpc property.

This patch will skip the test, if there is no valid resolution to get
the same bpc as set by max_bpc property.

V2:
* Refactor the logic
V3:
* Minor changes

Cc: Swati Sharma <swati2.sharma at intel.com>
CC: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_color.c | 60 +++++++++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 26 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 7915f001..f6d9841c 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -640,6 +640,29 @@ 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);
+	igt_output_set_prop_value(data->output, IGT_CONNECTOR_MAX_BPC, 10);
+
+	for_each_connector_mode(output) {
+		igt_output_override_mode(output, &connector->modes[j__]);
+		igt_display_commit(&data->display);
+
+		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)
 {
@@ -680,6 +703,7 @@ static void test_setup(data_t *data, enum pipe p)
 	igt_require(data->output);
 
 	igt_display_reset(&data->display);
+	igt_output_set_prop_value(data->output, IGT_CONNECTOR_MAX_BPC, 10);
 }
 
 static void test_cleanup(data_t *data)
@@ -774,10 +798,7 @@ run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
 				"At least GEN 11 is required to validate Deep-color.\n");
 
 	for_each_valid_output_on_pipe(&data->display, p, output) {
-		uint64_t max_bpc = get_max_bpc(output);
-		bool ret;
-
-		if (!max_bpc)
+		if (!get_max_bpc(output))
 			continue;
 
 		if (!panel_supports_deep_color(data->drm_fd, output->name))
@@ -787,36 +808,23 @@ run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
 		data->drm_format = DRM_FORMAT_XRGB2101010;
 		data->output = output;
 
-		igt_dynamic_f("pipe-%s-%s-gamma", kmstest_pipe_name(p), output->name) {
-			test_setup(data, p);
-			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, 10);
-
-			ret = test_pipe_gamma(data, data->primary);
+		test_setup(data, p);
+		if (is_i915_device(data->drm_fd) &&
+		    !i915_clock_constraint(data, p, 10))
+			continue;
 
-			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, max_bpc);
-			igt_assert(ret);
+		igt_dynamic_f("pipe-%s-%s-gamma", kmstest_pipe_name(p), output->name) {
+			igt_assert(test_pipe_gamma(data, data->primary));
 		}
 
 		igt_dynamic_f("pipe-%s-%s-degamma", kmstest_pipe_name(p), output->name) {
-			test_setup(data, p);
-			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, 10);
-
-			ret = test_pipe_degamma(data, data->primary);
-
-			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, max_bpc);
-			igt_assert(ret);
+			igt_assert(test_pipe_degamma(data, data->primary));
 		}
 
 		igt_dynamic_f("pipe-%s-%s-ctm", kmstest_pipe_name(p), output->name) {
-			test_setup(data, p);
-			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, 10);
-
-			ret = test_pipe_ctm(data, data->primary,
+			igt_assert(test_pipe_ctm(data, data->primary,
 					    red_green_blue,
-					    blue_green_blue, ctm);
-
-			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, max_bpc);
-			igt_assert(ret);
+					    blue_green_blue, ctm));
 		}
 
 		break;
-- 
2.35.1



More information about the Intel-gfx-trybot mailing list