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

Eric Anholt eric at anholt.net
Thu Aug 9 21:28:12 UTC 2018


Maxime Ripard <maxime.ripard at bootlin.com> writes:

> 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.
>
> 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);

Instead of asserting, should we pick the first if there was no
preferred?  I don't really know, so I'd ack the patch either way.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20180809/a741aac6/attachment-0001.sig>


More information about the igt-dev mailing list