From 04dfa492d195e063a07053815ff541b4351b0097 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 29 May 2012 16:52:23 +0200 Subject: [PATCH] tests/gem_wait_rendering_timeout: test the timeout case When I've first tried this it somehow failed, but I can't reproduce this any more. I guess I've hunted a ghost. --- tests/gem_wait_render_timeout.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/gem_wait_render_timeout.c b/tests/gem_wait_render_timeout.c index 53ec7d20..904e7839 100644 --- a/tests/gem_wait_render_timeout.c +++ b/tests/gem_wait_render_timeout.c @@ -163,8 +163,6 @@ int main(int argc, char **argv) intel_batchbuffer_flush(batch); ret = gem_bo_wait_timeout(fd, dst2->handle, &timeout); - if (do_signals) - drmtest_stop_signal_helper(); if (ret) { fprintf(stderr, "Timed wait failed %s\n", strerror(errno)); exit(EXIT_FAILURE); @@ -178,6 +176,20 @@ int main(int argc, char **argv) printf("Finished with %lu time remaining\n", timeout); } + /* Now check that we correctly time out, twice the auto-tune load should + * be good enough. */ + timeout = ENOUGH_WORK_IN_SECONDS * NSEC_PER_SEC; + for (i = 0; i < iter*2; i++) + blt_color_fill(batch, dst2, BUF_PAGES); + + intel_batchbuffer_flush(batch); + + ret = gem_bo_wait_timeout(fd, dst2->handle, &timeout); + assert(ret == -ETIME); + assert(timeout == 0); + + if (do_signals) + drmtest_stop_signal_helper(); drm_intel_bo_unreference(dst2); drm_intel_bo_unreference(dst); intel_batchbuffer_free(batch);