Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [i-g-t 1/2] tests/kms_atomic_transition: Reduce the execution time on simulation
@ 2023-02-09  6:23 Bhanuprakash Modem
  2023-02-09  6:23 ` [igt-dev] [i-g-t 2/2] tests/kms_atomic_transition: Test cleanup Bhanuprakash Modem
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Bhanuprakash Modem @ 2023-02-09  6:23 UTC (permalink / raw)
  To: igt-dev, karthik.b.s

Due to the more number of iterations, "modest-transition" tests are
getting timed out on pre-si CI. Reducing the number of iterations to
half can save a lot of execution time.

V2: - Separate patch for cleanup

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_atomic_transition.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 6d2ebbbff..e1b74ac2c 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -858,6 +858,9 @@ retry:
 
 	iter_max = 1 << j;
 
+	if (igt_run_in_simulation() && iter_max > 1)
+		iter_max = iter_max >> 1;
+
 	if (igt_display_try_commit_atomic(&data->display,
 				DRM_MODE_ATOMIC_TEST_ONLY |
 				DRM_MODE_ATOMIC_ALLOW_MODESET,
-- 
2.39.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [igt-dev] [i-g-t V2 2/2] tests/kms_atomic_transition: Test Cleanup
  2022-09-05  4:06 ` [igt-dev] [i-g-t 2/2] tests/kms_atomic_transition: Test Cleanup Bhanuprakash Modem
