diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-12-15 15:23:06 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-12-22 15:08:53 +0000 |
commit | aba7b4081bdf492cc5d08903d4941ca64a51f7e4 (patch) | |
tree | 15918f98637b812bb0bea90aa23176a744eddd8d /tests | |
parent | 60a1f327556136c7fc03af667bc8be460550610b (diff) |
igt/perf_pmu: Measure the reference batch for all-busy-check-all
Don't rely on the timer being precise when we can sleep for a known
duration.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/perf_pmu.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c index b3b28965..d88287c1 100644 --- a/tests/perf_pmu.c +++ b/tests/perf_pmu.c @@ -288,36 +288,50 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines) const struct intel_execution_engine2 *e; uint64_t val[num_engines]; int fd[num_engines]; - igt_spin_t *spin[num_engines]; + unsigned long slept; + igt_spin_t *spin = NULL; unsigned int i; i = 0; - fd[0] = -1; for_each_engine_class_instance(fd, e) { if (!gem_has_engine(gem_fd, e->class, e->instance)) continue; - fd[i] = open_group(I915_PMU_ENGINE_BUSY(e->class, e->instance), - fd[0]); - - spin[i] = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0); - igt_spin_batch_set_timeout(spin[i], batch_duration_ns); + if (spin) { + struct drm_i915_gem_exec_object2 obj = { + .handle = spin->handle + }; + struct drm_i915_gem_execbuffer2 eb = { + .buffer_count = 1, + .buffers_ptr = to_user_pointer(&obj), + .flags = e2ring(gem_fd, e), + }; + gem_execbuf(gem_fd, &eb); + } else { + spin = igt_spin_batch_new(gem_fd, 0, + e2ring(gem_fd, e), 0); + } - i++; + val[i++] = I915_PMU_ENGINE_BUSY(e->class, e->instance); } + igt_assert(i == num_engines); + fd[0] = -1; for (i = 0; i < num_engines; i++) - gem_sync(gem_fd, spin[i]->handle); + fd[i] = open_group(val[i], fd[0]); + + slept = measured_usleep(batch_duration_ns / 1000); + igt_spin_batch_end(spin); pmu_read_multi(fd[0], num_engines, val); log_busy(fd[0], num_engines, val); - for (i = 0; i < num_engines; i++) - igt_spin_batch_free(gem_fd, spin[i]); + igt_spin_batch_free(gem_fd, spin); close(fd[0]); for (i = 0; i < num_engines; i++) - assert_within_epsilon(val[i], batch_duration_ns, tolerance); + assert_within_epsilon(val[i], slept, tolerance); + gem_quiescent_gpu(gem_fd); } static void |