summaryrefslogtreecommitdiff
path: root/tests/i915/gem_sync.c
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@linux.intel.com>2019-04-18 11:54:27 +0300
committerMika Kuoppala <mika.kuoppala@linux.intel.com>2019-04-18 17:03:31 +0300
commit226b9995d1fb486d34cd35428025b55532e9e3d1 (patch)
tree1b698d55cc0833a3603a20be134602283b01b7f7 /tests/i915/gem_sync.c
parent2df2ad21f8df58cbfb2be671571d9d9bae54e96c (diff)
lib/igt_dummyload: libify checks for spin batch activation
Instead of opencoding the poll into the spinner, use a helper to check if spinner has started. v2: use zero as presumed offset (Chris) v3: cleanup the relocs (Chris) v4: leave the domains to zero, avoid relocation (Chris) Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/i915/gem_sync.c')
-rw-r--r--tests/i915/gem_sync.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/tests/i915/gem_sync.c b/tests/i915/gem_sync.c
index 3e4feff3..0a0ed2a1 100644
--- a/tests/i915/gem_sync.c
+++ b/tests/i915/gem_sync.c
@@ -225,7 +225,7 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
.engine = execbuf.flags,
.flags = (IGT_SPIN_POLL_RUN |
IGT_SPIN_FAST));
- igt_assert(spin->running);
+ igt_assert(igt_spin_has_poll(spin));
cmd = *spin->batch;
gem_execbuf(fd, &execbuf);
@@ -239,10 +239,9 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
cycles = 0;
do {
*spin->batch = cmd;
- *spin->running = 0;
+ spin->poll[SPIN_POLL_START_IDX] = 0;
gem_execbuf(fd, &spin->execbuf);
- while (!READ_ONCE(*spin->running))
- ;
+ igt_spin_busywait_until_started(spin);
this = gettime();
igt_spin_batch_end(spin);
@@ -264,10 +263,9 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
cycles = 0;
do {
*spin->batch = cmd;
- *spin->running = 0;
+ spin->poll[SPIN_POLL_START_IDX] = 0;
gem_execbuf(fd, &spin->execbuf);
- while (!READ_ONCE(*spin->running))
- ;
+ igt_spin_busywait_until_started(spin);
for (int n = 0; n < wlen; n++)
gem_execbuf(fd, &execbuf);
@@ -410,7 +408,7 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
.engine = execbuf.flags,
.flags = (IGT_SPIN_POLL_RUN |
IGT_SPIN_FAST));
- igt_assert(spin[0]->running);
+ igt_assert(igt_spin_has_poll(spin[0]));
cmd = *spin[0]->batch;
spin[1] = __igt_spin_batch_new(fd,
@@ -426,18 +424,17 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
for (int warmup = 0; warmup <= 1; warmup++) {
*spin[0]->batch = cmd;
- *spin[0]->running = 0;
+ spin[0]->poll[SPIN_POLL_START_IDX] = 0;
gem_execbuf(fd, &spin[0]->execbuf);
end = gettime() + timeout/10.;
elapsed = 0;
cycles = 0;
do {
- while (!READ_ONCE(*spin[0]->running))
- ;
+ igt_spin_busywait_until_started(spin[0]);
*spin[1]->batch = cmd;
- *spin[1]->running = 0;
+ spin[1]->poll[SPIN_POLL_START_IDX] = 0;
gem_execbuf(fd, &spin[1]->execbuf);
this = gettime();
@@ -458,21 +455,20 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
cycles, elapsed*1e6/cycles);
*spin[0]->batch = cmd;
- *spin[0]->running = 0;
+ spin[0]->poll[SPIN_POLL_START_IDX] = 0;
gem_execbuf(fd, &spin[0]->execbuf);
end = gettime() + timeout;
elapsed = 0;
cycles = 0;
do {
- while (!READ_ONCE(*spin[0]->running))
- ;
+ igt_spin_busywait_until_started(spin[0]);
for (int n = 0; n < wlen; n++)
gem_execbuf(fd, &execbuf);
*spin[1]->batch = cmd;
- *spin[1]->running = 0;
+ spin[1]->poll[SPIN_POLL_START_IDX] = 0;
gem_execbuf(fd, &spin[1]->execbuf);
this = gettime();