Lines Matching refs:stream

71    struct debug_stream  *stream,
83 static boolean debug( struct debug_stream *stream, const char *name, unsigned len )
86 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
89 PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]);
94 if (stream->print_addresses)
95 PRINTF(stream, "%08x: ", stream->offset);
98 PRINTF(stream, "%s (%d dwords):\n", name, len);
100 PRINTF(stream, "\t0x%08x\n", ptr[i]);
101 PRINTF(stream, "\n");
103 stream->offset += len * sizeof(unsigned);
128 static boolean debug_prim( struct debug_stream *stream, const char *name,
132 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
138 PRINTF(stream, "%s %s (%d dwords):\n", name, prim, len);
139 PRINTF(stream, "\t0x%08x\n", ptr[0]);
142 PRINTF(stream, "\t0x%08x // %f\n", ptr[i], *(float *)&ptr[i]);
144 PRINTF(stream, "\t0x%08x\n", ptr[i]);
148 PRINTF(stream, "\n");
150 stream->offset += len * sizeof(unsigned);
158 static boolean debug_program( struct debug_stream *stream, const char *name, unsigned len )
160 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
163 PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]);
168 if (stream->print_addresses)
169 PRINTF(stream, "%08x: ", stream->offset);
171 PRINTF(stream, "%s (%d dwords):\n", name, len);
172 i915_disassemble_program( stream, ptr, len );
174 stream->offset += len * sizeof(unsigned);
179 static boolean debug_chain( struct debug_stream *stream, const char *name, unsigned len )
181 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
182 unsigned old_offset = stream->offset + len * sizeof(unsigned);
185 PRINTF(stream, "%s (%d dwords):\n", name, len);
187 PRINTF(stream, "\t0x%08x\n", ptr[i]);
189 stream->offset = ptr[1] & ~0x3;
191 if (stream->offset < old_offset)
192 PRINTF(stream, "\n... skipping backwards from 0x%x --> 0x%x ...\n\n",
193 old_offset, stream->offset );
195 PRINTF(stream, "\n... skipping from 0x%x --> 0x%x ...\n\n",
196 old_offset, stream->offset );
203 static boolean debug_variable_length_prim( struct debug_stream *stream )
205 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
215 PRINTF(stream, "3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len);
217 PRINTF(stream, "\t0x%08x\n", ptr[i]);
218 PRINTF(stream, "\n");
220 stream->offset += len * sizeof(unsigned);
227 struct debug_stream *stream,
237 PRINTF(stream, "\t\t ");
243 PRINTF(stream, ": 0x%x\n", ((dw) & himask) >> (lo));
261 struct debug_stream *stream,
270 PRINTF(stream, "\t\t ");
276 PRINTF(stream, "\n");
280 static boolean debug_load_immediate( struct debug_stream *stream,
284 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
288 PRINTF(stream, "%s (%d dwords, flags: %x):\n", name, len, bits);
289 PRINTF(stream, "\t0x%08x\n", ptr[j++]);
292 PRINTF(stream, "\t LIS0: 0x%08x\n", ptr[j]);
293 PRINTF(stream, "\t vb address: 0x%08x\n", (ptr[j] & ~0x3));
294 BITS(stream, ptr[j], 0, 0, "vb invalidate disable");
298 PRINTF(stream, "\t LIS1: 0x%08x\n", ptr[j]);
299 BITS(stream, ptr[j], 29, 24, "vb dword width");
300 BITS(stream, ptr[j], 21, 16, "vb dword pitch");
301 BITS(stream, ptr[j], 15, 0, "vb max index");
306 PRINTF(stream, "\t LIS2: 0x%08x\n", ptr[j]);
310 BITS(stream, tc, 3, 0, "tex coord %d", i);
315 PRINTF(stream, "\t LIS3: 0x%08x\n", ptr[j]);
319 PRINTF(stream, "\t LIS4: 0x%08x\n", ptr[j]);
320 BITS(stream, ptr[j], 31, 23, "point width");
321 BITS(stream, ptr[j], 22, 19, "line width");
322 FLAG(stream, ptr[j], 18, "alpha flatshade");
323 FLAG(stream, ptr[j], 17, "fog flatshade");
324 FLAG(stream, ptr[j], 16, "spec flatshade");
325 FLAG(stream, ptr[j], 15, "rgb flatshade");
326 BITS(stream, ptr[j], 14, 13, "cull mode");
327 FLAG(stream, ptr[j], 12, "vfmt: point width");
328 FLAG(stream, ptr[j], 11, "vfmt: specular/fog");
329 FLAG(stream, ptr[j], 10, "vfmt: rgba");
330 FLAG(stream, ptr[j], 9, "vfmt: depth offset");
331 BITS(stream, ptr[j], 8, 6, "vfmt: position (2==xyzw)");
332 FLAG(stream, ptr[j], 5, "force dflt diffuse");
333 FLAG(stream, ptr[j], 4, "force dflt specular");
334 FLAG(stream, ptr[j], 3, "local depth offset enable");
335 FLAG(stream, ptr[j], 2, "vfmt: fp32 fog coord");
336 FLAG(stream, ptr[j], 1, "sprite point");
337 FLAG(stream, ptr[j], 0, "antialiasing");
341 PRINTF(stream, "\t LIS5: 0x%08x\n", ptr[j]);
342 BITS(stream, ptr[j], 31, 28, "rgba write disables");
343 FLAG(stream, ptr[j], 27, "force dflt point width");
344 FLAG(stream, ptr[j], 26, "last pixel enable");
345 FLAG(stream, ptr[j], 25, "global z offset enable");
346 FLAG(stream, ptr[j], 24, "fog enable");
347 BITS(stream, ptr[j], 23, 16, "stencil ref");
348 BITS(stream, ptr[j], 15, 13, "stencil test");
349 BITS(stream, ptr[j], 12, 10, "stencil fail op");
350 BITS(stream, ptr[j], 9, 7, "stencil pass z fail op");
351 BITS(stream, ptr[j], 6, 4, "stencil pass z pass op");
352 FLAG(stream, ptr[j], 3, "stencil write enable");
353 FLAG(stream, ptr[j], 2, "stencil test enable");
354 FLAG(stream, ptr[j], 1, "color dither enable");
355 FLAG(stream, ptr[j], 0, "logiop enable");
359 PRINTF(stream, "\t LIS6: 0x%08x\n", ptr[j]);
360 FLAG(stream, ptr[j], 31, "alpha test enable");
361 BITS(stream, ptr[j], 30, 28, "alpha func");
362 BITS(stream, ptr[j], 27, 20, "alpha ref");
363 FLAG(stream, ptr[j], 19, "depth test enable");
364 BITS(stream, ptr[j], 18, 16, "depth func");
365 FLAG(stream, ptr[j], 15, "blend enable");
366 BITS(stream, ptr[j], 14, 12, "blend func");
367 BITS(stream, ptr[j], 11, 8, "blend src factor");
368 BITS(stream, ptr[j], 7, 4, "blend dst factor");
369 FLAG(stream, ptr[j], 3, "depth write enable");
370 FLAG(stream, ptr[j], 2, "color write enable");
371 BITS(stream, ptr[j], 1, 0, "provoking vertex");
376 PRINTF(stream, "\n");
380 stream->offset += len * sizeof(unsigned);
387 static boolean debug_load_indirect( struct debug_stream *stream,
391 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
395 PRINTF(stream, "%s (%d dwords):\n", name, len);
396 PRINTF(stream, "\t0x%08x\n", ptr[j++]);
402 PRINTF(stream, " STATIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
403 PRINTF(stream, " 0x%08x\n", ptr[j++]);
406 PRINTF(stream, " DYNAMIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
409 PRINTF(stream, " SAMPLER: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
410 PRINTF(stream, " 0x%08x\n", ptr[j++]);
413 PRINTF(stream, " MAP: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
414 PRINTF(stream, " 0x%08x\n", ptr[j++]);
417 PRINTF(stream, " PROGRAM: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
418 PRINTF(stream, " 0x%08x\n", ptr[j++]);
421 PRINTF(stream, " CONSTANTS: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
422 PRINTF(stream, " 0x%08x\n", ptr[j++]);
432 PRINTF(stream, "\t DUMMY: 0x%08x\n", ptr[j++]);
435 PRINTF(stream, "\n");
440 stream->offset += len * sizeof(unsigned);
445 static void BR13( struct debug_stream *stream,
448 PRINTF(stream, "\t0x%08x\n", val);
449 FLAG(stream, val, 30, "clipping enable");
450 BITS(stream, val, 25, 24, "color depth (3==32bpp)");
451 BITS(stream, val, 23, 16, "raster op");
452 BITS(stream, val, 15, 0, "dest pitch");
456 static void BR22( struct debug_stream *stream,
459 PRINTF(stream, "\t0x%08x\n", val);
460 BITS(stream, val, 31, 16, "dest y1");
461 BITS(stream, val, 15, 0, "dest x1");
464 static void BR23( struct debug_stream *stream,
467 PRINTF(stream, "\t0x%08x\n", val);
468 BITS(stream, val, 31, 16, "dest y2");
469 BITS(stream, val, 15, 0, "dest x2");
472 static void BR09( struct debug_stream *stream,
475 PRINTF(stream, "\t0x%08x -- dest address\n", val);
478 static void BR26( struct debug_stream *stream,
481 PRINTF(stream, "\t0x%08x\n", val);
482 BITS(stream, val, 31, 16, "src y1");
483 BITS(stream, val, 15, 0, "src x1");
486 static void BR11( struct debug_stream *stream,
489 PRINTF(stream, "\t0x%08x\n", val);
490 BITS(stream, val, 15, 0, "src pitch");
493 static void BR12( struct debug_stream *stream,
496 PRINTF(stream, "\t0x%08x -- src address\n", val);
499 static void BR16( struct debug_stream *stream,
502 PRINTF(stream, "\t0x%08x -- color\n", val);
505 static boolean debug_copy_blit( struct debug_stream *stream,
509 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
512 PRINTF(stream, "%s (%d dwords):\n", name, len);
513 PRINTF(stream, "\t0x%08x\n", ptr[j++]);
515 BR13(stream, ptr[j++]);
516 BR22(stream, ptr[j++]);
517 BR23(stream, ptr[j++]);
518 BR09(stream, ptr[j++]);
519 BR26(stream, ptr[j++]);
520 BR11(stream, ptr[j++]);
521 BR12(stream, ptr[j++]);
523 stream->offset += len * sizeof(unsigned);
528 static boolean debug_color_blit( struct debug_stream *stream,
532 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
535 PRINTF(stream, "%s (%d dwords):\n", name, len);
536 PRINTF(stream, "\t0x%08x\n", ptr[j++]);
538 BR13(stream, ptr[j++]);
539 BR22(stream, ptr[j++]);
540 BR23(stream, ptr[j++]);
541 BR09(stream, ptr[j++]);
542 BR16(stream, ptr[j++]);
544 stream->offset += len * sizeof(unsigned);
549 static boolean debug_modes4( struct debug_stream *stream,
553 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
556 PRINTF(stream, "%s (%d dwords):\n", name, len);
557 PRINTF(stream, "\t0x%08x\n", ptr[j]);
558 BITS(stream, ptr[j], 21, 18, "logicop func");
559 FLAG(stream, ptr[j], 17, "stencil test mask modify-enable");
560 FLAG(stream, ptr[j], 16, "stencil write mask modify-enable");
561 BITS(stream, ptr[j], 15, 8, "stencil test mask");
562 BITS(stream, ptr[j], 7, 0, "stencil write mask");
565 stream->offset += len * sizeof(unsigned);
570 static boolean debug_map_state( struct debug_stream *stream,
574 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
577 PRINTF(stream, "%s (%d dwords):\n", name, len);
578 PRINTF(stream, "\t0x%08x\n", ptr[j++]);
581 PRINTF(stream, "\t0x%08x\n", ptr[j]);
582 BITS(stream, ptr[j], 15, 0, "map mask");
588 PRINTF(stream, "\t TMn.0: 0x%08x\n", ptr[j]);
589 PRINTF(stream, "\t map address: 0x%08x\n", (ptr[j] & ~0x3));
590 FLAG(stream, ptr[j], 1, "vertical line stride");
591 FLAG(stream, ptr[j], 0, "vertical line stride offset");
596 PRINTF(stream, "\t TMn.1: 0x%08x\n", ptr[j]);
597 BITS(stream, ptr[j], 31, 21, "height");
598 BITS(stream, ptr[j], 20, 10, "width");
599 BITS(stream, ptr[j], 9, 7, "surface format");
600 BITS(stream, ptr[j], 6, 3, "texel format");
601 FLAG(stream, ptr[j], 2, "use fence regs");
602 FLAG(stream, ptr[j], 1, "tiled surface");
603 FLAG(stream, ptr[j], 0, "tile walk ymajor");
607 PRINTF(stream, "\t TMn.2: 0x%08x\n", ptr[j]);
608 BITS(stream, ptr[j], 31, 21, "dword pitch");
609 BITS(stream, ptr[j], 20, 15, "cube face enables");
610 BITS(stream, ptr[j], 14, 9, "max lod");
611 FLAG(stream, ptr[j], 8, "mip layout right");
612 BITS(stream, ptr[j], 7, 0, "depth");
617 stream->offset += len * sizeof(unsigned);
622 static boolean debug_sampler_state( struct debug_stream *stream,
626 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
629 PRINTF(stream, "%s (%d dwords):\n", name, len);
630 PRINTF(stream, "\t0x%08x\n", ptr[j++]);
633 PRINTF(stream, "\t0x%08x\n", ptr[j]);
634 BITS(stream, ptr[j], 15, 0, "sampler mask");
640 PRINTF(stream, "\t TSn.0: 0x%08x\n", ptr[j]);
641 FLAG(stream, ptr[j], 31, "reverse gamma");
642 FLAG(stream, ptr[j], 30, "planar to packed");
643 FLAG(stream, ptr[j], 29, "yuv->rgb");
644 BITS(stream, ptr[j], 28, 27, "chromakey index");
645 BITS(stream, ptr[j], 26, 22, "base mip level");
646 BITS(stream, ptr[j], 21, 20, "mip mode filter");
647 BITS(stream, ptr[j], 19, 17, "mag mode filter");
648 BITS(stream, ptr[j], 16, 14, "min mode filter");
649 BITS(stream, ptr[j], 13, 5, "lod bias (s4.4)");
650 FLAG(stream, ptr[j], 4, "shadow enable");
651 FLAG(stream, ptr[j], 3, "max-aniso-4");
652 BITS(stream, ptr[j], 2, 0, "shadow func");
657 PRINTF(stream, "\t TSn.1: 0x%08x\n", ptr[j]);
658 BITS(stream, ptr[j], 31, 24, "min lod");
660 FLAG(stream, ptr[j], 17, "kill pixel enable");
661 FLAG(stream, ptr[j], 16, "keyed tex filter mode");
662 FLAG(stream, ptr[j], 15, "chromakey enable");
663 BITS(stream, ptr[j], 14, 12, "tcx wrap mode");
664 BITS(stream, ptr[j], 11, 9, "tcy wrap mode");
665 BITS(stream, ptr[j], 8, 6, "tcz wrap mode");
666 FLAG(stream, ptr[j], 5, "normalized coords");
667 BITS(stream, ptr[j], 4, 1, "map (surface) index");
668 FLAG(stream, ptr[j], 0, "EAST deinterlacer enable");
672 PRINTF(stream, "\t TSn.2: 0x%08x (default color)\n", ptr[j]);
677 stream->offset += len * sizeof(unsigned);
682 static boolean debug_dest_vars( struct debug_stream *stream,
686 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
689 PRINTF(stream, "%s (%d dwords):\n", name, len);
690 PRINTF(stream, "\t0x%08x\n", ptr[j++]);
693 PRINTF(stream, "\t0x%08x\n", ptr[j]);
694 FLAG(stream, ptr[j], 31, "early classic ztest");
695 FLAG(stream, ptr[j], 30, "opengl tex default color");
696 FLAG(stream, ptr[j], 29, "bypass iz");
697 FLAG(stream, ptr[j], 28, "lod preclamp");
698 BITS(stream, ptr[j], 27, 26, "dither pattern");
699 FLAG(stream, ptr[j], 25, "linear gamma blend");
700 FLAG(stream, ptr[j], 24, "debug dither");
701 BITS(stream, ptr[j], 23, 20, "dstorg x");
702 BITS(stream, ptr[j], 19, 16, "dstorg y");
704 BITS(stream, ptr[j], 14, 12, "422 write select");
705 BITS(stream, ptr[j], 11, 8, "cbuf format");
706 BITS(stream, ptr[j], 3, 2, "zbuf format");
707 FLAG(stream, ptr[j], 1, "vert line stride");
708 FLAG(stream, ptr[j], 1, "vert line stride offset");
712 stream->offset += len * sizeof(unsigned);
717 static boolean debug_buf_info( struct debug_stream *stream,
721 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
724 PRINTF(stream, "%s (%d dwords):\n", name, len);
725 PRINTF(stream, "\t0x%08x\n", ptr[j++]);
728 PRINTF(stream, "\t0x%08x\n", ptr[j]);
729 BITS(stream, ptr[j], 28, 28, "aux buffer id");
730 BITS(stream, ptr[j], 27, 24, "buffer id (7=depth, 3=back)");
731 FLAG(stream, ptr[j], 23, "use fence regs");
732 FLAG(stream, ptr[j], 22, "tiled surface");
733 FLAG(stream, ptr[j], 21, "tile walk ymajor");
735 BITS(stream, ptr[j], 13, 2, "dword pitch");
740 PRINTF(stream, "\t0x%08x -- buffer base address\n", ptr[j++]);
742 stream->offset += len * sizeof(unsigned);
747 static boolean i915_debug_packet( struct debug_stream *stream )
749 unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
756 return debug(stream, "MI_NOOP", 1);
758 return debug(stream, "MI_WAIT_FOR_EVENT", 1);
760 return debug(stream, "MI_FLUSH", 1);
762 debug(stream, "MI_BATCH_BUFFER_END", 1);
765 return debug(stream, "MI_LOAD_REGISTER_IMM", 3);
767 return debug_chain(stream, "MI_BATCH_BUFFER_START", 2);
769 (void)debug(stream, "UNKNOWN 0x0 case!", 1);
775 (void) debug(stream, "UNKNOWN 0x1 case!", 1);
781 return debug_color_blit(stream, "XY_COLOR_BLT", (cmd & 0xff) + 2);
783 return debug_copy_blit(stream, "XY_SRC_COPY_BLT", (cmd & 0xff) + 2);
785 return debug(stream, "blit command", (cmd & 0xff) + 2);
791 return debug(stream, "3DSTATE_ANTI_ALIASING", 1);
793 return debug(stream, "3DSTATE_RASTERIZATION_RULES", 1);
795 return debug(stream, "3DSTATE_BACKFACE_STENCIL_OPS", 2);
797 return debug(stream, "3DSTATE_BACKFACE_STENCIL_MASKS", 1);
799 return debug(stream, "3DSTATE_INDEPENDENT_ALPHA_BLEND", 1);
801 return debug(stream, "3DSTATE_MODES5", 1);
803 return debug_modes4(stream, "3DSTATE_MODES4", 1);
805 return debug(stream, "3DSTATE_FOG_COLOR", 1);
807 return debug(stream, "3DSTATE_COORD_SET_BINDINGS", 1);
812 return debug(stream, "3DSTATE_SCISSOR_ENABLE", 1);
814 return debug(stream, "3DSTATE_DEPTH_SUBRECTANGLE_DISABLE", 1);
816 (void) debug(stream, "UNKNOWN 0x1c case!", 1);
825 return debug_map_state(stream, "3DSTATE_MAP_STATE", (cmd & 0x1f) + 2);
827 return debug_sampler_state(stream, "3DSTATE_SAMPLER_STATE", (cmd & 0x1f) + 2);
829 return debug_load_immediate(stream, "3DSTATE_LOAD_STATE_IMMEDIATE", (cmd & 0xf) + 2);
831 return debug_program(stream, "3DSTATE_PIXEL_SHADER_PROGRAM", (cmd & 0x1ff) + 2);
833 return debug(stream, "3DSTATE_PIXEL_SHADER_CONSTANTS", (cmd & 0xff) + 2);
835 return debug_load_indirect(stream, "3DSTATE_LOAD_INDIRECT", (cmd & 0xff) + 2);
837 return debug(stream, "3DSTATE_DRAWING_RECTANGLE", (cmd & 0xffff) + 2);
839 return debug(stream, "3DSTATE_SCISSOR_RECTANGLE", (cmd & 0xffff) + 2);
841 return debug(stream, "3DSTATE_SPAN_STIPPLE", (cmd & 0xffff) + 2);
843 return debug_dest_vars(stream, "3DSTATE_DEST_BUFFER_VARS", (cmd & 0xffff) + 2);
845 return debug(stream, "3DSTATE_CONSTANT_BLEND_COLOR", (cmd & 0xffff) + 2);
847 return debug(stream, "3DSTATE_FOG_MODE", (cmd & 0xffff) + 2);
849 return debug_buf_info(stream, "3DSTATE_BUFFER_INFO", (cmd & 0xffff) + 2);
851 return debug(stream, "3DSTATE_DEPTH_OFFSET_SCALE", (cmd & 0xffff) + 2);
853 return debug(stream, "3DSTATE_DEFAULT_Z", (cmd & 0xffff) + 2);
855 return debug(stream, "3DSTATE_DEFAULT_DIFFUSE", (cmd & 0xffff) + 2);
857 return debug(stream, "3DSTATE_DEFAULT_SPECULAR", (cmd & 0xffff) + 2);
859 return debug(stream, "3DSTATE_CLEAR_PARAMETERS", (cmd & 0xffff) + 2);
867 return debug(stream, "???", (cmd & 0xffff) + 1);
869 return debug(stream, "", 1);
873 return debug_prim(stream, "3DPRIM (inline)", 1, (cmd & 0x1ffff) + 2);
877 return debug_variable_length_prim(stream);
879 return debug_prim(stream, "3DPRIM (indexed)", 0, (((cmd & 0xffff) + 1) / 2) + 1);
882 return debug_prim(stream, "3DPRIM (indirect sequential)", 0, 2);
885 return debug(stream, "", 0);
902 struct debug_stream stream;
908 stream.offset = 0;
909 stream.ptr = (char *)start;
910 stream.print_addresses = 0;
920 stream.offset < bytes)
922 if (!i915_debug_packet( &stream ))
925 assert(stream.offset <= bytes &&
926 stream.offset >= 0);