@ 2022-09-06 14:12 Bhanuprakash Modem
  2022-09-07  7:01 ` [igt-dev] [i-g-t " Bhanuprakash Modem
  0 siblings, 1 reply; 14+ messages in thread
From: Bhanuprakash Modem @ 2022-09-06 14:12 UTC (permalink / raw)
  To: igt-dev, karthik.b.s

Sanitize the system state before starting the subtest.

V2: - Cleanup the state before exiting the subtest

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_atomic_transition.c | 73 ++++++++++++++++++-----------------
 1 file changed, 38 insertions(+), 35 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 3f0ceb3d..31a0f3a4 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -47,9 +47,10 @@ struct plane_parms {
 
 typedef struct {
 	int drm_fd;
-	struct igt_fb fb, argb_fb, sprite_fb;
+	struct igt_fb fbs[2], argb_fb, sprite_fb;
 	igt_display_t display;
 	bool extended;
+	igt_pipe_crc_t *pipe_crcs[IGT_MAX_PIPES];
 } data_t;
 
 /* globals for fence support */
@@ -62,10 +63,11 @@ run_primary_test(data_t *data, enum pipe pipe, igt_output_t *output)
 {
 	drmModeModeInfo *mode;
 	igt_plane_t *primary;
-	igt_fb_t fb;
+	igt_fb_t *fb = &data->fbs[0];
 	int i, ret;
 	unsigned flags = DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET;
 
+	igt_display_reset(&data->display);
 	igt_output_set_pipe(output, pipe);
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
@@ -76,9 +78,9 @@ run_primary_test(data_t *data, enum pipe pipe, igt_output_t *output)
 	igt_skip_on_f(ret == -EINVAL, "Primary plane cannot be disabled separately from output\n");
 
 	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
-		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, &fb);
+		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, fb);
 
-	igt_plane_set_fb(primary, &fb);
+	igt_plane_set_fb(primary, fb);
 
 	for (i = 0; i < 4; i++) {
 		igt_display_commit2(&data->display, COMMIT_ATOMIC);
@@ -87,20 +89,15 @@ run_primary_test(data_t *data, enum pipe pipe, igt_output_t *output)
 			igt_wait_for_vblank(data->drm_fd,
 					data->display.pipes[pipe].crtc_offset);
 
-		igt_plane_set_fb(primary, (i & 1) ? &fb : NULL);
+		igt_plane_set_fb(primary, (i & 1) ? fb : NULL);
 		igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
 		if (i & 1)
 			igt_wait_for_vblank(data->drm_fd,
 					data->display.pipes[pipe].crtc_offset);
 
-		igt_plane_set_fb(primary, (i & 1) ? NULL : &fb);
+		igt_plane_set_fb(primary, (i & 1) ? NULL : fb);
 	}
-
-	igt_plane_set_fb(primary, NULL);
-	igt_output_set_pipe(output, PIPE_NONE);
-	igt_remove_fb(data->drm_fd, &fb);
-	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
 static void *fence_inc_thread(void *arg)
@@ -507,7 +504,7 @@ run_transition_test(data_t *data, enum pipe pipe, igt_output_t *output,
 	override_mode.flags ^= DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NHSYNC;
 
 	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
-		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, &data->fb);
+		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, &data->fbs[0]);
 
 	igt_output_set_pipe(output, pipe);
 
@@ -521,7 +518,7 @@ run_transition_test(data_t *data, enum pipe pipe, igt_output_t *output,
 		igt_output_set_pipe(output, pipe);
 	}
 
-	setup_parms(data, pipe, mode, &data->fb, &data->argb_fb, &data->sprite_fb, parms, &iter_max);
+	setup_parms(data, pipe, mode, &data->fbs[0], &data->argb_fb, &data->sprite_fb, parms, &iter_max);
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
@@ -663,7 +660,8 @@ static void test_cleanup(data_t *data, enum pipe pipe, igt_output_t *output, boo
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-	igt_remove_fb(data->drm_fd, &data->fb);
+	igt_remove_fb(data->drm_fd, &data->fbs[0]);
+	igt_remove_fb(data->drm_fd, &data->fbs[1]);
 	igt_remove_fb(data->drm_fd, &data->argb_fb);
 	igt_remove_fb(data->drm_fd, &data->sprite_fb);
 }
@@ -803,12 +801,11 @@ static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned mask, igt_crc
 
 static void run_modeset_tests(data_t *data, int howmany, bool nonblocking, bool fencing)
 {
-	struct igt_fb fbs[2];
 	int i, j;
 	unsigned iter_max;
-	igt_pipe_crc_t *pipe_crcs[IGT_MAX_PIPES] = { 0 };
 	igt_output_t *output;
 	uint16_t width = 0, height = 0;
+	bool ret = true;
 
 	for (i = 0; i < data->display.n_outputs; i++)
 		igt_output_set_pipe(&data->display.outputs[i], PIPE_NONE);
@@ -823,9 +820,9 @@ retry:
 	}
 
 	igt_create_pattern_fb(data->drm_fd, width, height,
-				   DRM_FORMAT_XRGB8888, 0, &fbs[0]);
+				   DRM_FORMAT_XRGB8888, 0, &data->fbs[0]);
 	igt_create_color_pattern_fb(data->drm_fd, width, height,
-				    DRM_FORMAT_XRGB8888, 0, .5, .5, .5, &fbs[1]);
+				    DRM_FORMAT_XRGB8888, 0, .5, .5, .5, &data->fbs[1]);
 
 	for_each_pipe(&data->display, i) {
 		igt_pipe_t *pipe = &data->display.pipes[i];
@@ -836,7 +833,7 @@ retry:
 		j += 1;
 
 		if (is_i915_device(data->drm_fd))
-			pipe_crcs[i] = igt_pipe_crc_new(data->drm_fd, i, INTEL_PIPE_CRC_SOURCE_AUTO);
+			data->pipe_crcs[i] = igt_pipe_crc_new(data->drm_fd, i, INTEL_PIPE_CRC_SOURCE_AUTO);
 
 		for_each_valid_output_on_pipe(&data->display, i, output) {
 			if (output->pending_pipe != PIPE_NONE)
@@ -848,8 +845,8 @@ retry:
 		}
 
 		if (mode) {
-			igt_plane_set_fb(plane, &fbs[1]);
-			igt_fb_set_size(&fbs[1], plane, mode->hdisplay, mode->vdisplay);
+			igt_plane_set_fb(plane, &data->fbs[1]);
+			igt_fb_set_size(&data->fbs[1], plane, mode->hdisplay, mode->vdisplay);
 			igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
 
 			if (fencing)
@@ -883,13 +880,13 @@ retry:
 		if (igt_hweight(i) > howmany)
 			continue;
 
-		event_mask = set_combinations(data, i, &fbs[0]);
+		event_mask = set_combinations(data, i, &data->fbs[0]);
 		if (!event_mask && i)
 			continue;
 
 		commit_display(data, event_mask, nonblocking);
 
-		collect_crcs_mask(pipe_crcs, i, crcs[0]);
+		collect_crcs_mask(data->pipe_crcs, i, crcs[0]);
 
 		for (j = iter_max - 1; j > i + 1; j--) {
 			if (igt_hweight(j) > howmany)
@@ -898,54 +895,60 @@ retry:
 			if (igt_hweight(i) < howmany && igt_hweight(j) < howmany)
 				continue;
 
-			event_mask = set_combinations(data, j, &fbs[1]);
+			event_mask = set_combinations(data, j, &data->fbs[1]);
 			if (!event_mask)
 				continue;
 
 			commit_display(data, event_mask, nonblocking);
 
-			collect_crcs_mask(pipe_crcs, j, crcs[1]);
+			collect_crcs_mask(data->pipe_crcs, j, crcs[1]);
 
 			refresh_primaries(data, j);
 			commit_display(data, j, nonblocking);
-			collect_crcs_mask(pipe_crcs, j, crcs[2]);
+			collect_crcs_mask(data->pipe_crcs, j, crcs[2]);
 
-			event_mask = set_combinations(data, i, &fbs[0]);
+			event_mask = set_combinations(data, i, &data->fbs[0]);
 			if (!event_mask)
 				continue;
 
 			commit_display(data, event_mask, nonblocking);
-			collect_crcs_mask(pipe_crcs, i, crcs[3]);
+			collect_crcs_mask(data->pipe_crcs, i, crcs[3]);
 
 			refresh_primaries(data, i);
 			commit_display(data, i, nonblocking);
-			collect_crcs_mask(pipe_crcs, i, crcs[4]);
+			collect_crcs_mask(data->pipe_crcs, i, crcs[4]);
 
 			if (!is_i915_device(data->drm_fd))
 				continue;
 
 			for (int k = 0; k < IGT_MAX_PIPES; k++) {
 				if (i & (1 << k)) {
-					igt_assert_crc_equal(&crcs[0][k], &crcs[3][k]);
-					igt_assert_crc_equal(&crcs[0][k], &crcs[4][k]);
+					ret &= igt_check_crc_equal(&crcs[0][k], &crcs[3][k]);
+					ret &= igt_check_crc_equal(&crcs[0][k], &crcs[4][k]);
 				}
 
 				if (j & (1 << k))
-					igt_assert_crc_equal(&crcs[1][k], &crcs[2][k]);
+					ret &= igt_check_crc_equal(&crcs[1][k], &crcs[2][k]);
+
+				if (!ret)
+					goto cleanup;
 			}
 		}
 	}
 
+cleanup:
 	set_combinations(data, 0, NULL);
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
 	if (is_i915_device(data->drm_fd)) {
 		for_each_pipe(&data->display, i)
-			igt_pipe_crc_free(pipe_crcs[i]);
+			igt_pipe_crc_free(data->pipe_crcs[i]);
 	}
 
-	igt_remove_fb(data->drm_fd, &fbs[1]);
-	igt_remove_fb(data->drm_fd, &fbs[0]);
+	igt_remove_fb(data->drm_fd, &data->fbs[0]);
+	igt_remove_fb(data->drm_fd, &data->fbs[1]);
+
+	igt_assert(ret || igt_skip_crc_compare);
 }
 
 static void run_modeset_transition(data_t *data, int requested_outputs, bool nonblocking, bool fencing)
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [igt-dev] [i-g-t 0/2] tests/kms_atomic_transition: IGT test cleanup
@ 2022-09-05  4:06 Bhanuprakash Modem
  2022-09-05  4:06 ` [igt-dev] [i-g-t 2/2] tests/kms_atomic_transition: Test Cleanup Bhanuprakash Modem
  0 siblings, 1 reply; 14+ messages in thread
