i915_debug.c File Reference

Include dependency graph for i915_debug.c:

Go to the source code of this file.

Defines

#define MBZ(dw, hi, lo)

Functions

static void PRINTF (struct debug_stream *stream, const char *fmt,...)
static boolean debug (struct debug_stream *stream, const char *name, unsigned len)
static const char * get_prim_name (unsigned val)
static boolean debug_prim (struct debug_stream *stream, const char *name, boolean dump_floats, unsigned len)
static boolean debug_program (struct debug_stream *stream, const char *name, unsigned len)
static boolean debug_chain (struct debug_stream *stream, const char *name, unsigned len)
static boolean debug_variable_length_prim (struct debug_stream *stream)
static void BITS (struct debug_stream *stream, unsigned dw, unsigned hi, unsigned lo, const char *fmt,...)
static void FLAG (struct debug_stream *stream, unsigned dw, unsigned bit, const char *fmt,...)
static boolean debug_load_immediate (struct debug_stream *stream, const char *name, unsigned len)
static boolean debug_load_indirect (struct debug_stream *stream, const char *name, unsigned len)
static void BR13 (struct debug_stream *stream, unsigned val)
static void BR22 (struct debug_stream *stream, unsigned val)
static void BR23 (struct debug_stream *stream, unsigned val)
static void BR09 (struct debug_stream *stream, unsigned val)
static void BR26 (struct debug_stream *stream, unsigned val)
static void BR11 (struct debug_stream *stream, unsigned val)
static void BR12 (struct debug_stream *stream, unsigned val)
static void BR16 (struct debug_stream *stream, unsigned val)
static boolean debug_copy_blit (struct debug_stream *stream, const char *name, unsigned len)
static boolean debug_color_blit (struct debug_stream *stream, const char *name, unsigned len)
static boolean debug_modes4 (struct debug_stream *stream, const char *name, unsigned len)
static boolean debug_map_state (struct debug_stream *stream, const char *name, unsigned len)
static boolean debug_sampler_state (struct debug_stream *stream, const char *name, unsigned len)
static boolean debug_dest_vars (struct debug_stream *stream, const char *name, unsigned len)
static boolean debug_buf_info (struct debug_stream *stream, const char *name, unsigned len)
static boolean i915_debug_packet (struct debug_stream *stream)
void i915_dump_batchbuffer (struct i915_context *i915)


Define Documentation

#define MBZ ( dw,
hi,
lo   ) 

Value:

do {                                                    \
   unsigned x = (dw) >> (lo);                           \
   unsigned lomask = (1 << (lo)) - 1;                   \
   unsigned himask;                                     \
   himask = (1UL << (hi)) - 1;                          \
   assert ((x & himask & ~lomask) == 0);        \
} while (0)

Definition at line 213 of file i915_debug.c.


Function Documentation

static void BITS ( struct debug_stream stream,
unsigned  dw,
unsigned  hi,
unsigned  lo,
const char *  fmt,
  ... 
) [static]

Definition at line 193 of file i915_debug.c.

References args, debug_vprintf, and PRINTF().

00200 {
00201    va_list  args;
00202    unsigned himask = ~0UL >> (31 - (hi));
00203 
00204    PRINTF(stream, "\t\t ");
00205 
00206    va_start( args, fmt );
00207    debug_vprintf( fmt, args );
00208    va_end( args );
00209 
00210    PRINTF(stream, ": 0x%x\n", ((dw) & himask) >> (lo));
00211 }

static void BR09 ( struct debug_stream stream,
unsigned  val 
) [static]

Definition at line 434 of file i915_debug.c.

References PRINTF().

00436 {
00437    PRINTF(stream, "\t0x%08x -- dest address\n",  val);
00438 }

static void BR11 ( struct debug_stream stream,
unsigned  val 
) [static]

Definition at line 448 of file i915_debug.c.

References BITS(), and PRINTF().

00450 {
00451    PRINTF(stream, "\t0x%08x\n",  val);
00452    BITS(stream, val, 15, 0,  "src pitch");
00453 }

static void BR12 ( struct debug_stream stream,
unsigned  val 
) [static]

Definition at line 455 of file i915_debug.c.

References PRINTF().

00457 {
00458    PRINTF(stream, "\t0x%08x -- src address\n",  val);
00459 }

static void BR13 ( struct debug_stream stream,
unsigned  val 
) [static]

Definition at line 407 of file i915_debug.c.

References BITS(), FLAG(), and PRINTF().

00409 {
00410    PRINTF(stream, "\t0x%08x\n",  val);
00411    FLAG(stream, val, 30, "clipping enable");
00412    BITS(stream, val, 25, 24, "color depth (3==32bpp)");
00413    BITS(stream, val, 23, 16, "raster op");
00414    BITS(stream, val, 15, 0,  "dest pitch");
00415 }

static void BR16 ( struct debug_stream stream,
unsigned  val 
) [static]

Definition at line 461 of file i915_debug.c.

References PRINTF().

00463 {
00464    PRINTF(stream, "\t0x%08x -- color\n",  val);
00465 }

static void BR22 ( struct debug_stream stream,
unsigned  val 
) [static]

Definition at line 418 of file i915_debug.c.

