summaryrefslogtreecommitdiff
path: root/tools/aubdump.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2016-11-15 21:59:57 -0800
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>2016-11-22 16:51:35 +0000
commit106b0ba68c77fa97449e10637e5eaca8bbfdb786 (patch)
tree9a6ebe61ef5fce5b60f4b30ae4627a819863d156 /tools/aubdump.c
parenta5788706852d0d02d6b9b7510daa1ffce083d4d5 (diff)
aubdump: Fix GTT setup for Gen8+
Gen8+ have 64 bit GTT entries, so we need to allocate twice as much space for the GTT table in order to cover the same number of GTT pages. Fixes sporadic page-fault crashes on the simulator. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'tools/aubdump.c')
-rw-r--r--tools/aubdump.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/tools/aubdump.c b/tools/aubdump.c
index 433f01ab..04deacd5 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -58,7 +58,6 @@ static char *filename = NULL;
static FILE *files[2] = { NULL, NULL };
static int gen = 0;
static int verbose = 0;
-static const uint32_t gtt_size = 0x10000;
static bool device_override;
static uint32_t device;
@@ -168,6 +167,20 @@ data_out(const void *data, size_t size)
}
}
+static uint32_t
+gtt_entry_size(void)
+{
+ return gen >= 8 ? 8 : 4;
+}
+
+static uint32_t
+gtt_size(void)
+{
+ /* Enough for 64MB assuming 4kB pages. */
+ const unsigned entries = 0x4000;
+ return entries * gtt_entry_size();
+}
+
static void
write_header(void)
{
@@ -190,11 +203,14 @@ write_header(void)
AUB_TRACE_TYPE_NOTYPE | AUB_TRACE_OP_DATA_WRITE);
dword_out(0); /* subtype */
dword_out(0); /* offset */
- dword_out(gtt_size); /* size */
+ dword_out(gtt_size()); /* size */
if (gen >= 8)
dword_out(0);
- for (uint32_t i = 0; i < gtt_size; i += 4, entry += 0x1000)
- dword_out(entry);
+ for (uint32_t i = 0; i * gtt_entry_size() < gtt_size(); i++) {
+ dword_out(entry + 0x1000 * i);
+ if (gen >= 8)
+ dword_out(0);
+ }
}
/**
@@ -376,7 +392,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
struct drm_i915_gem_exec_object2 *exec_objects =
(struct drm_i915_gem_exec_object2 *) (uintptr_t) execbuffer2->buffers_ptr;
uint32_t ring_flag = execbuffer2->flags & I915_EXEC_RING_MASK;
- uint32_t offset = gtt_size;
+ uint32_t offset = gtt_size();
struct drm_i915_gem_exec_object2 *obj;
struct bo *bo, *batch_bo;
void *data;