Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mrzyglod <daniel.t.mrzyglod@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/intel/xe_waitfence: add positive subtest with eci engine provided
Date: Wed, 15 Nov 2023 16:56:26 +0100	[thread overview]
Message-ID: <20231115155626.756378-1-daniel.t.mrzyglod@intel.com> (raw)

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

             reply	other threads:[~2023-11-15 15:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 15:56 Daniel Mrzyglod [this message]
2023-11-15 17:09 ` [igt-dev] [PATCH i-g-t] tests/intel/xe_waitfence: add positive subtest with eci engine provided 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231115155626.756378-1-daniel.t.mrzyglod@intel.com \
    --to=daniel.t.mrzyglod@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox