[igt-dev] [PATCH i-g-t] tests/kms_cursor: use safe values for test image to avoid rounding errors

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Nov 14 15:17:55 UTC 2019


On Fri, Nov 08, 2019 at 04:24:42PM +0200, Juha-Pekka Heikkila wrote:
> instead of 0.5 use 1.0 for white color, this is due to bit replication
> effect.

I tested this on a glk here using the 10bit gamma LUT and 8bit pixel
format, and both primary and cursor 0.5 (ie. 0x80) ended up in the
same LUT entry (0x202). So it appears they both replicate the MSBs
in the LSBs when extending the precision from 8bit to whatever the
pipe uses internally. So my theory that they'd do it differently
doesn't really hold water. Which means it's still a total mystery
why this doesn't work with 0.5.

> Also set cairo to use same blending mode as what HW uses.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  tests/kms_cursor_crc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> index d0fb8f1..0125122 100644
> --- a/tests/kms_cursor_crc.c
> +++ b/tests/kms_cursor_crc.c
> @@ -78,12 +78,13 @@ static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
>  	/* Cairo doesn't like to be fed numbers that are too wild */
>  	if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y > SHRT_MAX))
>  		return;
> +	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
>  	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
>  	/* 4 color rectangles in the corners, RGBY */
>  	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
>  	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
>  	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
> -	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, a);
> +	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 1.0, 1.0, 1.0, a);
>  }
>  
>  static void cursor_enable(data_t *data)
> -- 
> 2.7.4
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel


More information about the igt-dev mailing list