From: Robert Foss <robert.foss@xxxxxxxxxxxxx> This subtest verifies that waiting on fences works properly. Signed-off-by: Robert Foss <robert.foss@xxxxxxxxxxxxx> Reviewed-by: Eric Engestrom <eric@xxxxxxxxxxxx> --- tests/sw_sync.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/sw_sync.c b/tests/sw_sync.c index 5a2c53e..cc63012 100644 --- a/tests/sw_sync.c +++ b/tests/sw_sync.c @@ -81,6 +81,41 @@ static void test_alloc_merge_fence(void) close(timeline[1]); } +static void test_sync_wait(void) +{ + int fence, ret; + int timeline; + + timeline = sw_sync_timeline_create(); + fence = sw_sync_fence_create(timeline, 5); + + /* Wait on fence until timeout */ + ret = sw_sync_wait(fence, 0); + igt_assert_f(ret == 0, "Failure waiting on fence until timeout\n"); + + /* Advance timeline from 0 -> 1 */ + sw_sync_timeline_inc(timeline, 1); + + /* Wait on fence until timeout */ + ret = sw_sync_wait(fence, 0); + igt_assert_f(ret == 0, "Failure waiting on fence until timeout\n"); + + /* Signal the fence */ + sw_sync_timeline_inc(timeline, 4); + + /* Wait successfully */ + ret = sw_sync_wait(fence, 0); + igt_assert_f(ret > 0, "Failure waiting on fence\n"); + + /* Go even further, and confirm wait still succeeds */ + sw_sync_timeline_inc(timeline, 10); + ret = sw_sync_wait(fence, 0); + igt_assert_f(ret > 0, "Failure waiting ahead\n"); + + close(fence); + close(timeline); +} + igt_main { igt_subtest("alloc_timeline") @@ -94,5 +129,8 @@ igt_main igt_subtest("alloc_merge_fence") test_alloc_merge_fence(); + + igt_subtest("sync_wait") + test_sync_wait(); } -- 2.9.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx