Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Jouni Högander" <jouni.hogander@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Sai Gowtham Ch <sai.gowtham.ch@intel.com>
Subject: [igt-dev] [PATCH i-g-t v5 3/4] lib/xe/xe_spin: Handle spinner timer for Xe as well
Date: Mon, 19 Jun 2023 15:56:32 +0300	[thread overview]
Message-ID: <20230619125633.2395171-4-jouni.hogander@intel.com> (raw)
In-Reply-To: <20230619125633.2395171-1-jouni.hogander@intel.com>

Current spinner implementation for Xe doesn't support setting
timeout. Fix this by handling timers same way as for i915 as well.

Cc: Sai Gowtham Ch <sai.gowtham.ch@intel.com>

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 lib/xe/xe_spin.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
index 9f511e14f..d8c665f39 100644
--- a/lib/xe/xe_spin.c
+++ b/lib/xe/xe_spin.c
@@ -115,6 +115,7 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt)
 	spin->syncobj = syncobj_create(fd, 0);
 	spin->vm = opt->vm;
 	spin->engine = opt->engine;
+	spin->timerfd = -1;
 
 	if (!spin->vm)
 		spin->vm = xe_vm_create(fd, 0, 0);
@@ -163,6 +164,13 @@ void xe_spin_sync_wait(int fd, struct igt_spin *spin)
 void xe_spin_free(int fd, struct igt_spin *spin)
 {
 	igt_assert(spin->driver == INTEL_DRIVER_XE);
+
+	if (spin->timerfd >= 0) {
+		pthread_cancel(spin->timer_thread);
+		igt_assert(pthread_join(spin->timer_thread, NULL) == 0);
+		close(spin->timerfd);
+	}
+
 	xe_spin_end(spin->xe_spin);
 	xe_spin_sync_wait(fd, spin);
 	xe_vm_unbind_sync(fd, spin->vm, 0, spin->address, spin->bo_size);
-- 
2.34.1

  parent reply	other threads:[~2023-06-19 12:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19 12:56 [igt-dev] [PATCH i-g-t v5 0/4] Testcases for dirtyfb ioctl Jouni Högander
2023-06-19 12:56 ` [igt-dev] [PATCH i-g-t v5 1/4] tests/i915/kms_frontbuffer_tracking: Split fbc into library Jouni Högander
2023-06-19 12:56 ` [igt-dev] [PATCH i-g-t v5 2/4] tests/i915/kms_frontbuffer_tracking: Split drrs " Jouni Högander
2023-06-19 12:56 ` Jouni Högander [this message]
2023-06-19 12:56 ` [igt-dev] [PATCH i-g-t v5 4/4] tests/kms_dirtyfb: Add new test for dirtyfb ioctl Jouni Högander
2023-06-19 20:01 ` [igt-dev] ✓ Fi.CI.BAT: success for Testcases for dirtyfb ioctl (rev7) Patchwork
2023-06-20  7:03 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20230619125633.2395171-4-jouni.hogander@intel.com \
    --to=jouni.hogander@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=sai.gowtham.ch@intel.com \
    /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