diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2021-03-24 17:19:18 +0200 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2021-03-30 19:58:10 +0300 |
commit | 9fde7d9e4cedeb668bc5cc75ea73d2c842143d41 (patch) | |
tree | 5873e24c5ff8773cd93eb075034bc3ce3d423049 /tests/kms_cursor_crc.c | |
parent | e94a31e17008abb0e2a5e7d691de83ba2f0116bd (diff) |
tests/kms_cursor_crc: Extract run_size_tests()
Refactor the common size tests into their own function and
just call it twice.
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'tests/kms_cursor_crc.c')
-rw-r--r-- | tests/kms_cursor_crc.c | 103 |
1 files changed, 42 insertions, 61 deletions
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index 7068475e..5f3eeaa0 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -532,6 +532,9 @@ static void require_cursor_size(data_t *data, int w, int h) igt_plane_t *primary, *cursor; int ret; + igt_require(w <= data->cursor_max_w && + h <= data->cursor_max_h); + igt_output_set_pipe(output, data->pipe); mode = igt_output_get_mode(output); @@ -660,6 +663,41 @@ static void test_rapid_movement(data_t *data) igt_assert_lt(usec, 0.9 * 400 * 1000000 / data->refresh); } +static void run_size_tests(data_t *data, enum pipe pipe, + int w, int h) +{ + igt_fixture { + create_cursor_fb(data, w, h); + require_cursor_size(data, w, h); + } + + /* Using created cursor FBs to test cursor support */ + igt_describe("Check if a given-size cursor is well-positioned inside the screen."); + igt_subtest_f("pipe-%s-cursor%dx%donscreen", kmstest_pipe_name(pipe), w, h) + run_test(data, test_crc_onscreen, w, h); + + igt_describe("Check if a given-size cursor is well-positioned outside the " + "screen."); + igt_subtest_f("pipe-%s-cursor%dx%doffscreen", kmstest_pipe_name(pipe), w, h) + run_test(data, test_crc_offscreen, w, h); + + igt_describe("Check the smooth and pixel-by-pixel given-size cursor " + "movements on horizontal, vertical and diagonal."); + igt_subtest_f("pipe-%s-cursor%dx%dsliding", kmstest_pipe_name(pipe), w, h) + run_test(data, test_crc_sliding, w, h); + + igt_describe("Check random placement of a cursor with given size."); + igt_subtest_f("pipe-%s-cursor%dx%drandom", kmstest_pipe_name(pipe), w, h) + run_test(data, test_crc_random, w, h); + + igt_describe("Check the rapid update of given-size cursor movements."); + igt_subtest_f("pipe-%s-cursor%dx%drapid-movement", kmstest_pipe_name(pipe), w, h) + run_test(data, test_rapid_movement, w, h); + + igt_fixture + igt_remove_fb(data->drm_fd, &data->fb); +} + static void run_tests_on_pipe(data_t *data, enum pipe pipe) { int cursor_size; @@ -709,44 +747,8 @@ static void run_tests_on_pipe(data_t *data, enum pipe pipe) int w = cursor_size; int h = cursor_size; - igt_fixture { - igt_require(w <= data->cursor_max_w && - h <= data->cursor_max_h); - - create_cursor_fb(data, w, h); - } - - igt_subtest_group { - igt_fixture - require_cursor_size(data, w, h); - - /* Using created cursor FBs to test cursor support */ - igt_describe("Check if a given-size cursor is well-positioned inside the " - "screen."); - igt_subtest_f("pipe-%s-cursor-%dx%d-onscreen", kmstest_pipe_name(pipe), w, h) - run_test(data, test_crc_onscreen, w, h); - - igt_describe("Check if a given-size cursor is well-positioned outside the " - "screen."); - igt_subtest_f("pipe-%s-cursor-%dx%d-offscreen", kmstest_pipe_name(pipe), w, h) - run_test(data, test_crc_offscreen, w, h); - - igt_describe("Check the smooth and pixel-by-pixel given-size cursor " - "movements on horizontal, vertical and diagonal."); - igt_subtest_f("pipe-%s-cursor-%dx%d-sliding", kmstest_pipe_name(pipe), w, h) - run_test(data, test_crc_sliding, w, h); - - igt_describe("Check random placement of a cursor with given size."); - igt_subtest_f("pipe-%s-cursor-%dx%d-random", kmstest_pipe_name(pipe), w, h) - run_test(data, test_crc_random, w, h); - - igt_describe("Check the rapid update of given-size cursor movements."); - igt_subtest_f("pipe-%s-cursor-%dx%d-rapid-movement", kmstest_pipe_name(pipe), w, h) - run_test(data, test_rapid_movement, w, h); - } - - igt_fixture - igt_remove_fb(data->drm_fd, &data->fb); + igt_subtest_group + run_size_tests(data, pipe, w, h); /* * Test non-square cursors a bit on the platforms @@ -755,29 +757,8 @@ static void run_tests_on_pipe(data_t *data, enum pipe pipe) */ h /= 3; - igt_fixture - create_cursor_fb(data, w, h); - - igt_subtest_group { - igt_fixture - require_cursor_size(data, w, h); - - /* Using created cursor FBs to test cursor support */ - igt_subtest_f("pipe-%s-cursor-%dx%d-onscreen", kmstest_pipe_name(pipe), w, h) - run_test(data, test_crc_onscreen, w, h); - - igt_subtest_f("pipe-%s-cursor-%dx%d-offscreen", kmstest_pipe_name(pipe), w, h) - run_test(data, test_crc_offscreen, w, h); - - igt_subtest_f("pipe-%s-cursor-%dx%d-sliding", kmstest_pipe_name(pipe), w, h) - run_test(data, test_crc_sliding, w, h); - - igt_subtest_f("pipe-%s-cursor-%dx%d-random", kmstest_pipe_name(pipe), w, h) - run_test(data, test_crc_random, w, h); - } - - igt_fixture - igt_remove_fb(data->drm_fd, &data->fb); + igt_subtest_group + run_size_tests(data, pipe, w, h); } } |