[igt-dev] [PATCH i-g-t 03/25] tests/kms_plane: Add validate-in-formats subtest

Paulo Zanoni paulo.r.zanoni at intel.com
Thu Sep 20 21:10:15 UTC 2018


Em Qui, 2018-07-19 às 18:03 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Cross check the format list in the IN_FORMATS blob vs. the
> format list returned by getplane.

Bikeshed: unnecessary braces on the j loops.

By the way, this test won't break if you follow my suggestion from
patch 01 of populating plane->formats while leaving plane->modifiers
NULL.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>

> 
> Cc: Ulrich Hecht <ulrich.hecht+renesas at gmail.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  tests/kms_plane.c | 50
> ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index f9e123f0d1ea..e0625748186f 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -366,6 +366,53 @@ test_plane_panning(data_t *data, enum pipe pipe,
> unsigned int flags)
>  	igt_skip_on(connected_outs == 0);
>  }
>  
> +static void validate_plane_in_formats(igt_plane_t *plane)
> +{
> +	drmModePlanePtr drm_plane = plane->drm_plane;
> +
> +	igt_require(plane->format_mod_count);
> +
> +	/*
> +	 * Make sure every format in the IN_FORMATS blob
> +	 * also appears in the getplane formats.
> +	 */
> +	for (int i = 0; i < plane->format_mod_count; i++) {
> +		int j;
> +
> +		for (j = 0; j < drm_plane->count_formats; j++) {
> +			if (plane->formats[i] == drm_plane-
> >formats[j])
> +				break;
> +		}
> +		igt_assert_lt(j, drm_plane->count_formats);
> +	}
> +
> +	/*
> +	 * Make sure every format in getplane also
> +	 * appears in the IN_FORMATS blob.
> +	 */
> +	for (int i = 0; i < drm_plane->count_formats; i++) {
> +		int j;
> +
> +		for (j = 0; j < plane->format_mod_count; j++) {
> +			if (drm_plane->formats[i] == plane-
> >formats[j])
> +				break;
> +		}
> +		igt_assert_lt(j, plane->format_mod_count);
> +	}
> +}
> +
> +static void validate_in_formats(data_t *data)
> +{
> +	enum pipe pipe;
> +
> +	for_each_pipe(&data->display, pipe) {
> +		igt_plane_t *plane;
> +
> +		for_each_plane_on_pipe(&data->display, pipe, plane)
> +			validate_plane_in_formats(plane);
> +	}
> +}
> +
>  static const color_t colors[] = {
>  	{ 1.0f, 0.0f, 0.0f, },
>  	{ 0.0f, 1.0f, 0.0f, },
> @@ -592,6 +639,9 @@ igt_main
>  		igt_display_init(&data.display, data.drm_fd);
>  	}
>  
> +	igt_subtest_f("validate-in-formats")
> +		validate_in_formats(&data);
> +
>  	for_each_pipe_static(pipe)
>  		run_tests_for_pipe_plane(&data, pipe);
>  


More information about the igt-dev mailing list