From dbc547dbb525827a53543267bd38451c475e7c54 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Mon, 27 Sep 2010 13:34:52 +0800 Subject: [PATCH] intel_decode: decode 3d commands for sandybridge Signed-off-by: Zhenyu Wang --- tools/intel_decode.c | 357 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 323 insertions(+), 34 deletions(-) diff --git a/tools/intel_decode.c b/tools/intel_decode.c index cc441c3..5f0c524 100644 --- a/tools/intel_decode.c +++ b/tools/intel_decode.c @@ -1586,10 +1586,10 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int { 0x6904, 1, 1, "3DSTATE_PIPELINE_SELECT" }, { 0x7800, 7, 7, "3DSTATE_PIPELINED_POINTERS" }, { 0x7801, 6, 6, "3DSTATE_BINDING_TABLE_POINTERS" }, - { 0x780b, 1, 1, "3DSTATE_VF_STATISTICS" }, { 0x7808, 5, 257, "3DSTATE_VERTEX_BUFFERS" }, { 0x7809, 3, 256, "3DSTATE_VERTEX_ELEMENTS" }, { 0x780a, 3, 3, "3DSTATE_INDEX_BUFFER" }, + { 0x780b, 1, 1, "3DSTATE_VF_STATISTICS" }, { 0x7900, 4, 4, "3DSTATE_DRAWING_RECTANGLE" }, { 0x7901, 5, 5, "3DSTATE_CONSTANT_COLOR" }, { 0x7905, 5, 7, "3DSTATE_DEPTH_BUFFER" }, @@ -1601,16 +1601,18 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int { 0x790a, 3, 3, "3DSTATE_AA_LINE_PARAMETERS" }, { 0x790b, 4, 4, "3DSTATE_GS_SVB_INDEX" }, { 0x790d, 3, 3, "3DSTATE_MULTISAMPLE" }, + { 0x7910, 2, 2, "3DSTATE_CLEAR_PARAMS" }, { 0x7b00, 6, 6, "3DPRIMITIVE" }, { 0x7802, 4, 4, "3DSTATE_SAMPLER_STATE_POINTERS" }, { 0x7805, 3, 3, "3DSTATE_URB" }, + { 0x780d, 4, 4, "3DSTATE_VIEWPORT_STATE_POINTERS" }, { 0x780e, 4, 4, "3DSTATE_CC_STATE_POINTERS" }, + { 0x780f, 2, 2, "3DSTATE_SCISSOR_STATE_POINTERS" }, { 0x7810, 6, 6, "3DSTATE_VS_STATE" }, { 0x7811, 7, 7, "3DSTATE_GS_STATE" }, { 0x7812, 4, 4, "3DSTATE_CLIP_STATE" }, { 0x7813, 20, 20, "3DSTATE_SF_STATE" }, { 0x7814, 9, 9, "3DSTATE_WM_STATE" }, - { 0x7812, 4, 4, "3DSTATE_CLIP_STATE" }, { 0x7815, 5, 5, "3DSTATE_CONSTANT_VS_STATE" }, { 0x7816, 5, 5, "3DSTATE_CONSTANT_GS_STATE" }, { 0x7817, 5, 5, "3DSTATE_CONSTANT_PS_STATE" }, @@ -1716,6 +1718,29 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int } return len; + case 0x7802: + len = (data[0] & 0xff) + 2; + if (len != 4) + fprintf(out, "Bad count in 3DSTATE_SAMPLER_STATE_POINTERS\n"); + instr_out(data, hw_offset, 0, "3DSTATE_SAMPLER_STATE_POINTERS: VS mod %d, " + "GS mod %d, PS mod %d\n", + (data[0] & (1 << 8)) != 0, + (data[0] & (1 << 9)) != 0, + (data[0] & (1 << 10)) != 0); + instr_out(data, hw_offset, 1, "VS sampler state\n"); + instr_out(data, hw_offset, 2, "GS sampler state\n"); + instr_out(data, hw_offset, 3, "WM sampler state\n"); + return len; + case 0x7805: + len = (data[0] & 0xff) + 2; + if (len != 3) + fprintf(out, "Bad count in 3DSTATE_URB\n"); + instr_out(data, hw_offset, 0, "3DSTATE_URB\n"); + instr_out(data, hw_offset, 1, "VS entries %d, alloc size %d (1024bit row)\n", + data[1] & 0xffff, ((data[1] >> 16) & 0x0fff) - 1); + instr_out(data, hw_offset, 2, "GS entries %d, alloc size %d (1024bit row)\n", + (data[2] >> 8) & 0x3ff, (data[2] & 7) - 1); + return len; case 0x7808: len = (data[0] & 0xff) + 2; @@ -1726,9 +1751,17 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int instr_out(data, hw_offset, 0, "3DSTATE_VERTEX_BUFFERS\n"); for (i = 1; i < len;) { + int idx, access; + if (IS_GEN6(devid)) { + idx = 26; + access = 20; + } else { + idx = 27; + access = 26; + } instr_out(data, hw_offset, i, "buffer %d: %s, pitch %db\n", - data[i] >> 27, - data[i] & (1 << 26) ? "random" : "sequential", + data[i] >> idx, + data[i] & (1 << access) ? "random" : "sequential", data[i] & 0x07ff); i++; instr_out(data, hw_offset, i++, "buffer address\n"); @@ -1787,6 +1820,210 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int instr_out(data, hw_offset, 2, "ending buffer address\n"); return len; + case 0x780e: + len = (data[0] & 0xff) + 2; + if (len != 4) + fprintf(out, "Bad count in 3DSTATE_CC_STATE_POINTERS\n"); + instr_out(data, hw_offset, 0, "3DSTATE_CC_STATE_POINTERS\n"); + instr_out(data, hw_offset, 1, "blend change %d\n", data[1] & 1); + instr_out(data, hw_offset, 2, "depth stencil change %d\n", data[2] & 1); + instr_out(data, hw_offset, 3, "cc change %d\n", data[3] & 1); + return len; + + case 0x780f: + len = (data[0] & 0xff) + 2; + if (len != 2) + fprintf(out, "Bad count in 3DSTATE_SCISSOR_POINTERS\n"); + instr_out(data, hw_offset, 0, "3DSTATE_SCISSOR_POINTERS\n"); + instr_out(data, hw_offset, 1, "scissor rect offset\n"); + return len; + + case 0x7810: + len = (data[0] & 0xff) + 2; + if (len != 6) + fprintf(out, "Bad count in 3DSTATE_VS\n"); + instr_out(data, hw_offset, 0, "3DSTATE_VS\n"); + instr_out(data, hw_offset, 1, "kernel pointer\n"); + instr_out(data, hw_offset, 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(data, hw_offset, 3, "scratch offset\n"); + instr_out(data, hw_offset, 4, "Dispatch GRF start %d, VUE read length %d, " + "VUE read offset %d\n", + (data[4] >> 20) & 0x1f, + (data[4] >> 11) & 0x3f, + (data[4] >> 4) & 0x3f); + instr_out(data, hw_offset, 5, "Max Threads %d, Vertex Cache %sable, " + "VS func %sable\n", + ((data[5] >> 25) & 0x7f) + 1, + (data[5] & (1 << 1)) != 0 ? "dis" : "en", + (data[5] & 1) != 0 ? "en" : "dis"); + return len; + + case 0x7811: + len = (data[0] & 0xff) + 2; + if (len != 7) + fprintf(out, "Bad count in 3DSTATE_GS\n"); + instr_out(data, hw_offset, 0, "3DSTATE_GS\n"); + instr_out(data, hw_offset, 1, "kernel pointer\n"); + instr_out(data, hw_offset, 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(data, hw_offset, 3, "scratch offset\n"); + instr_out(data, hw_offset, 4, "Dispatch GRF start %d, VUE read length %d, " + "VUE read offset %d\n", + (data[4] & 0xf), + (data[4] >> 11) & 0x3f, + (data[4] >> 4) & 0x3f); + instr_out(data, hw_offset, 5, "Max Threads %d, Rendering %sable\n", + ((data[5] >> 25) & 0x7f) + 1, + (data[5] & (1 << 8)) != 0 ? "en" : "dis"); + instr_out(data, hw_offset, 6, "Reorder %sable, Discard Adjaceny %sable, " + "GS %sable\n", + (data[6] & (1 << 30)) != 0 ? "en" : "dis", + (data[6] & (1 << 29)) != 0 ? "en" : "dis", + (data[6] & (1 << 15)) != 0 ? "en" : "dis"); + return len; + + case 0x7812: + len = (data[0] & 0xff) + 2; + if (len != 4) + fprintf(out, "Bad count in 3DSTATE_CLIP\n"); + instr_out(data, hw_offset, 0, "3DSTATE_CLIP\n"); + instr_out(data, hw_offset, 1, "UserClip distance cull test mask 0x%x\n", + data[1] & 0xff); + instr_out(data, hw_offset, 2, "Clip %sable, API mode %s, Viewport XY test %sable, " + "Viewport Z test %sable, Guardband test %sable, Clip mode %d, " + "Perspective Divide %sable, Non-Perspective Barycentric %sable, " + "Tri Provoking %d, Line Provoking %d, Trifan Provoking %d\n", + (data[2] & (1 << 31)) != 0 ? "en" : "dis", + (data[2] & (1 << 30)) != 0 ? "D3D" : "OGL", + (data[2] & (1 << 28)) != 0 ? "en" : "dis", + (data[2] & (1 << 27)) != 0 ? "en" : "dis", + (data[2] & (1 << 26)) != 0 ? "en" : "dis", + (data[2] >> 13) & 7, + (data[2] & (1 << 9)) != 0 ? "dis" : "en", + (data[2] & (1 << 8)) != 0 ? "en" : "dis", + (data[2] >> 4) & 3, + (data[2] >> 2) & 3, + (data[2] & 3)); + instr_out(data, hw_offset, 3, "Min PointWidth %d, Max PointWidth %d, " + "Force Zero RTAIndex %sable, Max VPIndex %d\n", + (data[3] >> 17) & 0x7ff, + (data[3] >> 6) & 0x7ff, + (data[3] & (1 << 5)) != 0 ? "en" : "dis", + (data[3] & 0xf)); + return len; + + case 0x7813: + len = (data[0] & 0xff) + 2; + if (len != 20) + fprintf(out, "Bad count in 3DSTATE_SF\n"); + instr_out(data, hw_offset, 0, "3DSTATE_SF\n"); + instr_out(data, hw_offset, 1, "Attrib Out %d, Attrib Swizzle %sable, VUE read length %d, " + "VUE read offset %d\n", + (data[1] >> 22) & 0x3f, + (data[1] & (1 << 21)) != 0 ? "en" : "dis", + (data[1] >> 11) & 0x1f, + (data[1] >> 4) & 0x3f); + instr_out(data, hw_offset, 2, "Legacy Global DepthBias %sable, FrontFace fill %d, BF fill %d, " + "VP transform %sable, FrontWinding_%s\n", + (data[2] & (1 << 11)) != 0 ? "en" : "dis", + (data[2] >> 5) & 3, + (data[2] >> 3) & 3, + (data[2] & (1 << 1)) != 0 ? "en" : "dis", + (data[2] & 1) != 0 ? "CCW" : "CW"); + instr_out(data, hw_offset, 3, "AA %sable, CullMode %d, Scissor %sable, Multisample m ode %d\n", + (data[3] & (1 << 31)) != 0 ? "en" : "dis", + (data[3] >> 29) & 3, + (data[3] & (1 << 11)) != 0 ? "en" : "dis", + (data[3] >> 8) & 3); + instr_out(data, hw_offset, 4, "Last Pixel %sable, SubPixel Precision %d, Use PixelWidth %d\n", + (data[4] & (1 << 31)) != 0 ? "en" : "dis", + (data[4] & (1 << 12)) != 0 ? 4 : 8, + (data[4] & (1 << 11)) != 0); + instr_out(data, hw_offset, 5, "Global Depth Offset Constant %f\n", data[5]); + instr_out(data, hw_offset, 6, "Global Depth Offset Scale %f\n", data[6]); + instr_out(data, hw_offset, 7, "Global Depth Offset Clamp %f\n", data[7]); + int i, j; + for (i = 0, j = 0; i < 8; i++, j+=2) + instr_out(data, hw_offset, i+8, "Attrib %d (Override %s%s%s%s, Const Source %d, Swizzle Select %d, " + "Source %d); Attrib %d (Override %s%s%s%s, Const Source %d, Swizzle Select %d, Source %d)\n", + j+1, + (data[8+i] & (1 << 31)) != 0 ? "W":"", + (data[8+i] & (1 << 30)) != 0 ? "Z":"", + (data[8+i] & (1 << 29)) != 0 ? "Y":"", + (data[8+i] & (1 << 28)) != 0 ? "X":"", + (data[8+i] >> 25) & 3, (data[8+i] >> 22) & 3, + (data[8+i] >> 16) & 0x1f, + j, + (data[8+i] & (1 << 15)) != 0 ? "W":"", + (data[8+i] & (1 << 14)) != 0 ? "Z":"", + (data[8+i] & (1 << 13)) != 0 ? "Y":"", + (data[8+i] & (1 << 12)) != 0 ? "X":"", + (data[8+i] >> 9) & 3, (data[8+i] >> 6) & 3, + (data[8+i] & 0x1f)); + instr_out(data, hw_offset, 16, "Point Sprite TexCoord Enable\n"); + instr_out(data, hw_offset, 17, "Const Interp Enable\n"); + instr_out(data, hw_offset, 18, "Attrib 7-0 WrapShortest Enable\n"); + instr_out(data, hw_offset, 19, "Attrib 15-8 WrapShortest Enable\n"); + + return len; + + case 0x7814: + len = (data[0] & 0xff) + 2; + if (len != 9) + fprintf(out, "Bad count in 3DSTATE_WM\n"); + instr_out(data, hw_offset, 0, "3DSTATE_WM\n"); + instr_out(data, hw_offset, 1, "kernel start pointer 0\n"); + instr_out(data, hw_offset, 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(data, hw_offset, 3, "scratch offset\n"); + instr_out(data, hw_offset, 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(data, hw_offset, 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(data, hw_offset, 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(data, hw_offset, 7, "kernel start pointer 1\n"); + instr_out(data, hw_offset, 8, "kernel start pointer 2\n"); + + return len; + case 0x7900: if (len != 4) fprintf(out, "Bad count in 3DSTATE_DRAWING_RECTANGLE\n"); @@ -1815,11 +2052,20 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int instr_out(data, hw_offset, 0, "3DSTATE_DEPTH_BUFFER\n"); - instr_out(data, hw_offset, 1, "%s, %s, pitch = %d bytes, %stiled\n", - get_965_surfacetype(data[1] >> 29), - get_965_depthformat((data[1] >> 18) & 0x7), - (data[1] & 0x0001ffff) + 1, - data[1] & (1 << 27) ? "" : "not "); + if (IS_IRONLAKE(devid) || IS_GEN6(devid)) + instr_out(data, hw_offset, 1, "%s, %s, pitch = %d bytes, %stiled, HiZ %d, Seperate Stencil %d\n", + get_965_surfacetype(data[1] >> 29), + get_965_depthformat((data[1] >> 18) & 0x7), + (data[1] & 0x0001ffff) + 1, + data[1] & (1 << 27) ? "" : "not ", + (data[1] & (1 << 22)) != 0, + (data[1] & (1 << 21)) != 0); + else + instr_out(data, hw_offset, 1, "%s, %s, pitch = %d bytes, %stiled\n", + get_965_surfacetype(data[1] >> 29), + get_965_depthformat((data[1] >> 18) & 0x7), + (data[1] & 0x0001ffff) + 1, + data[1] & (1 << 27) ? "" : "not "); instr_out(data, hw_offset, 2, "depth offset\n"); instr_out(data, hw_offset, 3, "%dx%d\n", ((data[3] & 0x0007ffc0) >> 6) + 1, @@ -1827,36 +2073,79 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int instr_out(data, hw_offset, 4, "volume depth\n"); if (len >= 6) instr_out(data, hw_offset, 5, "\n"); - if (len >= 7) - instr_out(data, hw_offset, 6, "render target view extent\n"); + if (len >= 7) { + if (IS_GEN6(devid)) + instr_out(data, hw_offset, 6, "\n"); + else + instr_out(data, hw_offset, 6, "render target view extent\n"); + } + return len; case 0x7a00: - len = (data[0] & 0xff) + 2; - if (len != 4) - fprintf(out, "Bad count in PIPE_CONTROL\n"); - if (count < len) - BUFFER_FAIL(count, len, "PIPE_CONTROL"); - - switch ((data[0] >> 14) & 0x3) { - case 0: desc1 = "no write"; break; - case 1: desc1 = "qword write"; break; - case 2: desc1 = "PS_DEPTH_COUNT write"; break; - case 3: desc1 = "TIMESTAMP write"; break; + if (IS_GEN6(devid)) { + int i; + len = (data[0] & 0xff) + 2; + if (len != 4 && len != 5) + fprintf(out, "Bad count in PIPE_CONTROL\n"); + if (count < len) + BUFFER_FAIL(count, len, "PIPE_CONTROL"); + + switch ((data[1] >> 14) & 0x3) { + case 0: desc1 = "no write"; break; + case 1: desc1 = "qword write"; break; + case 2: desc1 = "PS_DEPTH_COUNT write"; break; + case 3: desc1 = "TIMESTAMP write"; break; + } + instr_out(data, hw_offset, 0, "PIPE_CONTROL\n"); + instr_out(data, hw_offset, 1, + "%s, %scs stall, %stlb invalidate, " + "%ssync gfdt, %sdepth stall, %sRC write flush, " + "%sinst flush, %sTC flush\n", + desc1, + data[1] & (1 << 20) ? "" : "no ", + data[1] & (1 << 18) ? "" : "no ", + data[1] & (1 << 17) ? "" : "no ", + data[1] & (1 << 13) ? "" : "no ", + data[1] & (1 << 12) ? "" : "no ", + data[1] & (1 << 11) ? "" : "no ", + data[1] & (1 << 10) ? "" : "no "); + if (len == 5) { + instr_out(data, hw_offset, 2, "destination address\n"); + instr_out(data, hw_offset, 3, "immediate dword low\n"); + instr_out(data, hw_offset, 4, "immediate dword high\n"); + } else { + for (i = 2; i < len; i++) { + instr_out(data, hw_offset, i, "\n"); + } + } + return len; + } else { + len = (data[0] & 0xff) + 2; + if (len != 4) + fprintf(out, "Bad count in PIPE_CONTROL\n"); + if (count < len) + BUFFER_FAIL(count, len, "PIPE_CONTROL"); + + switch ((data[0] >> 14) & 0x3) { + case 0: desc1 = "no write"; break; + case 1: desc1 = "qword write"; break; + case 2: desc1 = "PS_DEPTH_COUNT write"; break; + case 3: desc1 = "TIMESTAMP write"; break; + } + instr_out(data, hw_offset, 0, + "PIPE_CONTROL: %s, %sdepth stall, %sRC write flush, " + "%sinst flush\n", + desc1, + data[0] & (1 << 13) ? "" : "no ", + data[0] & (1 << 12) ? "" : "no ", + data[0] & (1 << 11) ? "" : "no "); + instr_out(data, hw_offset, 1, "destination address\n"); + instr_out(data, hw_offset, 2, "immediate dword low\n"); + instr_out(data, hw_offset, 3, "immediate dword high\n"); + return len; } - instr_out(data, hw_offset, 0, - "PIPE_CONTROL: %s, %sdepth stall, %sRC write flush, " - "%sinst flush\n", - desc1, - data[0] & (1 << 13) ? "" : "no ", - data[0] & (1 << 12) ? "" : "no ", - data[0] & (1 << 11) ? "" : "no "); - instr_out(data, hw_offset, 1, "destination address\n"); - instr_out(data, hw_offset, 2, "immediate dword low\n"); - instr_out(data, hw_offset, 3, "immediate dword high\n"); - return len; - case 0x7b00: len = (data[0] & 0xff) + 2; if (len != 6) -- 2.7.4