[igt-dev] [PATCH i-g-t] tests/kms_plane_lowres: Use lowest mode for testing

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Thu May 27 12:20:44 UTC 2021


Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>

On 26.5.2021 13.18, Mika Kahola wrote:
> Search and use the lowest possible mode, when switching resolutions
> from the default to the lowest mode and back.
> 
> While at it, reset display after each subtest run.
> 
> Signed-off-by: Mika Kahola <mika.kahola at intel.com>
> ---
>   tests/kms_plane_lowres.c | 23 ++++++++++-------------
>   1 file changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
> index 43cc4250d..b876162b3 100644
> --- a/tests/kms_plane_lowres.c
> +++ b/tests/kms_plane_lowres.c
> @@ -59,26 +59,21 @@ get_lowres_mode(int drmfd, igt_output_t *output,
>   		const drmModeModeInfo *mode_default)
>   {
>   	const drmModeModeInfo *mode;
> -	bool found = false;
> -	int limit = mode_default->vdisplay - SIZE;
> +	const drmModeModeInfo *min;
>   	int j;
>   
> +        /* search for lowest mode */
> +        min = mode_default;
>   	for (j = 0; j < output->config.connector->count_modes; j++) {
>   		mode = &output->config.connector->modes[j];
> -		if (mode->vdisplay < limit) {
> -			found = true;
> -			break;
> -		}
> +		if (mode->vdisplay < min->vdisplay)
> +			min = mode;
>   	}
>   
> -	if (!found) {
> -		igt_require_f(mode_default->vdisplay - SIZE > 768,
> -			      "Current mode not tall enough; plane would still be onscreen after switch to 10x7.\n");
> +	igt_require_f(mode_default->vdisplay - min->vdisplay > 2 * SIZE,
> +		      "Current mode not tall enough; plane would still be onscreen after switching to lowest mode.\n");
>   
> -		return *igt_std_1024_mode_get();
> -	}
> -
> -	return *mode;
> +	return *min;
>   }
>   
>   static igt_plane_t *first_sdr_plane(igt_output_t *output, uint32_t devid)
> @@ -250,6 +245,8 @@ test_planes_on_pipe_with_output(data_t *data, igt_plane_t *plane, uint64_t modif
>   	igt_remove_fb(data->drm_fd, &data->ref_hires.fb);
>   	igt_remove_fb(data->drm_fd, &data->ref_lowres.fb);
>   
> +	igt_display_reset(&data->display);
> +
>   	return tested;
>   }
>   
> 



More information about the igt-dev mailing list