[Intel-gfx] [PATCH 2/4] intel: Add decode for gen7 3DSTATE_WM.

Eric Anholt eric at anholt.net
Mon Feb 20 18:55:35 CET 2012


This requires pulling the gen6 3DSTATE_WM out to a function so it
doesn't override gen7's handler.
---
 intel/intel_decode.c              |  178 ++++++++++++++++++++++++++++---------
 intel/tests/gen7-3d.batch-ref.txt |   70 +++------------
 2 files changed, 150 insertions(+), 98 deletions(-)

diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index 00908d0..02e81f9 100644
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
@@ -2859,6 +2859,140 @@ gen7_3DSTATE_CONSTANT_HS(struct drm_intel_decode *ctx)
 	return gen7_3DSTATE_CONSTANT(ctx, "HS");
 }
 
+
+static int
+gen6_3DSTATE_WM(struct drm_intel_decode *ctx)
+{
+	instr_out(ctx, 0, "3DSTATE_WM\n");
+	instr_out(ctx, 1, "kernel start pointer 0\n");
+	instr_out(ctx, 2,
+		  "SPF=%d, VME=%d, Sampler Count %d, "
+		  "Binding table count %d\n",
+		  (ctx->data[2] >> 31) & 1,
+		  (ctx->data[2] >> 30) & 1,
+		  (ctx->data[2] >> 27) & 7,
+		  (ctx->data[2] >> 18) & 0xff);
+	instr_out(ctx, 3, "scratch offset\n");
+	instr_out(ctx, 4,
+		  "Depth Clear %d, Depth Resolve %d, HiZ Resolve %d, "
+		  "Dispatch GRF start[0] %d, start[1] %d, start[2] %d\n",
+		  (ctx->data[4] & (1 << 30)) != 0,
+		  (ctx->data[4] & (1 << 28)) != 0,
+		  (ctx->data[4] & (1 << 27)) != 0,
+		  (ctx->data[4] >> 16) & 0x7f,
+		  (ctx->data[4] >> 8) & 0x7f,
+		  (ctx->data[4] & 0x7f));
+	instr_out(ctx, 5,
+		  "MaxThreads %d, PS KillPixel %d, PS computed Z %d, "
+		  "PS use sourceZ %d, Thread Dispatch %d, PS use sourceW %d, "
+		  "Dispatch32 %d, Dispatch16 %d, Dispatch8 %d\n",
+		  ((ctx->data[5] >> 25) & 0x7f) + 1,
+		  (ctx->data[5] & (1 << 22)) != 0,
+		  (ctx->data[5] & (1 << 21)) != 0,
+		  (ctx->data[5] & (1 << 20)) != 0,
+		  (ctx->data[5] & (1 << 19)) != 0,
+		  (ctx->data[5] & (1 << 8)) != 0,
+		  (ctx->data[5] & (1 << 2)) != 0,
+		  (ctx->data[5] & (1 << 1)) != 0,
+		  (ctx->data[5] & (1 << 0)) != 0);
+	instr_out(ctx, 6,
+		  "Num SF output %d, Pos XY offset %d, ZW interp mode %d , "
+		  "Barycentric interp mode 0x%x, Point raster rule %d, "
+		  "Multisample mode %d, "
+		  "Multisample Dispatch mode %d\n",
+		  (ctx->data[6] >> 20) & 0x3f,
+		  (ctx->data[6] >> 18) & 3,
+		  (ctx->data[6] >> 16) & 3,
+		  (ctx->data[6] >> 10) & 0x3f,
+		  (ctx->data[6] & (1 << 9)) != 0,
+		  (ctx->data[6] >> 1) & 3,
+		  (ctx->data[6] & 1));
+	instr_out(ctx, 7, "kernel start pointer 1\n");
+	instr_out(ctx, 8, "kernel start pointer 2\n");
+
+	return 9;
+}
+
+static int
+gen7_3DSTATE_WM(struct drm_intel_decode *ctx)
+{
+	const char *computed_depth = "";
+	const char *early_depth = "";
+	const char *zw_interp = "";
+
+	switch ((ctx->data[1] >> 23) & 0x3) {
+	case 0:
+		computed_depth = "";
+		break;
+	case 1:
+		computed_depth = "computed depth";
+		break;
+	case 2:
+		computed_depth = "computed depth >=";
+		break;
+	case 3:
+		computed_depth = "computed depth <=";
+		break;
+	}
+
+	switch ((ctx->data[1] >> 21) & 0x3) {
+	case 0:
+		early_depth = "";
+		break;
+	case 1:
+		early_depth = ", EDSC_PSEXEC";
+		break;
+	case 2:
+		early_depth = ", EDSC_PREPS";
+		break;
+	case 3:
+		early_depth = ", BAD EDSC";
+		break;
+	}
+
+	switch ((ctx->data[1] >> 21) & 0x3) {
+	case 0:
+		early_depth = "";
+		break;
+	case 1:
+		early_depth = ", BAD ZW interp";
+		break;
+	case 2:
+		early_depth = ", ZW centroid";
+		break;
+	case 3:
+		early_depth = ", ZW sample";
+		break;
+	}
+
+	instr_out(ctx, 0, "3DSTATE_WM\n");
+	instr_out(ctx, 1, "(%s%s%s%s%s%s)%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+		  (ctx->data[1] & (1 << 11)) ? "PP " : "",
+		  (ctx->data[1] & (1 << 12)) ? "PC " : "",
+		  (ctx->data[1] & (1 << 13)) ? "PS " : "",
+		  (ctx->data[1] & (1 << 14)) ? "NPP " : "",
+		  (ctx->data[1] & (1 << 15)) ? "NPC " : "",
+		  (ctx->data[1] & (1 << 16)) ? "NPS " : "",
+		  (ctx->data[1] & (1 << 30)) ? ", depth clear" : "",
+		  (ctx->data[1] & (1 << 29)) ? "" : ", disabled",
+		  (ctx->data[1] & (1 << 28)) ? ", depth resolve" : "",
+		  (ctx->data[1] & (1 << 27)) ? ", hiz resolve" : "",
+		  (ctx->data[1] & (1 << 25)) ? ", kill" : "",
+		  computed_depth,
+		  early_depth,
+		  zw_interp,
+		  (ctx->data[1] & (1 << 20)) ? ", source depth" : "",
+		  (ctx->data[1] & (1 << 19)) ? ", source W" : "",
+		  (ctx->data[1] & (1 << 10)) ? ", coverage" : "",
+		  (ctx->data[1] & (1 << 4)) ? ", poly stipple" : "",
+		  (ctx->data[1] & (1 << 3)) ? ", line stipple" : "",
+		  (ctx->data[1] & (1 << 2)) ? ", point UL" : ", point UR"
+		  );
+	instr_out(ctx, 2, "MS\n");
+
+	return 3;
+}
+
 static int
 decode_3d_965(struct drm_intel_decode *ctx)
 {
@@ -2907,8 +3041,8 @@ decode_3d_965(struct drm_intel_decode *ctx)
 		{ 0x7812, 0x00ff, 4, 4, "3DSTATE_CLIP" },
 		{ 0x7813, 0x00ff, 20, 20, "3DSTATE_SF", 6 },
 		{ 0x7813, 0x00ff, 7, 7, "3DSTATE_SF", 7 },
-		{ 0x7814, 0x00ff, 3, 3, "3DSTATE_WM", 7 },
-		{ 0x7814, 0x00ff, 9, 9, "3DSTATE_WM" },
+		{ 0x7814, 0x00ff, 3, 3, "3DSTATE_WM", 7, gen7_3DSTATE_WM },
+		{ 0x7814, 0x00ff, 9, 9, "3DSTATE_WM", 6, gen6_3DSTATE_WM },
 		{ 0x7815, 0x00ff, 5, 5, "3DSTATE_CONSTANT_VS_STATE", 6 },
 		{ 0x7815, 0x00ff, 7, 7, "3DSTATE_CONSTANT_VS", 7, gen7_3DSTATE_CONSTANT_VS },
 		{ 0x7816, 0x00ff, 5, 5, "3DSTATE_CONSTANT_GS_STATE", 6 },
@@ -3303,46 +3437,6 @@ decode_3d_965(struct drm_intel_decode *ctx)
 
 		return len;
 
-	case 0x7814:
-		instr_out(ctx, 0, "3DSTATE_WM\n");
-		instr_out(ctx, 1, "kernel start pointer 0\n");
-		instr_out(ctx, 2,
-			  "SPF=%d, VME=%d, Sampler Count %d, "
-			  "Binding table count %d\n", (data[2] >> 31) & 1,
-			  (data[2] >> 30) & 1, (data[2] >> 27) & 7,
-			  (data[2] >> 18) & 0xff);
-		instr_out(ctx, 3, "scratch offset\n");
-		instr_out(ctx, 4,
-			  "Depth Clear %d, Depth Resolve %d, HiZ Resolve %d, "
-			  "Dispatch GRF start[0] %d, start[1] %d, start[2] %d\n",
-			  (data[4] & (1 << 30)) != 0,
-			  (data[4] & (1 << 28)) != 0,
-			  (data[4] & (1 << 27)) != 0, (data[4] >> 16) & 0x7f,
-			  (data[4] >> 8) & 0x7f, (data[4] & 0x7f));
-		instr_out(ctx, 5,
-			  "MaxThreads %d, PS KillPixel %d, PS computed Z %d, "
-			  "PS use sourceZ %d, Thread Dispatch %d, PS use sourceW %d, Dispatch32 %d, "
-			  "Dispatch16 %d, Dispatch8 %d\n",
-			  ((data[5] >> 25) & 0x7f) + 1,
-			  (data[5] & (1 << 22)) != 0,
-			  (data[5] & (1 << 21)) != 0,
-			  (data[5] & (1 << 20)) != 0,
-			  (data[5] & (1 << 19)) != 0, (data[5] & (1 << 8)) != 0,
-			  (data[5] & (1 << 2)) != 0, (data[5] & (1 << 1)) != 0,
-			  (data[5] & (1 << 0)) != 0);
-		instr_out(ctx, 6,
-			  "Num SF output %d, Pos XY offset %d, ZW interp mode %d , "
-			  "Barycentric interp mode 0x%x, Point raster rule %d, Multisample mode %d, "
-			  "Multisample Dispatch mode %d\n",
-			  (data[6] >> 20) & 0x3f, (data[6] >> 18) & 3,
-			  (data[6] >> 16) & 3, (data[6] >> 10) & 0x3f,
-			  (data[6] & (1 << 9)) != 0, (data[6] >> 1) & 3,
-			  (data[6] & 1));
-		instr_out(ctx, 7, "kernel start pointer 1\n");
-		instr_out(ctx, 8, "kernel start pointer 2\n");
-
-		return len;
-
 	case 0x7900:
 		instr_out(ctx, 0, "3DSTATE_DRAWING_RECTANGLE\n");
 		instr_out(ctx, 1, "top left: %d,%d\n",
diff --git a/intel/tests/gen7-3d.batch-ref.txt b/intel/tests/gen7-3d.batch-ref.txt
index 24a6e37..ff0bd56 100644
--- a/intel/tests/gen7-3d.batch-ref.txt
+++ b/intel/tests/gen7-3d.batch-ref.txt
@@ -137,14 +137,8 @@
 0x12300220:      0x00000000:    dword 5
 0x12300224:      0x00000000:    dword 6
 0x12300228:      0x78140001: 3DSTATE_WM
-0x1230022c:      0xa0000040:    kernel start pointer 0
-0x12300230:      0x00000000:    SPF=0, VME=0, Sampler Count 0, Binding table count 0
-0x12300234:      0x782a0000:    scratch offset
-0x12300238:      0x00007d40:    Depth Clear 0, Depth Resolve 0, HiZ Resolve 0, Dispatch GRF start[0] 0, start[1] 125, start[2] 64
-0x1230023c:      0x782f0000:    MaxThreads 61, PS KillPixel 0, PS computed Z 1, PS use sourceZ 0, Thread Dispatch 1, PS use sourceW 0, Dispatch32 0, Dispatch16 0, Dispatch8 0
-0x12300240:      0x00000000:    Num SF output 0, Pos XY offset 0, ZW interp mode 0 , Barycentric interp mode 0x0, Point raster rule 0, Multisample mode 0, Multisample Dispatch mode 0
-0x12300244:      0x78170005:    kernel start pointer 1
-0x12300248:      0x00000001:    kernel start pointer 2
+0x1230022c:      0xa0000040:    (), point UR
+0x12300230:      0x00000000:    MS
 0x12300234:      0x782a0000: 3DSTATE_BINDING_TABLE_POINTERS_PS
 0x12300238:      0x00007d40:    dword 1
 0x1230023c:      0x782f0000: 3DSTATE_SAMPLER_STATE_POINTERS_PS
@@ -276,14 +270,8 @@
 0x12300434:      0x00000000:    dword 5
 0x12300438:      0x00000000:    dword 6
 0x1230043c:      0x78140001: 3DSTATE_WM
-0x12300440:      0xa0000040:    kernel start pointer 0
-0x12300444:      0x00000000:    SPF=0, VME=0, Sampler Count 0, Binding table count 0
-0x12300448:      0x782a0000:    scratch offset
-0x1230044c:      0x00007a00:    Depth Clear 0, Depth Resolve 0, HiZ Resolve 0, Dispatch GRF start[0] 0, start[1] 122, start[2] 0
-0x12300450:      0x782f0000:    MaxThreads 61, PS KillPixel 0, PS computed Z 1, PS use sourceZ 0, Thread Dispatch 1, PS use sourceW 0, Dispatch32 0, Dispatch16 0, Dispatch8 0
-0x12300454:      0x00000000:    Num SF output 0, Pos XY offset 0, ZW interp mode 0 , Barycentric interp mode 0x0, Point raster rule 0, Multisample mode 0, Multisample Dispatch mode 0
-0x12300458:      0x78170005:    kernel start pointer 1
-0x1230045c:      0x00000000:    kernel start pointer 2
+0x12300440:      0xa0000040:    (), point UR
+0x12300444:      0x00000000:    MS
 0x12300448:      0x782a0000: 3DSTATE_BINDING_TABLE_POINTERS_PS
 0x1230044c:      0x00007a00:    dword 1
 0x12300450:      0x782f0000: 3DSTATE_SAMPLER_STATE_POINTERS_PS
@@ -517,14 +505,8 @@
 0x123007e0:      0x00000000:    dword 5
 0x123007e4:      0x00000000:    dword 6
 0x123007e8:      0x78140001: 3DSTATE_WM
-0x123007ec:      0xa0000840:    kernel start pointer 0
-0x123007f0:      0x00000000:    SPF=0, VME=0, Sampler Count 0, Binding table count 0
-0x123007f4:      0x782a0000:    scratch offset
-0x123007f8:      0x00007a00:    Depth Clear 0, Depth Resolve 0, HiZ Resolve 0, Dispatch GRF start[0] 0, start[1] 122, start[2] 0
-0x123007fc:      0x782f0000:    MaxThreads 61, PS KillPixel 0, PS computed Z 1, PS use sourceZ 0, Thread Dispatch 1, PS use sourceW 0, Dispatch32 0, Dispatch16 0, Dispatch8 0
-0x12300800:      0x00000000:    Num SF output 0, Pos XY offset 0, ZW interp mode 0 , Barycentric interp mode 0x0, Point raster rule 0, Multisample mode 0, Multisample Dispatch mode 0
-0x12300804:      0x78170005:    kernel start pointer 1
-0x12300808:      0x00000000:    kernel start pointer 2
+0x123007ec:      0xa0000840:    (PP ), point UR
+0x123007f0:      0x00000000:    MS
 0x123007f4:      0x782a0000: 3DSTATE_BINDING_TABLE_POINTERS_PS
 0x123007f8:      0x00007a00:    dword 1
 0x123007fc:      0x782f0000: 3DSTATE_SAMPLER_STATE_POINTERS_PS
@@ -609,14 +591,8 @@
 0x12300938:      0x00000000:    dword 5
 0x1230093c:      0x00000000:    dword 6
 0x12300940:      0x78140001: 3DSTATE_WM
-0x12300944:      0xa0000040:    kernel start pointer 0
-0x12300948:      0x00000000:    SPF=0, VME=0, Sampler Count 0, Binding table count 0
-0x1230094c:      0x782a0000:    scratch offset
-0x12300950:      0x00007a00:    Depth Clear 0, Depth Resolve 0, HiZ Resolve 0, Dispatch GRF start[0] 0, start[1] 122, start[2] 0
-0x12300954:      0x782f0000:    MaxThreads 61, PS KillPixel 0, PS computed Z 1, PS use sourceZ 0, Thread Dispatch 1, PS use sourceW 0, Dispatch32 0, Dispatch16 0, Dispatch8 0
-0x12300958:      0x00000000:    Num SF output 0, Pos XY offset 0, ZW interp mode 0 , Barycentric interp mode 0x0, Point raster rule 0, Multisample mode 0, Multisample Dispatch mode 0
-0x1230095c:      0x78170005:    kernel start pointer 1
-0x12300960:      0x00000000:    kernel start pointer 2
+0x12300944:      0xa0000040:    (), point UR
+0x12300948:      0x00000000:    MS
 0x1230094c:      0x782a0000: 3DSTATE_BINDING_TABLE_POINTERS_PS
 0x12300950:      0x00007a00:    dword 1
 0x12300954:      0x782f0000: 3DSTATE_SAMPLER_STATE_POINTERS_PS
@@ -824,14 +800,8 @@
 0x12300c7c:      0x00000000:    dword 5
 0x12300c80:      0x00000000:    dword 6
 0x12300c84:      0x78140001: 3DSTATE_WM
-0x12300c88:      0xa0000840:    kernel start pointer 0
-0x12300c8c:      0x00000000:    SPF=0, VME=0, Sampler Count 0, Binding table count 0
-0x12300c90:      0x782a0000:    scratch offset
-0x12300c94:      0x00007a00:    Depth Clear 0, Depth Resolve 0, HiZ Resolve 0, Dispatch GRF start[0] 0, start[1] 122, start[2] 0
-0x12300c98:      0x782f0000:    MaxThreads 61, PS KillPixel 0, PS computed Z 1, PS use sourceZ 0, Thread Dispatch 1, PS use sourceW 0, Dispatch32 0, Dispatch16 0, Dispatch8 0
-0x12300c9c:      0x00000000:    Num SF output 0, Pos XY offset 0, ZW interp mode 0 , Barycentric interp mode 0x0, Point raster rule 0, Multisample mode 0, Multisample Dispatch mode 0
-0x12300ca0:      0x78170005:    kernel start pointer 1
-0x12300ca4:      0x00000000:    kernel start pointer 2
+0x12300c88:      0xa0000840:    (PP ), point UR
+0x12300c8c:      0x00000000:    MS
 0x12300c90:      0x782a0000: 3DSTATE_BINDING_TABLE_POINTERS_PS
 0x12300c94:      0x00007a00:    dword 1
 0x12300c98:      0x782f0000: 3DSTATE_SAMPLER_STATE_POINTERS_PS
@@ -916,14 +886,8 @@
 0x12300dd4:      0x00000000:    dword 5
 0x12300dd8:      0x00000000:    dword 6
 0x12300ddc:      0x78140001: 3DSTATE_WM
-0x12300de0:      0xa0000040:    kernel start pointer 0
-0x12300de4:      0x00000000:    SPF=0, VME=0, Sampler Count 0, Binding table count 0
-0x12300de8:      0x782a0000:    scratch offset
-0x12300dec:      0x00007a00:    Depth Clear 0, Depth Resolve 0, HiZ Resolve 0, Dispatch GRF start[0] 0, start[1] 122, start[2] 0
-0x12300df0:      0x782f0000:    MaxThreads 61, PS KillPixel 0, PS computed Z 1, PS use sourceZ 0, Thread Dispatch 1, PS use sourceW 0, Dispatch32 0, Dispatch16 0, Dispatch8 0
-0x12300df4:      0x00000000:    Num SF output 0, Pos XY offset 0, ZW interp mode 0 , Barycentric interp mode 0x0, Point raster rule 0, Multisample mode 0, Multisample Dispatch mode 0
-0x12300df8:      0x78170005:    kernel start pointer 1
-0x12300dfc:      0x00000000:    kernel start pointer 2
+0x12300de0:      0xa0000040:    (), point UR
+0x12300de4:      0x00000000:    MS
 0x12300de8:      0x782a0000: 3DSTATE_BINDING_TABLE_POINTERS_PS
 0x12300dec:      0x00007a00:    dword 1
 0x12300df0:      0x782f0000: 3DSTATE_SAMPLER_STATE_POINTERS_PS
@@ -1131,14 +1095,8 @@
 0x12301118:      0x00000000:    dword 5
 0x1230111c:      0x00000000:    dword 6
 0x12301120:      0x78140001: 3DSTATE_WM
-0x12301124:      0xa0000840:    kernel start pointer 0
-0x12301128:      0x00000000:    SPF=0, VME=0, Sampler Count 0, Binding table count 0
-0x1230112c:      0x782a0000:    scratch offset
-0x12301130:      0x00007a00:    Depth Clear 0, Depth Resolve 0, HiZ Resolve 0, Dispatch GRF start[0] 0, start[1] 122, start[2] 0
-0x12301134:      0x782f0000:    MaxThreads 61, PS KillPixel 0, PS computed Z 1, PS use sourceZ 0, Thread Dispatch 1, PS use sourceW 0, Dispatch32 0, Dispatch16 0, Dispatch8 0
-0x12301138:      0x00000000:    Num SF output 0, Pos XY offset 0, ZW interp mode 0 , Barycentric interp mode 0x0, Point raster rule 0, Multisample mode 0, Multisample Dispatch mode 0
-0x1230113c:      0x78170005:    kernel start pointer 1
-0x12301140:      0x00000000:    kernel start pointer 2
+0x12301124:      0xa0000840:    (PP ), point UR
+0x12301128:      0x00000000:    MS
 0x1230112c:      0x782a0000: 3DSTATE_BINDING_TABLE_POINTERS_PS
 0x12301130:      0x00007a00:    dword 1
 0x12301134:      0x782f0000: 3DSTATE_SAMPLER_STATE_POINTERS_PS
-- 
1.7.9




More information about the Intel-gfx mailing list