[PATCH i-g-t v11 17/21] lib/sw_sync: Add igt_require_sw_sync to enable skipping on no sw_sync support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@xxxxxxxxxxxxx>
---
 lib/sw_sync.c | 14 ++++++++++++++
 lib/sw_sync.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/lib/sw_sync.c b/lib/sw_sync.c
index aa8feefe..276dc795 100644
--- a/lib/sw_sync.c
+++ b/lib/sw_sync.c
@@ -212,3 +212,17 @@ int sync_fence_count_status(int fd, int status)
 
 	return count;
 }
+
+static bool kernel_has_sw_sync(void)
+{
+	char buf[128];
+
+	igt_ignore_warn(system("/sbin/modprobe -s r sw_sync"));
+
+	return kernel_sw_sync_path(buf, sizeof(buf));
+}
+
+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 cea5a603..82af3378 100644
--- a/lib/sw_sync.h
+++ b/lib/sw_sync.h
@@ -39,6 +39,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.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux