From: Antti Koskipaa <antti.koskipaa@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t] kms_cursor_crc: Test cursor size change ioctl
Date: Mon, 2 Jun 2014 13:43:18 +0300 [thread overview]
Message-ID: <1401705798-2340-1-git-send-email-antti.koskipaa@linux.intel.com> (raw)
Now that we support cursor changes other than 64x64, a bug was found
where the size change was only applied at cursor enable time, rather
than at every update. Add a testcase for that.
Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
---
tests/kms_cursor_crc.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 06625ee..1b8da26 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -54,6 +54,7 @@ typedef struct {
int left, right, top, bottom;
int screenw, screenh;
int curw, curh; /* cursor size */
+ int cursor_max_size;
igt_pipe_crc_t *pipe_crc;
} test_data_t;
@@ -272,6 +273,7 @@ static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
test_data->screenh = mode->vdisplay;
test_data->curw = cursor_w;
test_data->curh = cursor_h;
+ test_data->cursor_max_size = cursor_w;
/* make sure cursor is disabled */
cursor_disable(test_data);
@@ -354,6 +356,56 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
igt_assert(cairo_status(cr) == 0);
}
+static void test_cursor_size(test_data_t *test_data)
+{
+ data_t *data = test_data->data;
+ igt_display_t *display = &data->display;
+ igt_pipe_crc_t *pipe_crc = test_data->pipe_crc;
+ igt_crc_t crc[10], ref_crc;
+ igt_plane_t *cursor;
+ cairo_t *cr;
+ uint32_t fb_id;
+ int i, size, cursor_max_size = test_data->cursor_max_size;
+
+ /* Create a maximum size cursor, then change the size in flight to
+ * smaller ones to see that the size is applied correctly
+ */
+ fb_id = igt_create_fb(data->drm_fd, cursor_max_size, cursor_max_size,
+ DRM_FORMAT_ARGB8888, false, &data->fb);
+ igt_assert(fb_id);
+
+ /* Use a solid white rectangle as the cursor */
+ cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
+ igt_paint_color_alpha(cr, 0, 0, cursor_max_size, cursor_max_size, 1.0, 1.0, 1.0, 1.0);
+
+ /* Hardware test loop */
+ cursor_enable(test_data);
+ cursor = igt_output_get_plane(test_data->output, IGT_PLANE_CURSOR);
+ igt_plane_set_position(cursor, 0, 0);
+ for (i = 0, size = cursor_max_size; size >= 64; size /= 2, i++) {
+ /* Change size in flight: */
+ int ret = drmModeSetCursor(data->drm_fd, test_data->output->config.crtc->crtc_id,
+ data->fb.gem_handle, size, size);
+ igt_assert(ret == 0);
+ igt_wait_for_vblank(data->drm_fd, test_data->pipe);
+ igt_pipe_crc_collect_crc(pipe_crc, &crc[i]);
+ }
+ cursor_disable(test_data);
+ /* Software test loop */
+ cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
+ for (i = 0, size = cursor_max_size; size >= 64; size /= 2, i++) {
+ /* Now render the same in software and collect crc */
+ igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0);
+ igt_display_commit(display);
+ igt_wait_for_vblank(data->drm_fd, test_data->pipe);
+ igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
+ /* Clear screen afterwards */
+ igt_paint_color(cr, 0, 0, test_data->screenw, test_data->screenh,
+ 0.0, 0.0, 0.0);
+ igt_assert(igt_crc_equal(&crc[i], &ref_crc));
+ }
+}
+
static void run_test_generic(data_t *data, int cursor_max_size)
{
int cursor_size;
@@ -407,6 +459,9 @@ igt_main
igt_display_init(&data.display, data.drm_fd);
}
+ igt_subtest_f("cursor-size-change")
+ run_test(&data, test_cursor_size, cursor_width, cursor_height);
+
run_test_generic(&data, cursor_width);
igt_fixture {
--
1.8.3.2
next reply other threads:[~2014-06-02 10:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 10:43 Antti Koskipaa [this message]
2014-06-02 15:53 ` [PATCH i-g-t] kms_cursor_crc: Test cursor size change ioctl Daniel Vetter
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=1401705798-2340-1-git-send-email-antti.koskipaa@linux.intel.com \
--to=antti.koskipaa@linux.intel.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