References BITS(), and PRINTF().

00420 {
00421    PRINTF(stream, "\t0x%08x\n",  val);
00422    BITS(stream, val, 31, 16, "dest y1");
00423    BITS(stream, val, 15, 0,  "dest x1");
00424 }

static void BR23 ( struct debug_stream stream,
unsigned  val 
) [static]

Definition at line 426 of file i915_debug.c.

References BITS(), and PRINTF().

00428 {
00429    PRINTF(stream, "\t0x%08x\n",  val);
00430    BITS(stream, val, 31, 16, "dest y2");
00431    BITS(stream, val, 15, 0,  "dest x2");
00432 }

static void BR26 ( struct debug_stream stream,
unsigned  val 
) [static]

Definition at line 440 of file i915_debug.c.

References BITS(), and PRINTF().

00442 {
00443    PRINTF(stream, "\t0x%08x\n",  val);
00444    BITS(stream, val, 31, 16, "src y1");
00445    BITS(stream, val, 15, 0,  "src x1");
00446 }

static boolean debug ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 50 of file i915_debug.c.

References assert, FALSE, debug_stream::offset, debug_stream::print_addresses, PRINTF(), debug_stream::ptr, and TRUE.

00051 {
00052    unsigned i;
00053    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00054    
00055    if (len == 0) {
00056       PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]);
00057       assert(0);
00058       return FALSE;
00059    }
00060 
00061    if (stream->print_addresses)
00062       PRINTF(stream, "%08x:  ", stream->offset);
00063 
00064 
00065    PRINTF(stream, "%s (%d dwords):\n", name, len);
00066    for (i = 0; i < len; i++)
00067       PRINTF(stream, "\t0x%08x\n",  ptr[i]);   
00068    PRINTF(stream, "\n");
00069 
00070    stream->offset += len * sizeof(unsigned);
00071    
00072    return TRUE;
00073 }

static boolean debug_buf_info ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 679 of file i915_debug.c.

References assert, BITS(), FLAG(), MBZ, debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00682 {
00683    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00684    int j = 0;
00685 
00686    PRINTF(stream, "%s (%d dwords):\n", name, len);
00687    PRINTF(stream, "\t0x%08x\n",  ptr[j++]);
00688 
00689    {
00690       PRINTF(stream, "\t0x%08x\n",  ptr[j]);
00691       BITS(stream, ptr[j], 28, 28, "aux buffer id");
00692       BITS(stream, ptr[j], 27, 24, "buffer id (7=depth, 3=back)");
00693       FLAG(stream, ptr[j], 23,     "use fence regs");
00694       FLAG(stream, ptr[j], 22,     "tiled surface");
00695       FLAG(stream, ptr[j], 21,     "tile walk ymajor");
00696       MBZ (ptr[j], 20, 14);
00697       BITS(stream, ptr[j], 13, 2,  "dword pitch");
00698       MBZ (ptr[j], 2,  0);
00699       j++;
00700    }
00701    
00702    PRINTF(stream, "\t0x%08x -- buffer base address\n",  ptr[j++]);
00703 
00704    stream->offset += len * sizeof(unsigned);
00705    assert(j == len);
00706    return TRUE;
00707 }

static boolean debug_chain ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 146 of file i915_debug.c.

References debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00147 {
00148    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00149    unsigned old_offset = stream->offset + len * sizeof(unsigned);
00150    unsigned i;
00151 
00152    PRINTF(stream, "%s (%d dwords):\n", name, len);
00153    for (i = 0; i < len; i++)
00154       PRINTF(stream, "\t0x%08x\n",  ptr[i]);
00155 
00156    stream->offset = ptr[1] & ~0x3;
00157    
00158    if (stream->offset < old_offset)
00159       PRINTF(stream, "\n... skipping backwards from 0x%x --> 0x%x ...\n\n", 
00160                    old_offset, stream->offset );
00161    else
00162       PRINTF(stream, "\n... skipping from 0x%x --> 0x%x ...\n\n", 
00163                    old_offset, stream->offset );
00164 
00165 
00166    return TRUE;
00167 }

static boolean debug_color_blit ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 490 of file i915_debug.c.

References assert, BR09(), BR13(), BR16(), BR22(), BR23(), debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00493 {
00494    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00495    int j = 0;
00496 
00497    PRINTF(stream, "%s (%d dwords):\n", name, len);
00498    PRINTF(stream, "\t0x%08x\n",  ptr[j++]);
00499 
00500    BR13(stream, ptr[j++]);
00501    BR22(stream, ptr[j++]);
00502    BR23(stream, ptr[j++]);
00503    BR09(stream, ptr[j++]);
00504    BR16(stream, ptr[j++]);
00505 
00506    stream->offset += len * sizeof(unsigned);
00507    assert(j == len);
00508    return TRUE;
00509 }

static boolean debug_copy_blit ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 467 of file i915_debug.c.

