[Intel-gfx] [PATCH 2/2] intel: Add per-dword decode of gen7 3DPRIMITIVE.

Eric Anholt eric at anholt.net
Mon Mar 5 19:37:21 CET 2012


---
 intel/intel_decode.c              |   29 ++++++++++++++++++++++++-----
 intel/tests/gen7-3d.batch-ref.txt |   14 +++++++-------
 2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index af621d4..df9b704 100644
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
@@ -2577,10 +2577,8 @@ static const char *get_965_element_component(uint32_t data, int component)
 	}
 }
 
-static const char *get_965_prim_type(uint32_t data)
+static const char *get_965_prim_type(uint32_t primtype)
 {
-	uint32_t primtype = (data >> 10) & 0x1f;
-
 	switch (primtype) {
 	case 0x01:
 		return "point list";
@@ -3009,7 +3007,7 @@ gen4_3DPRIMITIVE(struct drm_intel_decode *ctx)
 {
 	instr_out(ctx, 0,
 		  "3DPRIMITIVE: %s %s\n",
-		  get_965_prim_type(ctx->data[0]),
+		  get_965_prim_type((ctx->data[0] >> 10) & 0x1f),
 		  (ctx->data[0] & (1 << 15)) ? "random" : "sequential");
 	instr_out(ctx, 1, "vertex count\n");
 	instr_out(ctx, 2, "start vertex\n");
@@ -3021,6 +3019,27 @@ gen4_3DPRIMITIVE(struct drm_intel_decode *ctx)
 }
 
 static int
+gen7_3DPRIMITIVE(struct drm_intel_decode *ctx)
+{
+	bool indirect = !!(ctx->data[0] & (1 << 10));
+
+	instr_out(ctx, 0,
+		  "3DPRIMITIVE: %s%s\n",
+		  indirect ? " indirect" : "",
+		  (ctx->data[0] & (1 << 8)) ? " predicated" : "");
+	instr_out(ctx, 1, "%s %s\n",
+		  get_965_prim_type(ctx->data[1] & 0x3f),
+		  (ctx->data[1] & (1 << 8)) ? "random" : "sequential");
+	instr_out(ctx, 2, indirect ? "ignored" : "vertex count\n");
+	instr_out(ctx, 3, indirect ? "ignored" : "start vertex\n");
+	instr_out(ctx, 4, indirect ? "ignored" : "instance count\n");
+	instr_out(ctx, 5, indirect ? "ignored" : "start instance\n");
+	instr_out(ctx, 6, indirect ? "ignored" : "index bias\n");
+
+	return 7;
+}
+
+static int
 decode_3d_965(struct drm_intel_decode *ctx)
 {
 	uint32_t opcode;
@@ -3120,7 +3139,7 @@ decode_3d_965(struct drm_intel_decode *ctx)
 		{ 0x7917, 0x00ff, 2, 2+128*2, "3DSTATE_SO_DECL_LIST" },
 		{ 0x7918, 0x00ff, 4, 4, "3DSTATE_SO_BUFFER" },
 		{ 0x7a00, 0x00ff, 4, 6, "PIPE_CONTROL" },
-		{ 0x7b00, 0x00ff, 7, 7, "3DPRIMITIVE", 7 },
+		{ 0x7b00, 0x00ff, 7, 7, NULL, 7, gen7_3DPRIMITIVE },
 		{ 0x7b00, 0x00ff, 6, 6, NULL, 0, gen4_3DPRIMITIVE },
 	}, *opcode_3d = NULL;
 
diff --git a/intel/tests/gen7-3d.batch-ref.txt b/intel/tests/gen7-3d.batch-ref.txt
index 1488ca5..be3c85e 100644
--- a/intel/tests/gen7-3d.batch-ref.txt
+++ b/intel/tests/gen7-3d.batch-ref.txt
@@ -202,11 +202,11 @@
 0x12300324:      0x11230000:    (X, Y, 0.0, 1.0), dst offset 0x00 bytes
 0x12300328:      0x02400008:    buffer 0: invalid, type 0x0040, src offset 0x0008 bytes
 0x1230032c:      0x11130000:    (X, Y, Z, 1.0), dst offset 0x00 bytes
-0x12300330:      0x7b000005: 3DPRIMITIVE
-0x12300334:      0x00000007:    dword 1
-0x12300338:      0x00000004:    dword 2
-0x1230033c:      0x00000000:    dword 3
-0x12300340:      0x00000001:    dword 4
-0x12300344:      0x00000000:    dword 5
-0x12300348:      0x00000000:    dword 6
+0x12300330:      0x7b000005: 3DPRIMITIVE: 
+0x12300334:      0x00000007:    quad list sequential
+0x12300338:      0x00000004:    vertex count
+0x1230033c:      0x00000000:    start vertex
+0x12300340:      0x00000001:    instance count
+0x12300344:      0x00000000:    start instance
+0x12300348:      0x00000000:    index bias
 0x1230034c:      0x05000000: MI_BATCH_BUFFER_END
-- 
1.7.9.1




More information about the Intel-gfx mailing list