From: Mamta Shukla <mamtashukla555@gmail.com>
To: igt-dev@lists.freedesktop.org, hwentland@gmail.com,
manasi.d.navare@intel.com, petri.latvala@intel.com,
arkadiusz.hiler@intel.com
Subject: [igt-dev] [PATCH i-g-t, v2] tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane
Date: Thu, 10 Jan 2019 03:02:39 +0530 [thread overview]
Message-ID: <20190109213239.GA4470@armorer> (raw)
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>
---
changes in v2:
1.Remove unnecessary new line.
2.Add functions to clear screen in test_cursor_alpha function.
tests/kms_cursor_crc.c | 80 ++++++++++++++++++++++++++++++++++++++----
1 file changed, 73 insertions(+), 7 deletions(-)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 1514e7f2..8c1ecc2b 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,64 @@ 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);
+ 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);
+
+ /*Clear Screen*/
+ cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
+ igt_paint_color(cr, 0, 0, data->screenw, data->screenh,
+ 0.0, 0.0, 0.0);
+ igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
+ igt_remove_fb(data->drm_fd, &data->fb);
+}
+
+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 +519,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 +742,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 reply other threads:[~2019-01-09 21:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-09 21:32 Mamta Shukla [this message]
2019-01-09 21:58 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane (rev2) Patchwork
2019-01-09 23:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-01-12 22:56 ` [igt-dev] [PATCH i-g-t, v2] tests/kms_cursor_crc: Add test to check extreme alpha values for cursor plane Harry Wentland
2019-01-12 23:00 ` Wentland, Harry
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=20190109213239.GA4470@armorer \
--to=mamtashukla555@gmail.com \
--cc=arkadiusz.hiler@intel.com \
--cc=hwentland@gmail.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=manasi.d.navare@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.