From: Manasi Navare <manasi.d.navare@intel.com>
To: Mamta Shukla <mamtashukla555@gmail.com>
Cc: igt-dev@lists.freedesktop.org, hwentland@gmail.com,
petri.latvala@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane
Date: Mon, 7 Jan 2019 14:11:40 -0800 [thread overview]
Message-ID: <20190107221140.GA23387@intel.com> (raw)
In-Reply-To: <20181224181416.GA2856@armorer>
Overall the functionality looks good, just some minor coding style nits below:
On Mon, Dec 24, 2018 at 11:44:16PM +0530, Mamta Shukla wrote:
> Add test to check extreme alpha values i.e. fully opaque and fully transparent
> for cursor plane and verify by calculating hardware and software CRC.
>
> Signed-off-by: Mamta Shukla <mamtashukla555@gmail.com>
> ---
> tests/kms_cursor_crc.c | 77 ++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 70 insertions(+), 7 deletions(-)
>
> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> index 1514e7f2..7f581ca0 100644
> --- a/tests/kms_cursor_crc.c
> +++ b/tests/kms_cursor_crc.c
> @@ -65,7 +65,7 @@ typedef struct {
> #define TEST_DPMS (1<<0)
> #define TEST_SUSPEND (1<<1)
>
> -static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
> +static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
> {
> int wl, wr, ht, hb;
>
> @@ -80,10 +80,10 @@ static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch)
> return;
> 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, 1.0);
> - igt_paint_color_alpha(cr, x + wl, y, wr, ht, 0.0, 1.0, 0.0, 1.0);
> - igt_paint_color_alpha(cr, x, y + ht, wl, hb, 0.0, 0.0, 1.0, 1.0);
> - igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, 1.0);
> + 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);
> }
>
> static void cursor_enable(data_t *data)
> @@ -200,7 +200,7 @@ static void do_single_test(data_t *data, int x, int y)
>
> /* Now render the same in software and collect crc */
> cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
> - draw_cursor(cr, x, y, data->curw, data->curh);
> + draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
> igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
> igt_display_commit(display);
>
> @@ -404,6 +404,61 @@ static void cleanup_crtc(data_t *data, igt_output_t *output)
> igt_display_commit(display);
> }
>
> +static void test_cursor_alpha(data_t *data, double a)
> +{
> + igt_display_t *display = &data->display;
> + igt_pipe_crc_t *pipe_crc = data->pipe_crc;
> + igt_crc_t crc, ref_crc;
> + cairo_t *cr;
> + uint32_t fb_id;
> + int curw=data->curw;
> + int curh=data->curh;
> +
> + /*alpha cursor fb*/
> + fb_id = igt_create_color_fb(data->drm_fd, curw, curh,
> + DRM_FORMAT_ARGB8888,
> + LOCAL_DRM_FORMAT_MOD_NONE,
> + 1.0, 1.0, 1.0,
> + &data->fb);
> +
Unnecessary new line
> + igt_assert(fb_id);
> +
> + cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
> + draw_cursor(cr, 0, 0, curw, curh, a);
> + igt_put_cairo_ctx(data->drm_fd, &data->fb, cr);
> +
> + /*Hardware Test*/
> + cursor_enable(data);
> + igt_display_commit(display);
> + igt_wait_for_vblank(data->drm_fd, data->pipe);
> + igt_pipe_crc_collect_crc(pipe_crc, &crc);
> + cursor_disable(data);
> +
> + /*Software Test*/
> + cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
> + igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
> + igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
> +
> + igt_display_commit(display);
> + igt_wait_for_vblank(data->drm_fd, data->pipe);
> + igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
> + igt_assert_crc_equal(&crc, &ref_crc);
The other subtest test_cursor_size clears the screen at the end, may be you
should consider doing that as well
> + igt_remove_fb(data->drm_fd, &data->fb);
I think the igt_remove_fb is probably not needed here since the run_test_generic calls
this in igt_fixture at the end.
Please double check if you still need this call.
Apart from this everything else looks good to me.
Regards
Manasi
> +
> +}
> +
> +static void test_cursor_transparent(data_t *data)
> +{
> + test_cursor_alpha(data, 0.0);
> +
> +}
> +
> +static void test_cursor_opaque(data_t *data)
> +{
> + test_cursor_alpha(data, 1.0);
> +}
> +
> +
> static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int cursor_h)
> {
> igt_display_t *display = &data->display;
> @@ -461,7 +516,7 @@ 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);
> + draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
> igt_put_cairo_ctx(data->drm_fd, &data->fb, cr);
> }
>
> @@ -684,6 +739,14 @@ igt_main
> igt_subtest_f("cursor-size-change")
> run_test(&data, test_cursor_size, cursor_width, cursor_height);
>
> + igt_subtest_f("cursor-alpha-opaque") {
> + run_test(&data, test_cursor_opaque, cursor_width, cursor_height);
> + }
> +
> + igt_subtest_f("cursor-alpha-transparent") {
> + run_test(&data, test_cursor_transparent, cursor_width, cursor_height);
> + }
> +
> run_test_generic(&data);
>
> igt_fixture {
> --
> 2.17.1
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-01-07 22:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-24 18:14 [igt-dev] [PATCH i-g-t] tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane Mamta Shukla
2018-12-27 8:16 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-12-27 9:30 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-01-07 22:11 ` Manasi Navare [this message]
2019-01-09 19:04 ` [igt-dev] [PATCH i-g-t] " Mamta Shukla
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=20190107221140.GA23387@intel.com \
--to=manasi.d.navare@intel.com \
--cc=hwentland@gmail.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=mamtashukla555@gmail.com \
--cc=petri.latvala@intel.com \
/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