From 652ad3e549810f32b39f24b13023a050667e738a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 1 Sep 2016 13:57:31 +0100 Subject: igt/prime_vgem: Simplify inter-process flip checks Avoid having both the child and parent do the same "did the flip" happen check with each looking for the same event on the same fd. The problem being that the child may fall asleep and by the time it wakes up to do its check, the parent has already eaten the event. So leave the checking that the flip does occur to the parent. Signed-off-by: Chris Wilson --- tests/prime_vgem.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tests/prime_vgem.c') diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c index 8985e019..e78e074a 100644 --- a/tests/prime_vgem.c +++ b/tests/prime_vgem.c @@ -628,6 +628,7 @@ static void flip_to_vgem(int i915, int vgem, unsigned hang, const char *name) { + const struct timespec tv = { 1, 0 }; struct pollfd pfd; struct drm_event_vblank vbl; uint32_t fence; @@ -648,16 +649,14 @@ static void flip_to_vgem(int i915, int vgem, name); get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS); } - igt_assert_eq(poll(&pfd, 1, 20000), 1); } + igt_assert_f(nanosleep(&tv, NULL) == -1, + "flip to busy %s blocked\n", name); + /* And then the flip is completed as soon as it is ready */ if (!hang) { union drm_wait_vblank wait; - struct timespec tv = { 1, 0 }; - - igt_assert_f(nanosleep(&tv, NULL) == -1, - "flip to busy %s blocked\n", name); memset(&wait, 0, sizeof(wait)); wait.request.type = DRM_VBLANK_RELATIVE | pipe_select(0); -- cgit v1.2.3