Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ander Conselvan De Oliveira <conselvan2@gmail.com>
To: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t] kms_cursor_crc: Add a subtest with a 256x256 gradient cursor
Date: Fri, 10 Mar 2017 12:27:58 +0200	[thread overview]
Message-ID: <1489141678.2413.1.camel@gmail.com> (raw)
In-Reply-To: <20170310101835.29845-2-ander.conselvan.de.oliveira@intel.com>

On Fri, 2017-03-10 at 12:18 +0200, Ander Conselvan de Oliveira wrote:
> Some of the kms_cursor_crc subtests where failing on Geminilake. The
> root cause was an error on programming the pre-CSC gamma tables, which
> led to small rounding errors that, although not sufficient to change the
> image as captured at 8bpc with the Chamelium, were enough to generate a
> different CRC. It is not clear why the rounding is different when the
> cursor is enabled, but this was caught by chance, since the cursor would
> only be exercised with limited color combinations.
> 
> To improve coverage, add a test that uses a gradient covering all
> possible 8bit values for a channel.
> 
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> ---
>  tests/kms_cursor_crc.c | 42 ++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 38 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> index 4851e18..0b232bf 100644
> --- a/tests/kms_cursor_crc.c
> +++ b/tests/kms_cursor_crc.c
> @@ -87,6 +87,8 @@ static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
>  	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, 1.0);
>  }
>  
> +typedef void(*draw_cursor_cb)(cairo_t *cr, int x, int y, int cw, int ch);
> +
>  static void cursor_enable(data_t *data)
>  {
>  	igt_output_t *output = data->output;
> @@ -107,7 +109,8 @@ static void cursor_disable(data_t *data)
>  }
>  
>  
> -static void do_single_test(data_t *data, int x, int y)
> +static void do_single_test_with_cursor_cb(data_t *data, int x, int y,
> +					  draw_cursor_cb cursor_cb)
>  {
>  	igt_display_t *display = &data->display;
>  	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
> @@ -151,7 +154,7 @@ static void do_single_test(data_t *data, int x, int y)
>  	igt_display_commit(display);
>  
>  	/* Now render the same in software and collect crc */
> -	draw_cursor(cr, x, y, data->curw, data->curh);
> +	cursor_cb(cr, x, y, data->curw, data->curh);
>  	igt_display_commit(display);
>  
>  	igt_wait_for_vblank(data->drm_fd, data->pipe);
> @@ -162,6 +165,11 @@ static void do_single_test(data_t *data, int x, int y)
>  	igt_paint_color(cr, 0, 0, data->screenw, data->screenh, 0.0, 0.0, 0.0);
>  }
>  
> +static void do_single_test(data_t *data, int x, int y)
> +{
> +	do_single_test_with_cursor_cb(data, x, y, draw_cursor);
> +}
> +
>  static void do_fail_test(data_t *data, int x, int y, int expect)
>  {
>  	igt_display_t *display = &data->display;
> @@ -386,7 +394,8 @@ static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int
>  	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
>  }
>  
> -static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
> +static void create_cursor_fb_with_cb(data_t *data, int cur_w, int cur_h,
> +				     draw_cursor_cb cursor_cb)
>  {
>  	cairo_t *cr;
>  	uint32_t fb_id;
> @@ -406,10 +415,15 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
>  	igt_assert(fb_id);
>  
>  	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
> -	draw_cursor(cr, 0, 0, cur_w, cur_h);
> +	cursor_cb(cr, 0, 0, cur_w, cur_h);
>  	igt_assert(cairo_status(cr) == 0);
>  }
>  
> +static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
> +{
> +	create_cursor_fb_with_cb(data, cur_w, cur_h, draw_cursor);
> +}
> +
>  static bool has_nonsquare_cursors(uint32_t devid)
>  {
>  	/*
> @@ -506,6 +520,23 @@ static void test_rapid_movement(data_t *data)
>  
>  }
>  
> +static void draw_cursor_gradient(cairo_t *cr, int x, int y, int cw, int ch)
> +{
> +	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
> +	igt_paint_color_gradient(cr, x, y, cw, ch, 1.0, 1.0, 1.0);
> +}
> +
> +static void test_cursor_colors(data_t *data)
> +{
> +	int cursor_w = data->curw;
> +	int cursor_h = data->curh;
> +
> +	create_cursor_fb_with_cb(data, cursor_w, cursor_h,
> +				 draw_cursor_gradient);
> +	do_single_test_with_cursor_cb(data, 0, 0, draw_cursor_gradient);
> +	igt_remove_fb(data->drm_fd, &data->fb);
> +}
> +
>  static void run_test_generic(data_t *data)
>  {
>  	int cursor_size;
> @@ -613,6 +644,9 @@ igt_main
>  	igt_subtest_f("cursor-size-change")
>  		run_test(&data, test_cursor_size, cursor_width, cursor_height);
>  
> +	igt_subtest_f("gradient-cursor")

Just realized this needs an igt_require(max_cursor_[wh] >= 256).

Ander

> +		run_test(&data, test_cursor_colors, 256, 256);
> +
>  	run_test_generic(&data);
>  
>  	igt_fixture {
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-03-10 10:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 10:18 [PATCH] drm/i915/glk: Improve rounding caused by pre-CSC gamma tables Ander Conselvan de Oliveira
2017-03-10 10:18 ` [PATCH i-g-t] kms_cursor_crc: Add a subtest with a 256x256 gradient cursor Ander Conselvan de Oliveira
2017-03-10 10:27   ` Ander Conselvan De Oliveira [this message]
2017-03-14 14:24     ` Ander Conselvan De Oliveira
2017-03-10 12:48 ` [PATCH] drm/i915/glk: Improve rounding caused by pre-CSC gamma tables Ville Syrjälä
2017-03-10 13:18 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-03-14 14:23   ` Ander Conselvan De Oliveira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1489141678.2413.1.camel@gmail.com \
    --to=conselvan2@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox