i915_debug_fp.c File Reference

Include dependency graph for i915_debug_fp.c:

Go to the source code of this file.

Defines

#define REG_SWIZZLE_MASK   0x7777
#define REG_NEGATE_MASK   0x8888
#define REG_SWIZZLE_XYZW
#define GET_SRC0_REG(r0, r1)   ((r0<<14)|(r1>>A1_SRC0_CHANNEL_W_SHIFT))
#define GET_SRC1_REG(r0, r1)   ((r0<<8)|(r1>>A2_SRC1_CHANNEL_W_SHIFT))
#define GET_SRC2_REG(r)   (r)

Functions

static void PRINTF (struct debug_stream *stream, const char *fmt,...)
static void print_reg_type_nr (struct debug_stream *stream, unsigned type, unsigned nr)
static void print_reg_neg_swizzle (struct debug_stream *stream, unsigned reg)
static void print_src_reg (struct debug_stream *stream, unsigned dword)
static void print_dest_reg (struct debug_stream *stream, unsigned dword)
static void print_arith_op (struct debug_stream *stream, unsigned opcode, const unsigned *program)
static void print_tex_op (struct debug_stream *stream, unsigned opcode, const unsigned *program)
static void print_texkil_op (struct debug_stream *stream, unsigned opcode, const unsigned *program)
static void print_dcl_op (struct debug_stream *stream, unsigned opcode, const unsigned *program)
void i915_disassemble_program (struct debug_stream *stream, const unsigned *program, unsigned sz)

Variables

static const char * opcodes [0x20]
static const int args [0x20]
static const char * regname [0x8]


Define Documentation

#define GET_SRC0_REG ( r0,
r1   )     ((r0<<14)|(r1>>A1_SRC0_CHANNEL_W_SHIFT))

Definition at line 261 of file i915_debug_fp.c.

#define GET_SRC1_REG ( r0,
r1   )     ((r0<<8)|(r1>>A2_SRC1_CHANNEL_W_SHIFT))

Definition at line 262 of file i915_debug_fp.c.

#define GET_SRC2_REG (  )     (r)

Definition at line 263 of file i915_debug_fp.c.

#define REG_NEGATE_MASK   0x8888

Definition at line 181 of file i915_debug_fp.c.

#define REG_SWIZZLE_MASK   0x7777

Definition at line 180 of file i915_debug_fp.c.

#define REG_SWIZZLE_XYZW

Value:

Definition at line 183 of file i915_debug_fp.c.


Function Documentation

void i915_disassemble_program ( struct debug_stream stream,
const unsigned *  program,
unsigned  sz 
)

Definition at line 343 of file i915_debug_fp.c.

References A0_NOP, A0_SLT, D0_DCL, print_arith_op(), print_dcl_op(), print_tex_op(), print_texkil_op(), PRINTF(), T0_TEXKILL, and T0_TEXLD.

00343                                              {
00344       unsigned opcode = program[0] & (0x1f << 24);
00345 
00346       PRINTF(stream, "\t\t");
00347 
00348       if ((int) opcode >= A0_NOP && opcode <= A0_SLT)
00349          print_arith_op(stream, opcode >> 24, program);
00350       else if (opcode >= T0_TEXLD && opcode < T0_TEXKILL)
00351          print_tex_op(stream, opcode >> 24, program);
00352       else if (opcode == T0_TEXKILL)
00353          print_texkil_op(stream, opcode >> 24, program);
00354       else if (opcode == D0_DCL)
00355          print_dcl_op(stream, opcode >> 24, program);
00356       else
00357          PRINTF(stream, "Unknown opcode 0x%x\n", opcode);
00358    }
00359 
00360    PRINTF(stream, "\t\tEND\n\n");
00361 }
00362 
00363 
00364 

static void print_arith_op ( struct debug_stream stream,
unsigned  opcode,
const unsigned *  program 
) [static]

Definition at line 267 of file i915_debug_fp.c.

