summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhanuprakash Modem <bhanuprakash.modem@intel.com>2022-06-10 14:39:08 +0530
committerBhanuprakash Modem <bhanuprakash.modem@intel.com>2022-06-22 09:50:12 +0530
commitc02f0d48c433e153033f9060b4a5ba6604402db1 (patch)
tree4efdccc5e5e221ec82ddeabbeb21a3c7df04084e
parent331658a8475c8b0c0f7ffe5268a7318ef83da34e (diff)
tests/kms_cursor_legacy: Convert tests to dynamic
Convert the existing subtests to dynamic subtests. Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com> Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
-rw-r--r--tests/kms_cursor_legacy.c259
1 files changed, 141 insertions, 118 deletions
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 47b9b4e1..8f5e5fd2 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1424,6 +1424,15 @@ igt_main
igt_display_t display = { .drm_fd = -1 };
bool intel_psr2_restore = false;
int i;
+ const char *modes[flip_test_last+1] = {
+ "legacy",
+ "varying-size",
+ "toggle",
+ "atomic",
+ "atomic-transitions",
+ "atomic-transitions-varying-size"
+ };
+ const char *prefix[2] = {"basic", "short"};
igt_fixture {
display.drm_fd = drm_open_driver_master(DRIVER_ANY);
@@ -1438,55 +1447,42 @@ igt_main
intel_psr2_restore = i915_psr2_sel_fetch_to_psr1(display.drm_fd);
}
- /*Test description for pipe-* and all-pipe-* tests*/
igt_describe("Test checks how many cursor updates we can fit between vblanks "
- "on single pipe with different modes, priority and number of processes");
+ "on single/all pipes with different modes, priority and number of processes");
igt_subtest_group {
enum pipe n;
- for_each_pipe_static(n) {
- errno = 0;
-
- igt_fixture {
- igt_require_pipe(&display, n);
- }
+ struct {
+ const char *name;
+ int ncpus;
+ unsigned flags;
+ } tests[] = {
+ { "single-bo", 1, DRM_MODE_CURSOR_BO },
+ { "single-move", 1, DRM_MODE_CURSOR_MOVE },
+ { "forked-bo", ncpus, DRM_MODE_CURSOR_BO },
+ { "forked-move", ncpus, DRM_MODE_CURSOR_MOVE },
+ { "torture-bo", -ncpus, DRM_MODE_CURSOR_BO },
+ { "torture-move", -ncpus, DRM_MODE_CURSOR_MOVE },
+ };
- igt_subtest_f("pipe-%s-single-bo", kmstest_pipe_name(n))
- stress(&display, n, 1, DRM_MODE_CURSOR_BO, 20);
- igt_subtest_f("pipe-%s-single-move", kmstest_pipe_name(n))
- stress(&display, n, 1, DRM_MODE_CURSOR_MOVE, 20);
+ for (i = 0; i < ARRAY_SIZE(tests); i++) {
+ igt_subtest_with_dynamic(tests[i].name) {
+ for_each_pipe(&display, n) {
+ errno = 0;
- igt_subtest_f("pipe-%s-forked-bo", kmstest_pipe_name(n))
- stress(&display, n, ncpus, DRM_MODE_CURSOR_BO, 20);
- igt_subtest_f("pipe-%s-forked-move", kmstest_pipe_name(n))
- stress(&display, n, ncpus, DRM_MODE_CURSOR_MOVE, 20);
+ igt_dynamic_f("pipe-%s", kmstest_pipe_name(n))
+ stress(&display, n, tests[i].ncpus, tests[i].flags, 20);
+ }
- igt_subtest_f("pipe-%s-torture-bo", kmstest_pipe_name(n))
- stress(&display, n, -ncpus, DRM_MODE_CURSOR_BO, 20);
- igt_subtest_f("pipe-%s-torture-move", kmstest_pipe_name(n))
- stress(&display, n, -ncpus, DRM_MODE_CURSOR_MOVE, 20);
+ errno = 0;
+ igt_dynamic("all-pipes")
+ stress(&display, -1, tests[i].ncpus, tests[i].flags, 20);
+ }
}
}
- /*Test description for pipe-* and all-pipe-* tests*/
igt_describe("Test checks how many cursor updates we can fit between vblanks "
"on all pipes with different modes, priority and number of processes");
igt_subtest_group {
-
- igt_subtest("all-pipes-single-bo")
- stress(&display, -1, 1, DRM_MODE_CURSOR_BO, 20);
- igt_subtest("all-pipes-single-move")
- stress(&display, -1, 1, DRM_MODE_CURSOR_MOVE, 20);
-
- igt_subtest("all-pipes-forked-bo")
- stress(&display, -1, ncpus, DRM_MODE_CURSOR_BO, 20);
- igt_subtest("all-pipes-forked-move")
- stress(&display, -1, ncpus, DRM_MODE_CURSOR_MOVE, 20);
-
- igt_subtest("all-pipes-torture-bo")
- stress(&display, -1, -ncpus, DRM_MODE_CURSOR_BO, 20);
- igt_subtest("all-pipes-torture-move")
- stress(&display, -1, -ncpus, DRM_MODE_CURSOR_MOVE, 20);
-
igt_subtest("nonblocking-modeset-vs-cursor-atomic")
nonblocking_modeset_vs_cursor(&display, 1);
@@ -1494,43 +1490,54 @@ igt_main
nonblocking_modeset_vs_cursor(&display, 16);
}
- /*Test Description for 2x-* tests*/
igt_describe("This test executes flips on both CRTCs "
"while running cursor updates in parallel");
igt_subtest_group {
+ struct {
+ const char *name;
+ int nloops;
+ bool modeset;
+ bool atomic;
+ } tests[] = {
+ { "2x-flip-vs-cursor-legacy", 8, false, false },
+ { "2x-flip-vs-cursor-atomic", 8, false, true },
+ { "2x-long-flip-vs-cursor-legacy", 150, false, false },
+ { "2x-long-flip-vs-cursor-atomic", 150, false, true },
+ { "2x-nonblocking-modeset-vs-cursor-atomic", 4, true, true },
+ { "2x-long-nonblocking-modeset-vs-cursor-atomic", 15, true, true },
+ };
- igt_subtest("2x-flip-vs-cursor-legacy")
- two_screens_flip_vs_cursor(&display, 8, false, false);
-
- igt_subtest("2x-flip-vs-cursor-atomic")
- two_screens_flip_vs_cursor(&display, 8, false, true);
-
- igt_subtest("2x-cursor-vs-flip-legacy")
- two_screens_cursor_vs_flip(&display, 8, false);
-
- igt_subtest("2x-long-flip-vs-cursor-legacy")
- two_screens_flip_vs_cursor(&display, 150, false, false);
-
- igt_subtest("2x-long-flip-vs-cursor-atomic")
- two_screens_flip_vs_cursor(&display, 150, false, true);
-
- igt_subtest("2x-long-cursor-vs-flip-legacy")
- two_screens_cursor_vs_flip(&display, 50, false);
-
- igt_subtest("2x-nonblocking-modeset-vs-cursor-atomic")
- two_screens_flip_vs_cursor(&display, 4, true, true);
-
- igt_subtest("2x-cursor-vs-flip-atomic")
- two_screens_cursor_vs_flip(&display, 8, true);
+ for (i = 0; i < ARRAY_SIZE(tests); i++) {
+ igt_subtest(tests[i].name)
+ two_screens_flip_vs_cursor(&display,
+ tests[i].nloops,
+ tests[i].modeset,
+ tests[i].atomic);
+ }
+ }
- igt_subtest("2x-long-nonblocking-modeset-vs-cursor-atomic")
- two_screens_flip_vs_cursor(&display, 15, true, true);
+ igt_describe("This test executes flips on both CRTCs "
+ "while running cursor updates in parallel");
+ igt_subtest_group {
+ struct {
+ const char *name;
+ int nloops;
+ bool atomic;
+ } tests[] = {
+ { "2x-cursor-vs-flip-legacy", 8, false },
+ { "2x-long-cursor-vs-flip-legacy", 50, false },
+ { "2x-cursor-vs-flip-atomic", 8, true },
+ { "2x-long-cursor-vs-flip-atomic", 50, true },
+ };
- igt_subtest("2x-long-cursor-vs-flip-atomic")
- two_screens_cursor_vs_flip(&display, 50, true);
+ for (i = 0; i < ARRAY_SIZE(tests); i++) {
+ igt_subtest(tests[i].name)
+ two_screens_cursor_vs_flip(&display,
+ tests[i].nloops,
+ tests[i].atomic);
+ }
}
- /*Test description for cursor-crc tests*/
igt_describe("Test will first does a page flip and then cursor update");
igt_subtest_group {
igt_fixture
@@ -1543,7 +1550,6 @@ igt_main
flip_vs_cursor_crc(&display, true);
}
- /*Test description for busy-crc tests*/
igt_describe("this test perform a busy bo update followed by a cursor update");
igt_subtest_group {
igt_fixture
@@ -1556,69 +1562,86 @@ igt_main
flip_vs_cursor_busy_crc(&display, true);
}
- for (i = 0; i <= flip_test_last; i++) {
- const char *modes[flip_test_last+1] = {
- "legacy",
- "varying-size",
- "toggle",
- "atomic",
- "atomic-transitions",
- "atomic-transitions-varying-size"
- };
- const char *prefix = "short-";
+ for (i = 0; i < ARRAY_SIZE(prefix); i++) {
+ int j;
- switch (i) {
- case flip_test_legacy:
- case flip_test_varying_size:
- case flip_test_atomic:
- prefix = "basic-";
- break;
- default: break;
- }
+ igt_describe("Adds variety of tests:\n"
+ "* varying-size: change the size of cursor b/w 64*64 to maxw x maxh.\n"
+ "* atomic-transition: alternates between a full screen sprite plane "
+ "and full screen primary plane.\n"
+ "* toggle: which toggles cursor visibility and make sure cursor moves between updates.");
+ igt_subtest_group {
+ igt_subtest_with_dynamic_f("%s-flip-before-cursor", prefix[i]) {
+ for (j = 0; j <= flip_test_last; j++) {
+ igt_dynamic_f("%s", modes[j])
+ basic_flip_cursor(&display, j, FLIP_BEFORE_CURSOR, 0);
+ }
+ }
- igt_describe("Adds variety of tests: "
- "varying-size: change the size of cursor b/w 64*64 to maxw x maxh. "
- "atomic-transition: alternates between a full screen sprite plane. "
- "and full screen primary plane. "
- "toggle: which toggles cursor visibility and make sure cursor moves between updates.");
- igt_subtest_group {
- igt_subtest_f("%sflip-before-cursor-%s", prefix, modes[i])
- basic_flip_cursor(&display, i, FLIP_BEFORE_CURSOR, 0);
-
- igt_subtest_f("%sbusy-flip-before-cursor-%s", prefix, modes[i]) {
- igt_require(!cursor_slowpath(&display, i));
- igt_require_gem(display.drm_fd);
- basic_flip_cursor(&display, i, FLIP_BEFORE_CURSOR,
- BASIC_BUSY);
- }
- }
+ igt_subtest_with_dynamic_f("%s-busy-flip-before-cursor", prefix[i]) {
+ igt_require(!cursor_slowpath(&display, i));
+ igt_require_gem(display.drm_fd);
- igt_describe("The essence of the basic test is that neither the cursor nor the "
- "nonblocking flip stall the application of the next");
- igt_subtest_group {
+ for (j = 0; j <= flip_test_last; j++) {
+ igt_dynamic_f("%s", modes[j])
+ basic_flip_cursor(&display, j, FLIP_BEFORE_CURSOR, BASIC_BUSY);
+ }
+ }
- igt_subtest_f("%sflip-after-cursor-%s", prefix, modes[i])
- basic_flip_cursor(&display, i, FLIP_AFTER_CURSOR, 0);
+ igt_subtest_with_dynamic_f("%s-flip-after-cursor", prefix[i]) {
+ for (j = 0; j <= flip_test_last; j++) {
+ igt_dynamic_f("%s", modes[j])
+ basic_flip_cursor(&display, j, FLIP_AFTER_CURSOR, 0);
+ }
+ }
+ }
+ }
- igt_subtest_f("flip-vs-cursor-%s", modes[i])
- flip_vs_cursor(&display, i, 150);
+ igt_describe("The essence of the basic test is that neither the cursor nor the "
+ "nonblocking flip stall the application of the next");
+ igt_subtest_group {
+ igt_subtest_with_dynamic("flip-vs-cursor") {
+ for (i = 0; i <= flip_test_last; i++) {
+ igt_dynamic_f("%s", modes[i])
+ flip_vs_cursor(&display, i, 150);
+ }
+ }
- igt_subtest_f("cursor-vs-flip-%s", modes[i])
- cursor_vs_flip(&display, i, 50);
+ igt_subtest_with_dynamic("cursor-vs-flip") {
+ for (i = 0; i <= flip_test_last; i++) {
+ igt_dynamic_f("%s", modes[i])
+ cursor_vs_flip(&display, i, 50);
+ }
+ }
- igt_subtest_f("cursorA-vs-flipA-%s", modes[i])
- flip(&display, 0, 0, 10, i);
+ igt_subtest_with_dynamic("cursorA-vs-flipA") {
+ for (i = 0; i <= flip_test_last; i++) {
+ igt_dynamic_f("%s", modes[i])
+ flip(&display, 0, 0, 10, i);
+ }
+ }
- igt_subtest_f("cursorA-vs-flipB-%s", modes[i])
- flip(&display, 0, 1, 10, i);
+ igt_subtest_with_dynamic("cursorA-vs-flipB") {
+ for (i = 0; i <= flip_test_last; i++) {
+ igt_dynamic_f("%s", modes[i])
+ flip(&display, 0, 1, 10, i);
+ }
+ }
- igt_subtest_f("cursorB-vs-flipA-%s", modes[i])
- flip(&display, 1, 0, 10, i);
+ igt_subtest_with_dynamic("cursorB-vs-flipA") {
+ for (i = 0; i <= flip_test_last; i++) {
+ igt_dynamic_f("%s", modes[i])
+ flip(&display, 1, 0, 10, i);
+ }
+ }
- igt_subtest_f("cursorB-vs-flipB-%s", modes[i])
- flip(&display, 1, 1, 10, i);
+ igt_subtest_with_dynamic("cursorB-vs-flipB") {
+ for (i = 0; i <= flip_test_last; i++) {
+ igt_dynamic_f("%s", modes[i])
+ flip(&display, 1, 1, 10, i);
}
}
+ }
igt_fixture {
if (intel_psr2_restore)