kms_cursor_crc: Separate onscreen and offscreen tests

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>
This commit is contained in:
Antti Koskipaa 2014-04-10 15:08:08 +03:00 committed by Ville Syrjälä
parent fe8041b8f9
commit ead0173c4d

View File

@ -133,8 +133,7 @@ static void do_test(test_data_t *test_data,
do_single_test(test_data, left, bottom); do_single_test(test_data, left, bottom);
} }
static void test_crc(test_data_t *test_data, static void test_crc_onscreen(test_data_t *test_data)
bool onscreen)
{ {
int left = test_data->left; int left = test_data->left;
int right = test_data->right; 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_w = test_data->curw;
int cursor_h = test_data->curh; int cursor_h = test_data->curh;
if (onscreen) { /* fully inside */
/* cursor onscreen, crc should match, except when white visible cursor is used */ do_test(test_data, left, right, top, bottom);
test_data->crc_must_match = false;
/* fully inside */ /* 2 pixels inside */
do_test(test_data, left, right, top, bottom); 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));
/* 2 pixels inside */ /* 1 pixel inside */
do_test(test_data, left - (cursor_w-2), right + (cursor_w-2), top , bottom ); do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top , bottom );
do_test(test_data, left , right , top - (cursor_h-2), bottom + (cursor_h-2)); do_test(test_data, left , right , top - (cursor_h-1), bottom + (cursor_h-1));
do_test(test_data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-2), bottom + (cursor_h-2)); do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
}
/* 1 pixel inside */ static void test_crc_offscreen(test_data_t *test_data)
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)); int left = test_data->left;
do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1)); int right = test_data->right;
} else { int top = test_data->top;
/* cursor offscreen, crc should always match */ int bottom = test_data->bottom;
test_data->crc_must_match = false; int cursor_w = test_data->curw;
int cursor_h = test_data->curh;
/* fully outside */ /* fully outside */
do_test(test_data, left - (cursor_w), right + (cursor_w), top , bottom ); 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 , right , top - (cursor_h), bottom + (cursor_h));
do_test(test_data, left - (cursor_w), right + (cursor_w), 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 */ /* 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 - (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 , 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)); 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 */ /* 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 - (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 , 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)); 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 */ /* 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 - (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 , 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)); do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
/* go nuts */ /* go nuts */
do_test(test_data, INT_MIN, INT_MAX, INT_MIN, INT_MAX); 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, 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); 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_display_t *display = &data->display;
igt_output_t *output; 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_subtest_name(), pipe_name(test_data.pipe),
igt_output_name(output)); igt_output_name(output));
testfunc(&test_data, onscreen); testfunc(&test_data);
fprintf(stdout, "\n%s on pipe %c, connector %s: PASSED\n\n", fprintf(stdout, "\n%s on pipe %c, connector %s: PASSED\n\n",
igt_subtest_name(), pipe_name(test_data.pipe), 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 */ /* Using created cursor FBs to test cursor support */
igt_subtest_f("cursor-%s-onscreen", c_size) 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) 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);
} }
} }