Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v3 2/4] lib/xe_ioctl: Return remaining timeout of user fence wait
Date: Mon, 19 Jun 2023 07:32:48 +0200	[thread overview]
Message-ID: <20230619053250.322791-3-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20230619053250.322791-1-zbigniew.kempczynski@intel.com>

When user fence is signalled we may want to be aware how long did it
take. Return remaining timeout after fence was successfully signalled.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>

---
v3: Replace long to int64_t as return value (Kamil)
---
 lib/xe/xe_ioctl.c | 8 +++++---
 lib/xe/xe_ioctl.h | 6 +++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
index c8af747cf7..9ead7307c4 100644
--- a/lib/xe/xe_ioctl.c
+++ b/lib/xe/xe_ioctl.c
@@ -401,9 +401,9 @@ void xe_exec_wait(int fd, uint32_t engine, uint64_t addr)
 	syncobj_destroy(fd, sync.handle);
 }
 
-void xe_wait_ufence(int fd, uint64_t *addr, uint64_t value,
-		    struct drm_xe_engine_class_instance *eci,
-		    int64_t timeout)
+int64_t xe_wait_ufence(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),
@@ -417,6 +417,8 @@ void xe_wait_ufence(int fd, uint64_t *addr, uint64_t value,
 	};
 
 	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_WAIT_USER_FENCE, &wait), 0);
+
+	return wait.timeout;
 }
 
 /**
diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h
index d9d78f86c9..e014ad66c9 100644
--- a/lib/xe/xe_ioctl.h
+++ b/lib/xe/xe_ioctl.h
@@ -79,9 +79,9 @@ void xe_exec(int fd, struct drm_xe_exec *exec);
 void xe_exec_sync(int fd, uint32_t engine, uint64_t addr,
 		  struct drm_xe_sync *sync, uint32_t num_syncs);
 void xe_exec_wait(int fd, uint32_t engine, uint64_t addr);
-void xe_wait_ufence(int fd, uint64_t *addr, uint64_t value,
-		    struct drm_xe_engine_class_instance *eci,
-		    int64_t timeout);
+int64_t xe_wait_ufence(int fd, uint64_t *addr, uint64_t value,
+		       struct drm_xe_engine_class_instance *eci,
+		       int64_t timeout);
 int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
 			       struct drm_xe_engine_class_instance *eci,
 			       int64_t timeout);
-- 
2.34.1

  parent reply	other threads:[~2023-06-19  5:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19  5:32 [igt-dev] [PATCH i-g-t v3 0/4] Add absolute user fence timeout Zbigniew Kempczyński
2023-06-19  5:32 ` [igt-dev] [PATCH i-g-t v3 1/4] lib/xe_ioctl: Add xe_wait_ufence_abstime() helper Zbigniew Kempczyński
2023-06-19  5:32 ` Zbigniew Kempczyński [this message]
2023-06-19 11:51   ` [igt-dev] [PATCH i-g-t v3 2/4] lib/xe_ioctl: Return remaining timeout of user fence wait Kamil Konieczny
2023-06-19  5:32 ` [igt-dev] [PATCH i-g-t v3 3/4] tests/xe_waitfence: Rename vague subtest name "test" to reltime Zbigniew Kempczyński
2023-06-19  5:32 ` [igt-dev] [PATCH i-g-t v3 4/4] tests/xe_waitfence: Add abstime subtest for user fence Zbigniew Kempczyński
2023-06-19 11:52   ` Kamil Konieczny
2023-06-19 13:32     ` Zbigniew Kempczyński
2023-06-19  6:50 ` [igt-dev] ✓ Fi.CI.BAT: success for Add absolute user fence timeout (rev3) Patchwork
2023-06-19  8:04 ` [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=20230619053250.322791-3-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@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