summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2016-11-15 21:59:57 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2016-11-22 08:33:25 -0800
commit09f2fe49b1425762e60bdccf90e631f6b8c95338 (patch)
tree4c669da4966112967c87aa5d57fe46753e59658d
parent59cdcf1febdbeb1c00dccb30940089f6877d6c1d (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>
-rw-r--r--tools/aubdump.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/tools/aubdump.c b/tools/aubdump.c
index f7ef6995..1aa9c3b6 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);
+ }
}
/**
@@ -351,7 +367,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;