diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2018-08-14 11:40:40 +0100 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2018-09-14 12:53:27 +0100 |
commit | 8017074727a0725bf5ce5811acaed4b131f4471b (patch) | |
tree | cbf7c18c6f8a26092fee8bc5333f94809642e2da /benchmarks/gem_wsim.c | |
parent | 0ff0804b0d52e034459a80ab27c39965d5ea1e39 (diff) |
gem_wsim: Make batches preemptable by default
MI_NOOP cannot be preempted which means up to now gem_wsim workloads were
preemptable on batch buffer granularity only.
Add MI_ARB_CHK every 100us so the new default is mid-batch preemption.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks/gem_wsim.c')
-rw-r--r-- | benchmarks/gem_wsim.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index 282b986d..885e35bb 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -686,6 +686,25 @@ static unsigned long get_bb_sz(unsigned int duration) } static void +init_bb(struct w_step *w, unsigned int flags) +{ + /* Preemption point every 100us. */ + const unsigned int arb_period = get_bb_sz(100) / sizeof(uint32_t); + unsigned int i; + uint32_t *ptr; + + gem_set_domain(fd, w->bb_handle, + I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC); + + ptr = gem_mmap__wc(fd, w->bb_handle, 0, w->bb_sz, PROT_WRITE); + + for (i = arb_period; i < w->bb_sz / sizeof(uint32_t); i += arb_period) + ptr[i] = 0x5 << 23; /* MI_ARB_CHK */ + + munmap(ptr, w->bb_sz); +} + +static void terminate_bb(struct w_step *w, unsigned int flags) { const uint32_t bbe = 0xa << 23; @@ -839,6 +858,7 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags) w->bb_sz = get_bb_sz(w->duration.max); w->bb_handle = w->obj[j].handle = gem_create(fd, w->bb_sz); + init_bb(w, flags); terminate_bb(w, flags); if (flags & SEQNO) { |