From: Keith Whitwell Date: Sat, 11 Aug 2007 12:06:24 +0000 (+0100) Subject: make it easier to compare debug code with non-pipe version X-Git-Tag: 062012170305~17580^2~390^2~4361 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2eb839ce1dc9a7737925d69d7b628fc839fa752d;p=profile%2Fivi%2Fmesa.git make it easier to compare debug code with non-pipe version --- diff --git a/src/mesa/pipe/i915simple/i915_debug.c b/src/mesa/pipe/i915simple/i915_debug.c index 8050eb0..10d7817 100644 --- a/src/mesa/pipe/i915simple/i915_debug.c +++ b/src/mesa/pipe/i915simple/i915_debug.c @@ -32,7 +32,7 @@ #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 ) @@ -41,19 +41,19 @@ static GLboolean debug( struct debug_stream *stream, const char *name, GLuint le 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); @@ -90,17 +90,17 @@ static GLboolean debug_prim( struct debug_stream *stream, const char *name, - 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); @@ -115,15 +115,15 @@ static GLboolean debug_program( struct debug_stream *stream, const char *name, G 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); @@ -137,17 +137,17 @@ static GLboolean debug_chain( struct debug_stream *stream, const char *name, GLu 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 ); @@ -167,10 +167,10 @@ static GLboolean debug_variable_length_prim( struct debug_stream *stream ) 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; @@ -185,16 +185,16 @@ static GLboolean debug_load_immediate( struct debug_stream *stream, 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<> 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<winsys->printf( (stream)->winsys, __VA_ARGS__ ) +#define PRINTF( ... ) (stream)->winsys->printf( (stream)->winsys, __VA_ARGS__ ) @@ -132,27 +132,27 @@ print_reg_type_nr(struct debug_stream *stream, GLuint type, GLuint nr) 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; @@ -160,7 +160,7 @@ print_reg_type_nr(struct debug_stream *stream, GLuint type, GLuint nr) break; } - PRINTF(stream, "%s[%d]", regname[type], nr); + PRINTF("%s[%d]", regname[type], nr); } #define REG_SWIZZLE_MASK 0x7777 @@ -181,33 +181,33 @@ print_reg_neg_swizzle(struct debug_stream *stream, GLuint reg) (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; } } @@ -232,15 +232,15 @@ print_dest_reg(struct debug_stream *stream, GLuint dword) 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"); } @@ -256,29 +256,29 @@ print_arith_op(struct debug_stream *stream, 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; } @@ -288,27 +288,27 @@ print_tex_op(struct debug_stream *stream, 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"); } @@ -319,7 +319,7 @@ i915_disassemble_program(struct debug_stream *stream, GLuint size = program[0] & 0x1ff; GLint i; - PRINTF(stream, "\t\tBEGIN\n"); + PRINTF("\t\tBEGIN\n"); assert(size + 2 == sz); @@ -327,7 +327,7 @@ i915_disassemble_program(struct debug_stream *stream, 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); @@ -336,10 +336,10 @@ i915_disassemble_program(struct debug_stream *stream, 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"); }