diff options
author | Mika Kuoppala <mika.kuoppala@linux.intel.com> | 2019-04-23 17:15:58 +0300 |
---|---|---|
committer | Mika Kuoppala <mika.kuoppala@linux.intel.com> | 2019-04-24 10:55:43 +0300 |
commit | 5e7519121de3c0e97ec27d33d6164278e86e75c5 (patch) | |
tree | fd1296da4b1d4db235be3f92958e408245769ce5 /tests/i915/gem_sync.c | |
parent | 504367d33b787de2ba8e007a5b620cfd6f0b3074 (diff) |
lib/igt_dummyload: Introduce igt_spin_reset
Libify resetting a spin for reuse.
v2: use also in perf_pmu
v3: s/cmd_spin/cmd_precondition
v4: remove early return for !spin (Chris)
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
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.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/tests/i915/gem_sync.c b/tests/i915/gem_sync.c index f17ecd0b..8c5aaa14 100644 --- a/tests/i915/gem_sync.c +++ b/tests/i915/gem_sync.c @@ -209,7 +209,6 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen) struct drm_i915_gem_execbuffer2 execbuf; double end, this, elapsed, now, baseline; unsigned long cycles; - uint32_t cmd; igt_spin_t *spin; memset(&object, 0, sizeof(object)); @@ -226,7 +225,6 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen) .flags = (IGT_SPIN_POLL_RUN | IGT_SPIN_FAST)); igt_assert(igt_spin_has_poll(spin)); - cmd = *spin->batch; gem_execbuf(fd, &execbuf); @@ -238,8 +236,8 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen) elapsed = 0; cycles = 0; do { - *spin->batch = cmd; - spin->poll[SPIN_POLL_START_IDX] = 0; + igt_spin_reset(spin); + gem_execbuf(fd, &spin->execbuf); igt_spin_busywait_until_started(spin); @@ -262,8 +260,8 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen) elapsed = 0; cycles = 0; do { - *spin->batch = cmd; - spin->poll[SPIN_POLL_START_IDX] = 0; + igt_spin_reset(spin); + gem_execbuf(fd, &spin->execbuf); igt_spin_busywait_until_started(spin); @@ -321,17 +319,14 @@ static void active_ring(int fd, unsigned ring, int timeout) double start, end, elapsed; unsigned long cycles; igt_spin_t *spin[2]; - uint32_t cmd; spin[0] = __igt_spin_new(fd, .engine = ring, .flags = IGT_SPIN_FAST); - cmd = *spin[0]->batch; spin[1] = __igt_spin_new(fd, .engine = ring, .flags = IGT_SPIN_FAST); - igt_assert(*spin[1]->batch == cmd); start = gettime(); end = start + timeout; @@ -343,7 +338,8 @@ static void active_ring(int fd, unsigned ring, int timeout) igt_spin_end(s); gem_sync(fd, s->handle); - *s->batch = cmd; + igt_spin_reset(s); + gem_execbuf(fd, &s->execbuf); } cycles += 1024; @@ -393,7 +389,6 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen) double end, this, elapsed, now, baseline; unsigned long cycles; igt_spin_t *spin[2]; - uint32_t cmd; memset(&object, 0, sizeof(object)); object.handle = gem_create(fd, 4096); @@ -409,7 +404,6 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen) .flags = (IGT_SPIN_POLL_RUN | IGT_SPIN_FAST)); igt_assert(igt_spin_has_poll(spin[0])); - cmd = *spin[0]->batch; spin[1] = __igt_spin_new(fd, .engine = execbuf.flags, @@ -423,8 +417,8 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen) gem_sync(fd, object.handle); for (int warmup = 0; warmup <= 1; warmup++) { - *spin[0]->batch = cmd; - spin[0]->poll[SPIN_POLL_START_IDX] = 0; + igt_spin_reset(spin[0]); + gem_execbuf(fd, &spin[0]->execbuf); end = gettime() + timeout/10.; @@ -433,8 +427,8 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen) do { igt_spin_busywait_until_started(spin[0]); - *spin[1]->batch = cmd; - spin[1]->poll[SPIN_POLL_START_IDX] = 0; + igt_spin_reset(spin[1]); + gem_execbuf(fd, &spin[1]->execbuf); this = gettime(); @@ -454,8 +448,8 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen) names[child % num_engines] ? " b" : "B", cycles, elapsed*1e6/cycles); - *spin[0]->batch = cmd; - spin[0]->poll[SPIN_POLL_START_IDX] = 0; + igt_spin_reset(spin[0]); + gem_execbuf(fd, &spin[0]->execbuf); end = gettime() + timeout; @@ -467,8 +461,8 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen) for (int n = 0; n < wlen; n++) gem_execbuf(fd, &execbuf); - *spin[1]->batch = cmd; - spin[1]->poll[SPIN_POLL_START_IDX] = 0; + igt_spin_reset(spin[1]); + gem_execbuf(fd, &spin[1]->execbuf); this = gettime(); |