[igt-dev] [PATCH i-g-t] tests/kms_plane: Make sure the crcs aren't all equal

Ser, Simon simon.ser at intel.com
Wed Jun 12 15:38:11 UTC 2019


On Thu, 2019-05-02 at 23:06 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Make sure there is at least one unique crc among the set of
> reference crcs. This avoids the test succeeding when the plane
> is never even on, as happened with SDR planes on icl after
> I fumbled switchhing the pipe HDR and non-HDR modes.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

This patch LGTM.

Reviewed-by: SImon Ser <simon.ser at intel.com>

> ---
>  tests/kms_plane.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index 471bcbeb8f77..29a768d7830c 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -448,6 +448,25 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
>  	igt_remove_fb(data->drm_fd, &old_fb);
>  }
>  
> +static int num_unique_crcs(const igt_crc_t crc[], int num_crc)
> +{
> +	int num_unique_crc = 0;
> +
> +	for (int i = 0; i < num_crc; i++) {
> +		int j;
> +
> +		for (j = i + 1; j < num_crc; j++) {
> +			if (igt_check_crc_equal(&crc[i], &crc[j]))
> +				break;
> +		}
> +
> +		if (j == num_crc)
> +			num_unique_crc++;
> +	}
> +
> +	return num_unique_crc;
> +}
> +
>  static bool test_format_plane(data_t *data, enum pipe pipe,
>  			      igt_output_t *output, igt_plane_t *plane)
>  {
> @@ -520,6 +539,13 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
>  					i, &ref_crc[i], &fb);
>  	}
>  
> +	/*
> +	 * Make sure we have some difference between the colors. This
> +	 * at least avoids claiming success when everything is just
> +	 * black all the time (eg. if the plane is never even on).
> +	 */
> +	igt_require(num_unique_crcs(ref_crc, ARRAY_SIZE(colors)) > 1);
> +
>  	for (int i = 0; i < plane->format_mod_count; i++) {
>  		int crc_mismatch_count = 0;
>  		int crc_mismatch_mask = 0;


More information about the igt-dev mailing list