[igt-dev] [PATCH i-g-t 3/4] tests/kms_plane: fix rounding error

Kahola, Mika mika.kahola at intel.com
Fri Jun 18 08:19:40 UTC 2021


> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Juha-
> Pekka Heikkila
> Sent: Tuesday, June 15, 2021 7:00 PM
> To: igt-dev at lists.freedesktop.org
> Subject: [igt-dev] [PATCH i-g-t 3/4] tests/kms_plane: fix rounding error
> 
> On some screen sizes with legacy hw there was possible to get rounding
> error on source clamping test which would incorrectly fail clamping tests.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>

Looks solid.

Reviewed-by: Mika Kahola <mika.kahola at intel.com>

> ---
>  tests/kms_plane.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c index
> ba419bbde..f22c045d8 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -473,12 +473,19 @@ static void draw_entire_color_array(data_t *data,
> cairo_t *cr, uint32_t format,
>  	const int color_amount = ARRAY_SIZE(colors_extended);
>  	const int x = format == DRM_FORMAT_XRGB8888 ? 0 : data->crop;
> 
> +	if (format != DRM_FORMAT_XRGB8888) {
> +		cairo_rectangle(cr, data->crop, data->crop,
> +				fb->width - data->crop * 2,
> +				fb->height - data->crop * 2);
> +	}
> +
> +
>  	for (int n = 0; n < color_amount; n++) {
>  		int y = (fb->height - x * 2) * n / color_amount + x;
> 
>  		igt_paint_color(cr, x, y,
>  				fb->width - x * 2,
> -				(fb->height - x * 2) / color_amount,
> +				(fb->height - x * 2) / color_amount + 1,
>  				colors_extended[n].red,
>  				colors_extended[n].green,
>  				colors_extended[n].blue);
> --
> 2.28.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list