summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2020-06-18 10:50:51 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2020-06-18 11:42:07 +0100
commit30949b4686d49ee92fd8c1951ff73fd3ef3d566d (patch)
tree62225229bce76b75757e82dda7c9ada3d2c768d9
parent0ae89fa583c8d4660b0c5e43c62d06360ab75b0e (diff)
gem_wsim: Do not keep batch mapped unless neededwsim
At this point we only need to keep the mapping for infinite batch buffers. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
-rw-r--r--benchmarks/gem_wsim.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 811a4b1b..496e5042 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -1449,6 +1449,7 @@ static unsigned int terminate_bb(struct w_step *w)
const uint32_t bbe = 0xa << 23;
unsigned long mmap_start, mmap_len;
unsigned long batch_start = w->bb_sz;
+ bool keep_mmap = false;
unsigned int r = 0;
uint32_t *ptr, *cs;
@@ -1472,6 +1473,7 @@ static unsigned int terminate_bb(struct w_step *w)
*cs++ = w->preempt_us ? 0x5 << 23 /* MI_ARB_CHK; */ : MI_NOOP;
w->recursive_bb_start = cs;
+ keep_mmap = true;
*cs++ = MI_BATCH_BUFFER_START | 1 << 8 | 1;
*cs++ = 0;
*cs++ = 0;
@@ -1479,6 +1481,9 @@ static unsigned int terminate_bb(struct w_step *w)
*cs = bbe;
+ if (!keep_mmap)
+ munmap(ptr, mmap_len);
+
return r;
}