Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/intel/xe_waitfence: add positive subtest with eci engine provided
@ 2023-11-15 15:56 Daniel Mrzyglod
  2023-11-15 17:09 ` Kamil Konieczny
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: Daniel Mrzyglod @ 2023-11-15 15:56 UTC (permalink / raw)
  To: igt-dev

Postive tests to check XE_WAIT_USER_FENCE ioctl where
engine class instance is provided

Signed-off-by: Daniel Mrzyglod <daniel.t.mrzyglod@intel.com>
---
 tests/intel/xe_waitfence.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tests/intel/xe_waitfence.c b/tests/intel/xe_waitfence.c
index ac7e99dde..dcf2908d6 100644
--- a/tests/intel/xe_waitfence.c
+++ b/tests/intel/xe_waitfence.c
@@ -37,9 +37,30 @@ static void do_bind(int fd, uint32_t vm, uint32_t bo, uint64_t offset,
 	xe_vm_bind_async(fd, vm, 0, bo, offset, addr, size, sync, 1);
 }
 
+static int xe_wait_ufence_hasengine(int fd, uint64_t *addr, uint64_t value,
+		       struct drm_xe_engine_class_instance *eci,
+		       int64_t timeout)
+{
+	struct drm_xe_wait_user_fence wait = {
+		.addr = to_user_pointer(addr),
+		.op = DRM_XE_UFENCE_WAIT_EQ,
+		.flags = !eci ? 0 : DRM_XE_UFENCE_WAIT_ABSTIME,
+		.value = value,
+		.mask = DRM_XE_UFENCE_WAIT_U64,
+		.timeout = timeout,
+		.num_engines = eci ? 1 :0,
+		.instances = eci ? to_user_pointer(eci) : 0,
+	};
+
+	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_WAIT_USER_FENCE, &wait), 0);
+
+	return wait.timeout;
+}
+
 enum waittype {
 	RELTIME,
 	ABSTIME,
+	HASENGINE,
 };
 
 /**
@@ -50,10 +71,16 @@ enum waittype {
  * SUBTEST: abstime
  * Description: Check basic waitfences functionality with timeout
  *              passed as absolute time in nanoseconds
+ *
+ * SUBTEST: hasengine
+ * Description: Check basic waitfences functionality with timeout
+ *              passed as relative time in nanoseconds and provide engine class
+ *              instance
  */
 static void
 waitfence(int fd, enum waittype wt)
 {
+	struct drm_xe_engine_class_instance *eci;
 	uint32_t bo_1;
 	uint32_t bo_2;
 	uint32_t bo_3;
@@ -83,6 +110,11 @@ waitfence(int fd, enum waittype wt)
 		timeout = xe_wait_ufence(fd, &wait_fence, 7, NULL, MS_TO_NS(10));
 		igt_debug("wait type: RELTIME - timeout: %ld, timeout left: %ld\n",
 			  MS_TO_NS(10), timeout);
+	} else if (wt == HASENGINE) {
+		eci = xe_hw_engine(fd, 1);
+		timeout = xe_wait_ufence_hasengine(fd, &wait_fence, 7, eci, MS_TO_NS(10));
+		igt_debug("wait type: RELTIME - timeout: %ld, timeout left: %ld\n",
+				  MS_TO_NS(10), timeout);
 	} else {
 		struct timespec ts;
 		int64_t current, signalled;
@@ -192,6 +224,8 @@ invalid_engine(int fd)
 }
 
 
+
+
 igt_main
 {
 	int fd;
@@ -205,6 +239,9 @@ igt_main
 	igt_subtest("abstime")
 		waitfence(fd, ABSTIME);
 
+	igt_subtest("hasengine")
+		waitfence(fd, HASENGINE);
+
 	igt_subtest("invalid-flag")
 		invalid_flag(fd);
 
-- 
2.41.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-11-23 23:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-15 15:56 [igt-dev] [PATCH i-g-t] tests/intel/xe_waitfence: add positive subtest with eci engine provided Daniel Mrzyglod
2023-11-15 17:09 ` Kamil Konieczny
2023-11-15 20:10 ` [igt-dev] ✓ CI.xeBAT: success for " Patchwork
2023-11-17  9:28 ` [igt-dev] [PATCH i-g-t v2] tests/intel/xe_waitfence: add subtest with provided engine class instance Daniel Mrzyglod
2023-11-20 16:15   ` Kamil Konieczny
2023-11-17 10:17 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/intel/xe_waitfence: add positive subtest with eci engine provided (rev2) Patchwork
2023-11-21 10:14 ` [igt-dev] [PATCH i-g-t v3] tests/intel/xe_waitfence: add subtest with provided engine class instance Daniel Mrzyglod
2023-11-22 15:48   ` Kamil Konieczny
2023-11-21 14:01 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/intel/xe_waitfence: add positive subtest with eci engine provided (rev3) Patchwork
2023-11-21 15:24 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
2023-11-22 16:43 ` [igt-dev] [PATCH i-g-t v4] tests/intel/xe_waitfence: add subtest with provided engine class instance Daniel Mrzyglod
2023-11-23  8:51   ` Kamil Konieczny
2023-11-22 20:38 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/intel/xe_waitfence: add positive subtest with eci engine provided (rev4) Patchwork
2023-11-22 21:20 ` [igt-dev] ✓ CI.xeBAT: " Patchwork
2023-11-23 23:16 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox