#include "i915_winsys.h"
#include "i915_debug.h"
-#define PRINTF( stream, ... ) (stream)->winsys->printf( (stream)->winsys, __VA_ARGS__ )
+#define PRINTF( ... ) (stream)->winsys->printf( (stream)->winsys, __VA_ARGS__ )
static GLboolean debug( struct debug_stream *stream, const char *name, GLuint len )
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
if (len == 0) {
- PRINTF( stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0] );
+ PRINTF( "Error - zero length packet (0x%08x)\n", stream->ptr[0] );
assert(0);
return GL_FALSE;
}
if (stream->print_addresses)
- PRINTF(stream, "%08x: ", stream->offset);
+ PRINTF("%08x: ", stream->offset);
- PRINTF(stream, "%s (%d dwords):\n", name, len);
+ PRINTF("%s (%d dwords):\n", name, len);
for (i = 0; i < len; i++)
- PRINTF(stream, "\t\t0x%08x\n", ptr[i]);
- PRINTF(stream, "\n");
+ PRINTF("\t\t0x%08x\n", ptr[i]);
+ PRINTF("\n");
stream->offset += len * sizeof(GLuint);
- PRINTF(stream, "%s %s (%d dwords):\n", name, prim, len);
- PRINTF(stream, "\t\t0x%08x\n", ptr[0]);
+ PRINTF("%s %s (%d dwords):\n", name, prim, len);
+ PRINTF("\t\t0x%08x\n", ptr[0]);
for (i = 1; i < len; i++) {
if (dump_floats)
- PRINTF(stream, "\t\t0x%08x // %f\n", ptr[i], *(GLfloat *)&ptr[i]);
+ PRINTF("\t\t0x%08x // %f\n", ptr[i], *(GLfloat *)&ptr[i]);
else
- PRINTF(stream, "\t\t0x%08x\n", ptr[i]);
+ PRINTF("\t\t0x%08x\n", ptr[i]);
}
- PRINTF(stream, "\n");
+ PRINTF("\n");
stream->offset += len * sizeof(GLuint);
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
if (len == 0) {
- PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]);
+ PRINTF("Error - zero length packet (0x%08x)\n", stream->ptr[0]);
assert(0);
return GL_FALSE;
}
if (stream->print_addresses)
- PRINTF(stream, "%08x: ", stream->offset);
+ PRINTF("%08x: ", stream->offset);
- PRINTF(stream, "%s (%d dwords):\n", name, len);
+ PRINTF("%s (%d dwords):\n", name, len);
i915_disassemble_program( stream, ptr, len );
stream->offset += len * sizeof(GLuint);
GLuint old_offset = stream->offset + len * sizeof(GLuint);
GLuint i;
- PRINTF(stream, "%s (%d dwords):\n", name, len);
+ PRINTF("%s (%d dwords):\n", name, len);
for (i = 0; i < len; i++)
- PRINTF(stream, "\t\t0x%08x\n", ptr[i]);
+ PRINTF("\t\t0x%08x\n", ptr[i]);
stream->offset = ptr[1] & ~0x3;
if (stream->offset < old_offset)
- PRINTF(stream, "\n... skipping backwards from 0x%x --> 0x%x ...\n\n",
+ PRINTF("\n... skipping backwards from 0x%x --> 0x%x ...\n\n",
old_offset, stream->offset );
else
- PRINTF(stream, "\n... skipping from 0x%x --> 0x%x ...\n\n",
+ PRINTF("\n... skipping from 0x%x --> 0x%x ...\n\n",
old_offset, stream->offset );
len = 1+(i+2)/2;
- PRINTF(stream, "3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len);
+ PRINTF("3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len);
for (i = 0; i < len; i++)
- PRINTF(stream, "\t\t0x%08x\n", ptr[i]);
- PRINTF(stream, "\n");
+ PRINTF("\t\t0x%08x\n", ptr[i]);
+ PRINTF("\n");
stream->offset += len * sizeof(GLuint);
return GL_TRUE;
GLuint bits = (ptr[0] >> 4) & 0xff;
GLuint i, j = 0;
- PRINTF(stream, "%s (%d dwords, flags: %x):\n", name, len, bits);
- PRINTF(stream, "\t\t0x%08x\n", ptr[j++]);
+ PRINTF("%s (%d dwords, flags: %x):\n", name, len, bits);
+ PRINTF("\t\t0x%08x\n", ptr[j++]);
for (i = 0; i < 8; i++) {
if (bits & (1<<i)) {
- PRINTF(stream, "\t LIS%d: 0x%08x\n", i, ptr[j++]);
+ PRINTF("\t LIS%d: 0x%08x\n", i, ptr[j++]);
}
}
- PRINTF(stream, "\n");
+ PRINTF("\n");
assert(j == len);
GLuint bits = (ptr[0] >> 8) & 0x3f;
GLuint i, j = 0;
- PRINTF(stream, "%s (%d dwords):\n", name, len);
- PRINTF(stream, "\t\t0x%08x\n", ptr[j++]);
+ PRINTF("%s (%d dwords):\n", name, len);
+ PRINTF("\t\t0x%08x\n", ptr[j++]);
for (i = 0; i < 6; i++) {
if (bits & (1<<i)) {
switch (1<<(8+i)) {
case LI0_STATE_STATIC_INDIRECT:
- PRINTF(stream, " STATIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
+ PRINTF(" STATIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ PRINTF(" 0x%08x\n", ptr[j++]);
break;
case LI0_STATE_DYNAMIC_INDIRECT:
- PRINTF(stream, " DYNAMIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ PRINTF(" DYNAMIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
break;
case LI0_STATE_SAMPLER:
- PRINTF(stream, " SAMPLER: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
+ PRINTF(" SAMPLER: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ PRINTF(" 0x%08x\n", ptr[j++]);
break;
case LI0_STATE_MAP:
- PRINTF(stream, " MAP: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
+ PRINTF(" MAP: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ PRINTF(" 0x%08x\n", ptr[j++]);
break;
case LI0_STATE_PROGRAM:
- PRINTF(stream, " PROGRAM: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
+ PRINTF(" PROGRAM: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ PRINTF(" 0x%08x\n", ptr[j++]);
break;
case LI0_STATE_CONSTANTS:
- PRINTF(stream, " CONSTANTS: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(stream, " 0x%08x\n", ptr[j++]);
+ PRINTF(" CONSTANTS: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ PRINTF(" 0x%08x\n", ptr[j++]);
break;
default:
assert(0);
}
if (bits == 0) {
- PRINTF(stream, "\t DUMMY: 0x%08x\n", ptr[j++]);
+ PRINTF("\t DUMMY: 0x%08x\n", ptr[j++]);
}
- PRINTF(stream, "\n");
+ PRINTF("\n");
assert(j == len);
-#define PRINTF( stream, ... ) (stream)->winsys->printf( (stream)->winsys, __VA_ARGS__ )
+#define PRINTF( ... ) (stream)->winsys->printf( (stream)->winsys, __VA_ARGS__ )
case REG_TYPE_T:
switch (nr) {
case T_DIFFUSE:
- PRINTF(stream, "T_DIFFUSE");
+ PRINTF("T_DIFFUSE");
return;
case T_SPECULAR:
- PRINTF(stream, "T_SPECULAR");
+ PRINTF("T_SPECULAR");
return;
case T_FOG_W:
- PRINTF(stream, "T_FOG_W");
+ PRINTF("T_FOG_W");
return;
default:
- PRINTF(stream, "T_TEX%d", nr);
+ PRINTF("T_TEX%d", nr);
return;
}
case REG_TYPE_OC:
if (nr == 0) {
- PRINTF(stream, "oC");
+ PRINTF("oC");
return;
}
break;
case REG_TYPE_OD:
if (nr == 0) {
- PRINTF(stream, "oD");
+ PRINTF("oD");
return;
}
break;
break;
}
- PRINTF(stream, "%s[%d]", regname[type], nr);
+ PRINTF("%s[%d]", regname[type], nr);
}
#define REG_SWIZZLE_MASK 0x7777
(reg & REG_NEGATE_MASK) == 0)
return;
- PRINTF(stream, ".");
+ PRINTF(".");
for (i = 3; i >= 0; i--) {
if (reg & (1 << ((i * 4) + 3)))
- PRINTF(stream, "-");
+ PRINTF("-");
switch ((reg >> (i * 4)) & 0x7) {
case 0:
- PRINTF(stream, "x");
+ PRINTF("x");
break;
case 1:
- PRINTF(stream, "y");
+ PRINTF("y");
break;
case 2:
- PRINTF(stream, "z");
+ PRINTF("z");
break;
case 3:
- PRINTF(stream, "w");
+ PRINTF("w");
break;
case 4:
- PRINTF(stream, "0");
+ PRINTF("0");
break;
case 5:
- PRINTF(stream, "1");
+ PRINTF("1");
break;
default:
- PRINTF(stream, "?");
+ PRINTF("?");
break;
}
}
print_reg_type_nr(stream, type, nr);
if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL)
return;
- PRINTF(stream, ".");
+ PRINTF(".");
if (dword & A0_DEST_CHANNEL_X)
- PRINTF(stream, "x");
+ PRINTF("x");
if (dword & A0_DEST_CHANNEL_Y)
- PRINTF(stream, "y");
+ PRINTF("y");
if (dword & A0_DEST_CHANNEL_Z)
- PRINTF(stream, "z");
+ PRINTF("z");
if (dword & A0_DEST_CHANNEL_W)
- PRINTF(stream, "w");
+ PRINTF("w");
}
if (opcode != A0_NOP) {
print_dest_reg(stream, program[0]);
if (program[0] & A0_DEST_SATURATE)
- PRINTF(stream, " = SATURATE ");
+ PRINTF(" = SATURATE ");
else
- PRINTF(stream, " = ");
+ PRINTF(" = ");
}
- PRINTF(stream, "%s ", opcodes[opcode]);
+ PRINTF("%s ", opcodes[opcode]);
print_src_reg(stream, GET_SRC0_REG(program[0], program[1]));
if (args[opcode] == 1) {
- PRINTF(stream, "\n");
+ PRINTF("\n");
return;
}
- PRINTF(stream, ", ");
+ PRINTF(", ");
print_src_reg(stream, GET_SRC1_REG(program[1], program[2]));
if (args[opcode] == 2) {
- PRINTF(stream, "\n");
+ PRINTF("\n");
return;
}
- PRINTF(stream, ", ");
+ PRINTF(", ");
print_src_reg(stream, GET_SRC2_REG(program[2]));
- PRINTF(stream, "\n");
+ PRINTF("\n");
return;
}
GLuint opcode, const GLuint * program)
{
print_dest_reg(stream, program[0] | A0_DEST_CHANNEL_ALL);
- PRINTF(stream, " = ");
+ PRINTF(" = ");
- PRINTF(stream, "%s ", opcodes[opcode]);
+ PRINTF("%s ", opcodes[opcode]);
- PRINTF(stream, "S[%d],", program[0] & T0_SAMPLER_NR_MASK);
+ PRINTF("S[%d],", program[0] & T0_SAMPLER_NR_MASK);
print_reg_type_nr(stream,
(program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) &
REG_TYPE_MASK,
(program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK);
- PRINTF(stream, "\n");
+ PRINTF("\n");
}
static void
print_dcl_op(struct debug_stream *stream,
GLuint opcode, const GLuint * program)
{
- PRINTF(stream, "%s ", opcodes[opcode]);
+ PRINTF("%s ", opcodes[opcode]);
print_dest_reg(stream,
program[0] | A0_DEST_CHANNEL_ALL);
- PRINTF(stream, "\n");
+ PRINTF("\n");
}
GLuint size = program[0] & 0x1ff;
GLint i;
- PRINTF(stream, "\t\tBEGIN\n");
+ PRINTF("\t\tBEGIN\n");
assert(size + 2 == sz);
for (i = 1; i < sz; i += 3, program += 3) {
GLuint opcode = program[0] & (0x1f << 24);
- PRINTF(stream, "\t\t");
+ PRINTF("\t\t");
if ((GLint) opcode >= A0_NOP && opcode <= A0_SLT)
print_arith_op(stream, opcode >> 24, program);
else if (opcode == D0_DCL)
print_dcl_op(stream, opcode >> 24, program);
else
- PRINTF(stream, "Unknown opcode 0x%x\n", opcode);
+ PRINTF("Unknown opcode 0x%x\n", opcode);
}
- PRINTF(stream, "\t\tEND\n\n");
+ PRINTF("\t\tEND\n\n");
}