References assert, BR09(), BR11(), BR12(), BR13(), BR22(), BR23(), BR26(), debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00470 {
00471    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00472    int j = 0;
00473 
00474    PRINTF(stream, "%s (%d dwords):\n", name, len);
00475    PRINTF(stream, "\t0x%08x\n",  ptr[j++]);
00476    
00477    BR13(stream, ptr[j++]);
00478    BR22(stream, ptr[j++]);
00479    BR23(stream, ptr[j++]);
00480    BR09(stream, ptr[j++]);
00481    BR26(stream, ptr[j++]);
00482    BR11(stream, ptr[j++]);
00483    BR12(stream, ptr[j++]);
00484 
00485    stream->offset += len * sizeof(unsigned);
00486    assert(j == len);
00487    return TRUE;
00488 }

static boolean debug_dest_vars ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 644 of file i915_debug.c.

References assert, BITS(), FLAG(), MBZ, debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00647 {
00648    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00649    int j = 0;
00650 
00651    PRINTF(stream, "%s (%d dwords):\n", name, len);
00652    PRINTF(stream, "\t0x%08x\n",  ptr[j++]);
00653 
00654    {
00655       PRINTF(stream, "\t0x%08x\n",  ptr[j]);
00656       FLAG(stream, ptr[j], 31,     "early classic ztest");
00657       FLAG(stream, ptr[j], 30,     "opengl tex default color");
00658       FLAG(stream, ptr[j], 29,     "bypass iz");
00659       FLAG(stream, ptr[j], 28,     "lod preclamp");
00660       BITS(stream, ptr[j], 27, 26, "dither pattern");
00661       FLAG(stream, ptr[j], 25,     "linear gamma blend");
00662       FLAG(stream, ptr[j], 24,     "debug dither");
00663       BITS(stream, ptr[j], 23, 20, "dstorg x");
00664       BITS(stream, ptr[j], 19, 16, "dstorg y");
00665       MBZ (ptr[j], 15, 15 );
00666       BITS(stream, ptr[j], 14, 12, "422 write select");
00667       BITS(stream, ptr[j], 11, 8,  "cbuf format");
00668       BITS(stream, ptr[j], 3, 2,   "zbuf format");
00669       FLAG(stream, ptr[j], 1,      "vert line stride");
00670       FLAG(stream, ptr[j], 1,      "vert line stride offset");
00671       j++;
00672    }
00673    
00674    stream->offset += len * sizeof(unsigned);
00675    assert(j == len);
00676    return TRUE;
00677 }

static boolean debug_load_immediate ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 242 of file i915_debug.c.

References assert, BITS(), FLAG(), debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00245 {
00246    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00247    unsigned bits = (ptr[0] >> 4) & 0xff;
00248    unsigned j = 0;
00249    
00250    PRINTF(stream, "%s (%d dwords, flags: %x):\n", name, len, bits);
00251    PRINTF(stream, "\t0x%08x\n",  ptr[j++]);
00252 
00253    if (bits & (1<<0)) {
00254       PRINTF(stream, "\t  LIS0: 0x%08x\n", ptr[j]);
00255       PRINTF(stream, "\t vb address: 0x%08x\n", (ptr[j] & ~0x3));
00256       BITS(stream, ptr[j], 0, 0, "vb invalidate disable");
00257       j++;
00258    }
00259    if (bits & (1<<1)) {
00260       PRINTF(stream, "\t  LIS1: 0x%08x\n", ptr[j]);
00261       BITS(stream, ptr[j], 29, 24, "vb dword width");
00262       BITS(stream, ptr[j], 21, 16, "vb dword pitch");
00263       BITS(stream, ptr[j], 15, 0, "vb max index");
00264       j++;
00265    }
00266    if (bits & (1<<2)) {
00267       int i;
00268       PRINTF(stream, "\t  LIS2: 0x%08x\n", ptr[j]);
00269       for (i = 0; i < 8; i++) {
00270          unsigned tc = (ptr[j] >> (i * 4)) & 0xf;
00271          if (tc != 0xf)
00272             BITS(stream, tc, 3, 0, "tex coord %d", i);
00273       }
00274       j++;
00275    }
00276    if (bits & (1<<3)) {
00277       PRINTF(stream, "\t  LIS3: 0x%08x\n", ptr[j]);
00278       j++;
00279    }
00280    if (bits & (1<<4)) {
00281       PRINTF(stream, "\t  LIS4: 0x%08x\n", ptr[j]);
00282       BITS(stream, ptr[j], 31, 23, "point width");
00283       BITS(stream, ptr[j], 22, 19, "line width");
00284       FLAG(stream, ptr[j], 18, "alpha flatshade");
00285       FLAG(stream, ptr[j], 17, "fog flatshade");
00286       FLAG(stream, ptr[j], 16, "spec flatshade");
00287       FLAG(stream, ptr[j], 15, "rgb flatshade");
00288       BITS(stream, ptr[j], 14, 13, "cull mode");
00289       FLAG(stream, ptr[j], 12, "vfmt: point width");
00290       FLAG(stream, ptr[j], 11, "vfmt: specular/fog");
00291       FLAG(stream, ptr[j], 10, "vfmt: rgba");
00292       FLAG(stream, ptr[j], 9, "vfmt: depth offset");
00293       BITS(stream, ptr[j], 8, 6, "vfmt: position (2==xyzw)");
00294       FLAG(stream, ptr[j], 5, "force dflt diffuse");
00295       FLAG(stream, ptr[j], 4, "force dflt specular");
00296       FLAG(stream, ptr[j], 3, "local depth offset enable");
00297       FLAG(stream, ptr[j], 2, "vfmt: fp32 fog coord");
00298       FLAG(stream, ptr[j], 1, "sprite point");
00299       FLAG(stream, ptr[j], 0, "antialiasing");
00300       j++;
00301    }
00302    if (bits & (1<<5)) {
00303       PRINTF(stream, "\t  LIS5: 0x%08x\n", ptr[j]);
00304       BITS(stream, ptr[j], 31, 28, "rgba write disables");
00305       FLAG(stream, ptr[j], 27,     "force dflt point width");
00306       FLAG(stream, ptr[j], 26,     "last pixel enable");
00307       FLAG(stream, ptr[j], 25,     "global z offset enable");
00308       FLAG(stream, ptr[j], 24,     "fog enable");
00309       BITS(stream, ptr[j], 23, 16, "stencil ref");
00310       BITS(stream, ptr[j], 15, 13, "stencil test");
00311       BITS(stream, ptr[j], 12, 10, "stencil fail op");
00312       BITS(stream, ptr[j], 9, 7,   "stencil pass z fail op");
00313       BITS(stream, ptr[j], 6, 4,   "stencil pass z pass op");
00314       FLAG(stream, ptr[j], 3,      "stencil write enable");
00315       FLAG(stream, ptr[j], 2,      "stencil test enable");
00316       FLAG(stream, ptr[j], 1,      "color dither enable");
00317       FLAG(stream, ptr[j], 0,      "logiop enable");
00318       j++;
00319    }
00320    if (bits & (1<<6)) {
00321       PRINTF(stream, "\t  LIS6: 0x%08x\n", ptr[j]);
00322       FLAG(stream, ptr[j], 31,      "alpha test enable");
00323       BITS(stream, ptr[j], 30, 28,  "alpha func");
00324       BITS(stream, ptr[j], 27, 20,  "alpha ref");
00325       FLAG(stream, ptr[j], 19,      "depth test enable");
00326       BITS(stream, ptr[j], 18, 16,  "depth func");
00327       FLAG(stream, ptr[j], 15,      "blend enable");
00328       BITS(stream, ptr[j], 14, 12,  "blend func");
00329       BITS(stream, ptr[j], 11, 8,   "blend src factor");
00330       BITS(stream, ptr[j], 7,  4,   "blend dst factor");
00331       FLAG(stream, ptr[j], 3,       "depth write enable");
00332       FLAG(stream, ptr[j], 2,       "color write enable");
00333       BITS(stream, ptr[j], 1,  0,   "provoking vertex"); 
00334       j++;
00335    }
00336 
00337 
00338    PRINTF(stream, "\n");
00339 
00340    assert(j == len);
00341 
00342    stream->offset += len * sizeof(unsigned);
00343    
00344    return TRUE;
00345 }

