From e23accf43753055430064fa02efe7d33ab11564f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 6 Mar 2015 08:37:09 +0000 Subject: [PATCH] igt/gem_wait: Test negative timeouts The user should be able to specify a negative timeout to indefinitely wait upon a bo becoming idle. Signed-off-by: Chris Wilson --- tests/gem_wait.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/gem_wait.c b/tests/gem_wait.c index 515f7f67..67317ddf 100644 --- a/tests/gem_wait.c +++ b/tests/gem_wait.c @@ -111,6 +111,7 @@ static void render_timeout(int fd) drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; int64_t timeout = ENOUGH_WORK_IN_SECONDS * NSEC_PER_SEC; + int64_t negative_timeout = -1; int ret; const bool do_signals = true; /* signals will seem to make the operation * use less process CPU time */ @@ -206,6 +207,17 @@ static void render_timeout(int fd) igt_assert_eq(timeout, 0); + /* Now check that we can pass negative (infinite) timeouts. */ + negative_timeout = -1; + for (i = 0; i < iter; i++) + blt_color_fill(batch, dst2, BUF_PAGES); + + intel_batchbuffer_flush(batch); + + igt_assert_eq(gem_bo_wait_timeout(fd, dst2->handle, &negative_timeout), 0); + igt_assert_eq(negative_timeout, 0); + igt_assert(gem_bo_busy(fd, dst2->handle) == false); + if (do_signals) igt_stop_signal_helper(); drm_intel_bo_unreference(dst2);