kms_cursor_crc enhancements
v2 cover kms_cursor_crc enhancements
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.
v2:
- reinstate "go nuts" -test
- Add background picture for better test coverage
Antti Koskipaa (8):
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
kms_cursor_crc: Add background picture
tests/kms_cursor_crc.c | 255 ++++++++++++++++++++++++++++--------------------- 1 file changed, 146 insertions(+), 109 deletions(-)
Signature · 1 line
1.8.3.2
PATCH v2 1/8 kms_cursor_crc: Remove some test cases and change cursor to color
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.
--- tests/kms_cursor_crc.c | 75 +++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 43 deletions(-)
tests/kms_cursor_crc.c +32 -43
@@ -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); } }
Signature · 1 line
1.8.3.2
PATCH v2 2/8 kms_cursor_crc: Move cursor enable and disable calls where they belong
In reply to Antti KoskipaaWe can't have the hw cursor enabled during software render tests.
--- tests/kms_cursor_crc.c | 54 ++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 28 deletions(-)
tests/kms_cursor_crc.c +26 -28
@@ -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,
Signature · 1 line
1.8.3.2
Re: [PATCH i-g-t v2 2/8] kms_cursor_crc: Move cursor enable and disable calls where they belong
Quoted 44 lines · Antti Koskipaa
We can't have the hw cursor enabled during software render tests.
Signed-off-by Antti Koskipaa <[email protected]>--- tests/kms_cursor_crc.c | 54 ++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 28 deletions(-)tests/kms_cursor_crc.c +24
-0@@ -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)
tests/kms_cursor_crc.c static void do_single_test(test_data_t *test_data, int x, int y) · line 119
Quoted 10 lines
tests/kms_cursor_crc.c +2
-0printf ("." );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);
Cursor is getting disabled before we collect the crc:?
Quoted 57 lines
tests/kms_cursor_crc.c +0
-28if (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,Signature · 6 lines
1.8.3.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
PATCH v2 3/8 kms_cursor_crc: Use a function pointer to call test
In reply to Antti KoskipaaMore tests are coming, and this allows us to not repeat the boilerplate code in run_test() for each subtest.
--- tests/kms_cursor_crc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
tests/kms_cursor_crc.c +10 -5
@@ -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); } }
Signature · 1 line
1.8.3.2
PATCH v2 4/8 kms_cursor_crc: Separate onscreen and offscreen tests
In reply to Antti KoskipaaAlso remove onscreen boolean from parameter list. All test-related data should be put into test_data from now.
--- tests/kms_cursor_crc.c | 99 +++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 49 deletions(-)
tests/kms_cursor_crc.c +50 -49
@@ -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 oigt_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); } }
Signature · 1 line
1.8.3.2
PATCH v2 5/8 kms_cursor_crc: Add reference software rendering
In reply to Antti KoskipaaThis 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.
--- tests/kms_cursor_crc.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
tests/kms_cursor_crc.c +20 -7
@@ -52,14 +52,17 @@ 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;static void draw_cursor (cairo_t *cr,int x,int y,int w) { w /=2 ; +/* Cairo doesn't like to be fed numbers that are too wild */ +if ((x <SHRT_MIN ) || (x >SHRT_MAX ) || (y <SHRT_MIN ) || (y >SHRT_MAX )) +return ;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 );
@@ -105,23 +108,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,
@@ -232,6 +243,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;
Signature · 1 line
1.8.3.2
PATCH v2 6/8 kms_cursor_crc: Add moving cursor test
In reply to Antti Koskipaa--- tests/kms_cursor_crc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
tests/kms_cursor_crc.c +16 -0
@@ -200,6 +200,20 @@ static void test_crc_offscreen(test_data_t *test_data)do_test (test_data,INT_MIN ,INT_MAX ,INT_MIN ,INT_MAX ); } +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) {
@@ -343,6 +357,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); } }
Signature · 1 line
1.8.3.2
PATCH v2 7/8 kms_cursor_crc: Add random cursor placement test
In reply to Antti Koskipaa--- tests/kms_cursor_crc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
tests/kms_cursor_crc.c +14 -0
@@ -214,6 +214,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) {
@@ -359,6 +371,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); } }
Signature · 1 line
1.8.3.2
Re: [PATCH i-g-t v2 7/8] kms_cursor_crc: Add random cursor placement test
Quoted 14 lines · Antti Koskipaa
Signed-off-by Antti Koskipaa <[email protected]>--- tests/kms_cursor_crc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)tests/kms_cursor_crc.c +1
-0@@ -214,6 +214,18 @@ static void test_crc_sliding(test_data_t *test_data) } } +static void test_crc_random (test_data_t *test_data)
tests/kms_cursor_crc.c static void test_crc_sliding(test_data_t *test_data) · line 227
Quoted 10 lines
tests/kms_cursor_crc.c +10
-0+{ +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); + } +}
As this is not deterministic it would be nice if the test would print out some of the test parameters on failure (cursor coordinates and size at least). Otherwise there's no good way to analyze failures.
Quoted 20 lines
tests/kms_cursor_crc.c +3
-0+static bool prepare_crtc (test_data_t *test_data,igt_output_t *output,int cursor_w,int cursor_h) {@@ -359,6 +371,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); } }Signature · 6 lines
1.8.3.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
PATCH v2 8/8 kms_cursor_crc: Add background picture
In reply to Antti KoskipaaThis gives the cursor something to be on, instead of just a black background. Slows the test down only one second over six minutes.
--- tests/kms_cursor_crc.c | 1 + 1 file changed, 1 insertion(+)
tests/kms_cursor_crc.c +1 -0
@@ -115,6 +115,7 @@ static void do_single_test(test_data_t *test_data, int x, int y)printf ("." );fflush (stdout);/* Hardware test */ +igt_paint_test_pattern (cr, test_data->screenw, test_data->screenh);cursor_enable (test_data); cursor =igt_output_get_plane (test_data->output,IGT_PLANE_CURSOR );igt_plane_set_position (cursor, x, y);
Signature · 1 line
1.8.3.2
Quoted 13 lines · Antti Koskipaa
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.
v2:
- reinstate "go nuts" -test
- Add background picture for better test coverage
Quoted 9 lines
Antti Koskipaa (8):
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
kms_cursor_crc: Add background picture
I pushed the lot, and fixed the small issue in 2/8 that I pointed out.
I also pushed a pile of extra fixes, mainly to fix --list-subtests, and I also tried to fix my gen2 LVDS vs. pipe B issue, which I suppose is the same thing as this bug:
https://bugs.freedesktop.org/show_bug.cgi?id=75131
Quoted 11 lines
tests/kms_cursor_crc.c | 255 ++++++++++++++++++++++++++++--------------------- 1 file changed, 146 insertions(+), 109 deletions(-)Signature · 6 lines
1.8.3.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 24 lines · Ville Syrjälä
Quoted 13 lines · Antti Koskipaa
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.
v2:
- reinstate "go nuts" -test
- Add background picture for better test coverageQuoted 9 lines
Antti Koskipaa (8):
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
kms_cursor_crc: Add background picture
Quoted 6 lines
I pushed the lot, and fixed the small issue in 2/8 that I pointed out.
I also pushed a pile of extra fixes, mainly to fix --list-subtests, and I also tried to fix my gen2 LVDS vs. pipe B issue, which I suppose is the same thing as this bug:
https://bugs.freedesktop.org/show_bug.cgi?id=75131
This is a general issue with the current igt kms helper, and it's going to bite us again with the chv 3 pipe support due to pipe restrictions on the DP ports. I have a todo (and some patches) somewhere, but just didn't get around to this yet :(
There's a few other issues with the high-level helpers like no sane support to reset all the state - after the first test most subsequent ones end up all skipping ...
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch