diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-08-10 16:08:31 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-08-10 16:16:36 +0100 |
commit | d9462e61f9b43828d6132679485a92108b60b2c8 (patch) | |
tree | d164947542a77b23dd5c7a4a0d71c4b26a2bd709 /benchmarks/gem_exec_trace.c | |
parent | 4c74a683c10ddfb2232cdb93f03c03295dde1201 (diff) |
benchmarks/gem_exec_trace: Clear all new bo handles
When reallocing the bo array, remember to set the new entries to 0.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks/gem_exec_trace.c')
-rw-r--r-- | benchmarks/gem_exec_trace.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/benchmarks/gem_exec_trace.c b/benchmarks/gem_exec_trace.c index a9e3eff1..598527ce 100644 --- a/benchmarks/gem_exec_trace.c +++ b/benchmarks/gem_exec_trace.c @@ -103,9 +103,11 @@ static void *add_bo(void *ptr) struct trace_add_bo *t = ptr; uint32_t bb = 0xa << 23; - if (t->handle > num_bo) { - num_bo = (t->handle + 4095) & -4096; - bo = realloc(bo, sizeof(*bo)*num_bo); + if (t->handle >= num_bo) { + int new_bo = (t->handle + 4096) & -4096; + bo = realloc(bo, sizeof(*bo)*new_bo); + memset(bo + num_bo, 0, sizeof(*bo)*(new_bo - num_bo)); + num_bo = new_bo; } bo[t->handle].handle = gem_create(fd, t->size); |