Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2 0/2] tests/kms_flip: Binary mode optimizations
@ 2018-06-13 12:58 Mika Kahola
  2018-06-13 12:58 ` [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_flip: Set duration for subtest from command line Mika Kahola
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Mika Kahola @ 2018-06-13 12:58 UTC (permalink / raw)
  To: igt-dev

kms_flip in binary mode takes considerable amount of time to complete.
These couple of patches introduces optimizations to the test. The first
patch sets the subtest duration to be a configurable command line parameter.
The second patch suggests the change in execution order so that all basic
subtests are executed first and after that move on to execute 2X tests.

For VIZ-14324

Mika Kahola (2):
  tests/kms_flip: Set duration for subtest from command line
  tests/kms_flip: Change 2x tests execution order

 tests/kms_flip.c | 122 ++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 85 insertions(+), 37 deletions(-)

-- 
2.7.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [igt-dev] [PATCH i-g-t 1/2] tests/kms_flip: Set duration for subtest from command line
@ 2018-06-12 11:19 Mika Kahola
  2018-06-13 11:30 ` [igt-dev] [PATCH i-g-t v2 " Mika Kahola
  0 siblings, 1 reply; 10+ messages in thread
From: Mika Kahola @ 2018-06-12 11:19 UTC (permalink / raw)
  To: igt-dev

To reduce the execution time of kms_flip test on CI, let's move subtest
duration parameter as command line option. The default subtest duration
is 0 seconds meaning that the subtest is run only once.

The patch reduces the kms_flip binary mode execution time on Geminilake from
1189 seconds down to 307 seconds with default subtest duration.

No functional changes on subtests.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 tests/kms_flip.c | 113 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 77 insertions(+), 36 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 3d6fe94..09aaac2 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -82,6 +82,8 @@
 #define DRM_CAP_TIMESTAMP_MONOTONIC 6
 #endif
 
+#define MAX_DURATION            60
+
 drmModeRes *resources;
 int drm_fd;
 static drm_intel_bufmgr *bufmgr;
@@ -95,6 +97,13 @@ static drmModeConnector *last_connector;
 
 uint32_t *fb_ptr;
 
+/* Command line parameters. */
+struct {
+	int duration;
+} opt = {
+	.duration = 0,
+};
+
 struct type_name {
 	int type;
 	const char *name;
@@ -1518,56 +1527,89 @@ static void test_nonblocking_read(int in)
 	close(fd);
 }
 
+static int opt_handler(int option, int option_index, void *input)
+{
+	switch (option) {
+	case 'd':
+		opt.duration = strtol(optarg, NULL, 0);
+
+		if (opt.duration > MAX_DURATION) {
+			igt_debug("limiting test duration from %ds to %ds\n",
+				  opt.duration, MAX_DURATION);
+			opt.duration = MAX_DURATION;
+		}
+
+		if (opt.duration < 0) {
+			igt_debug("limiting test duration from %ds to %ds\n",
+				  opt.duration, 0);
+			opt.duration = 0;
+		}
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	return 0;
+}
+
+const char *help_str =
+	"  --duration test duration in seconds (default 0s)\n";
+
 int main(int argc, char **argv)
 {
+	struct option long_options[] = {
+		{ "duration", required_argument, NULL, 'd'},
+		{ 0, 0, 0, 0 }
+	};
+
 	struct {
-		int duration;
 		int flags;
 		const char *name;
 	} tests[] = {
-		{ 30, TEST_VBLANK | TEST_CHECK_TS, "wf_vblank-ts-check" },
-		{ 30, TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_CHECK_TS,
+		{ TEST_VBLANK | TEST_CHECK_TS, "wf_vblank-ts-check" },
+		{ TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_CHECK_TS,
 					"blocking-wf_vblank" },
-		{ 30,  TEST_VBLANK | TEST_VBLANK_ABSOLUTE,
+		{ TEST_VBLANK | TEST_VBLANK_ABSOLUTE,
 					"absolute-wf_vblank" },
-		{ 30,  TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_VBLANK_ABSOLUTE,
+		{ TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_VBLANK_ABSOLUTE,
 					"blocking-absolute-wf_vblank" },
-		{ 10, TEST_FLIP | TEST_BASIC, "plain-flip" },
-		{ 30, TEST_FLIP | TEST_EBUSY , "busy-flip" },
-		{ 30, TEST_FLIP | TEST_FENCE_STRESS , "flip-vs-fences" },
-		{ 30, TEST_FLIP | TEST_CHECK_TS, "plain-flip-ts-check" },
-		{ 30, TEST_FLIP | TEST_CHECK_TS | TEST_FB_RECREATE,
+		{ TEST_FLIP | TEST_BASIC, "plain-flip" },
+		{ TEST_FLIP | TEST_EBUSY , "busy-flip" },
+		{ TEST_FLIP | TEST_FENCE_STRESS , "flip-vs-fences" },
+		{ TEST_FLIP | TEST_CHECK_TS, "plain-flip-ts-check" },
+		{ TEST_FLIP | TEST_CHECK_TS | TEST_FB_RECREATE,
 			"plain-flip-fb-recreate" },
-		{ 30, TEST_FLIP | TEST_RMFB | TEST_MODESET , "flip-vs-rmfb" },
-		{ 20, TEST_FLIP | TEST_DPMS | TEST_EINVAL | TEST_BASIC, "flip-vs-dpms" },
-		{ 30,  TEST_FLIP | TEST_PAN, "flip-vs-panning" },
-		{ 20, TEST_FLIP | TEST_MODESET | TEST_EINVAL | TEST_BASIC, "flip-vs-modeset" },
-		{ 30,  TEST_FLIP | TEST_VBLANK_EXPIRED_SEQ,
+		{ TEST_FLIP | TEST_RMFB | TEST_MODESET , "flip-vs-rmfb" },
+		{ TEST_FLIP | TEST_DPMS | TEST_EINVAL | TEST_BASIC, "flip-vs-dpms" },
+		{ TEST_FLIP | TEST_PAN, "flip-vs-panning" },
+		{ TEST_FLIP | TEST_MODESET | TEST_EINVAL | TEST_BASIC, "flip-vs-modeset" },
+		{ TEST_FLIP | TEST_VBLANK_EXPIRED_SEQ,
 					"flip-vs-expired-vblank" },
 
-		{ 30, TEST_FLIP | TEST_VBLANK | TEST_VBLANK_ABSOLUTE |
-		      TEST_CHECK_TS, "flip-vs-absolute-wf_vblank" },
-		{ 10, TEST_FLIP | TEST_VBLANK | TEST_CHECK_TS | TEST_BASIC,
+		{ TEST_FLIP | TEST_VBLANK | TEST_VBLANK_ABSOLUTE |
+		  TEST_CHECK_TS, "flip-vs-absolute-wf_vblank" },
+		{ TEST_FLIP | TEST_VBLANK | TEST_CHECK_TS | TEST_BASIC,
 					"flip-vs-wf_vblank" },
-		{ 30, TEST_FLIP | TEST_VBLANK | TEST_VBLANK_BLOCK |
-			TEST_CHECK_TS, "flip-vs-blocking-wf-vblank" },
-		{ 30, TEST_FLIP | TEST_MODESET | TEST_HANG | TEST_NOEVENT, "flip-vs-modeset-vs-hang" },
-		{ 30, TEST_FLIP | TEST_PAN | TEST_HANG, "flip-vs-panning-vs-hang" },
-		{ 1, TEST_FLIP | TEST_EINVAL | TEST_FB_BAD_TILING, "flip-vs-bad-tiling" },
+		{ TEST_FLIP | TEST_VBLANK | TEST_VBLANK_BLOCK |
+		  TEST_CHECK_TS, "flip-vs-blocking-wf-vblank" },
+		{ TEST_FLIP | TEST_MODESET | TEST_HANG | TEST_NOEVENT, "flip-vs-modeset-vs-hang" },
+		{ TEST_FLIP | TEST_PAN | TEST_HANG, "flip-vs-panning-vs-hang" },
+		{ TEST_FLIP | TEST_EINVAL | TEST_FB_BAD_TILING, "flip-vs-bad-tiling" },
 
-		{ 1, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP,
+		{ TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP,
 					"flip-vs-dpms-off-vs-modeset" },
-		{ 1, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP | TEST_SINGLE_BUFFER,
+		{ TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP | TEST_SINGLE_BUFFER,
 					"single-buffer-flip-vs-dpms-off-vs-modeset" },
-		{ 30, TEST_FLIP | TEST_NO_2X_OUTPUT | TEST_DPMS_OFF_OTHERS , "dpms-off-confusion" },
-		{ 0, TEST_ENOENT | TEST_NOEVENT, "nonexisting-fb" },
-		{ 10, TEST_DPMS_OFF | TEST_DPMS | TEST_VBLANK_RACE, "dpms-vs-vblank-race" },
-		{ 10, TEST_MODESET | TEST_VBLANK_RACE, "modeset-vs-vblank-race" },
-		{ 0, TEST_BO_TOOBIG | TEST_NO_2X_OUTPUT, "bo-too-big" },
+		{ TEST_FLIP | TEST_NO_2X_OUTPUT | TEST_DPMS_OFF_OTHERS , "dpms-off-confusion" },
+		{ TEST_ENOENT | TEST_NOEVENT, "nonexisting-fb" },
+		{ TEST_DPMS_OFF | TEST_DPMS | TEST_VBLANK_RACE, "dpms-vs-vblank-race" },
+		{ TEST_MODESET | TEST_VBLANK_RACE, "modeset-vs-vblank-race" },
+		{ TEST_BO_TOOBIG | TEST_NO_2X_OUTPUT, "bo-too-big" },
 	};
 	int i;
 
-	igt_subtest_init(argc, argv);
+	igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str,
+				    opt_handler, NULL);
 
 	igt_fixture {
 		drm_fd = drm_open_driver_master(DRIVER_ANY);
@@ -1592,7 +1634,7 @@ int main(int argc, char **argv)
 		igt_subtest_f("%s%s",
 			      tests[i].flags & TEST_BASIC ? "basic-" : "",
 			      tests[i].name)
-			run_test(tests[i].duration, tests[i].flags);
+			run_test(opt.duration, tests[i].flags);
 
 		if (tests[i].flags & TEST_NO_2X_OUTPUT)
 			continue;
@@ -1602,7 +1644,7 @@ int main(int argc, char **argv)
 			continue;
 
 		igt_subtest_f( "2x-%s", tests[i].name)
-			run_pair(tests[i].duration, tests[i].flags);
+			run_pair(opt.duration, tests[i].flags);
 	}
 
 	igt_fork_signal_helper();
@@ -1614,7 +1656,7 @@ int main(int argc, char **argv)
 			continue;
 
 		igt_subtest_f( "%s-interruptible", tests[i].name)
-			run_test(tests[i].duration, tests[i].flags);
+			run_test(opt.duration, tests[i].flags);
 
 		if (tests[i].flags & TEST_NO_2X_OUTPUT)
 			continue;
@@ -1624,7 +1666,7 @@ int main(int argc, char **argv)
 			continue;
 
 		igt_subtest_f( "2x-%s-interruptible", tests[i].name)
-			run_pair(tests[i].duration, tests[i].flags);
+			run_pair(opt.duration, tests[i].flags);
 	}
 	igt_stop_signal_helper();
 
@@ -1632,6 +1674,5 @@ int main(int argc, char **argv)
 	 * Let drm_fd leak, since it's needed by the dpms restore
 	 * exit_handler and igt_exit() won't return.
 	 */
-
 	igt_exit();
 }
-- 
2.7.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-06-14 10:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-13 12:58 [igt-dev] [PATCH i-g-t v2 0/2] tests/kms_flip: Binary mode optimizations Mika Kahola
2018-06-13 12:58 ` [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_flip: Set duration for subtest from command line Mika Kahola
2018-06-13 13:57   ` Ville Syrjälä
2018-06-14 10:40     ` Mika Kahola
2018-06-13 12:58 ` [igt-dev] [PATCH i-g-t v2 2/2] tests/kms_flip: Change 2x tests execution order Mika Kahola
2018-06-13 15:55 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_flip: Binary mode optimizations (rev3) Patchwork
2018-06-13 19:43 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-06-12 11:19 [igt-dev] [PATCH i-g-t 1/2] tests/kms_flip: Set duration for subtest from command line Mika Kahola
2018-06-13 11:30 ` [igt-dev] [PATCH i-g-t v2 " Mika Kahola
2018-06-13 12:07   ` Chris Wilson
2018-06-13 12:49     ` Mika Kahola

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox