All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
@ 2017-10-31 13:44 Imre Deak
  2017-10-31 14:05 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Imre Deak @ 2017-10-31 13:44 UTC (permalink / raw)
  To: intel-gfx

Doing modeset on internal panels may have a considerable overhead due to
the panel specific power sequencing delays. To avoid long test runtimes
limit the runtime of each subtest. Randomize the plane/pipe combinations
to preserve the test coverage on such panels at least over multiple test
runs.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103334
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 tests/kms_atomic_transition.c | 175 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 150 insertions(+), 25 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 4c295125..ac67fc3a 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -39,6 +39,14 @@
 #define DRM_CAP_CURSOR_HEIGHT 0x9
 #endif
 
+#define MAX_SUBTEST_DURATION_NS (20ULL * NSEC_PER_SEC)
+
+struct test_config {
+	igt_display_t *display;
+	bool user_seed;
+	int seed;
+};
+
 struct plane_parms {
 	struct igt_fb *fb;
 	uint32_t width, height;
@@ -401,6 +409,28 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
 	}
 }
 
+/* Copied from https://benpfaff.org/writings/clc/shuffle.html */
+static void shuffle_array(uint32_t *array, int size, int seed)
+{
+	int i;
+
+	for (i = 0; i < size; i++) {
+		int j = i + rand() / (RAND_MAX / (size - i) + 1);
+
+		igt_swap(array[i], array[j]);
+	}
+}
+
+static void init_combination_array(uint32_t *array, int size, int seed)
+{
+	int i;
+
+	for (i = 0; i < size; i++)
+		array[i] = i;
+
+	shuffle_array(array, size, seed);
+}
+
 /*
  * 1. Set primary plane to a known fb.
  * 2. Make sure getcrtc returns the correct fb id.
@@ -411,19 +441,27 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
  * so test this and make sure it works.
  */
 static void
-run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output,
-		enum transition_type type, bool nonblocking, bool fencing)
+run_transition_test(struct test_config *test_config, enum pipe pipe,
+		    igt_output_t *output, enum transition_type type,
+		    bool nonblocking, bool fencing)
 {
 	struct igt_fb fb, argb_fb, sprite_fb;
 	drmModeModeInfo *mode, override_mode;
+	igt_display_t *display = test_config->display;
 	igt_plane_t *plane;
 	igt_pipe_t *pipe_obj = &display->pipes[pipe];
 	uint32_t iter_max = 1 << pipe_obj->n_planes, i;
+	uint32_t *plane_combinations;
+	struct timespec start = { };
 	struct plane_parms parms[pipe_obj->n_planes];
 	bool skip_test = false;
 	unsigned flags = 0;
 	int ret;
 
+	plane_combinations = malloc(sizeof(*plane_combinations) * iter_max);
+	igt_assert(plane_combinations);
+	init_combination_array(plane_combinations, iter_max, test_config->seed);
+
 	if (fencing)
 		prepare_fencing(display, pipe);
 	else
@@ -527,39 +565,59 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 		goto cleanup;
 	}
 
+	igt_nsec_elapsed(&start);
+
 	for (i = 0; i < iter_max; i++) {
 		igt_output_set_pipe(output, pipe);
 
-		wm_setup_plane(display, pipe, i, parms, fencing);
+		wm_setup_plane(display, pipe, plane_combinations[i], parms,
+			       fencing);
 
-		atomic_commit(display, pipe, flags, (void *)(unsigned long)i, fencing);
+		atomic_commit(display, pipe, flags,
+			      (void *)(unsigned long)plane_combinations[i],
+			      fencing);
 		wait_for_transition(display, pipe, nonblocking, fencing);
 
 		if (type == TRANSITION_MODESET_DISABLE) {
+			if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
+				goto cleanup;
+
 			igt_output_set_pipe(output, PIPE_NONE);
 
 			wm_setup_plane(display, pipe, 0, parms, fencing);
 
 			atomic_commit(display, pipe, flags, (void *) 0UL, fencing);
 			wait_for_transition(display, pipe, nonblocking, fencing);
+
 		} else {
 			uint32_t j;
 
 			/* i -> i+1 will be done when i increases, can be skipped here */
 			for (j = iter_max - 1; j > i + 1; j--) {
-				wm_setup_plane(display, pipe, j, parms, fencing);
+				if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
+					goto cleanup;
+
+				wm_setup_plane(display, pipe,
+					       plane_combinations[j], parms,
+					       fencing);
 
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, &override_mode);
 
-				atomic_commit(display, pipe, flags, (void *)(unsigned long) j, fencing);
+				atomic_commit(display, pipe, flags,
+					      (void *)(unsigned long)plane_combinations[j],
+					      fencing);
 				wait_for_transition(display, pipe, nonblocking, fencing);
 
-				wm_setup_plane(display, pipe, i, parms, fencing);
+				wm_setup_plane(display, pipe,
+					       plane_combinations[i], parms,
+					       fencing);
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, NULL);
 
-				atomic_commit(display, pipe, flags, (void *)(unsigned long) i, fencing);
+				atomic_commit(display, pipe, flags,
+					      (void *)(unsigned long)plane_combinations[i],
+					      fencing);
 				wait_for_transition(display, pipe, nonblocking, fencing);
 			}
 		}
@@ -579,6 +637,9 @@ cleanup:
 	igt_remove_fb(display->drm_fd, &fb);
 	igt_remove_fb(display->drm_fd, &argb_fb);
 	igt_remove_fb(display->drm_fd, &sprite_fb);
+
+	free(plane_combinations);
+
 	if (skip_test)
 		igt_skip("Atomic nonblocking modesets are not supported.\n");
 }
@@ -696,16 +757,24 @@ static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned mask, igt_crc
 	}
 }
 
-static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblocking, bool fencing)
+static void run_modeset_tests(struct test_config *test_config, int howmany,
+			      bool nonblocking, bool fencing)
 {
+	igt_display_t *display = test_config->display;
 	struct igt_fb fbs[2];
 	int i, j;
 	unsigned iter_max = 1 << display->n_pipes;
+	uint32_t *pipe_combinations;
+	struct timespec start = { };
 	igt_pipe_crc_t *pipe_crcs[IGT_MAX_PIPES] = { 0 };
 	igt_output_t *output;
 	unsigned width = 0, height = 0;
 	bool skip_test = false;
 
+	pipe_combinations = malloc(sizeof(*pipe_combinations) * iter_max);
+	igt_assert(pipe_combinations);
+	init_combination_array(pipe_combinations, iter_max, test_config->seed);
+
 	for_each_connected_output(display, output) {
 		drmModeModeInfo *mode = igt_output_get_mode(output);
 
@@ -757,6 +826,8 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
+	igt_nsec_elapsed(&start);
+
 	for (i = 0; i < iter_max; i++) {
 		igt_crc_t crcs[5][IGT_MAX_PIPES];
 		unsigned event_mask;
@@ -773,6 +844,9 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 		collect_crcs_mask(pipe_crcs, i, crcs[0]);
 
 		for (j = iter_max - 1; j > i + 1; j--) {
+			if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
+				goto cleanup;
+
 			if (hweight32(j) > howmany)
 				continue;
 
@@ -828,13 +902,18 @@ cleanup:
 	igt_remove_fb(display->drm_fd, &fbs[1]);
 	igt_remove_fb(display->drm_fd, &fbs[0]);
 
+	free(pipe_combinations);
+
 	if (skip_test)
 		igt_skip("Atomic nonblocking modesets are not supported.\n");
 
 }
 
-static void run_modeset_transition(igt_display_t *display, int requested_outputs, bool nonblocking, bool fencing)
+static void run_modeset_transition(struct test_config *test_config,
+				   int requested_outputs, bool nonblocking,
+				   bool fencing)
 {
+	igt_display_t *display = test_config->display;
 	igt_output_t *outputs[IGT_MAX_PIPES] = {};
 	int num_outputs = 0;
 	enum pipe pipe;
@@ -861,16 +940,41 @@ static void run_modeset_transition(igt_display_t *display, int requested_outputs
 		      "Should have at least %i outputs, found %i\n",
 		      requested_outputs, num_outputs);
 
-	run_modeset_tests(display, requested_outputs, nonblocking, fencing);
+	run_modeset_tests(test_config, requested_outputs, nonblocking, fencing);
 }
 
-igt_main
+static int opt_handler(int option, int option_index, void *handler_data)
 {
+	struct test_config *test_config = handler_data;
+
+	switch (option) {
+	case 's':
+		test_config->user_seed = true;
+		test_config->seed = strtol(optarg, NULL, 0);
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	return 0;
+}
+
+int main(int argc, char **argv)
+{
+	const char *help_str =
+		"  --seed       Seed for random number generator\n";
+	struct option long_options[] = {
+		{ "seed",    required_argument, NULL, 's' },
+		{ },
+	};
+	struct test_config test_config = { };
 	igt_display_t display;
 	igt_output_t *output;
 	enum pipe pipe;
 	int i;
 
+	igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str,
+				    opt_handler, &test_config);
 	igt_skip_on_simulation();
 
 	igt_fixture {
@@ -883,6 +987,15 @@ igt_main
 		igt_require(display.is_atomic);
 
 		igt_display_require_output(&display);
+
+		test_config.display = &display;
+		if (!test_config.user_seed)
+			test_config.seed = time(NULL);
+
+		srand(test_config.seed);
+
+		igt_info("Running tests randomized with seed %d\n",
+			 test_config.seed);
 	}
 
 	igt_subtest("plane-primary-toggle-with-vblank-wait")
@@ -891,55 +1004,67 @@ igt_main
 
 	igt_subtest("plane-all-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false);
+			run_transition_test(&test_config, pipe, output,
+					    TRANSITION_PLANES, false, false);
 
 	igt_subtest("plane-all-transition-fencing")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, true);
+			run_transition_test(&test_config, pipe, output,
+					    TRANSITION_PLANES, false, true);
 
 	igt_subtest("plane-all-transition-nonblocking")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false);
+			run_transition_test(&test_config, pipe, output,
+					    TRANSITION_PLANES, true, false);
 
 	igt_subtest("plane-all-transition-nonblocking-fencing")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, true);
+			run_transition_test(&test_config, pipe, output,
+					    TRANSITION_PLANES, true, true);
 
 	igt_subtest("plane-use-after-nonblocking-unbind")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_AFTER_FREE, true, false);
+			run_transition_test(&test_config, pipe, output,
+					    TRANSITION_AFTER_FREE, true, false);
 
 	igt_subtest("plane-use-after-nonblocking-unbind-fencing")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_AFTER_FREE, true, true);
+			run_transition_test(&test_config, pipe, output,
+					    TRANSITION_AFTER_FREE, true, true);
 
 	igt_subtest("plane-all-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false);
+			run_transition_test(&test_config, pipe, output,
+					    TRANSITION_MODESET, false, false);
 
 	igt_subtest("plane-all-modeset-transition-fencing")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, true);
+			run_transition_test(&test_config, pipe, output,
+					    TRANSITION_MODESET, false, true);
 
 	igt_subtest("plane-toggle-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);
+			run_transition_test(&test_config, pipe, output,
+					    TRANSITION_MODESET_DISABLE,
+					    false, false);
 
 	for (i = 1; i <= IGT_MAX_PIPES; i++) {
 		igt_subtest_f("%ix-modeset-transitions", i)
-			run_modeset_transition(&display, i, false, false);
+			run_modeset_transition(&test_config, i, false, false);
 
 		igt_subtest_f("%ix-modeset-transitions-nonblocking", i)
-			run_modeset_transition(&display, i, true, false);
+			run_modeset_transition(&test_config, i, true, false);
 
 		igt_subtest_f("%ix-modeset-transitions-fencing", i)
-			run_modeset_transition(&display, i, false, true);
+			run_modeset_transition(&test_config, i, false, true);
 
 		igt_subtest_f("%ix-modeset-transitions-nonblocking-fencing", i)
-			run_modeset_transition(&display, i, true, true);
+			run_modeset_transition(&test_config, i, true, true);
 	}
 
 	igt_fixture {
 		igt_display_fini(&display);
 	}
+
+	igt_exit();
 }
-- 
2.13.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-10-31 13:44 [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations Imre Deak
@ 2017-10-31 14:05 ` Patchwork
  2017-10-31 14:46 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2017-10-31 14:05 UTC (permalink / raw)
  To: Imre Deak; +Cc: intel-gfx

== Series Details ==

Series: kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
URL   : https://patchwork.freedesktop.org/series/32905/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
7aac0e88606ce453b111ce80419dc58519db05ad assembler: Fix bashism in run-test.sh

with latest DRM-Tip kernel build CI_DRM_3300
dfe1410689e6 drm-tip: 2017y-10m-31d-09h-42m-59s UTC integration manifest

No testlist changes.

Test pm_rpm:
        Subgroup basic-rte:
                skip       -> PASS       (fi-hsw-4770r)
Test drv_module_reload:
        Subgroup basic-reload:
                pass       -> DMESG-WARN (fi-bsw-n3050) fdo#103479
        Subgroup basic-reload-inject:
                incomplete -> DMESG-WARN (fi-cfl-s) fdo#103206

fdo#103479 https://bugs.freedesktop.org/show_bug.cgi?id=103479
fdo#103206 https://bugs.freedesktop.org/show_bug.cgi?id=103206

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:445s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:376s
fi-bsw-n3050     total:289  pass:242  dwarn:1   dfail:0   fail:0   skip:46  time:534s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:268s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:501s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:502s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:501s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:480s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:559s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:603s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:425s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:249s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:576s
fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:483s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:428s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:432s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:425s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:486s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:463s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:483s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:571s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:476s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:588s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:548s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:457s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:592s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:651s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:519s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:507s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:454s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:566s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:422s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_450/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.IGT: success for kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-10-31 13:44 [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations Imre Deak
  2017-10-31 14:05 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-10-31 14:46 ` Patchwork
  2017-10-31 16:56 ` ✗ Fi.CI.BAT: failure " Patchwork
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2017-10-31 14:46 UTC (permalink / raw)
  To: Imre Deak; +Cc: intel-gfx

== Series Details ==

Series: kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
URL   : https://patchwork.freedesktop.org/series/32905/
State : success

== Summary ==

Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-A:
                dmesg-warn -> PASS       (shard-hsw) fdo#102249 +1
Test kms_flip:
        Subgroup plain-flip-fb-recreate-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#100368
Test perf:
        Subgroup polling:
                pass       -> FAIL       (shard-hsw) fdo#102252

fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252

shard-hsw        total:2539 pass:1431 dwarn:1   dfail:0   fail:10  skip:1097 time:9295s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_450/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.BAT: failure for kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-10-31 13:44 [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations Imre Deak
  2017-10-31 14:05 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-10-31 14:46 ` ✓ Fi.CI.IGT: " Patchwork
@ 2017-10-31 16:56 ` Patchwork
  2017-10-31 22:23 ` [PATCH i-g-t] " Chris Wilson
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2017-10-31 16:56 UTC (permalink / raw)
  To: Imre Deak; +Cc: intel-gfx

== Series Details ==

Series: kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
URL   : https://patchwork.freedesktop.org/series/32905/
State : failure

== Summary ==

IGT patchset tested on top of latest successful build
7aac0e88606ce453b111ce80419dc58519db05ad assembler: Fix bashism in run-test.sh

with latest DRM-Tip kernel build CI_DRM_3301
8bc65f660b98 drm-tip: 2017y-10m-31d-10h-44m-16s UTC integration manifest

No testlist changes.

Test gem_ctx_create:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-bsw-n3050)
Test kms_flip:
        Subgroup basic-flip-vs-dpms:
                pass       -> INCOMPLETE (fi-cnl-y)
Test kms_force_connector_basic:
        Subgroup force-connector-state:
                pass       -> SKIP       (fi-ivb-3520m)
        Subgroup force-edid:
                pass       -> SKIP       (fi-ivb-3520m)
        Subgroup force-load-detect:
                pass       -> SKIP       (fi-ivb-3520m)
        Subgroup prune-stale-modes:
                pass       -> SKIP       (fi-ivb-3520m)
Test kms_frontbuffer_tracking:
        Subgroup basic:
                pass       -> FAIL       (fi-glk-dsi) fdo#103167

fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:441s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:462s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:374s
fi-bsw-n3050     total:289  pass:242  dwarn:1   dfail:0   fail:0   skip:46  time:531s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:266s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:498s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:499s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:498s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:480s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:551s
fi-cnl-y         total:217  pass:196  dwarn:0   dfail:0   fail:0   skip:20 
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:431s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:252s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:578s
fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:490s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:435s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:431s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:425s
fi-ivb-3520m     total:289  pass:256  dwarn:0   dfail:0   fail:0   skip:33  time:484s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:462s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:474s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:574s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:474s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:589s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:543s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:452s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:590s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:648s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:521s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:499s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:456s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:567s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:421s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_451/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-10-31 13:44 [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations Imre Deak
                   ` (2 preceding siblings ...)
  2017-10-31 16:56 ` ✗ Fi.CI.BAT: failure " Patchwork
@ 2017-10-31 22:23 ` Chris Wilson
  2017-11-01  9:56   ` Imre Deak
  2017-11-01 10:05 ` ✗ Fi.CI.IGT: warning for " Patchwork
  2017-11-01 11:32 ` [PATCH i-g-t] " Maarten Lankhorst
  5 siblings, 1 reply; 13+ messages in thread
From: Chris Wilson @ 2017-10-31 22:23 UTC (permalink / raw)
  To: Imre Deak, intel-gfx

Quoting Imre Deak (2017-10-31 13:44:47)
> Doing modeset on internal panels may have a considerable overhead due to
> the panel specific power sequencing delays. To avoid long test runtimes
> limit the runtime of each subtest. Randomize the plane/pipe combinations
> to preserve the test coverage on such panels at least over multiple test
> runs.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103334
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  tests/kms_atomic_transition.c | 175 ++++++++++++++++++++++++++++++++++++------
>  1 file changed, 150 insertions(+), 25 deletions(-)
> 
> diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> index 4c295125..ac67fc3a 100644
> --- a/tests/kms_atomic_transition.c
> +++ b/tests/kms_atomic_transition.c
> @@ -39,6 +39,14 @@
>  #define DRM_CAP_CURSOR_HEIGHT 0x9
>  #endif
>  
> +#define MAX_SUBTEST_DURATION_NS (20ULL * NSEC_PER_SEC)
> +
> +struct test_config {
> +       igt_display_t *display;
> +       bool user_seed;
> +       int seed;
> +};
> +
>  struct plane_parms {
>         struct igt_fb *fb;
>         uint32_t width, height;
> @@ -401,6 +409,28 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
>         }
>  }
>  
> +/* Copied from https://benpfaff.org/writings/clc/shuffle.html */
> +static void shuffle_array(uint32_t *array, int size, int seed)
> +{
> +       int i;
> +
> +       for (i = 0; i < size; i++) {
> +               int j = i + rand() / (RAND_MAX / (size - i) + 1);
> +
> +               igt_swap(array[i], array[j]);
> +       }
> +}

igt_permute_array()

Not saying anything, but I was told using CI for stochastic coverage was
a flat no...
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-10-31 22:23 ` [PATCH i-g-t] " Chris Wilson
@ 2017-11-01  9:56   ` Imre Deak
  2017-11-01 10:48     ` Chris Wilson
  0 siblings, 1 reply; 13+ messages in thread
From: Imre Deak @ 2017-11-01  9:56 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Tue, Oct 31, 2017 at 10:23:25PM +0000, Chris Wilson wrote:
> Quoting Imre Deak (2017-10-31 13:44:47)
> > Doing modeset on internal panels may have a considerable overhead due to
> > the panel specific power sequencing delays. To avoid long test runtimes
> > limit the runtime of each subtest. Randomize the plane/pipe combinations
> > to preserve the test coverage on such panels at least over multiple test
> > runs.
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103334
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  tests/kms_atomic_transition.c | 175 ++++++++++++++++++++++++++++++++++++------
> >  1 file changed, 150 insertions(+), 25 deletions(-)
> > 
> > diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> > index 4c295125..ac67fc3a 100644
> > --- a/tests/kms_atomic_transition.c
> > +++ b/tests/kms_atomic_transition.c
> > @@ -39,6 +39,14 @@
> >  #define DRM_CAP_CURSOR_HEIGHT 0x9
> >  #endif
> >  
> > +#define MAX_SUBTEST_DURATION_NS (20ULL * NSEC_PER_SEC)
> > +
> > +struct test_config {
> > +       igt_display_t *display;
> > +       bool user_seed;
> > +       int seed;
> > +};
> > +
> >  struct plane_parms {
> >         struct igt_fb *fb;
> >         uint32_t width, height;
> > @@ -401,6 +409,28 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
> >         }
> >  }
> >  
> > +/* Copied from https://benpfaff.org/writings/clc/shuffle.html */
> > +static void shuffle_array(uint32_t *array, int size, int seed)
> > +{
> > +       int i;
> > +
> > +       for (i = 0; i < size; i++) {
> > +               int j = i + rand() / (RAND_MAX / (size - i) + 1);
> > +
> > +               igt_swap(array[i], array[j]);
> > +       }
> > +}
> 
> igt_permute_array()

Thanks, will use that instead.

> Not saying anything, but I was told using CI for stochastic coverage was
> a flat no...

Ok, but it would only be the case for slow panels where the alternative
is not to run the test at all. And is this a problem if we can replay a
failing case with --seed?

--Imre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.IGT: warning for kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-10-31 13:44 [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations Imre Deak
                   ` (3 preceding siblings ...)
  2017-10-31 22:23 ` [PATCH i-g-t] " Chris Wilson
@ 2017-11-01 10:05 ` Patchwork
  2017-11-01 11:32 ` [PATCH i-g-t] " Maarten Lankhorst
  5 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2017-11-01 10:05 UTC (permalink / raw)
  To: Imre Deak; +Cc: intel-gfx

== Series Details ==

Series: kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
URL   : https://patchwork.freedesktop.org/series/32905/
State : warning

== Summary ==

Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-A:
                dmesg-warn -> PASS       (shard-hsw)
        Subgroup extended-modeset-hang-oldfb-with-reset-render-B:
                pass       -> DMESG-WARN (shard-hsw)
Test kms_flip:
        Subgroup plain-flip-fb-recreate-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#100368
Test perf:
        Subgroup polling:
                pass       -> FAIL       (shard-hsw) fdo#102252

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252

shard-hsw        total:2539 pass:1431 dwarn:1   dfail:0   fail:10  skip:1097 time:9295s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_450/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-11-01  9:56   ` Imre Deak
@ 2017-11-01 10:48     ` Chris Wilson
  2017-11-01 11:08       ` Imre Deak
  0 siblings, 1 reply; 13+ messages in thread
From: Chris Wilson @ 2017-11-01 10:48 UTC (permalink / raw)
  To: imre.deak; +Cc: intel-gfx

Quoting Imre Deak (2017-11-01 09:56:22)
> On Tue, Oct 31, 2017 at 10:23:25PM +0000, Chris Wilson wrote:
> > Quoting Imre Deak (2017-10-31 13:44:47)
> > > Doing modeset on internal panels may have a considerable overhead due to
> > > the panel specific power sequencing delays. To avoid long test runtimes
> > > limit the runtime of each subtest. Randomize the plane/pipe combinations
> > > to preserve the test coverage on such panels at least over multiple test
> > > runs.
> > > 
> > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103334
> > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > > ---
> > >  tests/kms_atomic_transition.c | 175 ++++++++++++++++++++++++++++++++++++------
> > >  1 file changed, 150 insertions(+), 25 deletions(-)
> > > 
> > > diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> > > index 4c295125..ac67fc3a 100644
> > > --- a/tests/kms_atomic_transition.c
> > > +++ b/tests/kms_atomic_transition.c
> > > @@ -39,6 +39,14 @@
> > >  #define DRM_CAP_CURSOR_HEIGHT 0x9
> > >  #endif
> > >  
> > > +#define MAX_SUBTEST_DURATION_NS (20ULL * NSEC_PER_SEC)
> > > +
> > > +struct test_config {
> > > +       igt_display_t *display;
> > > +       bool user_seed;
> > > +       int seed;
> > > +};
> > > +
> > >  struct plane_parms {
> > >         struct igt_fb *fb;
> > >         uint32_t width, height;
> > > @@ -401,6 +409,28 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
> > >         }
> > >  }
> > >  
> > > +/* Copied from https://benpfaff.org/writings/clc/shuffle.html */
> > > +static void shuffle_array(uint32_t *array, int size, int seed)
> > > +{
> > > +       int i;
> > > +
> > > +       for (i = 0; i < size; i++) {
> > > +               int j = i + rand() / (RAND_MAX / (size - i) + 1);
> > > +
> > > +               igt_swap(array[i], array[j]);
> > > +       }
> > > +}
> > 
> > igt_permute_array()
> 
> Thanks, will use that instead.
> 
> > Not saying anything, but I was told using CI for stochastic coverage was
> > a flat no...
> 
> Ok, but it would only be the case for slow panels where the alternative
> is not to run the test at all. And is this a problem if we can replay a
> failing case with --seed?

If the purpose of CI is purely regression testing and not exploratory
debugging, each PW run must be with the same seed as the CI_DRM run.

The seed must be clearly displayed in the results so that when comparing
CI_DRM runs the flip-flop can be traced to the change in seed.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-11-01 10:48     ` Chris Wilson
@ 2017-11-01 11:08       ` Imre Deak
  2017-11-02 13:26         ` Imre Deak
  0 siblings, 1 reply; 13+ messages in thread
From: Imre Deak @ 2017-11-01 11:08 UTC (permalink / raw)
  To: Chris Wilson, Tomi P Sarvela, Petri Latvala; +Cc: intel-gfx

On Wed, Nov 01, 2017 at 10:48:50AM +0000, Chris Wilson wrote:
> Quoting Imre Deak (2017-11-01 09:56:22)
> > On Tue, Oct 31, 2017 at 10:23:25PM +0000, Chris Wilson wrote:
> > > Quoting Imre Deak (2017-10-31 13:44:47)
> > > > Doing modeset on internal panels may have a considerable overhead due to
> > > > the panel specific power sequencing delays. To avoid long test runtimes
> > > > limit the runtime of each subtest. Randomize the plane/pipe combinations
> > > > to preserve the test coverage on such panels at least over multiple test
> > > > runs.
> > > > 
> > > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103334
> > > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > > > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > > > ---
> > > >  tests/kms_atomic_transition.c | 175 ++++++++++++++++++++++++++++++++++++------
> > > >  1 file changed, 150 insertions(+), 25 deletions(-)
> > > > 
> > > > diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> > > > index 4c295125..ac67fc3a 100644
> > > > --- a/tests/kms_atomic_transition.c
> > > > +++ b/tests/kms_atomic_transition.c
> > > > @@ -39,6 +39,14 @@
> > > >  #define DRM_CAP_CURSOR_HEIGHT 0x9
> > > >  #endif
> > > >  
> > > > +#define MAX_SUBTEST_DURATION_NS (20ULL * NSEC_PER_SEC)
> > > > +
> > > > +struct test_config {
> > > > +       igt_display_t *display;
> > > > +       bool user_seed;
> > > > +       int seed;
> > > > +};
> > > > +
> > > >  struct plane_parms {
> > > >         struct igt_fb *fb;
> > > >         uint32_t width, height;
> > > > @@ -401,6 +409,28 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
> > > >         }
> > > >  }
> > > >  
> > > > +/* Copied from https://benpfaff.org/writings/clc/shuffle.html */
> > > > +static void shuffle_array(uint32_t *array, int size, int seed)
> > > > +{
> > > > +       int i;
> > > > +
> > > > +       for (i = 0; i < size; i++) {
> > > > +               int j = i + rand() / (RAND_MAX / (size - i) + 1);
> > > > +
> > > > +               igt_swap(array[i], array[j]);
> > > > +       }
> > > > +}
> > > 
> > > igt_permute_array()
> > 
> > Thanks, will use that instead.
> > 
> > > Not saying anything, but I was told using CI for stochastic coverage was
> > > a flat no...
> > 
> > Ok, but it would only be the case for slow panels where the alternative
> > is not to run the test at all. And is this a problem if we can replay a
> > failing case with --seed?
> 
> If the purpose of CI is purely regression testing and not exploratory
> debugging, each PW run must be with the same seed as the CI_DRM run.
> 
> The seed must be clearly displayed in the results so that when comparing
> CI_DRM runs the flip-flop can be traced to the change in seed.

Adding Petri and Tomi. So I guess the question is if we want this in CI
and if it's a reasonable effort to implement it.

--Imre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-10-31 13:44 [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations Imre Deak
                   ` (4 preceding siblings ...)
  2017-11-01 10:05 ` ✗ Fi.CI.IGT: warning for " Patchwork
@ 2017-11-01 11:32 ` Maarten Lankhorst
  2017-11-01 12:55   ` Imre Deak
  5 siblings, 1 reply; 13+ messages in thread
From: Maarten Lankhorst @ 2017-11-01 11:32 UTC (permalink / raw)
  To: Imre Deak, intel-gfx

Op 31-10-17 om 14:44 schreef Imre Deak:
> Doing modeset on internal panels may have a considerable overhead due to
> the panel specific power sequencing delays. To avoid long test runtimes
> limit the runtime of each subtest. Randomize the plane/pipe combinations
> to preserve the test coverage on such panels at least over multiple test
> runs.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103334
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  tests/kms_atomic_transition.c | 175 ++++++++++++++++++++++++++++++++++++------
>  1 file changed, 150 insertions(+), 25 deletions(-)
>
> diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> index 4c295125..ac67fc3a 100644
> --- a/tests/kms_atomic_transition.c
> +++ b/tests/kms_atomic_transition.c
> @@ -39,6 +39,14 @@
>  #define DRM_CAP_CURSOR_HEIGHT 0x9
>  #endif
>  
> +#define MAX_SUBTEST_DURATION_NS (20ULL * NSEC_PER_SEC)
> +
> +struct test_config {
> +	igt_display_t *display;
> +	bool user_seed;
> +	int seed;
> +};
> +
>  struct plane_parms {
>  	struct igt_fb *fb;
>  	uint32_t width, height;
> @@ -401,6 +409,28 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
>  	}
>  }
>  
> +/* Copied from https://benpfaff.org/writings/clc/shuffle.html */
> +static void shuffle_array(uint32_t *array, int size, int seed)
> +{
> +	int i;
> +
> +	for (i = 0; i < size; i++) {
> +		int j = i + rand() / (RAND_MAX / (size - i) + 1);
> +
> +		igt_swap(array[i], array[j]);
> +	}
> +}
I wouldn't worry about predictibility of the random number generator..

int j = i + rand() % (size - i) is good enough and easier to read. :)

I think the struct test_config can be killed too, since it goes unused in shuffle_array, nothing in the test uses it...
> +static void init_combination_array(uint32_t *array, int size, int seed)
> +{
> +	int i;
> +
> +	for (i = 0; i < size; i++)
> +		array[i] = i;
> +
> +	shuffle_array(array, size, seed);
> +}
> +
>  /*
>   * 1. Set primary plane to a known fb.
>   * 2. Make sure getcrtc returns the correct fb id.
> @@ -411,19 +441,27 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
>   * so test this and make sure it works.
>   */
>  static void
> -run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output,
> -		enum transition_type type, bool nonblocking, bool fencing)
> +run_transition_test(struct test_config *test_config, enum pipe pipe,
> +		    igt_output_t *output, enum transition_type type,
> +		    bool nonblocking, bool fencing)
>  {
>  	struct igt_fb fb, argb_fb, sprite_fb;
>  	drmModeModeInfo *mode, override_mode;
> +	igt_display_t *display = test_config->display;
>  	igt_plane_t *plane;
>  	igt_pipe_t *pipe_obj = &display->pipes[pipe];
>  	uint32_t iter_max = 1 << pipe_obj->n_planes, i;
> +	uint32_t *plane_combinations;
> +	struct timespec start = { };
>  	struct plane_parms parms[pipe_obj->n_planes];
>  	bool skip_test = false;
>  	unsigned flags = 0;
>  	int ret;
>  
> +	plane_combinations = malloc(sizeof(*plane_combinations) * iter_max);
> +	igt_assert(plane_combinations);
> +	init_combination_array(plane_combinations, iter_max, test_config->seed);
It would be cleaner to have a separate test for transition_modeset. The rest should be run to completion
and don't need shuffling, since in normal cases, they'll never hit a timeout.

So make a separate test for that, and perhaps also add a flag for disabling the timeout.

>  	if (fencing)
>  		prepare_fencing(display, pipe);
>  	else
> @@ -527,39 +565,59 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
>  		goto cleanup;
>  	}
>  
> +	igt_nsec_elapsed(&start);
> +
>  	for (i = 0; i < iter_max; i++) {
>  		igt_output_set_pipe(output, pipe);
>  
> -		wm_setup_plane(display, pipe, i, parms, fencing);
> +		wm_setup_plane(display, pipe, plane_combinations[i], parms,
> +			       fencing);
>  
> -		atomic_commit(display, pipe, flags, (void *)(unsigned long)i, fencing);
> +		atomic_commit(display, pipe, flags,
> +			      (void *)(unsigned long)plane_combinations[i],
> +			      fencing);
>  		wait_for_transition(display, pipe, nonblocking, fencing);
>  
>  		if (type == TRANSITION_MODESET_DISABLE) {
> +			if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
> +				goto cleanup;
> +
>  			igt_output_set_pipe(output, PIPE_NONE);
>  
>  			wm_setup_plane(display, pipe, 0, parms, fencing);
>  
>  			atomic_commit(display, pipe, flags, (void *) 0UL, fencing);
>  			wait_for_transition(display, pipe, nonblocking, fencing);
> +
>  		} else {
>  			uint32_t j;
>  
>  			/* i -> i+1 will be done when i increases, can be skipped here */
>  			for (j = iter_max - 1; j > i + 1; j--) {
> -				wm_setup_plane(display, pipe, j, parms, fencing);
> +				if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
> +					goto cleanup;
> +
> +				wm_setup_plane(display, pipe,
> +					       plane_combinations[j], parms,
> +					       fencing);
>  
>  				if (type == TRANSITION_MODESET)
>  					igt_output_override_mode(output, &override_mode);
>  
> -				atomic_commit(display, pipe, flags, (void *)(unsigned long) j, fencing);
> +				atomic_commit(display, pipe, flags,
> +					      (void *)(unsigned long)plane_combinations[j],
> +					      fencing);
>  				wait_for_transition(display, pipe, nonblocking, fencing);
>  
> -				wm_setup_plane(display, pipe, i, parms, fencing);
> +				wm_setup_plane(display, pipe,
> +					       plane_combinations[i], parms,
> +					       fencing);
>  				if (type == TRANSITION_MODESET)
>  					igt_output_override_mode(output, NULL);
>  
> -				atomic_commit(display, pipe, flags, (void *)(unsigned long) i, fencing);
> +				atomic_commit(display, pipe, flags,
> +					      (void *)(unsigned long)plane_combinations[i],
> +					      fencing);
>  				wait_for_transition(display, pipe, nonblocking, fencing);
>  			}
>  		}
> @@ -579,6 +637,9 @@ cleanup:
>  	igt_remove_fb(display->drm_fd, &fb);
>  	igt_remove_fb(display->drm_fd, &argb_fb);
>  	igt_remove_fb(display->drm_fd, &sprite_fb);
> +
> +	free(plane_combinations);
> +
>  	if (skip_test)
>  		igt_skip("Atomic nonblocking modesets are not supported.\n");
>  }
> @@ -696,16 +757,24 @@ static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned mask, igt_crc
>  	}
>  }
>  
> -static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblocking, bool fencing)
> +static void run_modeset_tests(struct test_config *test_config, int howmany,
> +			      bool nonblocking, bool fencing)
>  {
> +	igt_display_t *display = test_config->display;
>  	struct igt_fb fbs[2];
>  	int i, j;
>  	unsigned iter_max = 1 << display->n_pipes;
> +	uint32_t *pipe_combinations;
> +	struct timespec start = { };
>  	igt_pipe_crc_t *pipe_crcs[IGT_MAX_PIPES] = { 0 };
>  	igt_output_t *output;
>  	unsigned width = 0, height = 0;
>  	bool skip_test = false;
>  
> +	pipe_combinations = malloc(sizeof(*pipe_combinations) * iter_max);
> +	igt_assert(pipe_combinations);
> +	init_combination_array(pipe_combinations, iter_max, test_config->seed);
Kill all the changes to run_modeset_tests too please? The randomness here goes unused, and I would rather have it run all the modesetting combinations.
I can understand plane transitions taking too long, but the modeset tests are typically very short.
>  	for_each_connected_output(display, output) {
>  		drmModeModeInfo *mode = igt_output_get_mode(output);
>  
> @@ -757,6 +826,8 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
>  
>  	igt_display_commit2(display, COMMIT_ATOMIC);
>  
> +	igt_nsec_elapsed(&start);
> +
>  	for (i = 0; i < iter_max; i++) {
>  		igt_crc_t crcs[5][IGT_MAX_PIPES];
>  		unsigned event_mask;
> @@ -773,6 +844,9 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
>  		collect_crcs_mask(pipe_crcs, i, crcs[0]);
>  
>  		for (j = iter_max - 1; j > i + 1; j--) {
> +			if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
> +				goto cleanup;
> +
>  			if (hweight32(j) > howmany)
>  				continue;
>  
> @@ -828,13 +902,18 @@ cleanup:
>  	igt_remove_fb(display->drm_fd, &fbs[1]);
>  	igt_remove_fb(display->drm_fd, &fbs[0]);
>  
> +	free(pipe_combinations);
> +
>  	if (skip_test)
>  		igt_skip("Atomic nonblocking modesets are not supported.\n");
>  
>  }
>  
> -static void run_modeset_transition(igt_display_t *display, int requested_outputs, bool nonblocking, bool fencing)
> +static void run_modeset_transition(struct test_config *test_config,
> +				   int requested_outputs, bool nonblocking,
> +				   bool fencing)
>  {
> +	igt_display_t *display = test_config->display;
>  	igt_output_t *outputs[IGT_MAX_PIPES] = {};
>  	int num_outputs = 0;
>  	enum pipe pipe;
> @@ -861,16 +940,41 @@ static void run_modeset_transition(igt_display_t *display, int requested_outputs
>  		      "Should have at least %i outputs, found %i\n",
>  		      requested_outputs, num_outputs);
>  
> -	run_modeset_tests(display, requested_outputs, nonblocking, fencing);
> +	run_modeset_tests(test_config, requested_outputs, nonblocking, fencing);
>  }
>  
> -igt_main
> +static int opt_handler(int option, int option_index, void *handler_data)
>  {
> +	struct test_config *test_config = handler_data;
> +
> +	switch (option) {
> +	case 's':
> +		test_config->user_seed = true;
> +		test_config->seed = strtol(optarg, NULL, 0);
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +
> +	return 0;
> +}
> +
> +int main(int argc, char **argv)
> +{
> +	const char *help_str =
> +		"  --seed       Seed for random number generator\n";
> +	struct option long_options[] = {
> +		{ "seed",    required_argument, NULL, 's' },
> +		{ },
> +	};
> +	struct test_config test_config = { };
>  	igt_display_t display;
>  	igt_output_t *output;
>  	enum pipe pipe;
>  	int i;
>  
> +	igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str,
> +				    opt_handler, &test_config);
>  	igt_skip_on_simulation();
>  
>  	igt_fixture {
> @@ -883,6 +987,15 @@ igt_main
>  		igt_require(display.is_atomic);
>  
>  		igt_display_require_output(&display);
> +
> +		test_config.display = &display;
> +		if (!test_config.user_seed)
> +			test_config.seed = time(NULL);
> +
> +		srand(test_config.seed);
> +
> +		igt_info("Running tests randomized with seed %d\n",
> +			 test_config.seed);
>  	}
>  
>  	igt_subtest("plane-primary-toggle-with-vblank-wait")
> @@ -891,55 +1004,67 @@ igt_main
>  
>  	igt_subtest("plane-all-transition")
>  		for_each_pipe_with_valid_output(&display, pipe, output)
> -			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false);
> +			run_transition_test(&test_config, pipe, output,
> +					    TRANSITION_PLANES, false, false);
>  
>  	igt_subtest("plane-all-transition-fencing")
>  		for_each_pipe_with_valid_output(&display, pipe, output)
> -			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, true);
> +			run_transition_test(&test_config, pipe, output,
> +					    TRANSITION_PLANES, false, true);
>  
>  	igt_subtest("plane-all-transition-nonblocking")
>  		for_each_pipe_with_valid_output(&display, pipe, output)
> -			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false);
> +			run_transition_test(&test_config, pipe, output,
> +					    TRANSITION_PLANES, true, false);
>  
>  	igt_subtest("plane-all-transition-nonblocking-fencing")
>  		for_each_pipe_with_valid_output(&display, pipe, output)
> -			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, true);
> +			run_transition_test(&test_config, pipe, output,
> +					    TRANSITION_PLANES, true, true);
>  
>  	igt_subtest("plane-use-after-nonblocking-unbind")
>  		for_each_pipe_with_valid_output(&display, pipe, output)
> -			run_transition_test(&display, pipe, output, TRANSITION_AFTER_FREE, true, false);
> +			run_transition_test(&test_config, pipe, output,
> +					    TRANSITION_AFTER_FREE, true, false);
>  
>  	igt_subtest("plane-use-after-nonblocking-unbind-fencing")
>  		for_each_pipe_with_valid_output(&display, pipe, output)
> -			run_transition_test(&display, pipe, output, TRANSITION_AFTER_FREE, true, true);
> +			run_transition_test(&test_config, pipe, output,
> +					    TRANSITION_AFTER_FREE, true, true);
>  
>  	igt_subtest("plane-all-modeset-transition")
>  		for_each_pipe_with_valid_output(&display, pipe, output)
> -			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false);
> +			run_transition_test(&test_config, pipe, output,
> +					    TRANSITION_MODESET, false, false);
>  
>  	igt_subtest("plane-all-modeset-transition-fencing")
>  		for_each_pipe_with_valid_output(&display, pipe, output)
> -			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, true);
> +			run_transition_test(&test_config, pipe, output,
> +					    TRANSITION_MODESET, false, true);
>  
>  	igt_subtest("plane-toggle-modeset-transition")
>  		for_each_pipe_with_valid_output(&display, pipe, output)
> -			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);
> +			run_transition_test(&test_config, pipe, output,
> +					    TRANSITION_MODESET_DISABLE,
> +					    false, false);
>  
>  	for (i = 1; i <= IGT_MAX_PIPES; i++) {
>  		igt_subtest_f("%ix-modeset-transitions", i)
> -			run_modeset_transition(&display, i, false, false);
> +			run_modeset_transition(&test_config, i, false, false);
>  
>  		igt_subtest_f("%ix-modeset-transitions-nonblocking", i)
> -			run_modeset_transition(&display, i, true, false);
> +			run_modeset_transition(&test_config, i, true, false);
>  
>  		igt_subtest_f("%ix-modeset-transitions-fencing", i)
> -			run_modeset_transition(&display, i, false, true);
> +			run_modeset_transition(&test_config, i, false, true);
>  
>  		igt_subtest_f("%ix-modeset-transitions-nonblocking-fencing", i)
> -			run_modeset_transition(&display, i, true, true);
> +			run_modeset_transition(&test_config, i, true, true);
>  	}
>  
>  	igt_fixture {
>  		igt_display_fini(&display);
>  	}
> +
> +	igt_exit();
>  }


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-11-01 11:32 ` [PATCH i-g-t] " Maarten Lankhorst
@ 2017-11-01 12:55   ` Imre Deak
  2017-11-01 14:23     ` Maarten Lankhorst
  0 siblings, 1 reply; 13+ messages in thread
From: Imre Deak @ 2017-11-01 12:55 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx

On Wed, Nov 01, 2017 at 12:32:37PM +0100, Maarten Lankhorst wrote:
> Op 31-10-17 om 14:44 schreef Imre Deak:
> > Doing modeset on internal panels may have a considerable overhead due to
> > the panel specific power sequencing delays. To avoid long test runtimes
> > limit the runtime of each subtest. Randomize the plane/pipe combinations
> > to preserve the test coverage on such panels at least over multiple test
> > runs.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103334
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  tests/kms_atomic_transition.c | 175 ++++++++++++++++++++++++++++++++++++------
> >  1 file changed, 150 insertions(+), 25 deletions(-)
> >
> > diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> > index 4c295125..ac67fc3a 100644
> > --- a/tests/kms_atomic_transition.c
> > +++ b/tests/kms_atomic_transition.c
> > @@ -39,6 +39,14 @@
> >  #define DRM_CAP_CURSOR_HEIGHT 0x9
> >  #endif
> >  
> > +#define MAX_SUBTEST_DURATION_NS (20ULL * NSEC_PER_SEC)
> > +
> > +struct test_config {
> > +	igt_display_t *display;
> > +	bool user_seed;
> > +	int seed;
> > +};
> > +
> >  struct plane_parms {
> >  	struct igt_fb *fb;
> >  	uint32_t width, height;
> > @@ -401,6 +409,28 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
> >  	}
> >  }
> >  
> > +/* Copied from https://benpfaff.org/writings/clc/shuffle.html */
> > +static void shuffle_array(uint32_t *array, int size, int seed)
> > +{
> > +	int i;
> > +
> > +	for (i = 0; i < size; i++) {
> > +		int j = i + rand() / (RAND_MAX / (size - i) + 1);
> > +
> > +		igt_swap(array[i], array[j]);
> > +	}
> > +}
> I wouldn't worry about predictibility of the random number generator..
> 
> int j = i + rand() % (size - i) is good enough and easier to read. :)

Chris already suggested igt_permute_array(), will use that.

> 
> I think the struct test_config can be killed too, since it goes unused
> in shuffle_array, nothing in the test uses it...

Oops, some kind of left-over from an earlier version. Thanks for spotting
it.

> > +static void init_combination_array(uint32_t *array, int size, int seed)
> > +{
> > +	int i;
> > +
> > +	for (i = 0; i < size; i++)
> > +		array[i] = i;
> > +
> > +	shuffle_array(array, size, seed);
> > +}
> > +
> >  /*
> >   * 1. Set primary plane to a known fb.
> >   * 2. Make sure getcrtc returns the correct fb id.
> > @@ -411,19 +441,27 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
> >   * so test this and make sure it works.
> >   */
> >  static void
> > -run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output,
> > -		enum transition_type type, bool nonblocking, bool fencing)
> > +run_transition_test(struct test_config *test_config, enum pipe pipe,
> > +		    igt_output_t *output, enum transition_type type,
> > +		    bool nonblocking, bool fencing)
> >  {
> >  	struct igt_fb fb, argb_fb, sprite_fb;
> >  	drmModeModeInfo *mode, override_mode;
> > +	igt_display_t *display = test_config->display;
> >  	igt_plane_t *plane;
> >  	igt_pipe_t *pipe_obj = &display->pipes[pipe];
> >  	uint32_t iter_max = 1 << pipe_obj->n_planes, i;
> > +	uint32_t *plane_combinations;
> > +	struct timespec start = { };
> >  	struct plane_parms parms[pipe_obj->n_planes];
> >  	bool skip_test = false;
> >  	unsigned flags = 0;
> >  	int ret;
> >  
> > +	plane_combinations = malloc(sizeof(*plane_combinations) * iter_max);
> > +	igt_assert(plane_combinations);
> > +	init_combination_array(plane_combinations, iter_max, test_config->seed);
> It would be cleaner to have a separate test for transition_modeset.
> The rest should be run to completion and don't need shuffling, since
> in normal cases, they'll never hit a timeout.

Do you mean type == TRANSITION_MODESET? There are already separate
subtests for that. Yes, can disable the timeout and shuffling for the
rest.

> So make a separate test for that, and perhaps also add a flag for
> disabling the timeout.

Ok.

> 
> >  	if (fencing)
> >  		prepare_fencing(display, pipe);
> >  	else
> > @@ -527,39 +565,59 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
> >  		goto cleanup;
> >  	}
> >  
> > +	igt_nsec_elapsed(&start);
> > +
> >  	for (i = 0; i < iter_max; i++) {
> >  		igt_output_set_pipe(output, pipe);
> >  
> > -		wm_setup_plane(display, pipe, i, parms, fencing);
> > +		wm_setup_plane(display, pipe, plane_combinations[i], parms,
> > +			       fencing);
> >  
> > -		atomic_commit(display, pipe, flags, (void *)(unsigned long)i, fencing);
> > +		atomic_commit(display, pipe, flags,
> > +			      (void *)(unsigned long)plane_combinations[i],
> > +			      fencing);
> >  		wait_for_transition(display, pipe, nonblocking, fencing);
> >  
> >  		if (type == TRANSITION_MODESET_DISABLE) {
> > +			if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
> > +				goto cleanup;
> > +
> >  			igt_output_set_pipe(output, PIPE_NONE);
> >  
> >  			wm_setup_plane(display, pipe, 0, parms, fencing);
> >  
> >  			atomic_commit(display, pipe, flags, (void *) 0UL, fencing);
> >  			wait_for_transition(display, pipe, nonblocking, fencing);
> > +
> >  		} else {
> >  			uint32_t j;
> >  
> >  			/* i -> i+1 will be done when i increases, can be skipped here */
> >  			for (j = iter_max - 1; j > i + 1; j--) {
> > -				wm_setup_plane(display, pipe, j, parms, fencing);
> > +				if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
> > +					goto cleanup;
> > +
> > +				wm_setup_plane(display, pipe,
> > +					       plane_combinations[j], parms,
> > +					       fencing);
> >  
> >  				if (type == TRANSITION_MODESET)
> >  					igt_output_override_mode(output, &override_mode);
> >  
> > -				atomic_commit(display, pipe, flags, (void *)(unsigned long) j, fencing);
> > +				atomic_commit(display, pipe, flags,
> > +					      (void *)(unsigned long)plane_combinations[j],
> > +					      fencing);
> >  				wait_for_transition(display, pipe, nonblocking, fencing);
> >  
> > -				wm_setup_plane(display, pipe, i, parms, fencing);
> > +				wm_setup_plane(display, pipe,
> > +					       plane_combinations[i], parms,
> > +					       fencing);
> >  				if (type == TRANSITION_MODESET)
> >  					igt_output_override_mode(output, NULL);
> >  
> > -				atomic_commit(display, pipe, flags, (void *)(unsigned long) i, fencing);
> > +				atomic_commit(display, pipe, flags,
> > +					      (void *)(unsigned long)plane_combinations[i],
> > +					      fencing);
> >  				wait_for_transition(display, pipe, nonblocking, fencing);
> >  			}
> >  		}
> > @@ -579,6 +637,9 @@ cleanup:
> >  	igt_remove_fb(display->drm_fd, &fb);
> >  	igt_remove_fb(display->drm_fd, &argb_fb);
> >  	igt_remove_fb(display->drm_fd, &sprite_fb);
> > +
> > +	free(plane_combinations);
> > +
> >  	if (skip_test)
> >  		igt_skip("Atomic nonblocking modesets are not supported.\n");
> >  }
> > @@ -696,16 +757,24 @@ static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned mask, igt_crc
> >  	}
> >  }
> >  
> > -static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblocking, bool fencing)
> > +static void run_modeset_tests(struct test_config *test_config, int howmany,
> > +			      bool nonblocking, bool fencing)
> >  {
> > +	igt_display_t *display = test_config->display;
> >  	struct igt_fb fbs[2];
> >  	int i, j;
> >  	unsigned iter_max = 1 << display->n_pipes;
> > +	uint32_t *pipe_combinations;
> > +	struct timespec start = { };
> >  	igt_pipe_crc_t *pipe_crcs[IGT_MAX_PIPES] = { 0 };
> >  	igt_output_t *output;
> >  	unsigned width = 0, height = 0;
> >  	bool skip_test = false;
> >  
> > +	pipe_combinations = malloc(sizeof(*pipe_combinations) * iter_max);
> > +	igt_assert(pipe_combinations);
> > +	init_combination_array(pipe_combinations, iter_max, test_config->seed);
>
> Kill all the changes to run_modeset_tests too please? The randomness
> here goes unused, and I would rather have it run all the modesetting
> combinations.  I can understand plane transitions taking too long, but
> the modeset tests are typically very short.

IIUC with 3 pipes it's 27 iterations, so with 2 full modesets per iteration it
can take ~1 minute using slow panels. The same with 4 pipes would take ~4
minutes.

> >  	for_each_connected_output(display, output) {
> >  		drmModeModeInfo *mode = igt_output_get_mode(output);
> >  
> > @@ -757,6 +826,8 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
> >  
> >  	igt_display_commit2(display, COMMIT_ATOMIC);
> >  
> > +	igt_nsec_elapsed(&start);
> > +
> >  	for (i = 0; i < iter_max; i++) {
> >  		igt_crc_t crcs[5][IGT_MAX_PIPES];
> >  		unsigned event_mask;
> > @@ -773,6 +844,9 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
> >  		collect_crcs_mask(pipe_crcs, i, crcs[0]);
> >  
> >  		for (j = iter_max - 1; j > i + 1; j--) {
> > +			if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
> > +				goto cleanup;
> > +
> >  			if (hweight32(j) > howmany)
> >  				continue;
> >  
> > @@ -828,13 +902,18 @@ cleanup:
> >  	igt_remove_fb(display->drm_fd, &fbs[1]);
> >  	igt_remove_fb(display->drm_fd, &fbs[0]);
> >  
> > +	free(pipe_combinations);
> > +
> >  	if (skip_test)
> >  		igt_skip("Atomic nonblocking modesets are not supported.\n");
> >  
> >  }
> >  
> > -static void run_modeset_transition(igt_display_t *display, int requested_outputs, bool nonblocking, bool fencing)
> > +static void run_modeset_transition(struct test_config *test_config,
> > +				   int requested_outputs, bool nonblocking,
> > +				   bool fencing)
> >  {
> > +	igt_display_t *display = test_config->display;
> >  	igt_output_t *outputs[IGT_MAX_PIPES] = {};
> >  	int num_outputs = 0;
> >  	enum pipe pipe;
> > @@ -861,16 +940,41 @@ static void run_modeset_transition(igt_display_t *display, int requested_outputs
> >  		      "Should have at least %i outputs, found %i\n",
> >  		      requested_outputs, num_outputs);
> >  
> > -	run_modeset_tests(display, requested_outputs, nonblocking, fencing);
> > +	run_modeset_tests(test_config, requested_outputs, nonblocking, fencing);
> >  }
> >  
> > -igt_main
> > +static int opt_handler(int option, int option_index, void *handler_data)
> >  {
> > +	struct test_config *test_config = handler_data;
> > +
> > +	switch (option) {
> > +	case 's':
> > +		test_config->user_seed = true;
> > +		test_config->seed = strtol(optarg, NULL, 0);
> > +		break;
> > +	default:
> > +		igt_assert(false);
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +int main(int argc, char **argv)
> > +{
> > +	const char *help_str =
> > +		"  --seed       Seed for random number generator\n";
> > +	struct option long_options[] = {
> > +		{ "seed",    required_argument, NULL, 's' },
> > +		{ },
> > +	};
> > +	struct test_config test_config = { };
> >  	igt_display_t display;
> >  	igt_output_t *output;
> >  	enum pipe pipe;
> >  	int i;
> >  
> > +	igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str,
> > +				    opt_handler, &test_config);
> >  	igt_skip_on_simulation();
> >  
> >  	igt_fixture {
> > @@ -883,6 +987,15 @@ igt_main
> >  		igt_require(display.is_atomic);
> >  
> >  		igt_display_require_output(&display);
> > +
> > +		test_config.display = &display;
> > +		if (!test_config.user_seed)
> > +			test_config.seed = time(NULL);
> > +
> > +		srand(test_config.seed);
> > +
> > +		igt_info("Running tests randomized with seed %d\n",
> > +			 test_config.seed);
> >  	}
> >  
> >  	igt_subtest("plane-primary-toggle-with-vblank-wait")
> > @@ -891,55 +1004,67 @@ igt_main
> >  
> >  	igt_subtest("plane-all-transition")
> >  		for_each_pipe_with_valid_output(&display, pipe, output)
> > -			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false);
> > +			run_transition_test(&test_config, pipe, output,
> > +					    TRANSITION_PLANES, false, false);
> >  
> >  	igt_subtest("plane-all-transition-fencing")
> >  		for_each_pipe_with_valid_output(&display, pipe, output)
> > -			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, true);
> > +			run_transition_test(&test_config, pipe, output,
> > +					    TRANSITION_PLANES, false, true);
> >  
> >  	igt_subtest("plane-all-transition-nonblocking")
> >  		for_each_pipe_with_valid_output(&display, pipe, output)
> > -			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false);
> > +			run_transition_test(&test_config, pipe, output,
> > +					    TRANSITION_PLANES, true, false);
> >  
> >  	igt_subtest("plane-all-transition-nonblocking-fencing")
> >  		for_each_pipe_with_valid_output(&display, pipe, output)
> > -			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, true);
> > +			run_transition_test(&test_config, pipe, output,
> > +					    TRANSITION_PLANES, true, true);
> >  
> >  	igt_subtest("plane-use-after-nonblocking-unbind")
> >  		for_each_pipe_with_valid_output(&display, pipe, output)
> > -			run_transition_test(&display, pipe, output, TRANSITION_AFTER_FREE, true, false);
> > +			run_transition_test(&test_config, pipe, output,
> > +					    TRANSITION_AFTER_FREE, true, false);
> >  
> >  	igt_subtest("plane-use-after-nonblocking-unbind-fencing")
> >  		for_each_pipe_with_valid_output(&display, pipe, output)
> > -			run_transition_test(&display, pipe, output, TRANSITION_AFTER_FREE, true, true);
> > +			run_transition_test(&test_config, pipe, output,
> > +					    TRANSITION_AFTER_FREE, true, true);
> >  
> >  	igt_subtest("plane-all-modeset-transition")
> >  		for_each_pipe_with_valid_output(&display, pipe, output)
> > -			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false);
> > +			run_transition_test(&test_config, pipe, output,
> > +					    TRANSITION_MODESET, false, false);
> >  
> >  	igt_subtest("plane-all-modeset-transition-fencing")
> >  		for_each_pipe_with_valid_output(&display, pipe, output)
> > -			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, true);
> > +			run_transition_test(&test_config, pipe, output,
> > +					    TRANSITION_MODESET, false, true);
> >  
> >  	igt_subtest("plane-toggle-modeset-transition")
> >  		for_each_pipe_with_valid_output(&display, pipe, output)
> > -			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);
> > +			run_transition_test(&test_config, pipe, output,
> > +					    TRANSITION_MODESET_DISABLE,
> > +					    false, false);
> >  
> >  	for (i = 1; i <= IGT_MAX_PIPES; i++) {
> >  		igt_subtest_f("%ix-modeset-transitions", i)
> > -			run_modeset_transition(&display, i, false, false);
> > +			run_modeset_transition(&test_config, i, false, false);
> >  
> >  		igt_subtest_f("%ix-modeset-transitions-nonblocking", i)
> > -			run_modeset_transition(&display, i, true, false);
> > +			run_modeset_transition(&test_config, i, true, false);
> >  
> >  		igt_subtest_f("%ix-modeset-transitions-fencing", i)
> > -			run_modeset_transition(&display, i, false, true);
> > +			run_modeset_transition(&test_config, i, false, true);
> >  
> >  		igt_subtest_f("%ix-modeset-transitions-nonblocking-fencing", i)
> > -			run_modeset_transition(&display, i, true, true);
> > +			run_modeset_transition(&test_config, i, true, true);
> >  	}
> >  
> >  	igt_fixture {
> >  		igt_display_fini(&display);
> >  	}
> > +
> > +	igt_exit();
> >  }
> 
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-11-01 12:55   ` Imre Deak
@ 2017-11-01 14:23     ` Maarten Lankhorst
  0 siblings, 0 replies; 13+ messages in thread
From: Maarten Lankhorst @ 2017-11-01 14:23 UTC (permalink / raw)
  To: imre.deak; +Cc: intel-gfx

Op 01-11-17 om 13:55 schreef Imre Deak:
> On Wed, Nov 01, 2017 at 12:32:37PM +0100, Maarten Lankhorst wrote:
>> Op 31-10-17 om 14:44 schreef Imre Deak:
>>> Doing modeset on internal panels may have a considerable overhead due to
>>> the panel specific power sequencing delays. To avoid long test runtimes
>>> limit the runtime of each subtest. Randomize the plane/pipe combinations
>>> to preserve the test coverage on such panels at least over multiple test
>>> runs.
>>>
>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103334
>>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> Signed-off-by: Imre Deak <imre.deak@intel.com>
>>> ---
>>>  tests/kms_atomic_transition.c | 175 ++++++++++++++++++++++++++++++++++++------
>>>  1 file changed, 150 insertions(+), 25 deletions(-)
>>>
>>> diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
>>> index 4c295125..ac67fc3a 100644
>>> --- a/tests/kms_atomic_transition.c
>>> +++ b/tests/kms_atomic_transition.c
>>> @@ -39,6 +39,14 @@
>>>  #define DRM_CAP_CURSOR_HEIGHT 0x9
>>>  #endif
>>>  
>>> +#define MAX_SUBTEST_DURATION_NS (20ULL * NSEC_PER_SEC)
>>> +
>>> +struct test_config {
>>> +	igt_display_t *display;
>>> +	bool user_seed;
>>> +	int seed;
>>> +};
>>> +
>>>  struct plane_parms {
>>>  	struct igt_fb *fb;
>>>  	uint32_t width, height;
>>> @@ -401,6 +409,28 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
>>>  	}
>>>  }
>>>  
>>> +/* Copied from https://benpfaff.org/writings/clc/shuffle.html */
>>> +static void shuffle_array(uint32_t *array, int size, int seed)
>>> +{
>>> +	int i;
>>> +
>>> +	for (i = 0; i < size; i++) {
>>> +		int j = i + rand() / (RAND_MAX / (size - i) + 1);
>>> +
>>> +		igt_swap(array[i], array[j]);
>>> +	}
>>> +}
>> I wouldn't worry about predictibility of the random number generator..
>>
>> int j = i + rand() % (size - i) is good enough and easier to read. :)
> Chris already suggested igt_permute_array(), will use that.
>
>> I think the struct test_config can be killed too, since it goes unused
>> in shuffle_array, nothing in the test uses it...
> Oops, some kind of left-over from an earlier version. Thanks for spotting
> it.
>
>>> +static void init_combination_array(uint32_t *array, int size, int seed)
>>> +{
>>> +	int i;
>>> +
>>> +	for (i = 0; i < size; i++)
>>> +		array[i] = i;
>>> +
>>> +	shuffle_array(array, size, seed);
>>> +}
>>> +
>>>  /*
>>>   * 1. Set primary plane to a known fb.
>>>   * 2. Make sure getcrtc returns the correct fb id.
>>> @@ -411,19 +441,27 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
>>>   * so test this and make sure it works.
>>>   */
>>>  static void
>>> -run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output,
>>> -		enum transition_type type, bool nonblocking, bool fencing)
>>> +run_transition_test(struct test_config *test_config, enum pipe pipe,
>>> +		    igt_output_t *output, enum transition_type type,
>>> +		    bool nonblocking, bool fencing)
>>>  {
>>>  	struct igt_fb fb, argb_fb, sprite_fb;
>>>  	drmModeModeInfo *mode, override_mode;
>>> +	igt_display_t *display = test_config->display;
>>>  	igt_plane_t *plane;
>>>  	igt_pipe_t *pipe_obj = &display->pipes[pipe];
>>>  	uint32_t iter_max = 1 << pipe_obj->n_planes, i;
>>> +	uint32_t *plane_combinations;
>>> +	struct timespec start = { };
>>>  	struct plane_parms parms[pipe_obj->n_planes];
>>>  	bool skip_test = false;
>>>  	unsigned flags = 0;
>>>  	int ret;
>>>  
>>> +	plane_combinations = malloc(sizeof(*plane_combinations) * iter_max);
>>> +	igt_assert(plane_combinations);
>>> +	init_combination_array(plane_combinations, iter_max, test_config->seed);
>> It would be cleaner to have a separate test for transition_modeset.
>> The rest should be run to completion and don't need shuffling, since
>> in normal cases, they'll never hit a timeout.
> Do you mean type == TRANSITION_MODESET? There are already separate
> subtests for that. Yes, can disable the timeout and shuffling for the
> rest.
>
>> So make a separate test for that, and perhaps also add a flag for
>> disabling the timeout.
> Ok.
>
>>>  	if (fencing)
>>>  		prepare_fencing(display, pipe);
>>>  	else
>>> @@ -527,39 +565,59 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
>>>  		goto cleanup;
>>>  	}
>>>  
>>> +	igt_nsec_elapsed(&start);
>>> +
>>>  	for (i = 0; i < iter_max; i++) {
>>>  		igt_output_set_pipe(output, pipe);
>>>  
>>> -		wm_setup_plane(display, pipe, i, parms, fencing);
>>> +		wm_setup_plane(display, pipe, plane_combinations[i], parms,
>>> +			       fencing);
>>>  
>>> -		atomic_commit(display, pipe, flags, (void *)(unsigned long)i, fencing);
>>> +		atomic_commit(display, pipe, flags,
>>> +			      (void *)(unsigned long)plane_combinations[i],
>>> +			      fencing);
>>>  		wait_for_transition(display, pipe, nonblocking, fencing);
>>>  
>>>  		if (type == TRANSITION_MODESET_DISABLE) {
>>> +			if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
>>> +				goto cleanup;
>>> +
>>>  			igt_output_set_pipe(output, PIPE_NONE);
>>>  
>>>  			wm_setup_plane(display, pipe, 0, parms, fencing);
>>>  
>>>  			atomic_commit(display, pipe, flags, (void *) 0UL, fencing);
>>>  			wait_for_transition(display, pipe, nonblocking, fencing);
>>> +
>>>  		} else {
>>>  			uint32_t j;
>>>  
>>>  			/* i -> i+1 will be done when i increases, can be skipped here */
>>>  			for (j = iter_max - 1; j > i + 1; j--) {
>>> -				wm_setup_plane(display, pipe, j, parms, fencing);
>>> +				if (igt_nsec_elapsed(&start) >= MAX_SUBTEST_DURATION_NS)
>>> +					goto cleanup;
>>> +
>>> +				wm_setup_plane(display, pipe,
>>> +					       plane_combinations[j], parms,
>>> +					       fencing);
>>>  
>>>  				if (type == TRANSITION_MODESET)
>>>  					igt_output_override_mode(output, &override_mode);
>>>  
>>> -				atomic_commit(display, pipe, flags, (void *)(unsigned long) j, fencing);
>>> +				atomic_commit(display, pipe, flags,
>>> +					      (void *)(unsigned long)plane_combinations[j],
>>> +					      fencing);
>>>  				wait_for_transition(display, pipe, nonblocking, fencing);
>>>  
>>> -				wm_setup_plane(display, pipe, i, parms, fencing);
>>> +				wm_setup_plane(display, pipe,
>>> +					       plane_combinations[i], parms,
>>> +					       fencing);
>>>  				if (type == TRANSITION_MODESET)
>>>  					igt_output_override_mode(output, NULL);
>>>  
>>> -				atomic_commit(display, pipe, flags, (void *)(unsigned long) i, fencing);
>>> +				atomic_commit(display, pipe, flags,
>>> +					      (void *)(unsigned long)plane_combinations[i],
>>> +					      fencing);
>>>  				wait_for_transition(display, pipe, nonblocking, fencing);
>>>  			}
>>>  		}
>>> @@ -579,6 +637,9 @@ cleanup:
>>>  	igt_remove_fb(display->drm_fd, &fb);
>>>  	igt_remove_fb(display->drm_fd, &argb_fb);
>>>  	igt_remove_fb(display->drm_fd, &sprite_fb);
>>> +
>>> +	free(plane_combinations);
>>> +
>>>  	if (skip_test)
>>>  		igt_skip("Atomic nonblocking modesets are not supported.\n");
>>>  }
>>> @@ -696,16 +757,24 @@ static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned mask, igt_crc
>>>  	}
>>>  }
>>>  
>>> -static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblocking, bool fencing)
>>> +static void run_modeset_tests(struct test_config *test_config, int howmany,
>>> +			      bool nonblocking, bool fencing)
>>>  {
>>> +	igt_display_t *display = test_config->display;
>>>  	struct igt_fb fbs[2];
>>>  	int i, j;
>>>  	unsigned iter_max = 1 << display->n_pipes;
>>> +	uint32_t *pipe_combinations;
>>> +	struct timespec start = { };
>>>  	igt_pipe_crc_t *pipe_crcs[IGT_MAX_PIPES] = { 0 };
>>>  	igt_output_t *output;
>>>  	unsigned width = 0, height = 0;
>>>  	bool skip_test = false;
>>>  
>>> +	pipe_combinations = malloc(sizeof(*pipe_combinations) * iter_max);
>>> +	igt_assert(pipe_combinations);
>>> +	init_combination_array(pipe_combinations, iter_max, test_config->seed);
>> Kill all the changes to run_modeset_tests too please? The randomness
>> here goes unused, and I would rather have it run all the modesetting
>> combinations.  I can understand plane transitions taking too long, but
>> the modeset tests are typically very short.
> IIUC with 3 pipes it's 27 iterations, so with 2 full modesets per iteration it
> can take ~1 minute using slow panels. The same with 4 pipes would take ~4
> minutes.
I'm ok with that. :)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations
  2017-11-01 11:08       ` Imre Deak
@ 2017-11-02 13:26         ` Imre Deak
  0 siblings, 0 replies; 13+ messages in thread
From: Imre Deak @ 2017-11-02 13:26 UTC (permalink / raw)
  To: Chris Wilson, Tomi P Sarvela, Petri Latvala, Martin Peres,
	Maarten Lankhorst
  Cc: intel-gfx

On Wed, Nov 01, 2017 at 01:08:47PM +0200, Imre Deak wrote:
> On Wed, Nov 01, 2017 at 10:48:50AM +0000, Chris Wilson wrote:
> > Quoting Imre Deak (2017-11-01 09:56:22)
> > > On Tue, Oct 31, 2017 at 10:23:25PM +0000, Chris Wilson wrote:
> > > > Quoting Imre Deak (2017-10-31 13:44:47)
> > > > > Doing modeset on internal panels may have a considerable overhead due to
> > > > > the panel specific power sequencing delays. To avoid long test runtimes
> > > > > limit the runtime of each subtest. Randomize the plane/pipe combinations
> > > > > to preserve the test coverage on such panels at least over multiple test
> > > > > runs.
> > > > > 
> > > > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103334
> > > > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > > > > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > > > > ---
> > > > >  tests/kms_atomic_transition.c | 175 ++++++++++++++++++++++++++++++++++++------
> > > > >  1 file changed, 150 insertions(+), 25 deletions(-)
> > > > > 
> > > > > diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> > > > > index 4c295125..ac67fc3a 100644
> > > > > --- a/tests/kms_atomic_transition.c
> > > > > +++ b/tests/kms_atomic_transition.c
> > > > > @@ -39,6 +39,14 @@
> > > > >  #define DRM_CAP_CURSOR_HEIGHT 0x9
> > > > >  #endif
> > > > >  
> > > > > +#define MAX_SUBTEST_DURATION_NS (20ULL * NSEC_PER_SEC)
> > > > > +
> > > > > +struct test_config {
> > > > > +       igt_display_t *display;
> > > > > +       bool user_seed;
> > > > > +       int seed;
> > > > > +};
> > > > > +
> > > > >  struct plane_parms {
> > > > >         struct igt_fb *fb;
> > > > >         uint32_t width, height;
> > > > > @@ -401,6 +409,28 @@ static void wait_for_transition(igt_display_t *display, enum pipe pipe, bool non
> > > > >         }
> > > > >  }
> > > > >  
> > > > > +/* Copied from https://benpfaff.org/writings/clc/shuffle.html */
> > > > > +static void shuffle_array(uint32_t *array, int size, int seed)
> > > > > +{
> > > > > +       int i;
> > > > > +
> > > > > +       for (i = 0; i < size; i++) {
> > > > > +               int j = i + rand() / (RAND_MAX / (size - i) + 1);
> > > > > +
> > > > > +               igt_swap(array[i], array[j]);
> > > > > +       }
> > > > > +}
> > > > 
> > > > igt_permute_array()
> > > 
> > > Thanks, will use that instead.
> > > 
> > > > Not saying anything, but I was told using CI for stochastic coverage was
> > > > a flat no...
> > > 
> > > Ok, but it would only be the case for slow panels where the alternative
> > > is not to run the test at all. And is this a problem if we can replay a
> > > failing case with --seed?
> > 
> > If the purpose of CI is purely regression testing and not exploratory
> > debugging, each PW run must be with the same seed as the CI_DRM run.
> > 
> > The seed must be clearly displayed in the results so that when comparing
> > CI_DRM runs the flip-flop can be traced to the change in seed.
> 
> Adding Petri and Tomi. So I guess the question is if we want this in CI
> and if it's a reasonable effort to implement it.

Discussing more with Tomi and Martin, the randomization idea is not so
practical at least for now.

So another approach would be to split out the testing on internal panels
from plane-all-modeset-transition and
plane-all-modeset-transition-fencing. We could have fast and slow
version of these internal-panel tests where the fast one would test all
combinations and the slow one only combinations with either all planes
on/off or only a single plane on. We could then include only the fast
versions in the fast-feedback testlist.

Will follow up with a version doing the above.

--Imre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-11-02 13:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 13:44 [PATCH i-g-t] kms_atomic_transition: Add subtest time limit/randomize plane, pipe combinations Imre Deak
2017-10-31 14:05 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-10-31 14:46 ` ✓ Fi.CI.IGT: " Patchwork
2017-10-31 16:56 ` ✗ Fi.CI.BAT: failure " Patchwork
2017-10-31 22:23 ` [PATCH i-g-t] " Chris Wilson
2017-11-01  9:56   ` Imre Deak
2017-11-01 10:48     ` Chris Wilson
2017-11-01 11:08       ` Imre Deak
2017-11-02 13:26         ` Imre Deak
2017-11-01 10:05 ` ✗ Fi.CI.IGT: warning for " Patchwork
2017-11-01 11:32 ` [PATCH i-g-t] " Maarten Lankhorst
2017-11-01 12:55   ` Imre Deak
2017-11-01 14:23     ` Maarten Lankhorst

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.