All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2] tests/kms_flip_tiling: Fix clean up when subtest fails
@ 2021-06-08  6:18 Jeevan B
  2021-06-08  7:03 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_flip_tiling: Fix clean up when subtest fails (rev2) Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeevan B @ 2021-06-08  6:18 UTC (permalink / raw)
  To: igt-dev; +Cc: petri.latvala

If a subtest fails during commit for some reason on the first connector,
all the subsequent subtests on the same pipe fails.
This is because the pipe is still connected to the previous connector
as the cleanup part will have been skipped during the failed subtest.

To fix this, moved the cleanup part to a separate function and calling it
outside the subtest scope.

v2: Fix indentation.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
 tests/kms_flip_tiling.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/tests/kms_flip_tiling.c b/tests/kms_flip_tiling.c
index 573cc337..211117f3 100644
--- a/tests/kms_flip_tiling.c
+++ b/tests/kms_flip_tiling.c
@@ -39,6 +39,7 @@ typedef struct {
 	igt_display_t display;
 	int gen;
 	uint32_t testformat;
+	struct igt_fb fb[2];
 } data_t;
 
 static igt_pipe_crc_t *_pipe_crc;
@@ -69,7 +70,6 @@ test_flip_tiling(data_t *data, enum pipe pipe, igt_output_t *output, uint64_t ti
 {
 	drmModeModeInfo *mode;
 	igt_plane_t *primary;
-	struct igt_fb fb[2];
 	igt_pipe_crc_t *pipe_crc;
 	igt_crc_t reference_crc, crc;
 	int fb_id, ret, width;
@@ -105,27 +105,27 @@ test_flip_tiling(data_t *data, enum pipe pipe, igt_output_t *output, uint64_t ti
 
 	fb_id = igt_create_pattern_fb(data->drm_fd, width, mode->vdisplay,
 				      data->testformat, tiling[0],
-				      &fb[0]);
+				      &data->fb[0]);
 	igt_assert(fb_id);
 
 	/* Second fb has different background so CRC does not match. */
 	fb_id = igt_create_color_pattern_fb(data->drm_fd, width, mode->vdisplay,
 				      data->testformat, tiling[1],
-				      0.5, 0.5, 0.5, &fb[1]);
+				      0.5, 0.5, 0.5, &data->fb[1]);
 	igt_assert(fb_id);
 
 	/* Set the crtc and generate a reference CRC. */
-	igt_plane_set_fb(primary, &fb[1]);
+	igt_plane_set_fb(primary, &data->fb[1]);
 	igt_display_commit(&data->display);
 	igt_pipe_crc_collect_crc(pipe_crc, &reference_crc);
 
 	/* Commit the first fb. */
-	igt_plane_set_fb(primary, &fb[0]);
+	igt_plane_set_fb(primary, &data->fb[0]);
 	igt_display_commit(&data->display);
 
 	/* Flip to the second fb. */
 	ret = drmModePageFlip(data->drm_fd, output->config.crtc->crtc_id,
-			      fb[1].fb_id, DRM_MODE_PAGE_FLIP_EVENT, NULL);
+			      data->fb[1].fb_id, DRM_MODE_PAGE_FLIP_EVENT, NULL);
 	/*
 	 * Page flip should work but some transitions may be temporarily
 	 * on some kernels.
@@ -137,6 +137,12 @@ test_flip_tiling(data_t *data, enum pipe pipe, igt_output_t *output, uint64_t ti
 	/* Get a crc and compare with the reference. */
 	igt_pipe_crc_collect_crc(pipe_crc, &crc);
 	igt_assert_crc_equal(&reference_crc, &crc);
+}
+
+static void test_cleanup(data_t *data, enum pipe pipe, igt_output_t *output)
+{
+	igt_plane_t *primary;
+	primary = igt_output_get_plane(output, 0);
 
 	/* Clean up. */
 	igt_plane_set_fb(primary, NULL);
@@ -144,8 +150,8 @@ test_flip_tiling(data_t *data, enum pipe pipe, igt_output_t *output, uint64_t ti
 	igt_output_set_pipe(output, PIPE_ANY);
 	igt_display_commit(&data->display);
 
-	igt_remove_fb(data->drm_fd, &fb[0]);
-	igt_remove_fb(data->drm_fd, &fb[1]);
+	igt_remove_fb(data->drm_fd, &data->fb[0]);
+	igt_remove_fb(data->drm_fd, &data->fb[1]);
 }
 
 static data_t data;
@@ -185,6 +191,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
 				test_flip_tiling(&data, pipe, output, tiling);
+			test_cleanup(&data, pipe, output);
 		}
 	}
 
@@ -204,6 +211,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
 				test_flip_tiling(&data, pipe, output, tiling);
+			test_cleanup(&data, pipe, output);
 		}
 	}
 
@@ -223,6 +231,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
 				test_flip_tiling(&data, pipe, output, tiling);
+			test_cleanup(&data, pipe, output);
 		}
 	}
 
@@ -246,6 +255,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
 				test_flip_tiling(&data, pipe, output, tiling);
+			test_cleanup(&data, pipe, output);
 		}
 	}
 
@@ -265,6 +275,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
 				test_flip_tiling(&data, pipe, output, tiling);
+			test_cleanup(&data, pipe, output);
 		}
 	}
 
@@ -284,6 +295,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
 				test_flip_tiling(&data, pipe, output, tiling);
+			test_cleanup(&data, pipe, output);
 		}
 	}
 
@@ -307,6 +319,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
 				test_flip_tiling(&data, pipe, output, tiling);
+			test_cleanup(&data, pipe, output);
 		}
 	}
 
@@ -326,6 +339,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
 				test_flip_tiling(&data, pipe, output, tiling);
+			test_cleanup(&data, pipe, output);
 		}
 	}
 
@@ -345,6 +359,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
 				test_flip_tiling(&data, pipe, output, tiling);
+			test_cleanup(&data, pipe, output);
 		}
 	}
 
-- 
2.19.1

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

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

end of thread, other threads:[~2021-07-01  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08  6:18 [igt-dev] [PATCH i-g-t v2] tests/kms_flip_tiling: Fix clean up when subtest fails Jeevan B
2021-06-08  7:03 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_flip_tiling: Fix clean up when subtest fails (rev2) Patchwork
2021-06-08 11:45 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-07-01  9:17 ` [igt-dev] [PATCH i-g-t v2] tests/kms_flip_tiling: Fix clean up when subtest fails Karthik B S

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.