From: Robert Foss <robert.foss@xxxxxxxxxxxxx> Add igt_require_sw_sync to provide tests to skip if sw_sync support isn't available on the host machine. Signed-off-by: Robert Foss <robert.foss@xxxxxxxxxxxxx> --- lib/sw_sync.c | 22 ++++++++++++++++++++++ lib/sw_sync.h | 1 + 2 files changed, 23 insertions(+) diff --git a/lib/sw_sync.c b/lib/sw_sync.c index 862f8c4..38fe670 100644 --- a/lib/sw_sync.c +++ b/lib/sw_sync.c @@ -197,3 +197,25 @@ int sync_fence_count_status(int fd, int status) igt_assert(count >= 0); return count; } + +static bool kernel_has_sw_sync(void) +{ + bool err; + + igt_ignore_warn(system("/sbin/modprobe -s r sw_sync")); + + err = false; + if (access(DEVFS_SW_SYNC, R_OK | W_OK) < 0) { + char buf[128]; + + snprintf(buf, sizeof(buf), "%s/sw_sync", igt_debugfs_mount()); + err = access(DEBUGFS_SW_SYNC, R_OK | W_OK) < 0; + } + + return !err; +} + +void igt_require_sw_sync(void) +{ + igt_require(kernel_has_sw_sync()); +} diff --git a/lib/sw_sync.h b/lib/sw_sync.h index 1f47b29..0bbe73c 100644 --- a/lib/sw_sync.h +++ b/lib/sw_sync.h @@ -43,6 +43,7 @@ int sync_merge(int fd1, int fd2); int sync_wait(int fence, int timeout); int sync_fence_count(int fd); int sync_fence_count_status(int fd, int status); +void igt_require_sw_sync(void); #endif -- 2.10.2 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx