[Intel-gfx] [PATCH i-g-t 04/10] gem_wsim: Move BO allocation to a helper
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Wed Jun 17 16:01:14 UTC 2020
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
benchmarks/gem_wsim.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 60982cb73ba7..5893de38a98e 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -1472,6 +1472,11 @@ get_ctxid(struct workload *wrk, struct w_step *w)
return wrk->ctx_list[w->context].id;
}
+static uint32_t alloc_bo(int i915, unsigned long size)
+{
+ return gem_create(i915, size);
+}
+
static void
alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags)
{
@@ -1483,7 +1488,7 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags)
w->obj = calloc(nr_obj, sizeof(*w->obj));
igt_assert(w->obj);
- w->obj[j].handle = gem_create(fd, 4096);
+ w->obj[j].handle = alloc_bo(fd, 4096);
w->obj[j].flags = EXEC_OBJECT_WRITE;
j++;
igt_assert(j < nr_obj);
@@ -1528,7 +1533,8 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags)
else
w->bb_sz = get_bb_sz(w, w->duration.max);
- w->bb_handle = w->obj[j].handle = gem_create(fd, w->bb_sz + (w->unbound_duration ? 4096 : 0));
+ w->bb_handle = w->obj[j].handle =
+ alloc_bo(fd, w->bb_sz + (w->unbound_duration ? 4096 : 0));
init_bb(w, flags);
w->obj[j].relocation_count = terminate_bb(w, flags);
@@ -1685,7 +1691,7 @@ static void allocate_working_set(struct working_set *set)
igt_assert(set->handles);
for (i = 0; i < set->nr; i++)
- set->handles[i] = gem_create(fd, set->sizes[i]);
+ set->handles[i] = alloc_bo(fd, set->sizes[i]);
}
#define alloca0(sz) ({ size_t sz__ = (sz); memset(alloca(sz__), 0, sz__); })
@@ -2323,7 +2329,7 @@ static unsigned long calibrate_nop(unsigned int tolerance_pct, struct intel_exec
do {
struct timespec t_start;
- obj.handle = gem_create(fd, size);
+ obj.handle = alloc_bo(fd, size);
gem_write(fd, obj.handle, size - sizeof(bbe), &bbe,
sizeof(bbe));
gem_execbuf(fd, &eb);
--
2.20.1
More information about the Intel-gfx
mailing list