[Intel-gfx] [PATCH] aubdump: Don't bail if a GEM handle of 0 is passed into execbuf

Jason Ekstrand jason at jlekstrand.net
Fri Mar 24 23:45:01 UTC 2017


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.
---
 tools/aubdump.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/aubdump.c b/tools/aubdump.c
index 8a89b8c..3aca7eb 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -131,7 +131,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;
 }
@@ -442,7 +441,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");
 	}
@@ -583,7 +582,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");
 }
 
-- 
2.5.0.400.gff86faf



More information about the Intel-gfx mailing list