1 /**************************************************************************
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #include "main/imports.h"
31 #include "i915_context.h"
32 #include "i915_debug.h"
34 #define PRINTF( ... ) _mesa_printf( __VA_ARGS__ )
36 static GLboolean
debug( struct debug_stream
*stream
, const char *name
, GLuint len
)
39 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
42 PRINTF("Error - zero length packet (0x%08x)\n", stream
->ptr
[0]);
47 if (stream
->print_addresses
)
48 PRINTF("%08x: ", stream
->offset
);
51 PRINTF("%s (%d dwords):\n", name
, len
);
52 for (i
= 0; i
< len
; i
++)
53 PRINTF("\t0x%08x\n", ptr
[i
]);
56 stream
->offset
+= len
* sizeof(GLuint
);
62 static const char *get_prim_name( GLuint val
)
64 switch (val
& PRIM3D_MASK
) {
65 case PRIM3D_TRILIST
: return "TRILIST"; break;
66 case PRIM3D_TRISTRIP
: return "TRISTRIP"; break;
67 case PRIM3D_TRISTRIP_RVRSE
: return "TRISTRIP_RVRSE"; break;
68 case PRIM3D_TRIFAN
: return "TRIFAN"; break;
69 case PRIM3D_POLY
: return "POLY"; break;
70 case PRIM3D_LINELIST
: return "LINELIST"; break;
71 case PRIM3D_LINESTRIP
: return "LINESTRIP"; break;
72 case PRIM3D_RECTLIST
: return "RECTLIST"; break;
73 case PRIM3D_POINTLIST
: return "POINTLIST"; break;
74 case PRIM3D_DIB
: return "DIB"; break;
75 case PRIM3D_CLEAR_RECT
: return "CLEAR_RECT"; break;
76 case PRIM3D_ZONE_INIT
: return "ZONE_INIT"; break;
77 default: return "????"; break;
81 static GLboolean
debug_prim( struct debug_stream
*stream
, const char *name
,
82 GLboolean dump_floats
,
85 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
86 const char *prim
= get_prim_name( ptr
[0] );
91 PRINTF("%s %s (%d dwords):\n", name
, prim
, len
);
92 PRINTF("\t0x%08x\n", ptr
[0]);
93 for (i
= 1; i
< len
; i
++) {
95 PRINTF("\t0x%08x // %f\n", ptr
[i
], *(GLfloat
*)&ptr
[i
]);
97 PRINTF("\t0x%08x\n", ptr
[i
]);
103 stream
->offset
+= len
* sizeof(GLuint
);
111 static GLboolean
debug_program( struct debug_stream
*stream
, const char *name
, GLuint len
)
113 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
116 PRINTF("Error - zero length packet (0x%08x)\n", stream
->ptr
[0]);
121 if (stream
->print_addresses
)
122 PRINTF("%08x: ", stream
->offset
);
124 PRINTF("%s (%d dwords):\n", name
, len
);
125 i915_disassemble_program( ptr
, len
);
127 stream
->offset
+= len
* sizeof(GLuint
);
132 static GLboolean
debug_chain( struct debug_stream
*stream
, const char *name
, GLuint len
)
134 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
135 GLuint old_offset
= stream
->offset
+ len
* sizeof(GLuint
);
138 PRINTF("%s (%d dwords):\n", name
, len
);
139 for (i
= 0; i
< len
; i
++)
140 PRINTF("\t0x%08x\n", ptr
[i
]);
142 stream
->offset
= ptr
[1] & ~0x3;
144 if (stream
->offset
< old_offset
)
145 PRINTF("\n... skipping backwards from 0x%x --> 0x%x ...\n\n",
146 old_offset
, stream
->offset
);
148 PRINTF("\n... skipping from 0x%x --> 0x%x ...\n\n",
149 old_offset
, stream
->offset
);
156 static GLboolean
debug_variable_length_prim( struct debug_stream
*stream
)
158 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
159 const char *prim
= get_prim_name( ptr
[0] );
162 GLushort
*idx
= (GLushort
*)(ptr
+1);
163 for (i
= 0; idx
[i
] != 0xffff; i
++)
168 PRINTF("3DPRIM, %s variable length %d indicies (%d dwords):\n", prim
, i
, len
);
169 for (i
= 0; i
< len
; i
++)
170 PRINTF("\t0x%08x\n", ptr
[i
]);
173 stream
->offset
+= len
* sizeof(GLuint
);
178 #define BITS( dw, hi, lo, ... ) \
180 unsigned himask = 0xffffffffU >> (31 - (hi)); \
182 PRINTF(__VA_ARGS__); \
183 PRINTF(": 0x%x\n", ((dw) & himask) >> (lo)); \
186 #define MBZ( dw, hi, lo) do { \
187 unsigned x = (dw) >> (lo); \
188 unsigned lomask = (1 << (lo)) - 1; \
190 himask = (1UL << (hi)) - 1; \
191 assert ((x & himask & ~lomask) == 0); \
194 #define FLAG( dw, bit, ... ) \
196 if (((dw) >> (bit)) & 1) { \
198 PRINTF(__VA_ARGS__); \
203 static GLboolean
debug_load_immediate( struct debug_stream
*stream
,
207 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
208 GLuint bits
= (ptr
[0] >> 4) & 0xff;
211 PRINTF("%s (%d dwords, flags: %x):\n", name
, len
, bits
);
212 PRINTF("\t0x%08x\n", ptr
[j
++]);
215 PRINTF("\t LIS0: 0x%08x\n", ptr
[j
]);
216 PRINTF("\t vb address: 0x%08x\n", (ptr
[j
] & ~0x3));
217 BITS(ptr
[j
], 0, 0, "vb invalidate disable");
221 PRINTF("\t LIS1: 0x%08x\n", ptr
[j
]);
222 BITS(ptr
[j
], 29, 24, "vb dword width");
223 BITS(ptr
[j
], 21, 16, "vb dword pitch");
224 BITS(ptr
[j
], 15, 0, "vb max index");
229 PRINTF("\t LIS2: 0x%08x\n", ptr
[j
]);
230 for (i
= 0; i
< 8; i
++) {
231 unsigned tc
= (ptr
[j
] >> (i
* 4)) & 0xf;
233 BITS(tc
, 3, 0, "tex coord %d", i
);
238 PRINTF("\t LIS3: 0x%08x\n", ptr
[j
]);
242 PRINTF("\t LIS4: 0x%08x\n", ptr
[j
]);
243 BITS(ptr
[j
], 31, 23, "point width");
244 BITS(ptr
[j
], 22, 19, "line width");
245 FLAG(ptr
[j
], 18, "alpha flatshade");
246 FLAG(ptr
[j
], 17, "fog flatshade");
247 FLAG(ptr
[j
], 16, "spec flatshade");
248 FLAG(ptr
[j
], 15, "rgb flatshade");
249 BITS(ptr
[j
], 14, 13, "cull mode");
250 FLAG(ptr
[j
], 12, "vfmt: point width");
251 FLAG(ptr
[j
], 11, "vfmt: specular/fog");
252 FLAG(ptr
[j
], 10, "vfmt: rgba");
253 FLAG(ptr
[j
], 9, "vfmt: depth offset");
254 BITS(ptr
[j
], 8, 6, "vfmt: position (2==xyzw)");
255 FLAG(ptr
[j
], 5, "force dflt diffuse");
256 FLAG(ptr
[j
], 4, "force dflt specular");
257 FLAG(ptr
[j
], 3, "local depth offset enable");
258 FLAG(ptr
[j
], 2, "vfmt: fp32 fog coord");
259 FLAG(ptr
[j
], 1, "sprite point");
260 FLAG(ptr
[j
], 0, "antialiasing");
264 PRINTF("\t LIS5: 0x%08x\n", ptr
[j
]);
265 BITS(ptr
[j
], 31, 28, "rgba write disables");
266 FLAG(ptr
[j
], 27, "force dflt point width");
267 FLAG(ptr
[j
], 26, "last pixel enable");
268 FLAG(ptr
[j
], 25, "global z offset enable");
269 FLAG(ptr
[j
], 24, "fog enable");
270 BITS(ptr
[j
], 23, 16, "stencil ref");
271 BITS(ptr
[j
], 15, 13, "stencil test");
272 BITS(ptr
[j
], 12, 10, "stencil fail op");
273 BITS(ptr
[j
], 9, 7, "stencil pass z fail op");
274 BITS(ptr
[j
], 6, 4, "stencil pass z pass op");
275 FLAG(ptr
[j
], 3, "stencil write enable");
276 FLAG(ptr
[j
], 2, "stencil test enable");
277 FLAG(ptr
[j
], 1, "color dither enable");
278 FLAG(ptr
[j
], 0, "logiop enable");
282 PRINTF("\t LIS6: 0x%08x\n", ptr
[j
]);
283 FLAG(ptr
[j
], 31, "alpha test enable");
284 BITS(ptr
[j
], 30, 28, "alpha func");
285 BITS(ptr
[j
], 27, 20, "alpha ref");
286 FLAG(ptr
[j
], 19, "depth test enable");
287 BITS(ptr
[j
], 18, 16, "depth func");
288 FLAG(ptr
[j
], 15, "blend enable");
289 BITS(ptr
[j
], 14, 12, "blend func");
290 BITS(ptr
[j
], 11, 8, "blend src factor");
291 BITS(ptr
[j
], 7, 4, "blend dst factor");
292 FLAG(ptr
[j
], 3, "depth write enable");
293 FLAG(ptr
[j
], 2, "color write enable");
294 BITS(ptr
[j
], 1, 0, "provoking vertex");
303 stream
->offset
+= len
* sizeof(GLuint
);
310 static GLboolean
debug_load_indirect( struct debug_stream
*stream
,
314 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
315 GLuint bits
= (ptr
[0] >> 8) & 0x3f;
318 PRINTF("%s (%d dwords):\n", name
, len
);
319 PRINTF("\t0x%08x\n", ptr
[j
++]);
321 for (i
= 0; i
< 6; i
++) {
324 case LI0_STATE_STATIC_INDIRECT
:
325 PRINTF(" STATIC: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
326 PRINTF(" 0x%08x\n", ptr
[j
++]);
328 case LI0_STATE_DYNAMIC_INDIRECT
:
329 PRINTF(" DYNAMIC: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
331 case LI0_STATE_SAMPLER
:
332 PRINTF(" SAMPLER: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
333 PRINTF(" 0x%08x\n", ptr
[j
++]);
336 PRINTF(" MAP: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
337 PRINTF(" 0x%08x\n", ptr
[j
++]);
339 case LI0_STATE_PROGRAM
:
340 PRINTF(" PROGRAM: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
341 PRINTF(" 0x%08x\n", ptr
[j
++]);
343 case LI0_STATE_CONSTANTS
:
344 PRINTF(" CONSTANTS: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
345 PRINTF(" 0x%08x\n", ptr
[j
++]);
355 PRINTF("\t DUMMY: 0x%08x\n", ptr
[j
++]);
363 stream
->offset
+= len
* sizeof(GLuint
);
368 static void BR13( struct debug_stream
*stream
,
371 PRINTF("\t0x%08x\n", val
);
372 FLAG(val
, 30, "clipping enable");
373 BITS(val
, 25, 24, "color depth (3==32bpp)");
374 BITS(val
, 23, 16, "raster op");
375 BITS(val
, 15, 0, "dest pitch");
379 static void BR2223( struct debug_stream
*stream
,
380 GLuint val22
, GLuint val23
)
382 union { GLuint val
; short field
[2]; } BR22
, BR23
;
387 PRINTF("\t0x%08x\n", val22
);
388 BITS(val22
, 31, 16, "dest y1");
389 BITS(val22
, 15, 0, "dest x1");
391 PRINTF("\t0x%08x\n", val23
);
392 BITS(val23
, 31, 16, "dest y2");
393 BITS(val23
, 15, 0, "dest x2");
395 /* The blit engine may produce unexpected results when these aren't met */
396 assert(BR22
.field
[0] < BR23
.field
[0]);
397 assert(BR22
.field
[1] < BR23
.field
[1]);
400 static void BR09( struct debug_stream
*stream
,
403 PRINTF("\t0x%08x -- dest address\n", val
);
406 static void BR26( struct debug_stream
*stream
,
409 PRINTF("\t0x%08x\n", val
);
410 BITS(val
, 31, 16, "src y1");
411 BITS(val
, 15, 0, "src x1");
414 static void BR11( struct debug_stream
*stream
,
417 PRINTF("\t0x%08x\n", val
);
418 BITS(val
, 15, 0, "src pitch");
421 static void BR12( struct debug_stream
*stream
,
424 PRINTF("\t0x%08x -- src address\n", val
);
427 static void BR16( struct debug_stream
*stream
,
430 PRINTF("\t0x%08x -- color\n", val
);
433 static GLboolean
debug_copy_blit( struct debug_stream
*stream
,
437 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
440 PRINTF("%s (%d dwords):\n", name
, len
);
441 PRINTF("\t0x%08x\n", ptr
[j
++]);
443 BR13(stream
, ptr
[j
++]);
444 BR2223(stream
, ptr
[j
], ptr
[j
+1]);
446 BR09(stream
, ptr
[j
++]);
447 BR26(stream
, ptr
[j
++]);
448 BR11(stream
, ptr
[j
++]);
449 BR12(stream
, ptr
[j
++]);
451 stream
->offset
+= len
* sizeof(GLuint
);
456 static GLboolean
debug_color_blit( struct debug_stream
*stream
,
460 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
463 PRINTF("%s (%d dwords):\n", name
, len
);
464 PRINTF("\t0x%08x\n", ptr
[j
++]);
466 BR13(stream
, ptr
[j
++]);
467 BR2223(stream
, ptr
[j
], ptr
[j
+1]);
469 BR09(stream
, ptr
[j
++]);
470 BR16(stream
, ptr
[j
++]);
472 stream
->offset
+= len
* sizeof(GLuint
);
477 static GLboolean
debug_modes4( struct debug_stream
*stream
,
481 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
484 PRINTF("%s (%d dwords):\n", name
, len
);
485 PRINTF("\t0x%08x\n", ptr
[j
]);
486 BITS(ptr
[j
], 21, 18, "logicop func");
487 FLAG(ptr
[j
], 17, "stencil test mask modify-enable");
488 FLAG(ptr
[j
], 16, "stencil write mask modify-enable");
489 BITS(ptr
[j
], 15, 8, "stencil test mask");
490 BITS(ptr
[j
], 7, 0, "stencil write mask");
493 stream
->offset
+= len
* sizeof(GLuint
);
498 static GLboolean
debug_map_state( struct debug_stream
*stream
,
502 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
505 PRINTF("%s (%d dwords):\n", name
, len
);
506 PRINTF("\t0x%08x\n", ptr
[j
++]);
509 PRINTF("\t0x%08x\n", ptr
[j
]);
510 BITS(ptr
[j
], 15, 0, "map mask");
516 PRINTF("\t TMn.0: 0x%08x\n", ptr
[j
]);
517 PRINTF("\t map address: 0x%08x\n", (ptr
[j
] & ~0x3));
518 FLAG(ptr
[j
], 1, "vertical line stride");
519 FLAG(ptr
[j
], 0, "vertical line stride offset");
524 PRINTF("\t TMn.1: 0x%08x\n", ptr
[j
]);
525 BITS(ptr
[j
], 31, 21, "height");
526 BITS(ptr
[j
], 20, 10, "width");
527 BITS(ptr
[j
], 9, 7, "surface format");
528 BITS(ptr
[j
], 6, 3, "texel format");
529 FLAG(ptr
[j
], 2, "use fence regs");
530 FLAG(ptr
[j
], 1, "tiled surface");
531 FLAG(ptr
[j
], 0, "tile walk ymajor");
535 PRINTF("\t TMn.2: 0x%08x\n", ptr
[j
]);
536 BITS(ptr
[j
], 31, 21, "dword pitch");
537 BITS(ptr
[j
], 20, 15, "cube face enables");
538 BITS(ptr
[j
], 14, 9, "max lod");
539 FLAG(ptr
[j
], 8, "mip layout right");
540 BITS(ptr
[j
], 7, 0, "depth");
545 stream
->offset
+= len
* sizeof(GLuint
);
550 static GLboolean
debug_sampler_state( struct debug_stream
*stream
,
554 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
557 PRINTF("%s (%d dwords):\n", name
, len
);
558 PRINTF("\t0x%08x\n", ptr
[j
++]);
561 PRINTF("\t0x%08x\n", ptr
[j
]);
562 BITS(ptr
[j
], 15, 0, "sampler mask");
568 PRINTF("\t TSn.0: 0x%08x\n", ptr
[j
]);
569 FLAG(ptr
[j
], 31, "reverse gamma");
570 FLAG(ptr
[j
], 30, "planar to packed");
571 FLAG(ptr
[j
], 29, "yuv->rgb");
572 BITS(ptr
[j
], 28, 27, "chromakey index");
573 BITS(ptr
[j
], 26, 22, "base mip level");
574 BITS(ptr
[j
], 21, 20, "mip mode filter");
575 BITS(ptr
[j
], 19, 17, "mag mode filter");
576 BITS(ptr
[j
], 16, 14, "min mode filter");
577 BITS(ptr
[j
], 13, 5, "lod bias (s4.4)");
578 FLAG(ptr
[j
], 4, "shadow enable");
579 FLAG(ptr
[j
], 3, "max-aniso-4");
580 BITS(ptr
[j
], 2, 0, "shadow func");
585 PRINTF("\t TSn.1: 0x%08x\n", ptr
[j
]);
586 BITS(ptr
[j
], 31, 24, "min lod");
587 MBZ( ptr
[j
], 23, 18 );
588 FLAG(ptr
[j
], 17, "kill pixel enable");
589 FLAG(ptr
[j
], 16, "keyed tex filter mode");
590 FLAG(ptr
[j
], 15, "chromakey enable");
591 BITS(ptr
[j
], 14, 12, "tcx wrap mode");
592 BITS(ptr
[j
], 11, 9, "tcy wrap mode");
593 BITS(ptr
[j
], 8, 6, "tcz wrap mode");
594 FLAG(ptr
[j
], 5, "normalized coords");
595 BITS(ptr
[j
], 4, 1, "map (surface) index");
596 FLAG(ptr
[j
], 0, "EAST deinterlacer enable");
600 PRINTF("\t TSn.2: 0x%08x (default color)\n", ptr
[j
]);
605 stream
->offset
+= len
* sizeof(GLuint
);
610 static GLboolean
debug_dest_vars( struct debug_stream
*stream
,
614 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
617 PRINTF("%s (%d dwords):\n", name
, len
);
618 PRINTF("\t0x%08x\n", ptr
[j
++]);
621 PRINTF("\t0x%08x\n", ptr
[j
]);
622 FLAG(ptr
[j
], 31, "early classic ztest");
623 FLAG(ptr
[j
], 30, "opengl tex default color");
624 FLAG(ptr
[j
], 29, "bypass iz");
625 FLAG(ptr
[j
], 28, "lod preclamp");
626 BITS(ptr
[j
], 27, 26, "dither pattern");
627 FLAG(ptr
[j
], 25, "linear gamma blend");
628 FLAG(ptr
[j
], 24, "debug dither");
629 BITS(ptr
[j
], 23, 20, "dstorg x");
630 BITS(ptr
[j
], 19, 16, "dstorg y");
631 MBZ (ptr
[j
], 15, 15 );
632 BITS(ptr
[j
], 14, 12, "422 write select");
633 BITS(ptr
[j
], 11, 8, "cbuf format");
634 BITS(ptr
[j
], 3, 2, "zbuf format");
635 FLAG(ptr
[j
], 1, "vert line stride");
636 FLAG(ptr
[j
], 1, "vert line stride offset");
640 stream
->offset
+= len
* sizeof(GLuint
);
645 static GLboolean
debug_buf_info( struct debug_stream
*stream
,
649 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
652 PRINTF("%s (%d dwords):\n", name
, len
);
653 PRINTF("\t0x%08x\n", ptr
[j
++]);
656 PRINTF("\t0x%08x\n", ptr
[j
]);
657 BITS(ptr
[j
], 28, 28, "aux buffer id");
658 BITS(ptr
[j
], 27, 24, "buffer id (7=depth, 3=back)");
659 FLAG(ptr
[j
], 23, "use fence regs");
660 FLAG(ptr
[j
], 22, "tiled surface");
661 FLAG(ptr
[j
], 21, "tile walk ymajor");
662 MBZ (ptr
[j
], 20, 14);
663 BITS(ptr
[j
], 13, 2, "dword pitch");
668 PRINTF("\t0x%08x -- buffer base address\n", ptr
[j
++]);
670 stream
->offset
+= len
* sizeof(GLuint
);
675 static GLboolean
i915_debug_packet( struct debug_stream
*stream
)
677 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
680 switch (((cmd
>> 29) & 0x7)) {
682 switch ((cmd
>> 23) & 0x3f) {
684 return debug(stream
, "MI_NOOP", 1);
686 return debug(stream
, "MI_WAIT_FOR_EVENT", 1);
688 return debug(stream
, "MI_FLUSH", 1);
690 debug(stream
, "MI_BATCH_BUFFER_END", 1);
693 return debug(stream
, "MI_LOAD_REGISTER_IMM", 3);
695 return debug_chain(stream
, "MI_BATCH_BUFFER_START", 2);
703 switch ((cmd
>> 22) & 0xff) {
705 return debug_color_blit(stream
, "XY_COLOR_BLT", (cmd
& 0xff) + 2);
707 return debug_copy_blit(stream
, "XY_SRC_COPY_BLT", (cmd
& 0xff) + 2);
709 return debug(stream
, "blit command", (cmd
& 0xff) + 2);
713 switch ((cmd
>> 24) & 0x1f) {
715 return debug(stream
, "3DSTATE_ANTI_ALIASING", 1);
717 return debug(stream
, "3DSTATE_RASTERIZATION_RULES", 1);
719 return debug(stream
, "3DSTATE_BACKFACE_STENCIL_OPS", 2);
721 return debug(stream
, "3DSTATE_BACKFACE_STENCIL_MASKS", 1);
723 return debug(stream
, "3DSTATE_INDEPENDENT_ALPHA_BLEND", 1);
725 return debug(stream
, "3DSTATE_MODES5", 1);
727 return debug_modes4(stream
, "3DSTATE_MODES4", 1);
729 return debug(stream
, "3DSTATE_FOG_COLOR", 1);
731 return debug(stream
, "3DSTATE_COORD_SET_BINDINGS", 1);
734 switch((cmd
>> 19) & 0x1f) {
736 return debug(stream
, "3DSTATE_SCISSOR_ENABLE", 1);
738 return debug(stream
, "3DSTATE_DEPTH_SUBRECTANGLE_DISABLE", 1);
745 switch ((cmd
>> 16) & 0xff) {
747 return debug_map_state(stream
, "3DSTATE_MAP_STATE", (cmd
& 0x1f) + 2);
749 return debug_sampler_state(stream
, "3DSTATE_SAMPLER_STATE", (cmd
& 0x1f) + 2);
751 return debug_load_immediate(stream
, "3DSTATE_LOAD_STATE_IMMEDIATE", (cmd
& 0xf) + 2);
753 return debug_program(stream
, "3DSTATE_PIXEL_SHADER_PROGRAM", (cmd
& 0x1ff) + 2);
755 return debug(stream
, "3DSTATE_PIXEL_SHADER_CONSTANTS", (cmd
& 0xff) + 2);
757 return debug_load_indirect(stream
, "3DSTATE_LOAD_INDIRECT", (cmd
& 0xff) + 2);
759 return debug(stream
, "3DSTATE_DRAWING_RECTANGLE", (cmd
& 0xffff) + 2);
761 return debug(stream
, "3DSTATE_SCISSOR_RECTANGLE", (cmd
& 0xffff) + 2);
763 return debug(stream
, "3DSTATE_SPAN_STIPPLE", (cmd
& 0xffff) + 2);
765 return debug_dest_vars(stream
, "3DSTATE_DEST_BUFFER_VARS", (cmd
& 0xffff) + 2);
767 return debug(stream
, "3DSTATE_CONSTANT_BLEND_COLOR", (cmd
& 0xffff) + 2);
769 return debug(stream
, "3DSTATE_FOG_MODE", (cmd
& 0xffff) + 2);
771 return debug_buf_info(stream
, "3DSTATE_BUFFER_INFO", (cmd
& 0xffff) + 2);
773 return debug(stream
, "3DSTATE_DEPTH_OFFSET_SCALE", (cmd
& 0xffff) + 2);
775 return debug(stream
, "3DSTATE_DEFAULT_Z", (cmd
& 0xffff) + 2);
777 return debug(stream
, "3DSTATE_DEFAULT_DIFFUSE", (cmd
& 0xffff) + 2);
779 return debug(stream
, "3DSTATE_DEFAULT_SPECULAR", (cmd
& 0xffff) + 2);
781 return debug(stream
, "3DSTATE_CLEAR_PARAMETERS", (cmd
& 0xffff) + 2);
789 return debug(stream
, "???", (cmd
& 0xffff) + 1);
791 return debug(stream
, "", 1);
794 if ((cmd
& (1 << 23)) == 0)
795 return debug_prim(stream
, "3DPRIM (inline)", 1, (cmd
& 0x1ffff) + 2);
796 else if (cmd
& (1 << 17))
798 if ((cmd
& 0xffff) == 0)
799 return debug_variable_length_prim(stream
);
801 return debug_prim(stream
, "3DPRIM (indexed)", 0, (((cmd
& 0xffff) + 1) / 2) + 1);
804 return debug_prim(stream
, "3DPRIM (indirect sequential)", 0, 2);
807 return debug(stream
, "", 0);
821 i915_dump_batchbuffer( GLuint
*start
,
824 struct debug_stream stream
;
825 GLuint bytes
= (end
- start
) * 4;
826 GLboolean done
= GL_FALSE
;
828 PRINTF("\n\nBATCH: (%d)\n", bytes
/ 4);
831 stream
.ptr
= (char *)start
;
832 stream
.print_addresses
= 0;
835 stream
.offset
< bytes
&&
838 if (!i915_debug_packet( &stream
))
841 assert(stream
.offset
<= bytes
&&
845 PRINTF("END-BATCH\n\n\n");