[PATCH i-g-t] tests/kms_color: Move dynamic subtests even further out

Shankar, Uma uma.shankar at intel.com
Fri Oct 25 05:20:44 UTC 2024



> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Ville Syrjala
> Sent: Wednesday, October 16, 2024 6:13 PM
> To: igt-dev at lists.freedesktop.org
> Subject: [PATCH i-g-t] tests/kms_color: Move dynamic subtests even further out
> 
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> In order to run this on older Intel based laptops we have to make it work for cases
> where we have just pipe B driving the single LVDS output. Currently the test just
> skips because it tries pipe A first which won't have a connected output. Move the
> output selection further out to remedy this.
> 
> I thought I already fixed this once with commit 766edf96979b
> ("tests/kms_color: Move dynamic subtests up one level") but it clearly isn't
> working now. Either I failed there or this has regreressed again due to some other
> changes.

Looks Good to me.
Reviewed-by: Uma Shankar <uma.shankar at intel.com>

> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  tests/kms_color.c | 78 +++++++++++++++++++++++------------------------
>  1 file changed, 38 insertions(+), 40 deletions(-)
> 
> diff --git a/tests/kms_color.c b/tests/kms_color.c index
> 5f0128bcad9e..d642f561df76 100644
> --- a/tests/kms_color.c
> +++ b/tests/kms_color.c
> @@ -787,12 +787,10 @@ run_gamma_degamma_tests_for_pipe(data_t *data,
> enum pipe p,
>  	data->drm_format = DRM_FORMAT_XRGB8888;
>  	data->mode = igt_output_get_mode(data->output);
> 
> -	if (!pipe_output_combo_valid(data, p))
> -		goto out;
> +	igt_require(pipe_output_combo_valid(data, p));
> +
> +	igt_assert(test_t(data, data->primary));
> 
> -	igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(p),
> igt_output_name(data->output))
> -		igt_assert(test_t(data, data->primary));
> -out:
>  	test_cleanup(data);
>  }
> 
> @@ -826,40 +824,36 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
>  	data->drm_format = DRM_FORMAT_XRGB8888;
>  	data->mode = igt_output_get_mode(data->output);
> 
> -	if (!pipe_output_combo_valid(data, p))
> -		goto out;
> +	igt_require(pipe_output_combo_valid(data, p));
> 
>  	if (!iter)
>  		iter = 1;
> 
> -	igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(p),
> igt_output_name(data->output)) {
> -		/*
> -		 * 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.
> -		 */
> -		for (i = 0; i < iter; i++) {
> -			color_t expected_colors[3] = {
> -				fb_colors[0],
> -				fb_colors[1],
> -				fb_colors[2],
> -			};
> -
> -			transform_color(&expected_colors[0], ctm, delta * (i -
> (iter / 2)));
> -			transform_color(&expected_colors[1], ctm, delta * (i -
> (iter / 2)));
> -			transform_color(&expected_colors[2], ctm, delta * (i -
> (iter / 2)));
> -
> -			if (test_pipe_ctm(data, data->primary, fb_colors,
> -					  expected_colors, ctm)) {
> -				success = true;
> -				break;
> -			}
> +	/*
> +	 * 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.
> +	 */
> +	for (i = 0; i < iter; i++) {
> +		color_t expected_colors[3] = {
> +			fb_colors[0],
> +			fb_colors[1],
> +			fb_colors[2],
> +		};
> +
> +		transform_color(&expected_colors[0], ctm, delta * (i - (iter / 2)));
> +		transform_color(&expected_colors[1], ctm, delta * (i - (iter / 2)));
> +		transform_color(&expected_colors[2], ctm, delta * (i - (iter / 2)));
> +
> +		if (test_pipe_ctm(data, data->primary, fb_colors,
> +				  expected_colors, ctm)) {
> +			success = true;
> +			break;
>  		}
> -		igt_assert(success);
>  	}
> +	igt_assert(success);
> 
> -out:
>  	test_cleanup(data);
>  }
> 
> @@ -1143,9 +1137,11 @@ run_tests_for_pipe(data_t *data)
>  	for (i = 0; i < ARRAY_SIZE(gamma_degamma_tests); i++) {
>  		igt_describe_f("%s", gamma_degamma_tests[i].desc);
>  		igt_subtest_with_dynamic_f("%s",
> gamma_degamma_tests[i].name) {
> -			for_each_pipe(&data->display, pipe) {
> -				run_gamma_degamma_tests_for_pipe(data,
> pipe,
> -
> gamma_degamma_tests[i].test_t);
> +			for_each_pipe_with_valid_output(&data->display, pipe,
> data->output) {
> +				igt_dynamic_f("pipe-%s-%s",
> kmstest_pipe_name(pipe),
> +					      igt_output_name(data->output))
> +
> 	run_gamma_degamma_tests_for_pipe(data, pipe,
> +
> gamma_degamma_tests[i].test_t);
>  			}
>  		}
>  	}
> @@ -1153,11 +1149,13 @@ run_tests_for_pipe(data_t *data)
>  	for (i = 0; i < ARRAY_SIZE(ctm_tests); i++) {
>  		igt_describe_f("%s", ctm_tests[i].desc);
>  		igt_subtest_with_dynamic_f("%s", ctm_tests[i].name) {
> -			for_each_pipe(&data->display, pipe) {
> -				run_ctm_tests_for_pipe(data, pipe,
> -						       ctm_tests[i].fb_colors,
> -						       ctm_tests[i].ctm,
> -						       ctm_tests[i].iter);
> +			for_each_pipe_with_valid_output(&data->display, pipe,
> data->output) {
> +				igt_dynamic_f("pipe-%s-%s",
> kmstest_pipe_name(pipe),
> +					      igt_output_name(data->output))
> +					run_ctm_tests_for_pipe(data, pipe,
> +
> ctm_tests[i].fb_colors,
> +							       ctm_tests[i].ctm,
> +							       ctm_tests[i].iter);
>  			}
>  		}
>  	}
> --
> 2.45.2



More information about the igt-dev mailing list