From 7c2650a1ec9a2e9c036169a2acda584a692a7050 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 21 Sep 2017 14:57:24 -0700 Subject: intel_aubdump: Support I915_EXEC_BATCH_FIRST. The batch is now on the other end of the list. Fixes issues where modern Mesa and modern kernels together start putting the batch at the front of the list, and intel_aubdump looks for it at the end of the list, causing it to interpret some other buffer as the batch. Then AubLoad or aubinator see bogus data like 1.0 float as a GPU command and get grumpy. --- tools/aubdump.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tools/aubdump.c') diff --git a/tools/aubdump.c b/tools/aubdump.c index 4392e589..78d183f4 100644 --- a/tools/aubdump.c +++ b/tools/aubdump.c @@ -99,6 +99,10 @@ struct drm_i915_gem_userptr { #define IS_USERPTR(p) ((uintptr_t) (p) & USERPTR_FLAG) #define GET_PTR(p) ( (void *) ((uintptr_t) p & ~(uintptr_t) 1) ) +#ifndef I915_EXEC_BATCH_FIRST +#define I915_EXEC_BATCH_FIRST (1 << 18) +#endif + static void __attribute__ ((format(__printf__, 2, 3))) fail_if(int cond, const char *format, ...) { @@ -449,7 +453,9 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2) fail_if(bo->map == MAP_FAILED, "intel_aubdump: bo mmap failed\n"); } - batch_bo = get_bo(exec_objects[execbuffer2->buffer_count - 1].handle); + int batch_index = (execbuffer2->flags & I915_EXEC_BATCH_FIRST) ? 0 : + execbuffer2->buffer_count - 1; + batch_bo = get_bo(exec_objects[batch_index].handle); for (uint32_t i = 0; i < execbuffer2->buffer_count; i++) { obj = &exec_objects[i]; bo = get_bo(obj->handle); -- cgit v1.2.3