00271                           {
00272       PRINTF(stream, "\n");
00273       return;
00274    }
00275 
00276    PRINTF(stream, ", ");
00277    print_src_reg(stream, GET_SRC1_REG(program[1], program[2]));
00278    if (args[opcode] == 2) {
00279       PRINTF(stream, "\n");
00280       return;
00281    }
00282 
00283    PRINTF(stream, ", ");
00284    print_src_reg(stream, GET_SRC2_REG(program[2]));
00285    PRINTF(stream, "\n");
00286    return;
00287 }
00288 
00289 
00290 static void
00291 print_tex_op(struct debug_stream *stream, 
00292              unsigned opcode, const unsigned * program)
00293 {
00294    print_dest_reg(stream, program[0] | A0_DEST_CHANNEL_ALL);
00295    PRINTF(stream, " = ");
00296 
00297    PRINTF(stream, "%s ", opcodes[opcode]);

static void print_dcl_op ( struct debug_stream stream,
unsigned  opcode,
const unsigned *  program 
) [static]

Definition at line 332 of file i915_debug_fp.c.

References assert, and PRINTF().

00335 {
00336    unsigned i;
00337 
00338    PRINTF(stream, "\t\tBEGIN\n");
00339 

static void print_dest_reg ( struct debug_stream stream,
unsigned  dword 
) [static]

Definition at line 242 of file i915_debug_fp.c.

00259 {

static void print_reg_neg_swizzle ( struct debug_stream stream,
unsigned  reg 
) [static]

Definition at line 190 of file i915_debug_fp.c.

References PRINTF().

00190                             {
00191       if (reg & (1 << ((i * 4) + 3)))
00192          PRINTF(stream, "-");
00193 
00194       switch ((reg >> (i * 4)) & 0x7) {
00195       case 0:
00196          PRINTF(stream, "x");
00197          break;
00198       case 1:
00199          PRINTF(stream, "y");
00200          break;
00201       case 2:
00202          PRINTF(stream, "z");
00203          break;
00204       case 3:
00205          PRINTF(stream, "w");
00206          break;
00207       case 4:
00208          PRINTF(stream, "0");
00209          break;
00210       case 5:
00211          PRINTF(stream, "1");
00212          break;
00213       default:
00214          PRINTF(stream, "?");
00215          break;
00216       }
00217    }
00218 }
00219 
00220 
00221 static void
00222 print_src_reg(struct debug_stream *stream, unsigned dword)
00223 {
00224    unsigned nr = (dword >> A2_SRC2_NR_SHIFT) & REG_NR_MASK;
00225    unsigned type = (dword >> A2_SRC2_TYPE_SHIFT) & REG_TYPE_MASK;
00226    print_reg_type_nr(stream, type, nr);
00227    print_reg_neg_swizzle(stream, dword);
00228 }

static void print_reg_type_nr ( struct debug_stream stream,
unsigned  type,
unsigned  nr 
) [static]

Definition at line 133 of file i915_debug_fp.c.

References PRINTF(), REG_TYPE_OC, REG_TYPE_OD, REG_TYPE_T, regname, T_DIFFUSE, T_FOG_W, and T_SPECULAR.

00134 {
00135    switch (type) {
00136    case REG_TYPE_T:
00137       switch (nr) {
00138       case T_DIFFUSE:
00139          PRINTF(stream, "T_DIFFUSE");
00140          return;
00141       case T_SPECULAR:
00142          PRINTF(stream, "T_SPECULAR");
00143          return;
00144       case T_FOG_W:
00145          PRINTF(stream, "T_FOG_W");
00146          return;
00147       default:
00148          PRINTF(stream, "T_TEX%d", nr);
00149          return;
00150       }
00151    case REG_TYPE_OC:
00152       if (nr == 0) {
00153          PRINTF(stream, "oC");
00154          return;
00155       }
00156       break;
00157    case REG_TYPE_OD:
00158       if (nr == 0) {
00159          PRINTF(stream, "oD");
00160          return;
00161       }
00162       break;
00163    default:
00164       break;
00165    }
00166 
00167    PRINTF(stream, "%s[%d]", regname[type], nr);
00168 }
00169 
00170 #define REG_SWIZZLE_MASK 0x7777
00171 #define REG_NEGATE_MASK 0x8888
00172 
00173 #define REG_SWIZZLE_XYZW ((SRC_X << A2_SRC2_CHANNEL_X_SHIFT) |  \
00174                       (SRC_Y << A2_SRC2_CHANNEL_Y_SHIFT) |      \
00175                       (SRC_Z << A2_SRC2_CHANNEL_Z_SHIFT) |      \
00176                       (SRC_W << A2_SRC2_CHANNEL_W_SHIFT))
00177 
00178 

static void print_src_reg ( struct debug_stream stream,
unsigned  dword 
) [static]

Definition at line 232 of file i915_debug_fp.c.

References A0_DEST_CHANNEL_ALL, A0_DEST_CHANNEL_X, A0_DEST_NR_SHIFT, A0_DEST_TYPE_SHIFT, print_reg_type_nr(), PRINTF(), REG_NR_MASK, and REG_TYPE_MASK.

00233 {
00234    unsigned nr = (dword >> A0_DEST_NR_SHIFT) & REG_NR_MASK;
00235    unsigned type = (dword >> A0_DEST_TYPE_SHIFT) & REG_TYPE_MASK;
00236    print_reg_type_nr(stream, type, nr);
00237    if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL)
00238       return;

static void print_tex_op ( struct debug_stream stream,
unsigned  opcode,
const unsigned *  program 
) [static]

Definition at line 301 of file i915_debug_fp.c.

00311 {
00312    PRINTF(stream, "TEXKIL ");
00313 
00314    print_reg_type_nr(stream, 
00315                      (program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) &
00316                      REG_TYPE_MASK,

static void print_texkil_op ( struct debug_stream stream,
unsigned  opcode,
const unsigned *  program 
) [static]

Definition at line 319 of file i915_debug_fp.c.

00324 {
00325    PRINTF(stream, "%s ", opcodes[opcode]);
00326    print_dest_reg(stream, 
00327                   program[0] | A0_DEST_CHANNEL_ALL);
00328    PRINTF(stream, "\n");
00329 }

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

Definition at line 36 of file i915_debug_fp.c.

References args, and debug_vprintf.

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


Variable Documentation

const int args[0x20] [static]

Definition at line 85 of file i915_debug_fp.c.

const char* opcodes[0x20] [static]

Definition at line 49 of file i915_debug_fp.c.

const char* regname[0x8] [static]

Initial value:

 {
   "R",
   "T",
   "CONST",
   "S",
   "OC",
   "OD",
   "U",
   "UNKNOWN",
}

Definition at line 121 of file i915_debug_fp.c.


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