summaryrefslogtreecommitdiff
path: root/tests/kms_busy.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-03-30 23:46:36 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-04-01 08:40:15 +0100
commit20f8f52498b9c382076cbc85079df44079e5500f (patch)
tree4715ea474f07e1d676c8918282ceb36fa0af2042 /tests/kms_busy.c
parentb93309b7823dcbbd2c52adb4ebb98e3cb060f910 (diff)
kms_busy: Use igt_waitchildren_timeout()
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@chris-wilson.co.uk> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests/kms_busy.c')
-rw-r--r--tests/kms_busy.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index ed3caae4..321db820 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -29,9 +29,6 @@
IGT_TEST_DESCRIPTION("Basic check of KMS ABI with busy framebuffers.");
-#define FRAME_TIME 16 /* milleseconds */
-#define TIMEOUT (6*16)
-
static igt_output_t *
set_fb_on_crtc(igt_display_t *dpy, int pipe, struct igt_fb *fb)
{
@@ -70,17 +67,13 @@ static void do_cleanup_display(igt_display_t *dpy)
igt_display_commit2(dpy, dpy->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
}
-static void sighandler(int sig)
-{
-}
-
static void flip_to_fb(igt_display_t *dpy, int pipe,
igt_output_t *output,
struct igt_fb *fb, unsigned ring,
const char *name, bool modeset)
{
struct pollfd pfd = { .fd = dpy->drm_fd, .events = POLLIN };
- struct timespec tv = { 1, 0 };
+ const int timeout = modeset ? 8500 : 100;
struct drm_event_vblank ev;
igt_spin_t *t = igt_spin_batch_new(dpy->drm_fd,
@@ -114,24 +107,14 @@ 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,
+ igt_assert_f(poll(&pfd, 1, 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 * timeout,
+ "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 +143,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 +175,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,