summaryrefslogtreecommitdiff
path: root/tools/aubdump.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2017-03-24 16:44:11 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2017-04-14 12:34:51 -0700
commitac1fe0968dedf7e6ce8885e18f8d3c68984e59d2 (patch)
tree0eaa1d497ab1bedd4e70a71affe15ebbe3c9370d /tools/aubdump.c
parent60568210a5616f2961a832fcb2f15daa5be918d1 (diff)
aubdump: Don't bail if a GEM handle of 0 is passed into execbuf
A gem handle of 0 can be used to check for whether or not 48-bit addressing is available. This keeps aubdump from failing on you if you try to do the check. Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Diffstat (limited to 'tools/aubdump.c')
-rw-r--r--tools/aubdump.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/aubdump.c b/tools/aubdump.c
index 08cee553..eccea74a 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -123,7 +123,6 @@ get_bo(uint32_t handle)
fail_if(handle >= MAX_BO_COUNT, "bo handle too large\n");
bo = &bos[handle];
- fail_if(bo->size == 0, "invalid bo handle (%d) in execbuf\n", handle);
return bo;
}
@@ -434,7 +433,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
offset = align_u32(offset + bo->size + 4095, 4096);
}
- if (bo->map == NULL)
+ if (bo->map == NULL && bo->size > 0)
bo->map = gem_mmap(fd, obj->handle, 0, bo->size);
fail_if(bo->map == MAP_FAILED, "intel_aubdump: bo mmap failed\n");
}
@@ -575,7 +574,7 @@ maybe_init(void)
}
fclose(config);
- bos = malloc(MAX_BO_COUNT * sizeof(bos[0]));
+ bos = calloc(MAX_BO_COUNT, sizeof(bos[0]));
fail_if(bos == NULL, "intel_aubdump: out of memory\n");
}