From: Bhanuprakash Modem @ 2022-09-05  4:06 UTC (permalink / raw)
  To: igt-dev, karthik.b.s

Convert all possible subtests to dynamic and sanitize the system
state before starting/exiting the subtest.

Bhanuprakash Modem (2):
  tests/kms_atomic_transition: Convert tests to dynamic
  tests/kms_atomic_transition: Test Cleanup

 tests/kms_atomic_transition.c | 371 +++++++++++++---------------------
 1 file changed, 137 insertions(+), 234 deletions(-)

--
2.35.1

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

end of thread, other threads:[~2023-02-10 22:58 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-09  6:23 [igt-dev] [i-g-t 1/2] tests/kms_atomic_transition: Reduce the execution time on simulation Bhanuprakash Modem
2023-02-09  6:23 ` [igt-dev] [i-g-t 2/2] tests/kms_atomic_transition: Test cleanup Bhanuprakash Modem
2023-02-10  4:49   ` [igt-dev] [i-g-t V2 " Bhanuprakash Modem
2023-02-10  6:34     ` Karthik B S
2023-02-09  6:35 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] tests/kms_atomic_transition: Reduce the execution time on simulation Patchwork
2023-02-09  6:56 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-02-10  3:20 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-02-10  4:47 ` [igt-dev] [i-g-t 1/2] " Karthik B S
2023-02-10 15:24 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_atomic_transition: Reduce the execution time on simulation (rev2) Patchwork
2023-02-10 22:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2022-09-06 14:12 [igt-dev] [i-g-t V2 2/2] tests/kms_atomic_transition: Test Cleanup Bhanuprakash Modem
2022-09-07  7:01 ` [igt-dev] [i-g-t " Bhanuprakash Modem
2022-09-07  8:45   ` Karthik B S
2022-09-05  4:06 [igt-dev] [i-g-t 0/2] tests/kms_atomic_transition: IGT test cleanup Bhanuprakash Modem
2022-09-05  4:06 ` [igt-dev] [i-g-t 2/2] tests/kms_atomic_transition: Test Cleanup Bhanuprakash Modem
2022-09-06 12:57   ` Karthik B S

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