From: Daniel Mrzyglod <daniel.t.mrzyglod@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2] tests/intel/xe_waitfence: add subtest with provided engine class instance
Date: Fri, 17 Nov 2023 10:28:29 +0100 [thread overview]
Message-ID: <20231117092829.1177588-1-daniel.t.mrzyglod@intel.com> (raw)
In-Reply-To: <20231115155626.756378-1-daniel.t.mrzyglod@intel.com>
Postive test to check XE_WAIT_USER_FENCE ioctl where
engine class instance is provided.
v2: Fix review comments (Kamil)
provide ABSTIME as proper time format
Signed-off-by: Daniel Mrzyglod <daniel.t.mrzyglod@intel.com>
---
tests/intel/xe_waitfence.c | 48 +++++++++++++++++++++++++++++++++++---
1 file changed, 45 insertions(+), 3 deletions(-)
diff --git a/tests/intel/xe_waitfence.c b/tests/intel/xe_waitfence.c
index ac7e99dde..a88d3b9af 100644
--- a/tests/intel/xe_waitfence.c
+++ b/tests/intel/xe_waitfence.c
@@ -37,9 +37,32 @@ 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 int64_t wait_with_eci_abstime(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,
+ };
+ struct timespec ts;
+
+ igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_WAIT_USER_FENCE, &wait), 0);
+ igt_assert_eq(clock_gettime(CLOCK_MONOTONIC, &ts), 0);
+
+ return ts.tv_sec * 1e9 + ts.tv_nsec;
+}
+
enum waittype {
RELTIME,
ABSTIME,
+ ENGINE,
};
/**
@@ -50,10 +73,18 @@ enum waittype {
* SUBTEST: abstime
* Description: Check basic waitfences functionality with timeout
* passed as absolute time in nanoseconds
+ *
+ * SUBTEST: engine
+ * 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 = NULL;
+ struct timespec ts;
+ int64_t current, signalled;
uint32_t bo_1;
uint32_t bo_2;
uint32_t bo_3;
@@ -83,10 +114,18 @@ 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 == ENGINE) {
+ eci = xe_hw_engine(fd, 1);
+ igt_assert(eci);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ current = ts.tv_sec * 1e9 + ts.tv_nsec;
+ timeout = current + MS_TO_NS(10);
+ signalled = wait_with_eci_abstime(fd, &wait_fence, 7, eci, timeout);
+ igt_debug("wait type: ENGINE ABSTIME - timeout: %" PRId64
+ ", signalled: %" PRId64
+ ", elapsed: %" PRId64 "\n",
+ timeout, signalled, signalled - current);
} else {
- struct timespec ts;
- int64_t current, signalled;
-
clock_gettime(CLOCK_MONOTONIC, &ts);
current = ts.tv_sec * 1e9 + ts.tv_nsec;
timeout = current + MS_TO_NS(10);
@@ -205,6 +244,9 @@ igt_main
igt_subtest("abstime")
waitfence(fd, ABSTIME);
+ igt_subtest("engine")
+ waitfence(fd, ENGINE);
+
igt_subtest("invalid-flag")
invalid_flag(fd);
--
2.41.0
next prev parent reply other threads:[~2023-11-17 9:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Daniel Mrzyglod [this message]
2023-11-20 16:15 ` [igt-dev] [PATCH i-g-t v2] tests/intel/xe_waitfence: add subtest with provided engine class instance 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=20231117092829.1177588-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