[igt-dev] [PATCH v4 08/13] chamelium: Use preferred mode when testing a single mode

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Aug 23 15:17:48 UTC 2018


On Thu, Jul 26, 2018 at 12:42:07PM +0200, Maxime Ripard wrote:
> The current code is testing the first mode in the connector list when it's
> testing a single mode. While this is arbitrarily chosen, it makes more
> sense to use the preferred mode reported by the display.

The kernel sorts modes such that preferred modes appear before
non-preferred modes.

> 
> Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
> ---
>  tests/kms_chamelium.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
> index 490bacc6f5fe..5d7fb83fb74f 100644
> --- a/tests/kms_chamelium.c
> +++ b/tests/kms_chamelium.c
> @@ -534,6 +534,20 @@ static void do_test_display_crc(data_t *data, struct chamelium_port *port,
>  	igt_remove_fb(data->drm_fd, &fb);
>  }
>  
> +static drmModeModeInfo *find_preferred_mode(drmModeConnector *connector)
> +{
> +	int i;
> +
> +	for (i = 0; i < connector->count_modes; i++) {
> +		drmModeModeInfo *mode = &connector->modes[i];
> +
> +		if (mode->type & DRM_MODE_TYPE_PREFERRED)
> +			return mode;
> +	}
> +
> +	return NULL;
> +}
> +
>  static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
>  				      int count)
>  {
> @@ -549,7 +563,10 @@ static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
>  	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>  	igt_assert(primary);
>  
> -	do_test_display_crc(data, port, output, &connector->modes[0], count);
> +	mode = find_preferred_mode(connector);
> +	igt_assert(mode);
> +
> +	do_test_display_crc(data, port, output, mode, count);
>  
>  	drmModeFreeConnector(connector);
>  }
> -- 
> git-series 0.9.1

-- 
Ville Syrjälä
Intel


More information about the igt-dev mailing list