[Intel-gfx] [PATCH] intel_aubdump: Default to 64-bit AUBs when the gen is unknown
Jordan Justen
jordan.l.justen at intel.com
Fri Sep 15 00:34:24 UTC 2017
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
tools/aubdump.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/tools/aubdump.c b/tools/aubdump.c
index 788bed13..893ddf93 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -58,6 +58,7 @@ static int gen = 0;
static int verbose = 0;
static bool device_override;
static uint32_t device;
+static bool use_64bit = false;
static const struct {
const char *name;
@@ -185,7 +186,7 @@ data_out(const void *data, size_t size)
static uint32_t
gtt_entry_size(void)
{
- return gen >= 8 ? 8 : 4;
+ return use_64bit ? 8 : 4;
}
static uint32_t
@@ -224,17 +225,17 @@ write_header(void)
data_out(comment, comment_dwords * 4);
/* Set up the GTT. The max we can handle is 64M */
- dword_out(CMD_AUB_TRACE_HEADER_BLOCK | ((gen >= 8 ? 6 : 5) - 2));
+ dword_out(CMD_AUB_TRACE_HEADER_BLOCK | ((use_64bit ? 6 : 5) - 2));
dword_out(AUB_TRACE_MEMTYPE_GTT_ENTRY |
AUB_TRACE_TYPE_NOTYPE | AUB_TRACE_OP_DATA_WRITE);
dword_out(0); /* subtype */
dword_out(0); /* offset */
dword_out(gtt_size()); /* size */
- if (gen >= 8)
+ if (use_64bit)
dword_out(0);
for (uint32_t i = 0; i * gtt_entry_size() < gtt_size(); i++) {
dword_out(entry + 0x1000 * i);
- if (gen >= 8)
+ if (use_64bit)
dword_out(0);
}
}
@@ -258,13 +259,13 @@ aub_write_trace_block(uint32_t type, void *virtual, uint32_t size, uint64_t gtt_
block_size = 8 * 4096;
dword_out(CMD_AUB_TRACE_HEADER_BLOCK |
- ((gen >= 8 ? 6 : 5) - 2));
+ ((use_64bit ? 6 : 5) - 2));
dword_out(AUB_TRACE_MEMTYPE_GTT |
type | AUB_TRACE_OP_DATA_WRITE);
dword_out(subtype);
dword_out(gtt_offset + offset);
dword_out(align_u32(block_size, 4));
- if (gen >= 8)
+ if (use_64bit)
dword_out((gtt_offset + offset) >> 32);
if (virtual)
@@ -280,7 +281,7 @@ aub_write_trace_block(uint32_t type, void *virtual, uint32_t size, uint64_t gtt_
static void
write_reloc(void *p, uint64_t v)
{
- if (gen >= 8) {
+ if (use_64bit) {
/* From the Broadwell PRM Vol. 2a,
* MI_LOAD_REGISTER_MEM::MemoryAddress:
*
@@ -319,7 +320,7 @@ aub_dump_ringbuffer(uint64_t batch_offset, uint64_t offset, int ring_flag)
/* Make a ring buffer to execute our batchbuffer. */
memset(ringbuffer, 0, sizeof(ringbuffer));
- aub_mi_bbs_len = gen >= 8 ? 3 : 2;
+ aub_mi_bbs_len = use_64bit ? 3 : 2;
ringbuffer[ring_count] = AUB_MI_BATCH_BUFFER_START | (aub_mi_bbs_len - 2);
write_reloc(&ringbuffer[ring_count + 1], batch_offset);
ring_count += aub_mi_bbs_len;
@@ -328,12 +329,12 @@ aub_dump_ringbuffer(uint64_t batch_offset, uint64_t offset, int ring_flag)
* the ring in the simulator.
*/
dword_out(CMD_AUB_TRACE_HEADER_BLOCK |
- ((gen >= 8 ? 6 : 5) - 2));
+ ((use_64bit ? 6 : 5) - 2));
dword_out(AUB_TRACE_MEMTYPE_GTT | ring | AUB_TRACE_OP_COMMAND_WRITE);
dword_out(0); /* general/surface subtype */
dword_out(offset);
dword_out(ring_count * 4);
- if (gen >= 8)
+ if (use_64bit)
dword_out(offset >> 32);
data_out(ringbuffer, ring_count * 4);
@@ -436,6 +437,11 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
filename, device, gen);
}
+ /* If we don't know the device gen, then it probably is a
+ * newer device which supports 64-bit.
+ */
+ use_64bit = gen >= 8 || gen == 0;
+
if (verbose)
printf("Dumping execbuffer2:\n");
--
2.14.1
More information about the Intel-gfx
mailing list