[igt-dev] [PATCH i-g-t] kms_busy: Use igt_waitchildren_timeout()

Chris Wilson chris at chris-wilson.co.uk
Sat Mar 30 23:50:03 UTC 2019


Replace the convoluted raising of SIGALRM from the child with an
interruptible sleep in the parent with the equivalent and far more
natural igt_waitchildren_timeout().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103182
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/kms_busy.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index ed3caae4c..329961b2c 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -114,24 +114,13 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
 						  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 		}
 
-		kill(getppid(), SIGALRM);
-		igt_assert(gem_bo_busy(dpy->drm_fd, fb->gem_handle));
 		igt_assert_f(poll(&pfd, 1, modeset ? 8500 : TIMEOUT) == 0,
 			     "flip completed whilst %s was busy [%d]\n",
 			     name, gem_bo_busy(dpy->drm_fd, fb->gem_handle));
+		igt_assert(gem_bo_busy(dpy->drm_fd, fb->gem_handle));
 	}
 
-	igt_assert_f(nanosleep(&tv, NULL) == -1,
-		     "flip to %s blocked waiting for busy fb", name);
-
-	igt_waitchildren();
-
-	if (!modeset) {
-		tv.tv_sec = 0;
-		tv.tv_nsec = (2 * TIMEOUT) * 1000000ULL;
-		nanosleep(&tv, NULL);
-	}
-
+	igt_waitchildren_timeout(5, "flip blocked waiting for busy bo\n");
 	igt_spin_batch_end(t);
 
 	igt_assert(read(dpy->drm_fd, &ev, sizeof(ev)) == sizeof(ev));
@@ -160,8 +149,6 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
 	if (modeset)
 		igt_require(dpy->is_atomic);
 
-	signal(SIGALRM, sighandler);
-
 	output = set_fb_on_crtc(dpy, pipe, &fb[0]);
 	igt_display_commit2(dpy, COMMIT_LEGACY);
 
@@ -194,8 +181,6 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
 	do_cleanup_display(dpy);
 	igt_remove_fb(dpy->drm_fd, &fb[1]);
 	igt_remove_fb(dpy->drm_fd, &fb[0]);
-
-	signal(SIGALRM, SIG_DFL);
 }
 
 static void test_atomic_commit_hang(igt_display_t *dpy, igt_plane_t *primary,
-- 
2.20.1



More information about the igt-dev mailing list