* [PATCH i-g-t 0/7] kms_cursor_crc enhancements
@ 2014-04-02 11:06 Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 1/7] kms_cursor_crc: Remove some test cases and change cursor to color Antti Koskipaa
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: Antti Koskipaa @ 2014-04-02 11:06 UTC (permalink / raw)
To: intel-gfx
This patch series enhances the cursor test to actually be useful.
The old "black transparent cursor on black background" tests are
replaced with a visible cursor and the framework is changed to
be more flexible and extendable. This way cursor rotation tests
can be added with ease in the future.
Also adds a couple more tests to the current set.
Antti Koskipaa (7):
kms_cursor_crc: Remove some test cases and change cursor to color
kms_cursor_crc: Move cursor enable and disable calls where they belong
kms_cursor_crc: Use a function pointer to call test
kms_cursor_crc: Separate onscreen and offscreen tests
kms_cursor_crc: Add reference software rendering
kms_cursor_crc: Add moving cursor test
kms_cursor_crc: Add random cursor placement test
tests/kms_cursor_crc.c | 248 +++++++++++++++++++++++++++----------------------
1 file changed, 139 insertions(+), 109 deletions(-)
--
1.8.3.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH i-g-t 1/7] kms_cursor_crc: Remove some test cases and change cursor to color
2014-04-02 11:06 [PATCH i-g-t 0/7] kms_cursor_crc enhancements Antti Koskipaa
@ 2014-04-02 11:06 ` Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 2/7] kms_cursor_crc: Move cursor enable and disable calls where they belong Antti Koskipaa
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Antti Koskipaa @ 2014-04-02 11:06 UTC (permalink / raw)
To: intel-gfx
Currently this test is quite useless, since it only checks for valid CRCs when
the correct output from a test is a completely black screen (invisible or visible
but black cursor, or cursor is offscreen) and disables the check when anything
visible is onscreen.
This patch changes the cursor to a colorful one and removes the test cases
that become redundant because of this change. The cursor is designed to be
asymmetrical such that future tests involving rotation, mirroring, etc. produce
different CRCs and failures can be detected.
This (temporarily) disables CRC testing until the next patch which will add
software rendering of the cursor and the CRC generation.
Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
---
tests/kms_cursor_crc.c | 75 +++++++++++++++++++++-----------------------------
1 file changed, 32 insertions(+), 43 deletions(-)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index fbb5d88..52281d0 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -39,19 +39,11 @@
#define DRM_CAP_CURSOR_HEIGHT 0x9
#endif
-enum cursor_type {
- WHITE_VISIBLE,
- WHITE_INVISIBLE,
- BLACK_VISIBLE,
- BLACK_INVISIBLE,
- NUM_CURSOR_TYPES,
-};
-
typedef struct {
int drm_fd;
igt_display_t display;
struct igt_fb primary_fb;
- struct igt_fb fb[NUM_CURSOR_TYPES];
+ struct igt_fb fb;
igt_pipe_crc_t **pipe_crc;
} data_t;
@@ -64,6 +56,16 @@ typedef struct {
int left, right, top, bottom;
} test_data_t;
+static void draw_cursor(cairo_t *cr, int x, int y, int w)
+{
+ w /= 2;
+ cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
+ /* 4 color rectangles in the corners, RGBY */
+ igt_paint_color_alpha(cr, x, y, w, w, 1.0, 0.0, 0.0, 1.0);
+ igt_paint_color_alpha(cr, x + w, y, w, w, 0.0, 1.0, 0.0, 1.0);
+ igt_paint_color_alpha(cr, x, y + w, w, w, 0.0, 0.0, 1.0, 1.0);
+ igt_paint_color_alpha(cr, x + w, y + w, w, w, 0.5, 0.5, 0.5, 1.0);
+}
static igt_pipe_crc_t *create_crc(data_t *data, enum pipe pipe)
{
@@ -104,7 +106,7 @@ static void do_test(test_data_t *test_data,
do_single_test(test_data, left, bottom);
}
-static void cursor_enable(test_data_t *test_data, enum cursor_type cursor_type)
+static void cursor_enable(test_data_t *test_data)
{
data_t *data = test_data->data;
igt_display_t *display = &data->display;
@@ -112,7 +114,7 @@ static void cursor_enable(test_data_t *test_data, enum cursor_type cursor_type)
igt_plane_t *cursor;
cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
- igt_plane_set_fb(cursor, &data->fb[cursor_type]);
+ igt_plane_set_fb(cursor, &data->fb);
igt_display_commit(display);
}
@@ -128,7 +130,7 @@ static void cursor_disable(test_data_t *test_data)
igt_display_commit(display);
}
-static void test_crc(test_data_t *test_data, enum cursor_type cursor_type,
+static void test_crc(test_data_t *test_data,
bool onscreen, int cursor_w, int cursor_h)
{
int left = test_data->left;
@@ -136,11 +138,11 @@ static void test_crc(test_data_t *test_data, enum cursor_type cursor_type,
int top = test_data->top;
int bottom = test_data->bottom;
- cursor_enable(test_data, cursor_type);
+ cursor_enable(test_data);
if (onscreen) {
/* cursor onscreen, crc should match, except when white visible cursor is used */
- test_data->crc_must_match = (cursor_type != WHITE_VISIBLE);
+ test_data->crc_must_match = false;
/* fully inside */
do_test(test_data, left, right, top, bottom);
@@ -156,7 +158,7 @@ static void test_crc(test_data_t *test_data, enum cursor_type cursor_type,
do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
} else {
/* cursor offscreen, crc should always match */
- test_data->crc_must_match = true;
+ test_data->crc_must_match = false;
/* fully outside */
do_test(test_data, left - (cursor_w), right + (cursor_w), top , bottom );
@@ -255,8 +257,7 @@ static void cleanup_crtc(test_data_t *test_data, igt_output_t *output)
igt_output_set_pipe(output, PIPE_ANY);
}
-static void run_test(data_t *data, enum cursor_type cursor_type, bool onscreen,
- int cursor_w, int cursor_h)
+static void run_test(data_t *data, bool onscreen, int cursor_w, int cursor_h)
{
igt_display_t *display = &data->display;
igt_output_t *output;
@@ -280,7 +281,7 @@ static void run_test(data_t *data, enum cursor_type cursor_type, bool onscreen,
igt_subtest_name(), pipe_name(test_data.pipe),
igt_output_name(output));
- test_crc(&test_data, cursor_type, onscreen, cursor_w, cursor_h);
+ test_crc(&test_data, onscreen, cursor_w, cursor_h);
fprintf(stdout, "\n%s on pipe %c, connector %s: PASSED\n\n",
igt_subtest_name(), pipe_name(test_data.pipe),
@@ -294,22 +295,18 @@ static void run_test(data_t *data, enum cursor_type cursor_type, bool onscreen,
igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
}
-static void create_cursor_fb(data_t *data,
- enum cursor_type cursor_type,
- double r, double g, double b, double a,
- int cur_w, int cur_h)
+static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
{
cairo_t *cr;
- uint32_t fb_id[NUM_CURSOR_TYPES];
+ uint32_t fb_id;
- fb_id[cursor_type] = igt_create_fb(data->drm_fd, cur_w, cur_h,
- DRM_FORMAT_ARGB8888, false,
- &data->fb[cursor_type]);
- igt_assert(fb_id[cursor_type]);
+ fb_id = igt_create_fb(data->drm_fd, cur_w, cur_h,
+ DRM_FORMAT_ARGB8888, false,
+ &data->fb);
+ igt_assert(fb_id);
- cr = igt_get_cairo_ctx(data->drm_fd,
- &data->fb[cursor_type]);
- igt_paint_color_alpha(cr, 0, 0, cur_w, cur_h, r, g, b, a);
+ cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
+ draw_cursor(cr, 0, 0, cur_w);
igt_assert(cairo_status(cr) == 0);
}
@@ -322,21 +319,13 @@ static void run_test_generic(data_t *data, int cursor_max_size)
igt_require(cursor_max_size >= cursor_size);
sprintf(c_size, "%d", cursor_size);
- /* Creating cursor framebuffers */
- create_cursor_fb(data, WHITE_VISIBLE, 1.0, 1.0, 1.0, 1.0, cursor_size, cursor_size);
- create_cursor_fb(data, WHITE_INVISIBLE, 1.0, 1.0, 1.0, 0.0, cursor_size, cursor_size);
- create_cursor_fb(data, BLACK_VISIBLE, 0.0, 0.0, 0.0, 1.0, cursor_size, cursor_size);
- create_cursor_fb(data, BLACK_INVISIBLE, 0.0, 0.0, 0.0, 0.0, cursor_size, cursor_size);
+ create_cursor_fb(data, cursor_size, cursor_size);
/* Using created cursor FBs to test cursor support */
- igt_subtest_f("white-visible-cursor-%s-onscreen", c_size)
- run_test(data, WHITE_VISIBLE, true, cursor_size, cursor_size);
- igt_subtest_f("white-invisible-cursor-%s-offscreen", c_size)
- run_test(data, WHITE_INVISIBLE, false, cursor_size, cursor_size);
- igt_subtest_f("black-visible-cursor-%s-onscreen", c_size)
- run_test(data, BLACK_VISIBLE, true, cursor_size, cursor_size);
- igt_subtest_f("black-invisible-cursor-%s-offscreen", c_size)
- run_test(data, BLACK_INVISIBLE, false, cursor_size, cursor_size);
+ igt_subtest_f("cursor-%s-onscreen", c_size)
+ run_test(data, true, cursor_size, cursor_size);
+ igt_subtest_f("cursor-%s-offscreen", c_size)
+ run_test(data, false, cursor_size, cursor_size);
}
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 2/7] kms_cursor_crc: Move cursor enable and disable calls where they belong
2014-04-02 11:06 [PATCH i-g-t 0/7] kms_cursor_crc enhancements Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 1/7] kms_cursor_crc: Remove some test cases and change cursor to color Antti Koskipaa
@ 2014-04-02 11:06 ` Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 3/7] kms_cursor_crc: Use a function pointer to call test Antti Koskipaa
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Antti Koskipaa @ 2014-04-02 11:06 UTC (permalink / raw)
To: intel-gfx
We can't have the hw cursor enabled during software render tests.
Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
---
tests/kms_cursor_crc.c | 54 ++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 28 deletions(-)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 52281d0..8802da6 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -67,6 +67,30 @@ static void draw_cursor(cairo_t *cr, int x, int y, int w)
igt_paint_color_alpha(cr, x + w, y + w, w, w, 0.5, 0.5, 0.5, 1.0);
}
+static void cursor_enable(test_data_t *test_data)
+{
+ data_t *data = test_data->data;
+ igt_display_t *display = &data->display;
+ igt_output_t *output = test_data->output;
+ igt_plane_t *cursor;
+
+ cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+ igt_plane_set_fb(cursor, &data->fb);
+ igt_display_commit(display);
+}
+
+static void cursor_disable(test_data_t *test_data)
+{
+ data_t *data = test_data->data;
+ igt_display_t *display = &data->display;
+ igt_output_t *output = test_data->output;
+ igt_plane_t *cursor;
+
+ cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+ igt_plane_set_fb(cursor, NULL);
+ igt_display_commit(display);
+}
+
static igt_pipe_crc_t *create_crc(data_t *data, enum pipe pipe)
{
igt_pipe_crc_t *crc;
@@ -85,10 +109,12 @@ static void do_single_test(test_data_t *test_data, int x, int y)
printf("."); fflush(stdout);
+ cursor_enable(test_data);
cursor = igt_output_get_plane(test_data->output, IGT_PLANE_CURSOR);
igt_plane_set_position(cursor, x, y);
igt_display_commit(display);
igt_wait_for_vblank(data->drm_fd, test_data->pipe);
+ cursor_disable(test_data);
igt_pipe_crc_collect_crc(pipe_crc, &crc);
if (test_data->crc_must_match)
@@ -106,30 +132,6 @@ static void do_test(test_data_t *test_data,
do_single_test(test_data, left, bottom);
}
-static void cursor_enable(test_data_t *test_data)
-{
- data_t *data = test_data->data;
- igt_display_t *display = &data->display;
- igt_output_t *output = test_data->output;
- igt_plane_t *cursor;
-
- cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
- igt_plane_set_fb(cursor, &data->fb);
- igt_display_commit(display);
-}
-
-static void cursor_disable(test_data_t *test_data)
-{
- data_t *data = test_data->data;
- igt_display_t *display = &data->display;
- igt_output_t *output = test_data->output;
- igt_plane_t *cursor;
-
- cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
- igt_plane_set_fb(cursor, NULL);
- igt_display_commit(display);
-}
-
static void test_crc(test_data_t *test_data,
bool onscreen, int cursor_w, int cursor_h)
{
@@ -138,8 +140,6 @@ static void test_crc(test_data_t *test_data,
int top = test_data->top;
int bottom = test_data->bottom;
- cursor_enable(test_data);
-
if (onscreen) {
/* cursor onscreen, crc should match, except when white visible cursor is used */
test_data->crc_must_match = false;
@@ -183,8 +183,6 @@ static void test_crc(test_data_t *test_data,
/* go nuts */
do_test(test_data, INT_MIN, INT_MAX, INT_MIN, INT_MAX);
}
-
- cursor_disable(test_data);
}
static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 3/7] kms_cursor_crc: Use a function pointer to call test
2014-04-02 11:06 [PATCH i-g-t 0/7] kms_cursor_crc enhancements Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 1/7] kms_cursor_crc: Remove some test cases and change cursor to color Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 2/7] kms_cursor_crc: Move cursor enable and disable calls where they belong Antti Koskipaa
@ 2014-04-02 11:06 ` Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 4/7] kms_cursor_crc: Separate onscreen and offscreen tests Antti Koskipaa
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Antti Koskipaa @ 2014-04-02 11:06 UTC (permalink / raw)
To: intel-gfx
More tests are coming, and this allows us to not repeat the boilerplate
code in run_test() for each subtest.
Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
---
tests/kms_cursor_crc.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 8802da6..60b50b5 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -54,6 +54,7 @@ typedef struct {
igt_crc_t ref_crc;
bool crc_must_match;
int left, right, top, bottom;
+ int curw, curh; /* cursor size */
} test_data_t;
static void draw_cursor(cairo_t *cr, int x, int y, int w)
@@ -133,12 +134,14 @@ static void do_test(test_data_t *test_data,
}
static void test_crc(test_data_t *test_data,
- bool onscreen, int cursor_w, int cursor_h)
+ bool onscreen)
{
int left = test_data->left;
int right = test_data->right;
int top = test_data->top;
int bottom = test_data->bottom;
+ int cursor_w = test_data->curw;
+ int cursor_h = test_data->curh;
if (onscreen) {
/* cursor onscreen, crc should match, except when white visible cursor is used */
@@ -228,6 +231,8 @@ static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
test_data->right = mode->hdisplay - cursor_w;
test_data->top = 0;
test_data->bottom = mode->vdisplay - cursor_h;
+ test_data->curw = cursor_w;
+ test_data->curh = cursor_h;
/* make sure cursor is disabled */
cursor_disable(test_data);
@@ -255,7 +260,7 @@ static void cleanup_crtc(test_data_t *test_data, igt_output_t *output)
igt_output_set_pipe(output, PIPE_ANY);
}
-static void run_test(data_t *data, bool onscreen, int cursor_w, int cursor_h)
+static void run_test(data_t *data, void (*testfunc)(test_data_t *, bool), bool onscreen, int cursor_w, int cursor_h)
{
igt_display_t *display = &data->display;
igt_output_t *output;
@@ -279,7 +284,7 @@ static void run_test(data_t *data, bool onscreen, int cursor_w, int cursor_h)
igt_subtest_name(), pipe_name(test_data.pipe),
igt_output_name(output));
- test_crc(&test_data, onscreen, cursor_w, cursor_h);
+ testfunc(&test_data, onscreen);
fprintf(stdout, "\n%s on pipe %c, connector %s: PASSED\n\n",
igt_subtest_name(), pipe_name(test_data.pipe),
@@ -321,9 +326,9 @@ static void run_test_generic(data_t *data, int cursor_max_size)
/* Using created cursor FBs to test cursor support */
igt_subtest_f("cursor-%s-onscreen", c_size)
- run_test(data, true, cursor_size, cursor_size);
+ run_test(data, test_crc, true, cursor_size, cursor_size);
igt_subtest_f("cursor-%s-offscreen", c_size)
- run_test(data, false, cursor_size, cursor_size);
+ run_test(data, test_crc, false, cursor_size, cursor_size);
}
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 4/7] kms_cursor_crc: Separate onscreen and offscreen tests
2014-04-02 11:06 [PATCH i-g-t 0/7] kms_cursor_crc enhancements Antti Koskipaa
` (2 preceding siblings ...)
2014-04-02 11:06 ` [PATCH i-g-t 3/7] kms_cursor_crc: Use a function pointer to call test Antti Koskipaa
@ 2014-04-02 11:06 ` Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 5/7] kms_cursor_crc: Add reference software rendering Antti Koskipaa
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Antti Koskipaa @ 2014-04-02 11:06 UTC (permalink / raw)
To: intel-gfx
Also remove onscreen boolean from parameter list. All test-related
data should be put into test_data from now.
Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
---
tests/kms_cursor_crc.c | 99 +++++++++++++++++++++++++-------------------------
1 file changed, 50 insertions(+), 49 deletions(-)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 60b50b5..94baa94 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -133,8 +133,7 @@ static void do_test(test_data_t *test_data,
do_single_test(test_data, left, bottom);
}
-static void test_crc(test_data_t *test_data,
- bool onscreen)
+static void test_crc_onscreen(test_data_t *test_data)
{
int left = test_data->left;
int right = test_data->right;
@@ -143,49 +142,51 @@ static void test_crc(test_data_t *test_data,
int cursor_w = test_data->curw;
int cursor_h = test_data->curh;
- if (onscreen) {
- /* cursor onscreen, crc should match, except when white visible cursor is used */
- test_data->crc_must_match = false;
-
- /* fully inside */
- do_test(test_data, left, right, top, bottom);
-
- /* 2 pixels inside */
- do_test(test_data, left - (cursor_w-2), right + (cursor_w-2), top , bottom );
- do_test(test_data, left , right , top - (cursor_h-2), bottom + (cursor_h-2));
- do_test(test_data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-2), bottom + (cursor_h-2));
-
- /* 1 pixel inside */
- do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top , bottom );
- do_test(test_data, left , right , top - (cursor_h-1), bottom + (cursor_h-1));
- do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
- } else {
- /* cursor offscreen, crc should always match */
- test_data->crc_must_match = false;
-
- /* fully outside */
- do_test(test_data, left - (cursor_w), right + (cursor_w), top , bottom );
- do_test(test_data, left , right , top - (cursor_h), bottom + (cursor_h));
- do_test(test_data, left - (cursor_w), right + (cursor_w), top - (cursor_h), bottom + (cursor_h));
-
- /* fully outside by 1 extra pixels */
- do_test(test_data, left - (cursor_w+1), right + (cursor_w+1), top , bottom );
- do_test(test_data, left , right , top - (cursor_h+1), bottom + (cursor_h+1));
- do_test(test_data, left - (cursor_w+1), right + (cursor_w+1), top - (cursor_h+1), bottom + (cursor_h+1));
-
- /* fully outside by 2 extra pixels */
- do_test(test_data, left - (cursor_w+2), right + (cursor_w+2), top , bottom );
- do_test(test_data, left , right , top - (cursor_h+2), bottom + (cursor_h+2));
- do_test(test_data, left - (cursor_w+2), right + (cursor_w+2), top - (cursor_h+2), bottom + (cursor_h+2));
-
- /* fully outside by a lot of extra pixels */
- do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top , bottom );
- do_test(test_data, left , right , top - (cursor_h+512), bottom + (cursor_h+512));
- do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
-
- /* go nuts */
- do_test(test_data, INT_MIN, INT_MAX, INT_MIN, INT_MAX);
- }
+ /* fully inside */
+ do_test(test_data, left, right, top, bottom);
+
+ /* 2 pixels inside */
+ do_test(test_data, left - (cursor_w-2), right + (cursor_w-2), top , bottom );
+ do_test(test_data, left , right , top - (cursor_h-2), bottom + (cursor_h-2));
+ do_test(test_data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-2), bottom + (cursor_h-2));
+
+ /* 1 pixel inside */
+ do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top , bottom );
+ do_test(test_data, left , right , top - (cursor_h-1), bottom + (cursor_h-1));
+ do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
+}
+
+static void test_crc_offscreen(test_data_t *test_data)
+{
+ int left = test_data->left;
+ int right = test_data->right;
+ int top = test_data->top;
+ int bottom = test_data->bottom;
+ int cursor_w = test_data->curw;
+ int cursor_h = test_data->curh;
+
+ /* fully outside */
+ do_test(test_data, left - (cursor_w), right + (cursor_w), top , bottom );
+ do_test(test_data, left , right , top - (cursor_h), bottom + (cursor_h));
+ do_test(test_data, left - (cursor_w), right + (cursor_w), top - (cursor_h), bottom + (cursor_h));
+
+ /* fully outside by 1 extra pixels */
+ do_test(test_data, left - (cursor_w+1), right + (cursor_w+1), top , bottom );
+ do_test(test_data, left , right , top - (cursor_h+1), bottom + (cursor_h+1));
+ do_test(test_data, left - (cursor_w+1), right + (cursor_w+1), top - (cursor_h+1), bottom + (cursor_h+1));
+
+ /* fully outside by 2 extra pixels */
+ do_test(test_data, left - (cursor_w+2), right + (cursor_w+2), top , bottom );
+ do_test(test_data, left , right , top - (cursor_h+2), bottom + (cursor_h+2));
+ do_test(test_data, left - (cursor_w+2), right + (cursor_w+2), top - (cursor_h+2), bottom + (cursor_h+2));
+
+ /* fully outside by a lot of extra pixels */
+ do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top , bottom );
+ do_test(test_data, left , right , top - (cursor_h+512), bottom + (cursor_h+512));
+ do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
+
+ /* go nuts */
+ do_test(test_data, INT_MIN, INT_MAX, INT_MIN, INT_MAX);
}
static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
@@ -260,7 +261,7 @@ static void cleanup_crtc(test_data_t *test_data, igt_output_t *output)
igt_output_set_pipe(output, PIPE_ANY);
}
-static void run_test(data_t *data, void (*testfunc)(test_data_t *, bool), bool onscreen, int cursor_w, int cursor_h)
+static void run_test(data_t *data, void (*testfunc)(test_data_t *), int cursor_w, int cursor_h)
{
igt_display_t *display = &data->display;
igt_output_t *output;
@@ -284,7 +285,7 @@ static void run_test(data_t *data, void (*testfunc)(test_data_t *, bool), bool o
igt_subtest_name(), pipe_name(test_data.pipe),
igt_output_name(output));
- testfunc(&test_data, onscreen);
+ testfunc(&test_data);
fprintf(stdout, "\n%s on pipe %c, connector %s: PASSED\n\n",
igt_subtest_name(), pipe_name(test_data.pipe),
@@ -326,9 +327,9 @@ static void run_test_generic(data_t *data, int cursor_max_size)
/* Using created cursor FBs to test cursor support */
igt_subtest_f("cursor-%s-onscreen", c_size)
- run_test(data, test_crc, true, cursor_size, cursor_size);
+ run_test(data, test_crc_onscreen, cursor_size, cursor_size);
igt_subtest_f("cursor-%s-offscreen", c_size)
- run_test(data, test_crc, false, cursor_size, cursor_size);
+ run_test(data, test_crc_offscreen, cursor_size, cursor_size);
}
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 5/7] kms_cursor_crc: Add reference software rendering
2014-04-02 11:06 [PATCH i-g-t 0/7] kms_cursor_crc enhancements Antti Koskipaa
` (3 preceding siblings ...)
2014-04-02 11:06 ` [PATCH i-g-t 4/7] kms_cursor_crc: Separate onscreen and offscreen tests Antti Koskipaa
@ 2014-04-02 11:06 ` Antti Koskipaa
2014-04-02 11:21 ` Ville Syrjälä
2014-04-02 11:06 ` [PATCH i-g-t 6/7] kms_cursor_crc: Add moving cursor test Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 7/7] kms_cursor_crc: Add random cursor placement test Antti Koskipaa
6 siblings, 1 reply; 11+ messages in thread
From: Antti Koskipaa @ 2014-04-02 11:06 UTC (permalink / raw)
To: intel-gfx
This patch first render the cursor with hardware rendering and
then with software, acquiring the CRC in both cases so they can be
properly compared. Say goodbye to crc_must_match variable.
Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
---
tests/kms_cursor_crc.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 94baa94..021d58a 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -52,8 +52,8 @@ typedef struct {
igt_output_t *output;
enum pipe pipe;
igt_crc_t ref_crc;
- bool crc_must_match;
int left, right, top, bottom;
+ int screenw, screenh;
int curw, curh; /* cursor size */
} test_data_t;
@@ -105,23 +105,31 @@ static void do_single_test(test_data_t *test_data, int x, int y)
data_t *data = test_data->data;
igt_display_t *display = &data->display;
igt_pipe_crc_t *pipe_crc = data->pipe_crc[test_data->pipe];
- igt_crc_t crc;
+ igt_crc_t crc, ref_crc;
igt_plane_t *cursor;
+ cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
printf("."); fflush(stdout);
+ /* Hardware test */
cursor_enable(test_data);
cursor = igt_output_get_plane(test_data->output, IGT_PLANE_CURSOR);
igt_plane_set_position(cursor, x, y);
igt_display_commit(display);
igt_wait_for_vblank(data->drm_fd, test_data->pipe);
+ igt_pipe_crc_collect_crc(pipe_crc, &crc);
cursor_disable(test_data);
- igt_pipe_crc_collect_crc(pipe_crc, &crc);
- if (test_data->crc_must_match)
- igt_assert(igt_crc_equal(&crc, &test_data->ref_crc));
- else
- igt_assert(!igt_crc_equal(&crc, &test_data->ref_crc));
+ /* Now render the same in software and collect crc */
+ draw_cursor(cr, x, y, test_data->curw);
+ 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, &ref_crc));
}
static void do_test(test_data_t *test_data,
@@ -184,9 +192,6 @@ static void test_crc_offscreen(test_data_t *test_data)
do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top , bottom );
do_test(test_data, left , right , top - (cursor_h+512), bottom + (cursor_h+512));
do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
-
- /* go nuts */
- do_test(test_data, INT_MIN, INT_MAX, INT_MIN, INT_MAX);
}
static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
@@ -232,6 +237,8 @@ static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
test_data->right = mode->hdisplay - cursor_w;
test_data->top = 0;
test_data->bottom = mode->vdisplay - cursor_h;
+ test_data->screenw = mode->hdisplay;
+ test_data->screenh = mode->vdisplay;
test_data->curw = cursor_w;
test_data->curh = cursor_h;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 6/7] kms_cursor_crc: Add moving cursor test
2014-04-02 11:06 [PATCH i-g-t 0/7] kms_cursor_crc enhancements Antti Koskipaa
` (4 preceding siblings ...)
2014-04-02 11:06 ` [PATCH i-g-t 5/7] kms_cursor_crc: Add reference software rendering Antti Koskipaa
@ 2014-04-02 11:06 ` Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 7/7] kms_cursor_crc: Add random cursor placement test Antti Koskipaa
6 siblings, 0 replies; 11+ messages in thread
From: Antti Koskipaa @ 2014-04-02 11:06 UTC (permalink / raw)
To: intel-gfx
Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
---
tests/kms_cursor_crc.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 021d58a..1e1d348 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -194,6 +194,20 @@ static void test_crc_offscreen(test_data_t *test_data)
do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
}
+static void test_crc_sliding(test_data_t *test_data)
+{
+ int i;
+
+ /* Make sure cursor moves smoothly and pixel-by-pixel, and that there are
+ * no alignment issues. Horizontal, vertical and diagonal test.
+ */
+ for (i = 0; i < 16; i++) {
+ do_single_test(test_data, i, 0);
+ do_single_test(test_data, 0, i);
+ do_single_test(test_data, i, i);
+ }
+}
+
static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
int cursor_w, int cursor_h)
{
@@ -337,6 +351,8 @@ static void run_test_generic(data_t *data, int cursor_max_size)
run_test(data, test_crc_onscreen, cursor_size, cursor_size);
igt_subtest_f("cursor-%s-offscreen", c_size)
run_test(data, test_crc_offscreen, cursor_size, cursor_size);
+ igt_subtest_f("cursor-%s-sliding", c_size)
+ run_test(data, test_crc_sliding, cursor_size, cursor_size);
}
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 7/7] kms_cursor_crc: Add random cursor placement test
2014-04-02 11:06 [PATCH i-g-t 0/7] kms_cursor_crc enhancements Antti Koskipaa
` (5 preceding siblings ...)
2014-04-02 11:06 ` [PATCH i-g-t 6/7] kms_cursor_crc: Add moving cursor test Antti Koskipaa
@ 2014-04-02 11:06 ` Antti Koskipaa
6 siblings, 0 replies; 11+ messages in thread
From: Antti Koskipaa @ 2014-04-02 11:06 UTC (permalink / raw)
To: intel-gfx
Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
---
tests/kms_cursor_crc.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 1e1d348..d461d72 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -208,6 +208,18 @@ static void test_crc_sliding(test_data_t *test_data)
}
}
+static void test_crc_random(test_data_t *test_data)
+{
+ int i;
+
+ /* Random cursor placement */
+ for (i = 0; i < 50; i++) {
+ int x = rand() % (test_data->screenw + test_data->curw * 2) - test_data->curw;
+ int y = rand() % (test_data->screenh + test_data->curh * 2) - test_data->curh;
+ do_single_test(test_data, x, y);
+ }
+}
+
static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
int cursor_w, int cursor_h)
{
@@ -353,6 +365,8 @@ static void run_test_generic(data_t *data, int cursor_max_size)
run_test(data, test_crc_offscreen, cursor_size, cursor_size);
igt_subtest_f("cursor-%s-sliding", c_size)
run_test(data, test_crc_sliding, cursor_size, cursor_size);
+ igt_subtest_f("cursor-%s-random", c_size)
+ run_test(data, test_crc_random, cursor_size, cursor_size);
}
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH i-g-t 5/7] kms_cursor_crc: Add reference software rendering
2014-04-02 11:06 ` [PATCH i-g-t 5/7] kms_cursor_crc: Add reference software rendering Antti Koskipaa
@ 2014-04-02 11:21 ` Ville Syrjälä
2014-04-02 11:27 ` Antti Koskipää
0 siblings, 1 reply; 11+ messages in thread
From: Ville Syrjälä @ 2014-04-02 11:21 UTC (permalink / raw)
To: Antti Koskipaa; +Cc: intel-gfx
On Wed, Apr 02, 2014 at 02:06:28PM +0300, Antti Koskipaa wrote:
<snip>
> @@ -184,9 +192,6 @@ static void test_crc_offscreen(test_data_t *test_data)
> do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top , bottom );
> do_test(test_data, left , right , top - (cursor_h+512), bottom + (cursor_h+512));
> do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
> -
> - /* go nuts */
> - do_test(test_data, INT_MIN, INT_MAX, INT_MIN, INT_MAX);
Why are you dropping the go nuts test? We had an actual bug in the
driver that this managed to hit. We should keep this test to avoid
regressions.
--
Ville Syrjälä
Intel OTC
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH i-g-t 5/7] kms_cursor_crc: Add reference software rendering
2014-04-02 11:21 ` Ville Syrjälä
@ 2014-04-02 11:27 ` Antti Koskipää
2014-04-02 11:38 ` Ville Syrjälä
0 siblings, 1 reply; 11+ messages in thread
From: Antti Koskipää @ 2014-04-02 11:27 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: intel-gfx
On 04/02/2014 02:21 PM, Ville Syrjälä wrote:
> On Wed, Apr 02, 2014 at 02:06:28PM +0300, Antti Koskipaa wrote:
> <snip>
>> @@ -184,9 +192,6 @@ static void test_crc_offscreen(test_data_t *test_data)
>> do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top , bottom );
>> do_test(test_data, left , right , top - (cursor_h+512), bottom + (cursor_h+512));
>> do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
>> -
>> - /* go nuts */
>> - do_test(test_data, INT_MIN, INT_MAX, INT_MIN, INT_MAX);
>
> Why are you dropping the go nuts test? We had an actual bug in the
> driver that this managed to hit. We should keep this test to avoid
> regressions.
Link please. Cairo went nuts with that one, but if there is a case for
the test, I'll work around Cairo to keep it.
--
- Antti
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH i-g-t 5/7] kms_cursor_crc: Add reference software rendering
2014-04-02 11:27 ` Antti Koskipää
@ 2014-04-02 11:38 ` Ville Syrjälä
0 siblings, 0 replies; 11+ messages in thread
From: Ville Syrjälä @ 2014-04-02 11:38 UTC (permalink / raw)
To: Antti Koskipää; +Cc: intel-gfx
On Wed, Apr 02, 2014 at 02:27:40PM +0300, Antti Koskipää wrote:
> On 04/02/2014 02:21 PM, Ville Syrjälä wrote:
> > On Wed, Apr 02, 2014 at 02:06:28PM +0300, Antti Koskipaa wrote:
> > <snip>
> >> @@ -184,9 +192,6 @@ static void test_crc_offscreen(test_data_t *test_data)
> >> do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top , bottom );
> >> do_test(test_data, left , right , top - (cursor_h+512), bottom + (cursor_h+512));
> >> do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
> >> -
> >> - /* go nuts */
> >> - do_test(test_data, INT_MIN, INT_MAX, INT_MIN, INT_MAX);
> >
> > Why are you dropping the go nuts test? We had an actual bug in the
> > driver that this managed to hit. We should keep this test to avoid
> > regressions.
>
> Link please. Cairo went nuts with that one, but if there is a case for
> the test, I'll work around Cairo to keep it.
commit 92e76c8c7e436a07af3e0b594480ff8689add078
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Mon Oct 21 19:01:58 2013 +0300
drm/i915: Clamp cursor coordinates to int16_t range
is the commit that fixed the bug.
--
Ville Syrjälä
Intel OTC
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-04-02 11:38 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-02 11:06 [PATCH i-g-t 0/7] kms_cursor_crc enhancements Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 1/7] kms_cursor_crc: Remove some test cases and change cursor to color Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 2/7] kms_cursor_crc: Move cursor enable and disable calls where they belong Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 3/7] kms_cursor_crc: Use a function pointer to call test Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 4/7] kms_cursor_crc: Separate onscreen and offscreen tests Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 5/7] kms_cursor_crc: Add reference software rendering Antti Koskipaa
2014-04-02 11:21 ` Ville Syrjälä
2014-04-02 11:27 ` Antti Koskipää
2014-04-02 11:38 ` Ville Syrjälä
2014-04-02 11:06 ` [PATCH i-g-t 6/7] kms_cursor_crc: Add moving cursor test Antti Koskipaa
2014-04-02 11:06 ` [PATCH i-g-t 7/7] kms_cursor_crc: Add random cursor placement test Antti Koskipaa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox