From 938df6be489cb66c2f90043a8ced9834765e4e8e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Jan 2012 12:23:42 -0800 Subject: [PATCH] intel: Add decode for gen7 state pointers. Since CC_STATE_POINTERS for gen6 and 7 are quite different but use the same opcode, move gen6 out to a helper function too, so we can use a helper function for gen7. --- intel/intel_decode.c | 80 ++++++++++++++++++++++++++++++++++----- intel/tests/gen7-3d.batch-ref.txt | 30 ++++++--------- 2 files changed, 83 insertions(+), 27 deletions(-) diff --git a/intel/intel_decode.c b/intel/intel_decode.c index 7b4ed42..49242dc 100644 --- a/intel/intel_decode.c +++ b/intel/intel_decode.c @@ -2704,6 +2704,71 @@ state_max_out(struct drm_intel_decode *ctx, unsigned int index, } static int +gen7_3DSTATE_VIEWPORT_STATE_POINTERS_CC(struct drm_intel_decode *ctx) +{ + instr_out(ctx, 0, "3DSTATE_VIEWPORT_STATE_POINTERS_CC\n"); + instr_out(ctx, 1, "pointer to CC viewport\n"); + + return 2; +} + +static int +gen7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP(struct drm_intel_decode *ctx) +{ + instr_out(ctx, 0, "3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP\n"); + instr_out(ctx, 1, "pointer to SF_CLIP viewport\n"); + + return 2; +} + +static int +gen7_3DSTATE_BLEND_STATE_POINTERS(struct drm_intel_decode *ctx) +{ + instr_out(ctx, 0, "3DSTATE_BLEND_STATE_POINTERS\n"); + instr_out(ctx, 1, "pointer to BLEND_STATE at 0x%08x (%s)\n", + ctx->data[1] & ~1, + (ctx->data[1] & 1) ? "changed" : "unchanged"); + + return 2; +} + +static int +gen7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS(struct drm_intel_decode *ctx) +{ + instr_out(ctx, 0, "3DSTATE_DEPTH_STENCIL_STATE_POINTERS\n"); + instr_out(ctx, 1, + "pointer to DEPTH_STENCIL_STATE at 0x%08x (%s)\n", + ctx->data[1] & ~1, + (ctx->data[1] & 1) ? "changed" : "unchanged"); + + return 2; +} + +static int +gen6_3DSTATE_CC_STATE_POINTERS(struct drm_intel_decode *ctx) +{ + instr_out(ctx, 0, "3DSTATE_CC_STATE_POINTERS\n"); + instr_out(ctx, 1, "blend change %d\n", ctx->data[1] & 1); + instr_out(ctx, 2, "depth stencil change %d\n", + ctx->data[2] & 1); + instr_out(ctx, 3, "cc change %d\n", ctx->data[3] & 1); + + return 4; +} + +static int +gen7_3DSTATE_CC_STATE_POINTERS(struct drm_intel_decode *ctx) +{ + instr_out(ctx, 0, "3DSTATE_CC_STATE_POINTERS\n"); + instr_out(ctx, 1, "pointer to COLOR_CALC_STATE at 0x%08x " + "(%s)\n", + ctx->data[1] & ~1, + (ctx->data[1] & 1) ? "changed" : "unchanged"); + + return 2; +} + +static int gen7_3DSTATE_URB_unit(struct drm_intel_decode *ctx, const char *unit) { int start_kb = ((ctx->data[1] >> 25) & 0x3f) * 8; @@ -2779,7 +2844,8 @@ decode_3d_965(struct drm_intel_decode *ctx) { 0x780a, 0x00ff, 3, 3, "3DSTATE_INDEX_BUFFER" }, { 0x780b, 0xffff, 1, 1, "3DSTATE_VF_STATISTICS" }, { 0x780d, 0x00ff, 4, 4, "3DSTATE_VIEWPORT_STATE_POINTERS" }, - { 0x780e, 0xffff, 4, 4, "3DSTATE_CC_STATE_POINTERS" }, + { 0x780e, 0xffff, 4, 4, NULL, 6, gen6_3DSTATE_CC_STATE_POINTERS }, + { 0x780e, 0x00ff, 2, 2, NULL, 7, gen7_3DSTATE_CC_STATE_POINTERS }, { 0x780f, 0x00ff, 2, 2, "3DSTATE_SCISSOR_POINTERS" }, { 0x7810, 0x00ff, 6, 6, "3DSTATE_VS" }, { 0x7811, 0x00ff, 7, 7, "3DSTATE_GS" }, @@ -2790,6 +2856,10 @@ decode_3d_965(struct drm_intel_decode *ctx) { 0x7816, 0x00ff, 5, 5, "3DSTATE_CONSTANT_GS_STATE" }, { 0x7817, 0x00ff, 5, 5, "3DSTATE_CONSTANT_PS_STATE" }, { 0x7818, 0xffff, 2, 2, "3DSTATE_SAMPLE_MASK" }, + { 0x7821, 0x00ff, 2, 2, NULL, 7, gen7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP }, + { 0x7823, 0x00ff, 2, 2, NULL, 7, gen7_3DSTATE_VIEWPORT_STATE_POINTERS_CC }, + { 0x7824, 0x00ff, 2, 2, NULL, 7, gen7_3DSTATE_BLEND_STATE_POINTERS }, + { 0x7825, 0x00ff, 2, 2, NULL, 7, gen7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS }, { 0x7830, 0x00ff, 2, 2, NULL, 7, gen7_3DSTATE_URB_VS }, { 0x7831, 0x00ff, 2, 2, NULL, 7, gen7_3DSTATE_URB_HS }, { 0x7832, 0x00ff, 2, 2, NULL, 7, gen7_3DSTATE_URB_DS }, @@ -3006,14 +3076,6 @@ decode_3d_965(struct drm_intel_decode *ctx) instr_out(ctx, 2, "ending buffer address\n"); return len; - case 0x780e: - instr_out(ctx, 0, "3DSTATE_CC_STATE_POINTERS\n"); - instr_out(ctx, 1, "blend change %d\n", data[1] & 1); - instr_out(ctx, 2, "depth stencil change %d\n", - data[2] & 1); - instr_out(ctx, 3, "cc change %d\n", data[3] & 1); - return len; - case 0x780f: instr_out(ctx, 0, "3DSTATE_SCISSOR_POINTERS\n"); instr_out(ctx, 1, "scissor rect offset\n"); diff --git a/intel/tests/gen7-3d.batch-ref.txt b/intel/tests/gen7-3d.batch-ref.txt index cde910f..6b2a0d4 100644 --- a/intel/tests/gen7-3d.batch-ref.txt +++ b/intel/tests/gen7-3d.batch-ref.txt @@ -18,10 +18,10 @@ 0x12300044: 0x00000001: dynamic state upper bound disabled 0x12300048: 0x00000001: indirect state upper bound disabled 0x1230004c: 0x00000001: instruction state upper bound disabled -0x12300050: 0x78230000: 3D UNKNOWN: 3d_965 opcode = 0x7823 -0x12300054: 0x00007fe0: MI_NOOP -0x12300058: 0x78210000: 3D UNKNOWN: 3d_965 opcode = 0x7821 -0x1230005c: 0x00007fc0: MI_NOOP +0x12300050: 0x78230000: 3DSTATE_VIEWPORT_STATE_POINTERS_CC +0x12300054: 0x00007fe0: pointer to CC viewport +0x12300058: 0x78210000: 3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP +0x1230005c: 0x00007fc0: pointer to SF_CLIP viewport 0x12300060: 0x79120000: 3D UNKNOWN: 3d_965 opcode = 0x7912 0x12300064: 0x00000008: MI_NOOP 0x12300068: 0x79160000: 3D UNKNOWN: 3d_965 opcode = 0x7916 @@ -34,15 +34,12 @@ 0x12300084: 0x04000000: 16KB start, size=1 64B rows, nr_entries=0, total size 0B 0x12300088: 0x78320000: 3DSTATE_URB_DS 0x1230008c: 0x04000000: 16KB start, size=1 64B rows, nr_entries=0, total size 0B -0x12300090: 0x78240000: 3D UNKNOWN: 3d_965 opcode = 0x7824 -0x12300094: 0x00007f81: MI_NOOP -Bad length 2 in 3DSTATE_CC_STATE_POINTERS, expeted 4-4 +0x12300090: 0x78240000: 3DSTATE_BLEND_STATE_POINTERS +0x12300094: 0x00007f81: pointer to BLEND_STATE at 0x00007f80 (changed) 0x12300098: 0x780e0000: 3DSTATE_CC_STATE_POINTERS -0x1230009c: 0x00007f41: blend change 1 -0x123000a0: 0x78250000: depth stencil change 0 -0x123000a4: 0x00007f01: cc change 1 -0x123000a0: 0x78250000: 3D UNKNOWN: 3d_965 opcode = 0x7825 -0x123000a4: 0x00007f01: MI_NOOP +0x1230009c: 0x00007f41: pointer to COLOR_CALC_STATE at 0x00007f40 (changed) +0x123000a0: 0x78250000: 3DSTATE_DEPTH_STENCIL_STATE_POINTERS +0x123000a4: 0x00007f01: pointer to DEPTH_STENCIL_STATE at 0x00007f00 (changed) Bad length 7 in 3DSTATE_CONSTANT_GS_STATE, expeted 5-5 0x123000a8: 0x78160005: 3DSTATE_CONSTANT_GS_STATE 0x123000ac: 0x00000000: dword 1 @@ -245,13 +242,10 @@ Bad length 7 in 3DPRIMITIVE, expeted 6-6 0x1230036c: 0x04000000: 16KB start, size=1 64B rows, nr_entries=0, total size 0B 0x12300370: 0x78320000: 3DSTATE_URB_DS 0x12300374: 0x04000000: 16KB start, size=1 64B rows, nr_entries=0, total size 0B -Bad length 2 in 3DSTATE_CC_STATE_POINTERS, expeted 4-4 0x12300378: 0x780e0000: 3DSTATE_CC_STATE_POINTERS -0x1230037c: 0x00007d01: blend change 1 -0x12300380: 0x78250000: depth stencil change 0 -0x12300384: 0x00007cc1: cc change 1 -0x12300380: 0x78250000: 3D UNKNOWN: 3d_965 opcode = 0x7825 -0x12300384: 0x00007cc1: MI_NOOP +0x1230037c: 0x00007d01: pointer to COLOR_CALC_STATE at 0x00007d00 (changed) +0x12300380: 0x78250000: 3DSTATE_DEPTH_STENCIL_STATE_POINTERS +0x12300384: 0x00007cc1: pointer to DEPTH_STENCIL_STATE at 0x00007cc0 (changed) 0x12300388: 0x78260000: 3D UNKNOWN: 3d_965 opcode = 0x7826 0x1230038c: 0x00007a00: MI_NOOP 0x12300390: 0x782b0000: 3D UNKNOWN: 3d_965 opcode = 0x782b -- 2.7.4