summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2021-07-01 09:04:40 +0200
committerZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2021-08-10 21:02:50 +0200
commit9e8cedeaf26344c7afd7185d6c2cf4b174560a33 (patch)
tree22ba1f7f0252139ec54b63c48c8237d76964bc1d
parent9165e7b3420fefb50d9e0f3ebcbf3ae166d90efb (diff)
tests/sysfs_timeslice_duration: Adopt to use allocator
For newer gens we're not able to rely on relocations. Adopt to use offsets acquired from the allocator. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
-rw-r--r--tests/i915/sysfs_timeslice_duration.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/i915/sysfs_timeslice_duration.c b/tests/i915/sysfs_timeslice_duration.c
index b73ee388..8a2f1c2f 100644
--- a/tests/i915/sysfs_timeslice_duration.c
+++ b/tests/i915/sysfs_timeslice_duration.c
@@ -37,6 +37,7 @@
#include "i915/gem_mman.h"
#include "igt_dummyload.h"
#include "igt_sysfs.h"
+#include "intel_allocator.h"
#include "ioctl_wrappers.h"
#include "intel_chipset.h"
#include "intel_reg.h"
@@ -371,6 +372,7 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)
igt_spin_t *spin[2];
uint64_t elapsed;
const intel_ctx_t *ctx[2];
+ uint64_t ahnd[2];
igt_assert(igt_sysfs_scanf(engine, "class", "%u", &class) == 1);
igt_assert(igt_sysfs_scanf(engine, "instance", "%u", &inst) == 1);
@@ -378,15 +380,18 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)
set_timeslice(engine, timeout);
ctx[0] = create_ctx(i915, class, inst, 0);
- spin[0] = igt_spin_new(i915, .ctx = ctx[0],
+ ahnd[0] = get_reloc_ahnd(i915, ctx[0]->id);
+ spin[0] = igt_spin_new(i915, .ahnd = ahnd[0], .ctx = ctx[0],
.flags = (IGT_SPIN_NO_PREEMPTION |
IGT_SPIN_POLL_RUN |
IGT_SPIN_FENCE_OUT));
igt_spin_busywait_until_started(spin[0]);
ctx[1] = create_ctx(i915, class, inst, 0);
+ ahnd[1] = get_reloc_ahnd(i915, ctx[1]->id);
igt_nsec_elapsed(&ts);
- spin[1] = igt_spin_new(i915, .ctx = ctx[1], .flags = IGT_SPIN_POLL_RUN);
+ spin[1] = igt_spin_new(i915, .ahnd = ahnd[1], .ctx = ctx[1],
+ .flags = IGT_SPIN_POLL_RUN);
igt_spin_busywait_until_started(spin[1]);
elapsed = igt_nsec_elapsed(&ts);
@@ -399,6 +404,8 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)
intel_ctx_destroy(i915, ctx[1]);
intel_ctx_destroy(i915, ctx[0]);
+ put_ahnd(ahnd[1]);
+ put_ahnd(ahnd[0]);
gem_quiescent_gpu(i915);
return elapsed;
@@ -460,6 +467,7 @@ static void test_off(int i915, int engine)
unsigned int saved;
igt_spin_t *spin[2];
const intel_ctx_t *ctx[2];
+ uint64_t ahnd[2];
/*
* As always, there are some who must run uninterrupted and simply do
@@ -482,14 +490,17 @@ static void test_off(int i915, int engine)
set_timeslice(engine, 0);
ctx[0] = create_ctx(i915, class, inst, 0);
- spin[0] = igt_spin_new(i915, .ctx = ctx[0],
+ ahnd[0] = get_reloc_ahnd(i915, ctx[0]->id);
+ spin[0] = igt_spin_new(i915, .ahnd = ahnd[0], .ctx = ctx[0],
.flags = (IGT_SPIN_NO_PREEMPTION |
IGT_SPIN_POLL_RUN |
IGT_SPIN_FENCE_OUT));
igt_spin_busywait_until_started(spin[0]);
ctx[1] = create_ctx(i915, class, inst, 0);
- spin[1] = igt_spin_new(i915, .ctx = ctx[1], .flags = IGT_SPIN_POLL_RUN);
+ ahnd[1] = get_reloc_ahnd(i915, ctx[1]->id);
+ spin[1] = igt_spin_new(i915, .ahnd = ahnd[1], .ctx = ctx[1],
+ .flags = IGT_SPIN_POLL_RUN);
for (int i = 0; i < 150; i++) {
igt_assert_eq(sync_fence_status(spin[0]->out_fence), 0);
@@ -508,6 +519,8 @@ static void test_off(int i915, int engine)
intel_ctx_destroy(i915, ctx[1]);
intel_ctx_destroy(i915, ctx[0]);
+ put_ahnd(ahnd[1]);
+ put_ahnd(ahnd[0]);
igt_assert(enable_hangcheck(i915, true));
gem_quiescent_gpu(i915);