static boolean debug_load_indirect ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 349 of file i915_debug.c.

References assert, LI0_STATE_CONSTANTS, LI0_STATE_DYNAMIC_INDIRECT, LI0_STATE_MAP, LI0_STATE_PROGRAM, LI0_STATE_SAMPLER, LI0_STATE_STATIC_INDIRECT, debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00352 {
00353    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00354    unsigned bits = (ptr[0] >> 8) & 0x3f;
00355    unsigned i, j = 0;
00356    
00357    PRINTF(stream, "%s (%d dwords):\n", name, len);
00358    PRINTF(stream, "\t0x%08x\n",  ptr[j++]);
00359 
00360    for (i = 0; i < 6; i++) {
00361       if (bits & (1<<i)) {
00362          switch (1<<(8+i)) {
00363          case LI0_STATE_STATIC_INDIRECT:
00364             PRINTF(stream, "        STATIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
00365             PRINTF(stream, "                0x%08x\n", ptr[j++]);
00366             break;
00367          case LI0_STATE_DYNAMIC_INDIRECT:
00368             PRINTF(stream, "       DYNAMIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
00369             break;
00370          case LI0_STATE_SAMPLER:
00371             PRINTF(stream, "       SAMPLER: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
00372             PRINTF(stream, "                0x%08x\n", ptr[j++]);
00373             break;
00374          case LI0_STATE_MAP:
00375             PRINTF(stream, "           MAP: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
00376             PRINTF(stream, "                0x%08x\n", ptr[j++]);
00377             break;
00378          case LI0_STATE_PROGRAM:
00379             PRINTF(stream, "       PROGRAM: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
00380             PRINTF(stream, "                0x%08x\n", ptr[j++]);
00381             break;
00382          case LI0_STATE_CONSTANTS:
00383             PRINTF(stream, "     CONSTANTS: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
00384             PRINTF(stream, "                0x%08x\n", ptr[j++]);
00385             break;
00386          default:
00387             assert(0);
00388             break;
00389          }
00390       }
00391    }
00392 
00393    if (bits == 0) {
00394       PRINTF(stream, "\t  DUMMY: 0x%08x\n", ptr[j++]);
00395    }
00396 
00397    PRINTF(stream, "\n");
00398 
00399 
00400    assert(j == len);
00401 
00402    stream->offset += len * sizeof(unsigned);
00403    
00404    return TRUE;
00405 }

static boolean debug_map_state ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 532 of file i915_debug.c.

References assert, BITS(), FLAG(), debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00535 {
00536    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00537    unsigned j = 0;
00538 
00539    PRINTF(stream, "%s (%d dwords):\n", name, len);
00540    PRINTF(stream, "\t0x%08x\n",  ptr[j++]);
00541    
00542    {
00543       PRINTF(stream, "\t0x%08x\n",  ptr[j]);
00544       BITS(stream, ptr[j], 15, 0,   "map mask");
00545       j++;
00546    }
00547 
00548    while (j < len) {
00549       {
00550          PRINTF(stream, "\t  TMn.0: 0x%08x\n", ptr[j]);
00551          PRINTF(stream, "\t map address: 0x%08x\n", (ptr[j] & ~0x3));
00552          FLAG(stream, ptr[j], 1, "vertical line stride");
00553          FLAG(stream, ptr[j], 0, "vertical line stride offset");
00554          j++;
00555       }
00556 
00557       {
00558          PRINTF(stream, "\t  TMn.1: 0x%08x\n", ptr[j]);
00559          BITS(stream, ptr[j], 31, 21, "height");
00560          BITS(stream, ptr[j], 20, 10, "width");
00561          BITS(stream, ptr[j], 9, 7, "surface format");
00562          BITS(stream, ptr[j], 6, 3, "texel format");
00563          FLAG(stream, ptr[j], 2, "use fence regs");
00564          FLAG(stream, ptr[j], 1, "tiled surface");
00565          FLAG(stream, ptr[j], 0, "tile walk ymajor");
00566          j++;
00567       }
00568       {
00569          PRINTF(stream, "\t  TMn.2: 0x%08x\n", ptr[j]);
00570          BITS(stream, ptr[j], 31, 21, "dword pitch");
00571          BITS(stream, ptr[j], 20, 15, "cube face enables");
00572          BITS(stream, ptr[j], 14, 9, "max lod");
00573          FLAG(stream, ptr[j], 8,     "mip layout right");
00574          BITS(stream, ptr[j], 7, 0, "depth");
00575          j++;
00576       }
00577    }
00578 
00579    stream->offset += len * sizeof(unsigned);
00580    assert(j == len);
00581    return TRUE;
00582 }

static boolean debug_modes4 ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 511 of file i915_debug.c.

References assert, BITS(), FLAG(), debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00514 {
00515    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00516    int j = 0;
00517 
00518    PRINTF(stream, "%s (%d dwords):\n", name, len);
00519    PRINTF(stream, "\t0x%08x\n",  ptr[j]);
00520    BITS(stream, ptr[j], 21, 18, "logicop func");
00521    FLAG(stream, ptr[j], 17, "stencil test mask modify-enable");
00522    FLAG(stream, ptr[j], 16, "stencil write mask modify-enable");
00523    BITS(stream, ptr[j], 15, 8, "stencil test mask");
00524    BITS(stream, ptr[j], 7, 0,  "stencil write mask");
00525    j++;
00526 
00527    stream->offset += len * sizeof(unsigned);
00528    assert(j == len);
00529    return TRUE;
00530 }

static boolean debug_prim ( struct debug_stream stream,
const char *  name,
boolean  dump_floats,
unsigned  len 
) [static]

Definition at line 95 of file i915_debug.c.

References get_prim_name(), debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00098 {
00099    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00100    const char *prim = get_prim_name( ptr[0] );
00101    unsigned i;
00102    
00103 
00104 
00105    PRINTF(stream, "%s %s (%d dwords):\n", name, prim, len);
00106    PRINTF(stream, "\t0x%08x\n",  ptr[0]);   
00107    for (i = 1; i < len; i++) {
00108       if (dump_floats)
00109          PRINTF(stream, "\t0x%08x // %f\n",  ptr[i], *(float *)&ptr[i]);   
00110       else
00111          PRINTF(stream, "\t0x%08x\n",  ptr[i]);   
00112    }
00113 
00114       
00115    PRINTF(stream, "\n");
00116 
00117    stream->offset += len * sizeof(unsigned);
00118    
00119    return TRUE;
00120 }

static boolean debug_program ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 125 of file i915_debug.c.

References assert, FALSE, i915_disassemble_program(), debug_stream::offset, debug_stream::print_addresses, PRINTF(), debug_stream::ptr, and TRUE.

00126 {
00127    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00128 
00129    if (len == 0) {
00130       PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]);
00131       assert(0);
00132       return FALSE;
00133    }
00134 
00135    if (stream->print_addresses)
00136       PRINTF(stream, "%08x:  ", stream->offset);
00137 
00138    PRINTF(stream, "%s (%d dwords):\n", name, len);
00139    i915_disassemble_program( stream, ptr, len );
00140 
00141    stream->offset += len * sizeof(unsigned);
00142    return TRUE;
00143 }

static boolean debug_sampler_state ( struct debug_stream stream,
const char *  name,
unsigned  len 
) [static]

Definition at line 584 of file i915_debug.c.

References assert, BITS(), FLAG(), MBZ, debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00587 {
00588    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00589    unsigned j = 0;
00590 
00591    PRINTF(stream, "%s (%d dwords):\n", name, len);
00592    PRINTF(stream, "\t0x%08x\n",  ptr[j++]);
00593    
00594    {
00595       PRINTF(stream, "\t0x%08x\n",  ptr[j]);
00596       BITS(stream, ptr[j], 15, 0,   "sampler mask");
00597       j++;
00598    }
00599 
00600    while (j < len) {
00601       {
00602          PRINTF(stream, "\t  TSn.0: 0x%08x\n", ptr[j]);
00603          FLAG(stream, ptr[j], 31, "reverse gamma");
00604          FLAG(stream, ptr[j], 30, "planar to packed");
00605          FLAG(stream, ptr[j], 29, "yuv->rgb");
00606          BITS(stream, ptr[j], 28, 27, "chromakey index");
00607          BITS(stream, ptr[j], 26, 22, "base mip level");
00608          BITS(stream, ptr[j], 21, 20, "mip mode filter");
00609          BITS(stream, ptr[j], 19, 17, "mag mode filter");
00610          BITS(stream, ptr[j], 16, 14, "min mode filter");
00611          BITS(stream, ptr[j], 13, 5,  "lod bias (s4.4)");
00612          FLAG(stream, ptr[j], 4,      "shadow enable");
00613          FLAG(stream, ptr[j], 3,      "max-aniso-4");
00614          BITS(stream, ptr[j], 2, 0,   "shadow func");
00615          j++;
00616       }
00617 
00618       {
00619          PRINTF(stream, "\t  TSn.1: 0x%08x\n", ptr[j]);
00620          BITS(stream, ptr[j], 31, 24, "min lod");
00621          MBZ( ptr[j], 23, 18 );
00622          FLAG(stream, ptr[j], 17,     "kill pixel enable");
00623          FLAG(stream, ptr[j], 16,     "keyed tex filter mode");
00624          FLAG(stream, ptr[j], 15,     "chromakey enable");
00625          BITS(stream, ptr[j], 14, 12, "tcx wrap mode");
00626          BITS(stream, ptr[j], 11, 9,  "tcy wrap mode");
00627          BITS(stream, ptr[j], 8,  6,  "tcz wrap mode");
00628          FLAG(stream, ptr[j], 5,      "normalized coords");
00629          BITS(stream, ptr[j], 4,  1,  "map (surface) index");
00630          FLAG(stream, ptr[j], 0,      "EAST deinterlacer enable");
00631          j++;
00632       }
00633       {
00634          PRINTF(stream, "\t  TSn.2: 0x%08x  (default color)\n", ptr[j]);
00635          j++;
00636       }
00637    }
00638 
00639    stream->offset += len * sizeof(unsigned);
00640    assert(j == len);
00641    return TRUE;
00642 }

static boolean debug_variable_length_prim ( struct debug_stream stream  )  [static]

Definition at line 170 of file i915_debug.c.

References get_prim_name(), debug_stream::offset, PRINTF(), debug_stream::ptr, and TRUE.

00171 {
00172    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00173    const char *prim = get_prim_name( ptr[0] );
00174    unsigned i, len;
00175 
00176    ushort *idx = (ushort *)(ptr+1);
00177    for (i = 0; idx[i] != 0xffff; i++)
00178       ;
00179 
00180    len = 1+(i+2)/2;
00181 
00182    PRINTF(stream, "3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len);
00183    for (i = 0; i < len; i++)
00184       PRINTF(stream, "\t0x%08x\n",  ptr[i]);
00185    PRINTF(stream, "\n");
00186 
00187    stream->offset += len * sizeof(unsigned);
00188    return TRUE;
00189 }

static void FLAG ( struct debug_stream stream,
unsigned  dw,
unsigned  bit,
const char *  fmt,
  ... 
) [static]

Definition at line 222 of file i915_debug.c.

References args, debug_vprintf, and PRINTF().

00228 {
00229    if (((dw) >> (bit)) & 1) {
00230       va_list  args;
00231 
00232       PRINTF(stream, "\t\t ");
00233 
00234       va_start( args, fmt );
00235       debug_vprintf( fmt, args );
00236       va_end( args );
00237 
00238       PRINTF(stream, "\n");
00239    }
00240 }

static const char* get_prim_name ( unsigned  val  )  [static]

Definition at line 76 of file i915_debug.c.

References PRIM3D_CLEAR_RECT, PRIM3D_DIB, PRIM3D_LINELIST, PRIM3D_LINESTRIP, PRIM3D_MASK, PRIM3D_POINTLIST, PRIM3D_POLY, PRIM3D_RECTLIST, PRIM3D_TRIFAN, PRIM3D_TRILIST, PRIM3D_TRISTRIP, PRIM3D_TRISTRIP_RVRSE, and PRIM3D_ZONE_INIT.

00077 {
00078    switch (val & PRIM3D_MASK) {
00079    case PRIM3D_TRILIST: return "TRILIST"; break;
00080    case PRIM3D_TRISTRIP: return "TRISTRIP"; break;
00081    case PRIM3D_TRISTRIP_RVRSE: return "TRISTRIP_RVRSE"; break;
00082    case PRIM3D_TRIFAN: return "TRIFAN"; break;
00083    case PRIM3D_POLY: return "POLY"; break;
00084    case PRIM3D_LINELIST: return "LINELIST"; break;
00085    case PRIM3D_LINESTRIP: return "LINESTRIP"; break;
00086    case PRIM3D_RECTLIST: return "RECTLIST"; break;
00087    case PRIM3D_POINTLIST: return "POINTLIST"; break;
00088    case PRIM3D_DIB: return "DIB"; break;
00089    case PRIM3D_CLEAR_RECT: return "CLEAR_RECT"; break;
00090    case PRIM3D_ZONE_INIT: return "ZONE_INIT"; break;
00091    default: return "????"; break;
00092    }
00093 }

static boolean i915_debug_packet ( struct debug_stream stream  )  [static]

Definition at line 709 of file i915_debug.c.

References assert, debug(), debug_buf_info(), debug_chain(), debug_color_blit(), debug_copy_blit(), debug_dest_vars(), debug_load_immediate(), debug_load_indirect(), debug_map_state(), debug_modes4(), debug_prim(), debug_program(), debug_sampler_state(), debug_variable_length_prim(), FALSE, debug_stream::offset, and debug_stream::ptr.

00710 {
00711    unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
00712    unsigned cmd = *ptr;
00713    
00714    switch (((cmd >> 29) & 0x7)) {
00715    case 0x0:
00716       switch ((cmd >> 23) & 0x3f) {
00717       case 0x0:
00718          return debug(stream, "MI_NOOP", 1);
00719       case 0x3:
00720          return debug(stream, "MI_WAIT_FOR_EVENT", 1);
00721       case 0x4:
00722          return debug(stream, "MI_FLUSH", 1);
00723       case 0xA:
00724          debug(stream, "MI_BATCH_BUFFER_END", 1);
00725          return FALSE;
00726       case 0x22:
00727          return debug(stream, "MI_LOAD_REGISTER_IMM", 3);
00728       case 0x31:
00729          return debug_chain(stream, "MI_BATCH_BUFFER_START", 2);
00730       default:
00731          (void)debug(stream, "UNKNOWN 0x0 case!", 1);
00732          assert(0);
00733          break;
00734       }
00735       break;
00736    case 0x1:
00737       (void) debug(stream, "UNKNOWN 0x1 case!", 1);
00738       assert(0);
00739       break;
00740    case 0x2:
00741       switch ((cmd >> 22) & 0xff) {      
00742       case 0x50:
00743          return debug_color_blit(stream, "XY_COLOR_BLT", (cmd & 0xff) + 2);
00744       case 0x53:
00745          return debug_copy_blit(stream, "XY_SRC_COPY_BLT", (cmd & 0xff) + 2);
00746       default:
00747          return debug(stream, "blit command", (cmd & 0xff) + 2);
00748       }
00749       break;
00750    case 0x3:
00751       switch ((cmd >> 24) & 0x1f) {      
00752       case 0x6:
00753          return debug(stream, "3DSTATE_ANTI_ALIASING", 1);
00754       case 0x7:
00755          return debug(stream, "3DSTATE_RASTERIZATION_RULES", 1);
00756       case 0x8:
00757          return debug(stream, "3DSTATE_BACKFACE_STENCIL_OPS", 2);
00758       case 0x9:
00759          return debug(stream, "3DSTATE_BACKFACE_STENCIL_MASKS", 1);
00760       case 0xb:
00761          return debug(stream, "3DSTATE_INDEPENDENT_ALPHA_BLEND", 1);
00762       case 0xc:
00763          return debug(stream, "3DSTATE_MODES5", 1);      
00764       case 0xd:
00765          return debug_modes4(stream, "3DSTATE_MODES4", 1);
00766       case 0x15:
00767          return debug(stream, "3DSTATE_FOG_COLOR", 1);
00768       case 0x16:
00769          return debug(stream, "3DSTATE_COORD_SET_BINDINGS", 1);
00770       case 0x1c:
00771          /* 3DState16NP */
00772          switch((cmd >> 19) & 0x1f) {
00773          case 0x10:
00774             return debug(stream, "3DSTATE_SCISSOR_ENABLE", 1);
00775          case 0x11:
00776             return debug(stream, "3DSTATE_DEPTH_SUBRECTANGLE_DISABLE", 1);
00777          default:
00778             (void) debug(stream, "UNKNOWN 0x1c case!", 1);
00779             assert(0);
00780             break;
00781          }
00782          break;
00783       case 0x1d:
00784          /* 3DStateMW */
00785          switch ((cmd >> 16) & 0xff) {
00786          case 0x0:
00787             return debug_map_state(stream, "3DSTATE_MAP_STATE", (cmd & 0x1f) + 2);
00788          case 0x1:
00789             return debug_sampler_state(stream, "3DSTATE_SAMPLER_STATE", (cmd & 0x1f) + 2);
00790          case 0x4:
00791             return debug_load_immediate(stream, "3DSTATE_LOAD_STATE_IMMEDIATE", (cmd & 0xf) + 2);
00792          case 0x5:
00793             return debug_program(stream, "3DSTATE_PIXEL_SHADER_PROGRAM", (cmd & 0x1ff) + 2);
00794          case 0x6:
00795             return debug(stream, "3DSTATE_PIXEL_SHADER_CONSTANTS", (cmd & 0xff) + 2);
00796          case 0x7:
00797             return debug_load_indirect(stream, "3DSTATE_LOAD_INDIRECT", (cmd & 0xff) + 2);
00798          case 0x80:
00799             return debug(stream, "3DSTATE_DRAWING_RECTANGLE", (cmd & 0xffff) + 2);
00800          case 0x81:
00801             return debug(stream, "3DSTATE_SCISSOR_RECTANGLE", (cmd & 0xffff) + 2);
00802          case 0x83:
00803             return debug(stream, "3DSTATE_SPAN_STIPPLE", (cmd & 0xffff) + 2);
00804          case 0x85:
00805             return debug_dest_vars(stream, "3DSTATE_DEST_BUFFER_VARS", (cmd & 0xffff) + 2);
00806          case 0x88:
00807             return debug(stream, "3DSTATE_CONSTANT_BLEND_COLOR", (cmd & 0xffff) + 2);
00808          case 0x89:
00809             return debug(stream, "3DSTATE_FOG_MODE", (cmd & 0xffff) + 2);
00810          case 0x8e:
00811             return debug_buf_info(stream, "3DSTATE_BUFFER_INFO", (cmd & 0xffff) + 2);
00812          case 0x97:
00813             return debug(stream, "3DSTATE_DEPTH_OFFSET_SCALE", (cmd & 0xffff) + 2);
00814          case 0x98:
00815             return debug(stream, "3DSTATE_DEFAULT_Z", (cmd & 0xffff) + 2);
00816          case 0x99:
00817             return debug(stream, "3DSTATE_DEFAULT_DIFFUSE", (cmd & 0xffff) + 2);
00818          case 0x9a:
00819             return debug(stream, "3DSTATE_DEFAULT_SPECULAR", (cmd & 0xffff) + 2);
00820          case 0x9c:
00821             return debug(stream, "3DSTATE_CLEAR_PARAMETERS", (cmd & 0xffff) + 2);
00822          default:
00823             assert(0);
00824             return 0;
00825          }
00826          break;
00827       case 0x1e:
00828          if (cmd & (1 << 23))
00829             return debug(stream, "???", (cmd & 0xffff) + 1);
00830          else
00831             return debug(stream, "", 1);
00832          break;
00833       case 0x1f:
00834          if ((cmd & (1 << 23)) == 0)    
00835             return debug_prim(stream, "3DPRIM (inline)", 1, (cmd & 0x1ffff) + 2);
00836          else if (cmd & (1 << 17)) 
00837          {
00838             if ((cmd & 0xffff) == 0)
00839                return debug_variable_length_prim(stream);
00840             else
00841                return debug_prim(stream, "3DPRIM (indexed)", 0, (((cmd & 0xffff) + 1) / 2) + 1);
00842          }
00843          else
00844             return debug_prim(stream, "3DPRIM  (indirect sequential)", 0, 2); 
00845          break;
00846       default:
00847          return debug(stream, "", 0);
00848       }
00849    default:
00850       assert(0);
00851       return 0;
00852    }
00853 
00854    assert(0);
00855    return 0;
00856 }

void i915_dump_batchbuffer ( struct i915_context i915  ) 

Definition at line 861 of file i915_debug.c.

References assert, debug_printf(), debug_stream::end, FALSE, i915_debug_packet(), debug_stream::offset, i915_context::pipe, debug_stream::print_addresses, debug_stream::ptr, pipe_context::winsys, and debug_stream::winsys.

00862 {
00863    struct debug_stream stream;
00864    /* TODO fix me */
00865    unsigned *start = 0;/*i915->batch_start;*/
00866    unsigned *end = 0;/*i915->winsys->batch_start( i915->winsys, 0, 0 );*/
00867    unsigned long bytes = (unsigned long) (end - start) * 4;
00868    boolean done = FALSE;
00869 
00870    stream.offset = 0;
00871    stream.ptr = (char *)start;
00872    stream.print_addresses = 0;
00873    stream.winsys = i915->pipe.winsys;
00874 
00875    if (!start || !end) {
00876       debug_printf( "\n\nBATCH: ???\n");
00877       return;
00878    }
00879    
00880    debug_printf( "\n\nBATCH: (%d)\n", bytes / 4);
00881 
00882    while (!done &&
00883           stream.offset < bytes)
00884    {
00885       if (!i915_debug_packet( &stream ))
00886          break;
00887 
00888       assert(stream.offset <= bytes &&
00889              stream.offset >= 0);
00890    }
00891 
00892    debug_printf( "END-BATCH\n\n\n");
00893 }

static void PRINTF ( struct debug_stream stream,
const char *  fmt,
  ... 
) [static]

Definition at line 37 of file i915_debug.c.

References args, and debug_vprintf.

00041 {
00042    va_list  args;
00043 
00044    va_start( args, fmt );
00045    debug_vprintf( fmt, args );
00046    va_end( args );
00047 }


Generated on Tue Sep 29 06:25:34 2009 for Gallium3D by  doxygen 1.5.4