i965: fix VS constant buffer reads
[mesa.git] / src / mesa / drivers / dri / intel / intel_decode.c
index cbee7dc5d9bca3633d5c8127568ea2115f69d0a8..f04638206d5c007e9c1c76ce3d4f281d4f6a6b93 100644 (file)
@@ -87,27 +87,28 @@ decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)
 
     struct {
        uint32_t opcode;
+       int len_mask;
        int min_len;
        int max_len;
        char *name;
     } opcodes_mi[] = {
-       { 0x08, 1, 1, "MI_ARB_ON_OFF" },
-       { 0x0a, 1, 1, "MI_BATCH_BUFFER_END" },
-       { 0x31, 2, 2, "MI_BATCH_BUFFER_START" },
-       { 0x14, 3, 3, "MI_DISPLAY_BUFFER_INFO" },
-       { 0x04, 1, 1, "MI_FLUSH" },
-       { 0x22, 3, 3, "MI_LOAD_REGISTER_IMM" },
-       { 0x13, 2, 2, "MI_LOAD_SCAN_LINES_EXCL" },
-       { 0x12, 2, 2, "MI_LOAD_SCAN_LINES_INCL" },
-       { 0x00, 1, 1, "MI_NOOP" },
-       { 0x11, 2, 2, "MI_OVERLAY_FLIP" },
-       { 0x07, 1, 1, "MI_REPORT_HEAD" },
-       { 0x18, 2, 2, "MI_SET_CONTEXT" },
-       { 0x20, 3, 4, "MI_STORE_DATA_IMM" },
-       { 0x21, 3, 4, "MI_STORE_DATA_INDEX" },
-       { 0x24, 3, 3, "MI_STORE_REGISTER_MEM" },
-       { 0x02, 1, 1, "MI_USER_INTERRUPT" },
-       { 0x03, 1, 1, "MI_WAIT_FOR_EVENT" },
+       { 0x08, 0, 1, 1, "MI_ARB_ON_OFF" },
+       { 0x0a, 0, 1, 1, "MI_BATCH_BUFFER_END" },
+       { 0x31, 0x3f, 2, 2, "MI_BATCH_BUFFER_START" },
+       { 0x14, 0x3f, 3, 3, "MI_DISPLAY_BUFFER_INFO" },
+       { 0x04, 0, 1, 1, "MI_FLUSH" },
+       { 0x22, 0, 3, 3, "MI_LOAD_REGISTER_IMM" },
+       { 0x13, 0x3f, 2, 2, "MI_LOAD_SCAN_LINES_EXCL" },
+       { 0x12, 0x3f, 2, 2, "MI_LOAD_SCAN_LINES_INCL" },
+       { 0x00, 0, 1, 1, "MI_NOOP" },
+       { 0x11, 0x3f, 2, 2, "MI_OVERLAY_FLIP" },
+       { 0x07, 0, 1, 1, "MI_REPORT_HEAD" },
+       { 0x18, 0x3f, 2, 2, "MI_SET_CONTEXT" },
+       { 0x20, 0x3f, 3, 4, "MI_STORE_DATA_IMM" },
+       { 0x21, 0x3f, 3, 4, "MI_STORE_DATA_INDEX" },
+       { 0x24, 0x3f, 3, 3, "MI_STORE_REGISTER_MEM" },
+       { 0x02, 0, 1, 1, "MI_USER_INTERRUPT" },
+       { 0x03, 0, 1, 1, "MI_WAIT_FOR_EVENT" },
     };
 
 
@@ -118,12 +119,14 @@ decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)
 
            instr_out(data, hw_offset, 0, "%s\n", opcodes_mi[opcode].name);
            if (opcodes_mi[opcode].max_len > 1) {
-               len = (data[0] & 0x000000ff) + 2;
+               len = (data[0] & opcodes_mi[opcode].len_mask) + 2;
                if (len < opcodes_mi[opcode].min_len ||
                    len > opcodes_mi[opcode].max_len)
                {
-                   fprintf(out, "Bad length in %s\n",
-                           opcodes_mi[opcode].name);
+                   fprintf(out, "Bad length (%d) in %s, [%d, %d]\n",
+                           len, opcodes_mi[opcode].name,
+                           opcodes_mi[opcode].min_len,
+                           opcodes_mi[opcode].max_len);
                }
            }
 
@@ -1510,7 +1513,7 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
 
        for (i = 1; i < len;) {
            instr_out(data, hw_offset, i, "buffer %d: %svalid, type 0x%04x, "
-                     "src offset 0x%04xd bytes\n",
+                     "src offset 0x%04x bytes\n",
                      data[i] >> 27,
                      data[i] & (1 << 26) ? "" : "in",
                      (data[i] >> 16) & 0x1ff,
@@ -1592,7 +1595,7 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
                  "3DPRIMITIVE: %s %s\n",
                  get_965_prim_type(data[0]),
                  (data[0] & (1 << 15)) ? "random" : "sequential");
-       instr_out(data, hw_offset, 1, "primitive count\n");
+       instr_out(data, hw_offset, 1, "vertex count\n");
        instr_out(data, hw_offset, 2, "start vertex\n");
        instr_out(data, hw_offset, 3, "instance count\n");
        instr_out(data, hw_offset, 4, "start instance\n");