From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A30710E4C2 for ; Thu, 22 Jun 2023 05:46:09 +0000 (UTC) From: =?UTF-8?q?Jouni=20H=C3=B6gander?= To: igt-dev@lists.freedesktop.org Date: Thu, 22 Jun 2023 08:45:42 +0300 Message-Id: <20230622054543.3360732-4-jouni.hogander@intel.com> In-Reply-To: <20230622054543.3360732-1-jouni.hogander@intel.com> References: <20230622054543.3360732-1-jouni.hogander@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t v6 3/4] lib/xe/xe_spin: Handle spinner timer for Xe as well List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sai Gowtham Ch Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: 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 Signed-off-by: Jouni Högander --- 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