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 static GLboolean
debug( struct debug_stream
*stream
, const char *name
, GLuint len
)
37 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
40 printf("Error - zero length packet (0x%08x)\n", stream
->ptr
[0]);
45 if (stream
->print_addresses
)
46 printf("%08x: ", stream
->offset
);
49 printf("%s (%d dwords):\n", name
, len
);
50 for (i
= 0; i
< len
; i
++)
51 printf("\t0x%08x\n", ptr
[i
]);
54 stream
->offset
+= len
* sizeof(GLuint
);
60 static const char *get_prim_name( GLuint val
)
62 switch (val
& PRIM3D_MASK
) {
63 case PRIM3D_TRILIST
: return "TRILIST"; break;
64 case PRIM3D_TRISTRIP
: return "TRISTRIP"; break;
65 case PRIM3D_TRISTRIP_RVRSE
: return "TRISTRIP_RVRSE"; break;
66 case PRIM3D_TRIFAN
: return "TRIFAN"; break;
67 case PRIM3D_POLY
: return "POLY"; break;
68 case PRIM3D_LINELIST
: return "LINELIST"; break;
69 case PRIM3D_LINESTRIP
: return "LINESTRIP"; break;
70 case PRIM3D_RECTLIST
: return "RECTLIST"; break;
71 case PRIM3D_POINTLIST
: return "POINTLIST"; break;
72 case PRIM3D_DIB
: return "DIB"; break;
73 case PRIM3D_CLEAR_RECT
: return "CLEAR_RECT"; break;
74 case PRIM3D_ZONE_INIT
: return "ZONE_INIT"; break;
75 default: return "????"; break;
79 static GLboolean
debug_prim( struct debug_stream
*stream
, const char *name
,
80 GLboolean dump_floats
,
83 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
84 const char *prim
= get_prim_name( ptr
[0] );
89 printf("%s %s (%d dwords):\n", name
, prim
, len
);
90 printf("\t0x%08x\n", ptr
[0]);
91 for (i
= 1; i
< len
; i
++) {
93 printf("\t0x%08x // %f\n", ptr
[i
], *(GLfloat
*)&ptr
[i
]);
95 printf("\t0x%08x\n", ptr
[i
]);
101 stream
->offset
+= len
* sizeof(GLuint
);
109 static GLboolean
debug_program( struct debug_stream
*stream
, const char *name
, GLuint len
)
111 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
114 printf("Error - zero length packet (0x%08x)\n", stream
->ptr
[0]);
119 if (stream
->print_addresses
)
120 printf("%08x: ", stream
->offset
);
122 printf("%s (%d dwords):\n", name
, len
);
123 i915_disassemble_program( ptr
, len
);
125 stream
->offset
+= len
* sizeof(GLuint
);
130 static GLboolean
debug_chain( struct debug_stream
*stream
, const char *name
, GLuint len
)
132 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
133 GLuint old_offset
= stream
->offset
+ len
* sizeof(GLuint
);
136 printf("%s (%d dwords):\n", name
, len
);
137 for (i
= 0; i
< len
; i
++)
138 printf("\t0x%08x\n", ptr
[i
]);
140 stream
->offset
= ptr
[1] & ~0x3;
142 if (stream
->offset
< old_offset
)
143 printf("\n... skipping backwards from 0x%x --> 0x%x ...\n\n",
144 old_offset
, stream
->offset
);
146 printf("\n... skipping from 0x%x --> 0x%x ...\n\n",
147 old_offset
, stream
->offset
);
154 static GLboolean
debug_variable_length_prim( struct debug_stream
*stream
)
156 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
157 const char *prim
= get_prim_name( ptr
[0] );
160 GLushort
*idx
= (GLushort
*)(ptr
+1);
161 for (i
= 0; idx
[i
] != 0xffff; i
++)
166 printf("3DPRIM, %s variable length %d indicies (%d dwords):\n", prim
, i
, len
);
167 for (i
= 0; i
< len
; i
++)
168 printf("\t0x%08x\n", ptr
[i
]);
171 stream
->offset
+= len
* sizeof(GLuint
);
176 #define BITS( dw, hi, lo, ... ) \
178 unsigned himask = 0xffffffffU >> (31 - (hi)); \
180 printf(__VA_ARGS__); \
181 printf(": 0x%x\n", ((dw) & himask) >> (lo)); \
184 #define MBZ( dw, hi, lo) do { \
185 unsigned x = (dw) >> (lo); \
186 unsigned lomask = (1 << (lo)) - 1; \
188 himask = (1UL << (hi)) - 1; \
189 assert ((x & himask & ~lomask) == 0); \
192 #define FLAG( dw, bit, ... ) \
194 if (((dw) >> (bit)) & 1) { \
196 printf(__VA_ARGS__); \
201 static GLboolean
debug_load_immediate( struct debug_stream
*stream
,
205 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
206 GLuint bits
= (ptr
[0] >> 4) & 0xff;
209 printf("%s (%d dwords, flags: %x):\n", name
, len
, bits
);
210 printf("\t0x%08x\n", ptr
[j
++]);
213 printf("\t LIS0: 0x%08x\n", ptr
[j
]);
214 printf("\t vb address: 0x%08x\n", (ptr
[j
] & ~0x3));
215 BITS(ptr
[j
], 0, 0, "vb invalidate disable");
219 printf("\t LIS1: 0x%08x\n", ptr
[j
]);
220 BITS(ptr
[j
], 29, 24, "vb dword width");
221 BITS(ptr
[j
], 21, 16, "vb dword pitch");
222 BITS(ptr
[j
], 15, 0, "vb max index");
227 printf("\t LIS2: 0x%08x\n", ptr
[j
]);
228 for (i
= 0; i
< 8; i
++) {
229 unsigned tc
= (ptr
[j
] >> (i
* 4)) & 0xf;
231 BITS(tc
, 3, 0, "tex coord %d", i
);
236 printf("\t LIS3: 0x%08x\n", ptr
[j
]);
240 printf("\t LIS4: 0x%08x\n", ptr
[j
]);
241 BITS(ptr
[j
], 31, 23, "point width");
242 BITS(ptr
[j
], 22, 19, "line width");
243 FLAG(ptr
[j
], 18, "alpha flatshade");
244 FLAG(ptr
[j
], 17, "fog flatshade");
245 FLAG(ptr
[j
], 16, "spec flatshade");
246 FLAG(ptr
[j
], 15, "rgb flatshade");
247 BITS(ptr
[j
], 14, 13, "cull mode");
248 FLAG(ptr
[j
], 12, "vfmt: point width");
249 FLAG(ptr
[j
], 11, "vfmt: specular/fog");
250 FLAG(ptr
[j
], 10, "vfmt: rgba");
251 FLAG(ptr
[j
], 9, "vfmt: depth offset");
252 BITS(ptr
[j
], 8, 6, "vfmt: position (2==xyzw)");
253 FLAG(ptr
[j
], 5, "force dflt diffuse");
254 FLAG(ptr
[j
], 4, "force dflt specular");
255 FLAG(ptr
[j
], 3, "local depth offset enable");
256 FLAG(ptr
[j
], 2, "vfmt: fp32 fog coord");
257 FLAG(ptr
[j
], 1, "sprite point");
258 FLAG(ptr
[j
], 0, "antialiasing");
262 printf("\t LIS5: 0x%08x\n", ptr
[j
]);
263 BITS(ptr
[j
], 31, 28, "rgba write disables");
264 FLAG(ptr
[j
], 27, "force dflt point width");
265 FLAG(ptr
[j
], 26, "last pixel enable");
266 FLAG(ptr
[j
], 25, "global z offset enable");
267 FLAG(ptr
[j
], 24, "fog enable");
268 BITS(ptr
[j
], 23, 16, "stencil ref");
269 BITS(ptr
[j
], 15, 13, "stencil test");
270 BITS(ptr
[j
], 12, 10, "stencil fail op");
271 BITS(ptr
[j
], 9, 7, "stencil pass z fail op");
272 BITS(ptr
[j
], 6, 4, "stencil pass z pass op");
273 FLAG(ptr
[j
], 3, "stencil write enable");
274 FLAG(ptr
[j
], 2, "stencil test enable");
275 FLAG(ptr
[j
], 1, "color dither enable");
276 FLAG(ptr
[j
], 0, "logiop enable");
280 printf("\t LIS6: 0x%08x\n", ptr
[j
]);
281 FLAG(ptr
[j
], 31, "alpha test enable");
282 BITS(ptr
[j
], 30, 28, "alpha func");
283 BITS(ptr
[j
], 27, 20, "alpha ref");
284 FLAG(ptr
[j
], 19, "depth test enable");
285 BITS(ptr
[j
], 18, 16, "depth func");
286 FLAG(ptr
[j
], 15, "blend enable");
287 BITS(ptr
[j
], 14, 12, "blend func");
288 BITS(ptr
[j
], 11, 8, "blend src factor");
289 BITS(ptr
[j
], 7, 4, "blend dst factor");
290 FLAG(ptr
[j
], 3, "depth write enable");
291 FLAG(ptr
[j
], 2, "color write enable");
292 BITS(ptr
[j
], 1, 0, "provoking vertex");
301 stream
->offset
+= len
* sizeof(GLuint
);
308 static GLboolean
debug_load_indirect( struct debug_stream
*stream
,
312 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
313 GLuint bits
= (ptr
[0] >> 8) & 0x3f;
316 printf("%s (%d dwords):\n", name
, len
);
317 printf("\t0x%08x\n", ptr
[j
++]);
319 for (i
= 0; i
< 6; i
++) {
322 case LI0_STATE_STATIC_INDIRECT
:
323 printf(" STATIC: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
324 printf(" 0x%08x\n", ptr
[j
++]);
326 case LI0_STATE_DYNAMIC_INDIRECT
:
327 printf(" DYNAMIC: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
329 case LI0_STATE_SAMPLER
:
330 printf(" SAMPLER: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
331 printf(" 0x%08x\n", ptr
[j
++]);
334 printf(" MAP: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
335 printf(" 0x%08x\n", ptr
[j
++]);
337 case LI0_STATE_PROGRAM
:
338 printf(" PROGRAM: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
339 printf(" 0x%08x\n", ptr
[j
++]);
341 case LI0_STATE_CONSTANTS
:
342 printf(" CONSTANTS: 0x%08x | %x\n", ptr
[j
]&~3, ptr
[j
]&3); j
++;
343 printf(" 0x%08x\n", ptr
[j
++]);
353 printf("\t DUMMY: 0x%08x\n", ptr
[j
++]);
361 stream
->offset
+= len
* sizeof(GLuint
);
366 static void BR13( struct debug_stream
*stream
,
369 printf("\t0x%08x\n", val
);
370 FLAG(val
, 30, "clipping enable");
371 BITS(val
, 25, 24, "color depth (3==32bpp)");
372 BITS(val
, 23, 16, "raster op");
373 BITS(val
, 15, 0, "dest pitch");
377 static void BR2223( struct debug_stream
*stream
,
378 GLuint val22
, GLuint val23
)
380 union { GLuint val
; short field
[2]; } BR22
, BR23
;
385 printf("\t0x%08x\n", val22
);
386 BITS(val22
, 31, 16, "dest y1");
387 BITS(val22
, 15, 0, "dest x1");
389 printf("\t0x%08x\n", val23
);
390 BITS(val23
, 31, 16, "dest y2");
391 BITS(val23
, 15, 0, "dest x2");
393 /* The blit engine may produce unexpected results when these aren't met */
394 assert(BR22
.field
[0] < BR23
.field
[0]);
395 assert(BR22
.field
[1] < BR23
.field
[1]);
398 static void BR09( struct debug_stream
*stream
,
401 printf("\t0x%08x -- dest address\n", val
);
404 static void BR26( struct debug_stream
*stream
,
407 printf("\t0x%08x\n", val
);
408 BITS(val
, 31, 16, "src y1");
409 BITS(val
, 15, 0, "src x1");
412 static void BR11( struct debug_stream
*stream
,
415 printf("\t0x%08x\n", val
);
416 BITS(val
, 15, 0, "src pitch");
419 static void BR12( struct debug_stream
*stream
,
422 printf("\t0x%08x -- src address\n", val
);
425 static void BR16( struct debug_stream
*stream
,
428 printf("\t0x%08x -- color\n", val
);
431 static GLboolean
debug_copy_blit( struct debug_stream
*stream
,
435 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
438 printf("%s (%d dwords):\n", name
, len
);
439 printf("\t0x%08x\n", ptr
[j
++]);
441 BR13(stream
, ptr
[j
++]);
442 BR2223(stream
, ptr
[j
], ptr
[j
+1]);
444 BR09(stream
, ptr
[j
++]);
445 BR26(stream
, ptr
[j
++]);
446 BR11(stream
, ptr
[j
++]);
447 BR12(stream
, ptr
[j
++]);
449 stream
->offset
+= len
* sizeof(GLuint
);
454 static GLboolean
debug_color_blit( struct debug_stream
*stream
,
458 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
461 printf("%s (%d dwords):\n", name
, len
);
462 printf("\t0x%08x\n", ptr
[j
++]);
464 BR13(stream
, ptr
[j
++]);
465 BR2223(stream
, ptr
[j
], ptr
[j
+1]);
467 BR09(stream
, ptr
[j
++]);
468 BR16(stream
, ptr
[j
++]);
470 stream
->offset
+= len
* sizeof(GLuint
);
475 static GLboolean
debug_modes4( struct debug_stream
*stream
,
479 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
482 printf("%s (%d dwords):\n", name
, len
);
483 printf("\t0x%08x\n", ptr
[j
]);
484 BITS(ptr
[j
], 21, 18, "logicop func");
485 FLAG(ptr
[j
], 17, "stencil test mask modify-enable");
486 FLAG(ptr
[j
], 16, "stencil write mask modify-enable");
487 BITS(ptr
[j
], 15, 8, "stencil test mask");
488 BITS(ptr
[j
], 7, 0, "stencil write mask");
491 stream
->offset
+= len
* sizeof(GLuint
);
496 static GLboolean
debug_map_state( struct debug_stream
*stream
,
500 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
503 printf("%s (%d dwords):\n", name
, len
);
504 printf("\t0x%08x\n", ptr
[j
++]);
507 printf("\t0x%08x\n", ptr
[j
]);
508 BITS(ptr
[j
], 15, 0, "map mask");
514 printf("\t TMn.0: 0x%08x\n", ptr
[j
]);
515 printf("\t map address: 0x%08x\n", (ptr
[j
] & ~0x3));
516 FLAG(ptr
[j
], 1, "vertical line stride");
517 FLAG(ptr
[j
], 0, "vertical line stride offset");
522 printf("\t TMn.1: 0x%08x\n", ptr
[j
]);
523 BITS(ptr
[j
], 31, 21, "height");
524 BITS(ptr
[j
], 20, 10, "width");
525 BITS(ptr
[j
], 9, 7, "surface format");
526 BITS(ptr
[j
], 6, 3, "texel format");
527 FLAG(ptr
[j
], 2, "use fence regs");
528 FLAG(ptr
[j
], 1, "tiled surface");
529 FLAG(ptr
[j
], 0, "tile walk ymajor");
533 printf("\t TMn.2: 0x%08x\n", ptr
[j
]);
534 BITS(ptr
[j
], 31, 21, "dword pitch");
535 BITS(ptr
[j
], 20, 15, "cube face enables");
536 BITS(ptr
[j
], 14, 9, "max lod");
537 FLAG(ptr
[j
], 8, "mip layout right");
538 BITS(ptr
[j
], 7, 0, "depth");
543 stream
->offset
+= len
* sizeof(GLuint
);
548 static GLboolean
debug_sampler_state( struct debug_stream
*stream
,
552 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
555 printf("%s (%d dwords):\n", name
, len
);
556 printf("\t0x%08x\n", ptr
[j
++]);
559 printf("\t0x%08x\n", ptr
[j
]);
560 BITS(ptr
[j
], 15, 0, "sampler mask");
566 printf("\t TSn.0: 0x%08x\n", ptr
[j
]);
567 FLAG(ptr
[j
], 31, "reverse gamma");
568 FLAG(ptr
[j
], 30, "planar to packed");
569 FLAG(ptr
[j
], 29, "yuv->rgb");
570 BITS(ptr
[j
], 28, 27, "chromakey index");
571 BITS(ptr
[j
], 26, 22, "base mip level");
572 BITS(ptr
[j
], 21, 20, "mip mode filter");
573 BITS(ptr
[j
], 19, 17, "mag mode filter");
574 BITS(ptr
[j
], 16, 14, "min mode filter");
575 BITS(ptr
[j
], 13, 5, "lod bias (s4.4)");
576 FLAG(ptr
[j
], 4, "shadow enable");
577 FLAG(ptr
[j
], 3, "max-aniso-4");
578 BITS(ptr
[j
], 2, 0, "shadow func");
583 printf("\t TSn.1: 0x%08x\n", ptr
[j
]);
584 BITS(ptr
[j
], 31, 24, "min lod");
585 MBZ( ptr
[j
], 23, 18 );
586 FLAG(ptr
[j
], 17, "kill pixel enable");
587 FLAG(ptr
[j
], 16, "keyed tex filter mode");
588 FLAG(ptr
[j
], 15, "chromakey enable");
589 BITS(ptr
[j
], 14, 12, "tcx wrap mode");
590 BITS(ptr
[j
], 11, 9, "tcy wrap mode");
591 BITS(ptr
[j
], 8, 6, "tcz wrap mode");
592 FLAG(ptr
[j
], 5, "normalized coords");
593 BITS(ptr
[j
], 4, 1, "map (surface) index");
594 FLAG(ptr
[j
], 0, "EAST deinterlacer enable");
598 printf("\t TSn.2: 0x%08x (default color)\n", ptr
[j
]);
603 stream
->offset
+= len
* sizeof(GLuint
);
608 static GLboolean
debug_dest_vars( struct debug_stream
*stream
,
612 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
615 printf("%s (%d dwords):\n", name
, len
);
616 printf("\t0x%08x\n", ptr
[j
++]);
619 printf("\t0x%08x\n", ptr
[j
]);
620 FLAG(ptr
[j
], 31, "early classic ztest");
621 FLAG(ptr
[j
], 30, "opengl tex default color");
622 FLAG(ptr
[j
], 29, "bypass iz");
623 FLAG(ptr
[j
], 28, "lod preclamp");
624 BITS(ptr
[j
], 27, 26, "dither pattern");
625 FLAG(ptr
[j
], 25, "linear gamma blend");
626 FLAG(ptr
[j
], 24, "debug dither");
627 BITS(ptr
[j
], 23, 20, "dstorg x");
628 BITS(ptr
[j
], 19, 16, "dstorg y");
629 MBZ (ptr
[j
], 15, 15 );
630 BITS(ptr
[j
], 14, 12, "422 write select");
631 BITS(ptr
[j
], 11, 8, "cbuf format");
632 BITS(ptr
[j
], 3, 2, "zbuf format");
633 FLAG(ptr
[j
], 1, "vert line stride");
634 FLAG(ptr
[j
], 1, "vert line stride offset");
638 stream
->offset
+= len
* sizeof(GLuint
);
643 static GLboolean
debug_buf_info( struct debug_stream
*stream
,
647 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
650 printf("%s (%d dwords):\n", name
, len
);
651 printf("\t0x%08x\n", ptr
[j
++]);
654 printf("\t0x%08x\n", ptr
[j
]);
655 BITS(ptr
[j
], 28, 28, "aux buffer id");
656 BITS(ptr
[j
], 27, 24, "buffer id (7=depth, 3=back)");
657 FLAG(ptr
[j
], 23, "use fence regs");
658 FLAG(ptr
[j
], 22, "tiled surface");
659 FLAG(ptr
[j
], 21, "tile walk ymajor");
660 MBZ (ptr
[j
], 20, 14);
661 BITS(ptr
[j
], 13, 2, "dword pitch");
666 printf("\t0x%08x -- buffer base address\n", ptr
[j
++]);
668 stream
->offset
+= len
* sizeof(GLuint
);
673 static GLboolean
i915_debug_packet( struct debug_stream
*stream
)
675 GLuint
*ptr
= (GLuint
*)(stream
->ptr
+ stream
->offset
);
678 switch (((cmd
>> 29) & 0x7)) {
680 switch ((cmd
>> 23) & 0x3f) {
682 return debug(stream
, "MI_NOOP", 1);
684 return debug(stream
, "MI_WAIT_FOR_EVENT", 1);
686 return debug(stream
, "MI_FLUSH", 1);
688 debug(stream
, "MI_BATCH_BUFFER_END", 1);
691 return debug(stream
, "MI_LOAD_REGISTER_IMM", 3);
693 return debug_chain(stream
, "MI_BATCH_BUFFER_START", 2);
701 switch ((cmd
>> 22) & 0xff) {
703 return debug_color_blit(stream
, "XY_COLOR_BLT", (cmd
& 0xff) + 2);
705 return debug_copy_blit(stream
, "XY_SRC_COPY_BLT", (cmd
& 0xff) + 2);
707 return debug(stream
, "blit command", (cmd
& 0xff) + 2);
711 switch ((cmd
>> 24) & 0x1f) {
713 return debug(stream
, "3DSTATE_ANTI_ALIASING", 1);
715 return debug(stream
, "3DSTATE_RASTERIZATION_RULES", 1);
717 return debug(stream
, "3DSTATE_BACKFACE_STENCIL_OPS", 2);
719 return debug(stream
, "3DSTATE_BACKFACE_STENCIL_MASKS", 1);
721 return debug(stream
, "3DSTATE_INDEPENDENT_ALPHA_BLEND", 1);
723 return debug(stream
, "3DSTATE_MODES5", 1);
725 return debug_modes4(stream
, "3DSTATE_MODES4", 1);
727 return debug(stream
, "3DSTATE_FOG_COLOR", 1);
729 return debug(stream
, "3DSTATE_COORD_SET_BINDINGS", 1);
732 switch((cmd
>> 19) & 0x1f) {
734 return debug(stream
, "3DSTATE_SCISSOR_ENABLE", 1);
736 return debug(stream
, "3DSTATE_DEPTH_SUBRECTANGLE_DISABLE", 1);
743 switch ((cmd
>> 16) & 0xff) {
745 return debug_map_state(stream
, "3DSTATE_MAP_STATE", (cmd
& 0x1f) + 2);
747 return debug_sampler_state(stream
, "3DSTATE_SAMPLER_STATE", (cmd
& 0x1f) + 2);
749 return debug_load_immediate(stream
, "3DSTATE_LOAD_STATE_IMMEDIATE", (cmd
& 0xf) + 2);
751 return debug_program(stream
, "3DSTATE_PIXEL_SHADER_PROGRAM", (cmd
& 0x1ff) + 2);
753 return debug(stream
, "3DSTATE_PIXEL_SHADER_CONSTANTS", (cmd
& 0xff) + 2);
755 return debug_load_indirect(stream
, "3DSTATE_LOAD_INDIRECT", (cmd
& 0xff) + 2);
757 return debug(stream
, "3DSTATE_DRAWING_RECTANGLE", (cmd
& 0xffff) + 2);
759 return debug(stream
, "3DSTATE_SCISSOR_RECTANGLE", (cmd
& 0xffff) + 2);
761 return debug(stream
, "3DSTATE_SPAN_STIPPLE", (cmd
& 0xffff) + 2);
763 return debug_dest_vars(stream
, "3DSTATE_DEST_BUFFER_VARS", (cmd
& 0xffff) + 2);
765 return debug(stream
, "3DSTATE_CONSTANT_BLEND_COLOR", (cmd
& 0xffff) + 2);
767 return debug(stream
, "3DSTATE_FOG_MODE", (cmd
& 0xffff) + 2);
769 return debug_buf_info(stream
, "3DSTATE_BUFFER_INFO", (cmd
& 0xffff) + 2);
771 return debug(stream
, "3DSTATE_DEPTH_OFFSET_SCALE", (cmd
& 0xffff) + 2);
773 return debug(stream
, "3DSTATE_DEFAULT_Z", (cmd
& 0xffff) + 2);
775 return debug(stream
, "3DSTATE_DEFAULT_DIFFUSE", (cmd
& 0xffff) + 2);
777 return debug(stream
, "3DSTATE_DEFAULT_SPECULAR", (cmd
& 0xffff) + 2);
779 return debug(stream
, "3DSTATE_CLEAR_PARAMETERS", (cmd
& 0xffff) + 2);
787 return debug(stream
, "???", (cmd
& 0xffff) + 1);
789 return debug(stream
, "", 1);
792 if ((cmd
& (1 << 23)) == 0)
793 return debug_prim(stream
, "3DPRIM (inline)", 1, (cmd
& 0x1ffff) + 2);
794 else if (cmd
& (1 << 17))
796 if ((cmd
& 0xffff) == 0)
797 return debug_variable_length_prim(stream
);
799 return debug_prim(stream
, "3DPRIM (indexed)", 0, (((cmd
& 0xffff) + 1) / 2) + 1);
802 return debug_prim(stream
, "3DPRIM (indirect sequential)", 0, 2);
805 return debug(stream
, "", 0);
820 i915_dump_batchbuffer( GLuint
*start
,
823 struct debug_stream stream
;
824 GLuint bytes
= (end
- start
) * 4;
825 GLboolean done
= GL_FALSE
;
827 printf("\n\nBATCH: (%d)\n", bytes
/ 4);
830 stream
.ptr
= (char *)start
;
831 stream
.print_addresses
= 0;
834 stream
.offset
< bytes
&&
837 if (!i915_debug_packet( &stream
))
840 assert(stream
.offset
<= bytes
&&
844 printf("END-BATCH\n\n\n");