summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-02-06 14:37:49 +0900
committerJosé Fonseca <[email protected]>2008-02-06 14:37:49 +0900
commit9791d7f64c5a58b9c1bf32d00c71e0e031f54f70 (patch)
tree8b942442af70cfe2a786aee35f250b46b9bb13f9 /src/mesa
parent78bce9c2dcd45d1d8706bb9bab3b3a73943de990 (diff)
gallium: Use p_debug.h instead of non-portable stdio.h/assert.h functions.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/draw/draw_prim.c18
-rw-r--r--src/mesa/pipe/draw/draw_vbuf.c63
-rw-r--r--src/mesa/pipe/draw/draw_vertex_fetch.c8
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader.c6
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader_llvm.c4
-rw-r--r--src/mesa/pipe/draw/draw_vf.c4
-rw-r--r--src/mesa/pipe/draw/draw_vf_generic.c3
-rw-r--r--src/mesa/pipe/draw/draw_vf_sse.c6
-rw-r--r--src/mesa/pipe/i915simple/i915_fpc_translate.c14
-rw-r--r--src/mesa/pipe/i915simple/i915_prim_vbuf.c3
-rw-r--r--src/mesa/pipe/i915simple/i915_state_derived.c2
-rw-r--r--src/mesa/pipe/i915simple/i915_state_emit.c2
-rw-r--r--src/mesa/pipe/i915simple/i915_state_immediate.c2
-rw-r--r--src/mesa/pipe/i915simple/i915_state_sampler.c2
-rw-r--r--src/mesa/pipe/i965simple/brw_cc.c2
-rw-r--r--src/mesa/pipe/i965simple/brw_curbe.c6
-rw-r--r--src/mesa/pipe/i965simple/brw_eu_debug.c10
-rw-r--r--src/mesa/pipe/i965simple/brw_eu_emit.c4
-rw-r--r--src/mesa/pipe/i965simple/brw_sf.c8
-rw-r--r--src/mesa/pipe/i965simple/brw_sf_emit.c14
-rw-r--r--src/mesa/pipe/i965simple/brw_state.c2
-rw-r--r--src/mesa/pipe/i965simple/brw_state_cache.c6
-rw-r--r--src/mesa/pipe/i965simple/brw_state_pool.c4
-rw-r--r--src/mesa/pipe/i965simple/brw_urb.c6
-rw-r--r--src/mesa/pipe/i965simple/brw_vs_emit.c2
-rw-r--r--src/mesa/pipe/i965simple/brw_wm.c2
-rw-r--r--src/mesa/pipe/i965simple/brw_wm_glsl.c2
-rw-r--r--src/mesa/pipe/i965simple/brw_wm_sampler_state.c2
-rw-r--r--src/mesa/pipe/p_compiler.h3
-rw-r--r--src/mesa/pipe/p_format.h3
-rw-r--r--src/mesa/pipe/p_util.h4
-rw-r--r--src/mesa/pipe/pipebuffer/pb_buffer.h4
-rw-r--r--src/mesa/pipe/pipebuffer/pb_buffer_fenced.c4
-rw-r--r--src/mesa/pipe/pipebuffer/pb_buffer_fenced.h2
-rw-r--r--src/mesa/pipe/pipebuffer/pb_buffer_malloc.c4
-rw-r--r--src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c4
-rw-r--r--src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c21
-rw-r--r--src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c8
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c24
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c10
-rw-r--r--src/mesa/pipe/softpipe/sp_tile_cache.c4
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.c6
-rwxr-xr-xsrc/mesa/pipe/tgsi/exec/tgsi_sse2.c44
-rw-r--r--src/mesa/pipe/tgsi/util/tgsi_build.c1
-rw-r--r--src/mesa/pipe/tgsi/util/tgsi_dump.c3
-rw-r--r--src/mesa/pipe/tgsi/util/tgsi_parse.c1
-rw-r--r--src/mesa/pipe/tgsi/util/tgsi_util.c1
47 files changed, 176 insertions, 182 deletions
diff --git a/src/mesa/pipe/draw/draw_prim.c b/src/mesa/pipe/draw/draw_prim.c
index 58400213d76..51e2242719a 100644
--- a/src/mesa/pipe/draw/draw_prim.c
+++ b/src/mesa/pipe/draw/draw_prim.c
@@ -30,6 +30,8 @@
* Keith Whitwell <[email protected]>
*/
+#include "pipe/p_debug.h"
+
#include "draw_private.h"
#include "draw_context.h"
@@ -60,8 +62,8 @@ static void draw_prim_queue_flush( struct draw_context *draw )
unsigned i;
if (0)
- fprintf(stdout,"Flushing with %d prims, %d verts\n",
- draw->pq.queue_nr, draw->vs.queue_nr);
+ debug_printf("Flushing with %d prims, %d verts\n",
+ draw->pq.queue_nr, draw->vs.queue_nr);
assert (draw->pq.queue_nr != 0);
@@ -120,9 +122,9 @@ static void draw_prim_queue_flush( struct draw_context *draw )
void draw_do_flush( struct draw_context *draw, unsigned flags )
{
if (0)
- fprintf(stdout,"Flushing with %d verts, %d prims\n",
- draw->vs.queue_nr,
- draw->pq.queue_nr );
+ debug_printf("Flushing with %d verts, %d prims\n",
+ draw->vs.queue_nr,
+ draw->pq.queue_nr );
if (flags >= DRAW_FLUSH_SHADER_QUEUE) {
@@ -157,11 +159,11 @@ static struct prim_header *get_queued_prim( struct draw_context *draw,
unsigned nr_verts )
{
if (!draw_vertex_cache_check_space( draw, nr_verts )) {
-// fprintf(stderr, "v");
+// debug_printf("v");
draw_do_flush( draw, DRAW_FLUSH_VERTEX_CACHE );
}
else if (draw->pq.queue_nr == PRIM_QUEUE_LENGTH) {
-// fprintf(stderr, "p");
+// debug_printf("p");
draw_do_flush( draw, DRAW_FLUSH_PRIM_QUEUE );
}
@@ -283,7 +285,7 @@ draw_prim( struct draw_context *draw,
boolean unfilled = (draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL);
-// _mesa_printf("%s (%d) %d/%d\n", __FUNCTION__, draw->prim, start, count );
+// debug_printf("%s (%d) %d/%d\n", __FUNCTION__, draw->prim, start, count );
switch (prim) {
case PIPE_PRIM_POINTS:
diff --git a/src/mesa/pipe/draw/draw_vbuf.c b/src/mesa/pipe/draw/draw_vbuf.c
index ac03001d8f3..be96c8fdeb1 100644
--- a/src/mesa/pipe/draw/draw_vbuf.c
+++ b/src/mesa/pipe/draw/draw_vbuf.c
@@ -34,8 +34,7 @@
*/
-#include <assert.h>
-
+#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "draw_vbuf.h"
@@ -125,55 +124,55 @@ dump_emitted_vertex(const struct vertex_info *vinfo, const uint8_t *data)
j = vinfo->src_index[i];
switch (vinfo->emit[i]) {
case EMIT_OMIT:
- fprintf(stderr, "EMIT_OMIT:");
+ debug_printf("EMIT_OMIT:");
break;
case EMIT_ALL:
assert(i == 0);
assert(j == 0);
- fprintf(stderr, "EMIT_ALL:\t");
+ debug_printf("EMIT_ALL:\t");
for(k = 0; k < vinfo->size*4; ++k)
- fprintf(stderr, "%02x ", *data++);
+ debug_printf("%02x ", *data++);
break;
case EMIT_1F:
- fprintf(stderr, "EMIT_1F:\t");
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+ debug_printf("EMIT_1F:\t");
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
break;
case EMIT_1F_PSIZE:
- fprintf(stderr, "EMIT_1F_PSIZE:\t");
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+ debug_printf("EMIT_1F_PSIZE:\t");
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
break;
case EMIT_2F:
- fprintf(stderr, "EMIT_2F:\t");
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+ debug_printf("EMIT_2F:\t");
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
break;
case EMIT_3F:
- fprintf(stderr, "EMIT_3F:\t");
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+ debug_printf("EMIT_3F:\t");
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
data += sizeof(float);
break;
case EMIT_4F:
- fprintf(stderr, "EMIT_4F:\t");
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
- fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+ debug_printf("EMIT_4F:\t");
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
+ debug_printf("%f ", *(float *)data); data += sizeof(float);
break;
case EMIT_4UB:
- fprintf(stderr, "EMIT_4UB:\t");
- fprintf(stderr, "%u ", *data++);
- fprintf(stderr, "%u ", *data++);
- fprintf(stderr, "%u ", *data++);
- fprintf(stderr, "%u ", *data++);
+ debug_printf("EMIT_4UB:\t");
+ debug_printf("%u ", *data++);
+ debug_printf("%u ", *data++);
+ debug_printf("%u ", *data++);
+ debug_printf("%u ", *data++);
break;
default:
assert(0);
}
- fprintf(stderr, "\n");
+ debug_printf("\n");
}
- fprintf(stderr, "\n");
+ debug_printf("\n");
}
#endif
@@ -190,7 +189,7 @@ emit_vertex( struct vbuf_stage *vbuf,
struct vertex_header *vertex )
{
#if 0
- fprintf(stderr, "emit vertex %d to %p\n",
+ debug_printf("emit vertex %d to %p\n",
vbuf->nr_vertices, vbuf->vertex_ptr);
#endif
@@ -198,7 +197,7 @@ emit_vertex( struct vbuf_stage *vbuf,
if(vertex->vertex_id < vbuf->nr_vertices)
return;
else
- fprintf(stderr, "Bad vertex id 0x%04x (>= 0x%04x)\n",
+ debug_printf("Bad vertex id 0x%04x (>= 0x%04x)\n",
vertex->vertex_id, vbuf->nr_vertices);
return;
}
@@ -269,9 +268,9 @@ emit_vertex( struct vbuf_stage *vbuf,
static float data[256];
draw_vf_emit_vertex(vbuf->vf, vertex, data);
if(memcmp((uint8_t *)vbuf->vertex_ptr - vbuf->vertex_size, data, vbuf->vertex_size)) {
- fprintf(stderr, "With VF:\n");
+ debug_printf("With VF:\n");
dump_emitted_vertex(vbuf->vinfo, (uint8_t *)data);
- fprintf(stderr, "Without VF:\n");
+ debug_printf("Without VF:\n");
dump_emitted_vertex(vbuf->vinfo, (uint8_t *)vbuf->vertex_ptr - vbuf->vertex_size);
assert(0);
}
diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/mesa/pipe/draw/draw_vertex_fetch.c
index b23f487e741..e13df04605c 100644
--- a/src/mesa/pipe/draw/draw_vertex_fetch.c
+++ b/src/mesa/pipe/draw/draw_vertex_fetch.c
@@ -162,7 +162,7 @@ static fetch_func get_fetch_func( enum pipe_format format )
{
char tmp[80];
pf_sprint_name(tmp, format);
- _mesa_printf("%s: %s\n", __FUNCTION__, tmp);
+ debug_printf("%s: %s\n", __FUNCTION__, tmp);
}
#endif
@@ -332,7 +332,7 @@ static void fetch_xyz_rgb( struct draw_context *draw,
assert(count <= 4);
-// _mesa_printf("%s\n", __FUNCTION__);
+// debug_printf("%s\n", __FUNCTION__);
/* loop over vertex attributes (vertex shader inputs)
*/
@@ -421,7 +421,7 @@ static void generic_vertex_fetch( struct draw_context *draw,
assert(count <= 4);
-// _mesa_printf("%s %d\n", __FUNCTION__, count);
+// debug_printf("%s %d\n", __FUNCTION__, count);
/* loop over vertex attributes (vertex shader inputs)
*/
@@ -467,7 +467,7 @@ void draw_update_vertex_fetch( struct draw_context *draw )
{
unsigned nr_attrs, i;
-// _mesa_printf("%s\n", __FUNCTION__);
+// debug_printf("%s\n", __FUNCTION__);
/* this may happend during context init */
if (!draw->vertex_shader)
diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c
index b851da845f0..e6590eafcc8 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader.c
+++ b/src/mesa/pipe/draw/draw_vertex_shader.c
@@ -166,7 +166,7 @@ run_vertex_program(struct draw_context *draw,
vOut[j]->data[0][3] = w;
#if DBG_VS
- printf("output[%d]win: %f %f %f %f\n", j,
+ debug_printf("output[%d]win: %f %f %f %f\n", j,
vOut[j]->data[0][0],
vOut[j]->data[0][1],
vOut[j]->data[0][2],
@@ -181,7 +181,7 @@ run_vertex_program(struct draw_context *draw,
vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
#if DBG_VS
- printf("output[%d][%d]: %f %f %f %f\n", j, slot,
+ debug_printf("output[%d][%d]: %f %f %f %f\n", j, slot,
vOut[j]->data[slot][0],
vOut[j]->data[slot][1],
vOut[j]->data[slot][2],
@@ -207,7 +207,7 @@ draw_vertex_shader_queue_flush(struct draw_context *draw)
*/
draw_update_vertex_fetch( draw );
-// fprintf(stderr, " q(%d) ", draw->vs.queue_nr );
+// debug_printf( " q(%d) ", draw->vs.queue_nr );
#ifdef MESA_LLVM
if (draw->vertex_shader->llvm_prog) {
draw_vertex_shader_queue_flush_llvm(draw);
diff --git a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c
index 4228c4f3889..63551c993e7 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c
+++ b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c
@@ -152,7 +152,7 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw)
z = vOut->clip[2] = dests[0][2];
w = vOut->clip[3] = dests[0][3];
#if DBG
- printf("output %d: %f %f %f %f\n", 0, x, y, z, w);
+ debug_printf("output %d: %f %f %f %f\n", 0, x, y, z, w);
#endif
vOut->clipmask = compute_clipmask(vOut->clip, draw->plane, draw->nr_planes);
@@ -179,7 +179,7 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw)
vOut->data[slot][3] = dests[slot][3];
#if DBG
- printf("output %d: %f %f %f %f\n", slot,
+ debug_printf("output %d: %f %f %f %f\n", slot,
vOut->data[slot][0],
vOut->data[slot][1],
vOut->data[slot][2],
diff --git a/src/mesa/pipe/draw/draw_vf.c b/src/mesa/pipe/draw/draw_vf.c
index 0da8e59ad68..f23d7fcec5c 100644
--- a/src/mesa/pipe/draw/draw_vf.c
+++ b/src/mesa/pipe/draw/draw_vf.c
@@ -168,7 +168,7 @@ draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
const unsigned format = map[i].format;
if (format == DRAW_EMIT_PAD) {
#if (DRAW_VF_DBG)
- _mesa_printf("%d: pad %d, offset %d\n", i,
+ debug_printf("%d: pad %d, offset %d\n", i,
map[i].offset, offset);
#endif
@@ -186,7 +186,7 @@ draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
memcpy(vf->attr[j].data, &map[i].data, vf->attr[j].vertattrsize);
#if (DRAW_VF_DBG)
- _mesa_printf("%d: %s, offset %d\n", i,
+ debug_printf("%d: %s, offset %d\n", i,
draw_vf_format_info[format].name,
vf->attr[j].vertoffset);
#endif
diff --git a/src/mesa/pipe/draw/draw_vf_generic.c b/src/mesa/pipe/draw/draw_vf_generic.c
index 7f5f56ef9cc..7a60a9db9c3 100644
--- a/src/mesa/pipe/draw/draw_vf_generic.c
+++ b/src/mesa/pipe/draw/draw_vf_generic.c
@@ -27,9 +27,8 @@
*/
-#include <assert.h>
-
#include "pipe/p_compiler.h"
+#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "draw_vf.h"
diff --git a/src/mesa/pipe/draw/draw_vf_sse.c b/src/mesa/pipe/draw/draw_vf_sse.c
index 1389e6cfb9c..1ad2ae756dd 100644
--- a/src/mesa/pipe/draw/draw_vf_sse.c
+++ b/src/mesa/pipe/draw/draw_vf_sse.c
@@ -453,7 +453,7 @@ static boolean build_vertex_emit( struct x86_program *p )
update_src_ptr(p, srcECX, vfESI, a);
}
else {
- fprintf(stderr, "Can't emit 1ub %x %x %d\n",
+ debug_printf("Can't emit 1ub %x %x %d\n",
a->vertoffset, a[-1].vertoffset, a[-1].vertattrsize );
return FALSE;
}
@@ -499,7 +499,7 @@ static boolean build_vertex_emit( struct x86_program *p )
j++; /* NOTE: two attrs consumed */
}
else {
- fprintf(stderr, "Can't emit 3ub\n");
+ debug_printf("Can't emit 3ub\n");
}
return FALSE; /* add this later */
break;
@@ -532,7 +532,7 @@ static boolean build_vertex_emit( struct x86_program *p )
update_src_ptr(p, srcECX, vfESI, a);
break;
default:
- fprintf(stderr, "unknown a[%d].format %d\n", j, a->format);
+ debug_printf("unknown a[%d].format %d\n", j, a->format);
return FALSE; /* catch any new opcodes */
}
diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/mesa/pipe/i915simple/i915_fpc_translate.c
index 0185512aeb8..868f0c7e046 100644
--- a/src/mesa/pipe/i915simple/i915_fpc_translate.c
+++ b/src/mesa/pipe/i915simple/i915_fpc_translate.c
@@ -100,7 +100,7 @@ negate(int reg, int x, int y, int z, int w)
static void
i915_use_passthrough_shader(struct i915_context *i915)
{
- fprintf(stderr, "**** Using i915 pass-through fragment shader\n");
+ debug_printf("**** Using i915 pass-through fragment shader\n");
i915->current.program = (uint *) MALLOC(sizeof(passthrough));
if (i915->current.program) {
@@ -119,12 +119,12 @@ i915_program_error(struct i915_fp_compile *p, const char *msg, ...)
va_list args;
char buffer[1024];
- fprintf(stderr, "i915_program_error: ");
+ debug_printf("i915_program_error: ");
va_start( args, msg );
vsprintf( buffer, msg, args );
va_end( args );
- fprintf(stderr, buffer);
- fprintf(stderr, "\n");
+ debug_printf(buffer);
+ debug_printf("\n");
p->error = 1;
}
@@ -169,7 +169,7 @@ src_vector(struct i915_fp_compile *p,
switch (sem_name) {
case TGSI_SEMANTIC_POSITION:
- fprintf(stderr, "SKIP SEM POS\n");
+ debug_printf("SKIP SEM POS\n");
/*
assert(p->wpos_tex != -1);
src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL);
@@ -913,7 +913,7 @@ i915_translate_instructions(struct i915_fp_compile *p,
ind = parse.FullToken.FullDeclaration.u.DeclarationRange.First;
sem = parse.FullToken.FullDeclaration.Semantic.SemanticName;
semi = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
- /*printf("FS Input DECL [%u] sem %u\n", ind, sem);*/
+ /*debug_printf("FS Input DECL [%u] sem %u\n", ind, sem);*/
p->input_semantic_name[ind] = sem;
p->input_semantic_index[ind] = semi;
}
@@ -924,7 +924,7 @@ i915_translate_instructions(struct i915_fp_compile *p,
ind = parse.FullToken.FullDeclaration.u.DeclarationRange.First;
sem = parse.FullToken.FullDeclaration.Semantic.SemanticName;
semi = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
- /*printf("FS Output DECL [%u] sem %u\n", ind, sem);*/
+ /*debug_printf("FS Output DECL [%u] sem %u\n", ind, sem);*/
p->output_semantic_name[ind] = sem;
p->output_semantic_index[ind] = semi;
}
diff --git a/src/mesa/pipe/i915simple/i915_prim_vbuf.c b/src/mesa/pipe/i915simple/i915_prim_vbuf.c
index 39154b2488b..e069773fd4e 100644
--- a/src/mesa/pipe/i915simple/i915_prim_vbuf.c
+++ b/src/mesa/pipe/i915simple/i915_prim_vbuf.c
@@ -38,9 +38,8 @@
*/
-#include <assert.h>
-
#include "pipe/draw/draw_vbuf.h"
+#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c
index 62741e30f80..653983e4a99 100644
--- a/src/mesa/pipe/i915simple/i915_state_derived.c
+++ b/src/mesa/pipe/i915simple/i915_state_derived.c
@@ -87,7 +87,7 @@ static void calculate_vertex_layout( struct i915_context *i915 )
}
break;
case TGSI_SEMANTIC_FOG:
- fprintf(stderr, "i915 fogcoord not implemented yet\n");
+ debug_printf("i915 fogcoord not implemented yet\n");
draw_emit_vertex_attr(&vinfo, EMIT_1F, INTERP_PERSPECTIVE, src++);
break;
default:
diff --git a/src/mesa/pipe/i915simple/i915_state_emit.c b/src/mesa/pipe/i915simple/i915_state_emit.c
index 657f5238938..3339287f498 100644
--- a/src/mesa/pipe/i915simple/i915_state_emit.c
+++ b/src/mesa/pipe/i915simple/i915_state_emit.c
@@ -107,7 +107,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
) * 3/2; /* plus 50% margin */
#if 0
- fprintf (stderr, "i915_emit_hardware_state: %d dwords, %d relocs\n", dwords, relocs);
+ debug_printf("i915_emit_hardware_state: %d dwords, %d relocs\n", dwords, relocs);
#endif
if(!BEGIN_BATCH(dwords, relocs)) {
diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/mesa/pipe/i915simple/i915_state_immediate.c
index 752d25f2331..07031fc6c5b 100644
--- a/src/mesa/pipe/i915simple/i915_state_immediate.c
+++ b/src/mesa/pipe/i915simple/i915_state_immediate.c
@@ -97,7 +97,7 @@ static void upload_S2S4(struct i915_context *i915)
LIS2 = i915->current.vertex_info.hwfmt[1];
LIS4 = i915->current.vertex_info.hwfmt[0];
/*
- printf("LIS2: 0x%x LIS4: 0x%x\n", LIS2, LIS4);
+ debug_printf("LIS2: 0x%x LIS4: 0x%x\n", LIS2, LIS4);
*/
assert(LIS4); /* should never be zero? */
}
diff --git a/src/mesa/pipe/i915simple/i915_state_sampler.c b/src/mesa/pipe/i915simple/i915_state_sampler.c
index 59408b6ba06..0dbbc5241d5 100644
--- a/src/mesa/pipe/i915simple/i915_state_sampler.c
+++ b/src/mesa/pipe/i915simple/i915_state_sampler.c
@@ -169,7 +169,7 @@ translate_texture_format(enum pipe_format pipeFormat)
case PIPE_FORMAT_S8Z24_UNORM:
return (MAPSURF_32BIT | MT_32BIT_xL824);
default:
- fprintf(stderr, "i915: translate_texture_format() bad image format %x\n",
+ debug_printf("i915: translate_texture_format() bad image format %x\n",
pipeFormat);
assert(0);
return 0;
diff --git a/src/mesa/pipe/i965simple/brw_cc.c b/src/mesa/pipe/i965simple/brw_cc.c
index dcee7318958..337e4f95f69 100644
--- a/src/mesa/pipe/i965simple/brw_cc.c
+++ b/src/mesa/pipe/i965simple/brw_cc.c
@@ -58,7 +58,7 @@ static int brw_translate_compare_func(int func)
return BRW_COMPAREFUNCTION_ALWAYS;
}
- fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, func);
+ debug_printf("Unknown value in %s: %x\n", __FUNCTION__, func);
return BRW_COMPAREFUNCTION_ALWAYS;
}
diff --git a/src/mesa/pipe/i965simple/brw_curbe.c b/src/mesa/pipe/i965simple/brw_curbe.c
index 2733eb4e75c..52bbd525c16 100644
--- a/src/mesa/pipe/i965simple/brw_curbe.c
+++ b/src/mesa/pipe/i965simple/brw_curbe.c
@@ -273,10 +273,10 @@ static void upload_constant_buffer(struct brw_context *brw)
if (1) {
for (i = 0; i < sz; i+=4)
- _mesa_printf("curbe %d.%d: %f %f %f %f\n", i/8, i&4,
+ debug_printf("curbe %d.%d: %f %f %f %f\n", i/8, i&4,
buf[i+0], buf[i+1], buf[i+2], buf[i+3]);
- _mesa_printf("last_buf %p buf %p sz %d/%d cmp %d\n",
+ debug_printf("last_buf %p buf %p sz %d/%d cmp %d\n",
brw->curbe.last_buf, buf,
bufsz, brw->curbe.last_bufsz,
brw->curbe.last_buf ? memcmp(buf, brw->curbe.last_buf, bufsz) : -1);
@@ -299,7 +299,7 @@ static void upload_constant_buffer(struct brw_context *brw)
bufsz,
1 << 6,
&brw->curbe.gs_offset)) {
- _mesa_printf("out of GS memory for curbe\n");
+ debug_printf("out of GS memory for curbe\n");
assert(0);
return;
}
diff --git a/src/mesa/pipe/i965simple/brw_eu_debug.c b/src/mesa/pipe/i965simple/brw_eu_debug.c
index be692f65022..4a94ddefa6a 100644
--- a/src/mesa/pipe/i965simple/brw_eu_debug.c
+++ b/src/mesa/pipe/i965simple/brw_eu_debug.c
@@ -30,6 +30,8 @@
*/
+#include "pipe/p_debug.h"
+
#include "brw_eu.h"
void brw_print_reg( struct brw_reg hwreg )
@@ -52,7 +54,7 @@ void brw_print_reg( struct brw_reg hwreg )
"f"
};
- _mesa_printf("%s%s",
+ debug_printf("%s%s",
hwreg.abs ? "abs/" : "",
hwreg.negate ? "-" : "");
@@ -63,17 +65,17 @@ void brw_print_reg( struct brw_reg hwreg )
hwreg.width == BRW_WIDTH_8 &&
hwreg.hstride == BRW_HORIZONTAL_STRIDE_1 &&
hwreg.type == BRW_REGISTER_TYPE_F) {
- _mesa_printf("vec%d", hwreg.nr);
+ debug_printf("vec%d", hwreg.nr);
}
else if (hwreg.file == BRW_GENERAL_REGISTER_FILE &&
hwreg.vstride == BRW_VERTICAL_STRIDE_0 &&
hwreg.width == BRW_WIDTH_1 &&
hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 &&
hwreg.type == BRW_REGISTER_TYPE_F) {
- _mesa_printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4);
+ debug_printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4);
}
else {
- _mesa_printf("%s%d.%d<%d;%d,%d>:%s",
+ debug_printf("%s%d.%d<%d;%d,%d>:%s",
file[hwreg.file],
hwreg.nr,
hwreg.subnr / type_sz(hwreg.type),
diff --git a/src/mesa/pipe/i965simple/brw_eu_emit.c b/src/mesa/pipe/i965simple/brw_eu_emit.c
index 2423536dd19..400a80b6fba 100644
--- a/src/mesa/pipe/i965simple/brw_eu_emit.c
+++ b/src/mesa/pipe/i965simple/brw_eu_emit.c
@@ -953,7 +953,7 @@ void brw_SAMPLE(struct brw_compile *p,
boolean need_stall = 0;
if(writemask == 0) {
-/* _mesa_printf("%s: zero writemask??\n", __FUNCTION__); */
+/* debug_printf("%s: zero writemask??\n", __FUNCTION__); */
return;
}
@@ -985,7 +985,7 @@ void brw_SAMPLE(struct brw_compile *p,
if (newmask != writemask) {
need_stall = 1;
-/* _mesa_printf("need stall %x %x\n", newmask , writemask); */
+/* debug_printf("need stall %x %x\n", newmask , writemask); */
}
else {
struct brw_reg m1 = brw_message_reg(msg_reg_nr);
diff --git a/src/mesa/pipe/i965simple/brw_sf.c b/src/mesa/pipe/i965simple/brw_sf.c
index b89b2e40875..7c83b81c858 100644
--- a/src/mesa/pipe/i965simple/brw_sf.c
+++ b/src/mesa/pipe/i965simple/brw_sf.c
@@ -175,7 +175,7 @@ static void upload_sf_prog( struct brw_context *brw )
//int semantic = parse.FullToken.FullDeclaration.Semantic.SemanticName;
//int semantic_index = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
- fprintf(stderr, "fs input %d..%d interp mode %d\n", first, last, interp_mode);
+ debug_printf("fs input %d..%d interp mode %d\n", first, last, interp_mode);
switch (interp_mode) {
case TGSI_INTERPOLATE_CONSTANT:
@@ -213,9 +213,9 @@ static void upload_sf_prog( struct brw_context *brw )
key.linear_mask |= 1;
key.const_mask <<= 1;
- fprintf(stderr, "key.persp_mask: %x\n", key.persp_mask);
- fprintf(stderr, "key.linear_mask: %x\n", key.linear_mask);
- fprintf(stderr, "key.const_mask: %x\n", key.const_mask);
+ debug_printf("key.persp_mask: %x\n", key.persp_mask);
+ debug_printf("key.linear_mask: %x\n", key.linear_mask);
+ debug_printf("key.const_mask: %x\n", key.const_mask);
// key.do_point_sprite = brw->attribs.Point->PointSprite;
diff --git a/src/mesa/pipe/i965simple/brw_sf_emit.c b/src/mesa/pipe/i965simple/brw_sf_emit.c
index 6ff5254ff73..78d6fa5e9e5 100644
--- a/src/mesa/pipe/i965simple/brw_sf_emit.c
+++ b/src/mesa/pipe/i965simple/brw_sf_emit.c
@@ -137,8 +137,8 @@ static boolean calculate_masks( struct brw_sf_compile *c,
unsigned persp_mask = c->key.persp_mask;
unsigned linear_mask = c->key.linear_mask;
- fprintf(stderr, "persp_mask: %x\n", persp_mask);
- fprintf(stderr, "linear_mask: %x\n", linear_mask);
+ debug_printf("persp_mask: %x\n", persp_mask);
+ debug_printf("linear_mask: %x\n", linear_mask);
*pc_persp = 0;
*pc_linear = 0;
@@ -162,9 +162,9 @@ static boolean calculate_masks( struct brw_sf_compile *c,
*pc_linear |= 0xf0;
}
- fprintf(stderr, "pc: %x\n", *pc);
- fprintf(stderr, "pc_persp: %x\n", *pc_persp);
- fprintf(stderr, "pc_linear: %x\n", *pc_linear);
+ debug_printf("pc: %x\n", *pc);
+ debug_printf("pc_persp: %x\n", *pc_persp);
+ debug_printf("pc_linear: %x\n", *pc_linear);
return is_last_attr;
@@ -177,7 +177,7 @@ void brw_emit_tri_setup( struct brw_sf_compile *c )
struct brw_compile *p = &c->func;
unsigned i;
- fprintf(stderr, "%s START ==============\n", __FUNCTION__);
+ debug_printf("%s START ==============\n", __FUNCTION__);
c->nr_verts = 3;
alloc_regs(c);
@@ -250,7 +250,7 @@ void brw_emit_tri_setup( struct brw_sf_compile *c )
}
}
- fprintf(stderr, "%s DONE ==============\n", __FUNCTION__);
+ debug_printf("%s DONE ==============\n", __FUNCTION__);
}
diff --git a/src/mesa/pipe/i965simple/brw_state.c b/src/mesa/pipe/i965simple/brw_state.c
index daf14ff4ff2..95dfce88e4a 100644
--- a/src/mesa/pipe/i965simple/brw_state.c
+++ b/src/mesa/pipe/i965simple/brw_state.c
@@ -225,7 +225,7 @@ static void brw_bind_vs_state(struct pipe_context *pipe, void *vs)
brw->attribs.VertexProgram = (struct brw_vertex_program *)vs;
brw->state.dirty.brw |= BRW_NEW_VS;
- printf("YYYYYYYYYYYYY BINDING VERTEX SHADER\n");
+ debug_printf("YYYYYYYYYYYYY BINDING VERTEX SHADER\n");
}
static void brw_delete_vs_state(struct pipe_context *pipe, void *shader)
diff --git a/src/mesa/pipe/i965simple/brw_state_cache.c b/src/mesa/pipe/i965simple/brw_state_cache.c
index c5738733f4e..b3a5124461d 100644
--- a/src/mesa/pipe/i965simple/brw_state_cache.c
+++ b/src/mesa/pipe/i965simple/brw_state_cache.c
@@ -149,7 +149,7 @@ unsigned brw_upload_cache( struct brw_cache *cache,
if (!brw_pool_alloc(cache->pool, data_size, 1 << 6, &offset)) {
/* Should not be possible:
*/
- printf("brw_pool_alloc failed\n");
+ debug_printf("brw_pool_alloc failed\n");
exit(1);
}
@@ -177,7 +177,7 @@ unsigned brw_upload_cache( struct brw_cache *cache,
}
if (BRW_DEBUG & DEBUG_STATE)
- printf("upload %s: %d bytes to pool buffer %p offset %x\n",
+ debug_printf("upload %s: %d bytes to pool buffer %p offset %x\n",
cache->name,
data_size,
(void*)cache->pool->buffer,
@@ -416,7 +416,7 @@ void brw_clear_all_caches( struct brw_context *brw )
int i;
if (BRW_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
+ debug_printf("%s\n", __FUNCTION__);
for (i = 0; i < BRW_MAX_CACHE; i++)
clear_cache(&brw->cache[i]);
diff --git a/src/mesa/pipe/i965simple/brw_state_pool.c b/src/mesa/pipe/i965simple/brw_state_pool.c
index 7c67f0ee25d..f3174bfe0ae 100644
--- a/src/mesa/pipe/i965simple/brw_state_pool.c
+++ b/src/mesa/pipe/i965simple/brw_state_pool.c
@@ -58,7 +58,7 @@ boolean brw_pool_alloc( struct brw_mem_pool *pool,
size = align(size, 4);
if (pool->offset + fixup + size >= pool->size) {
- printf("%s failed\n", __FUNCTION__);
+ debug_printf("%s failed\n", __FUNCTION__);
assert(0);
exit(0);
}
@@ -74,7 +74,7 @@ static
void brw_invalidate_pool( struct brw_mem_pool *pool )
{
if (BRW_DEBUG & DEBUG_STATE)
- printf("\n\n\n %s \n\n\n", __FUNCTION__);
+ debug_printf("\n\n\n %s \n\n\n", __FUNCTION__);
pool->offset = 0;
diff --git a/src/mesa/pipe/i965simple/brw_urb.c b/src/mesa/pipe/i965simple/brw_urb.c
index b284526aa6e..101a4367b90 100644
--- a/src/mesa/pipe/i965simple/brw_urb.c
+++ b/src/mesa/pipe/i965simple/brw_urb.c
@@ -120,18 +120,18 @@ static void recalculate_urb_fence( struct brw_context *brw )
* entries and the values for minimum nr of entries
* provided above.
*/
- fprintf(stderr, "couldn't calculate URB layout!\n");
+ debug_printf("couldn't calculate URB layout!\n");
exit(1);
}
if (BRW_DEBUG & (DEBUG_URB|DEBUG_FALLBACKS))
- printf("URB CONSTRAINED\n");
+ debug_printf("URB CONSTRAINED\n");
}
else
brw->urb.constrained = 0;
if (BRW_DEBUG & DEBUG_URB)
- printf("URB fence: %d ..VS.. %d ..GS.. %d ..CLP.. %d ..SF.. %d ..CS.. %d\n",
+ debug_printf("URB fence: %d ..VS.. %d ..GS.. %d ..CLP.. %d ..SF.. %d ..CS.. %d\n",
brw->urb.vs_start,
brw->urb.gs_start,
brw->urb.clip_start,
diff --git a/src/mesa/pipe/i965simple/brw_vs_emit.c b/src/mesa/pipe/i965simple/brw_vs_emit.c
index b32c233dd22..98915ba1016 100644
--- a/src/mesa/pipe/i965simple/brw_vs_emit.c
+++ b/src/mesa/pipe/i965simple/brw_vs_emit.c
@@ -1228,7 +1228,7 @@ static void process_instruction(struct brw_vs_compile *c,
case TGSI_OPCODE_ENDSUB:
break;
default:
- printf("Unsupport opcode %d in vertex shader\n", inst->Instruction.Opcode);
+ debug_printf("Unsupport opcode %d in vertex shader\n", inst->Instruction.Opcode);
break;
}
diff --git a/src/mesa/pipe/i965simple/brw_wm.c b/src/mesa/pipe/i965simple/brw_wm.c
index 0ee0fbed511..539b1707444 100644
--- a/src/mesa/pipe/i965simple/brw_wm.c
+++ b/src/mesa/pipe/i965simple/brw_wm.c
@@ -57,7 +57,7 @@ static void do_wm_prog( struct brw_context *brw,
c->pixel_w = brw_null_reg();
- fprintf(stderr, "XXXXXXXX FP\n");
+ debug_printf("XXXXXXXX FP\n");
brw_wm_glsl_emit(c);
diff --git a/src/mesa/pipe/i965simple/brw_wm_glsl.c b/src/mesa/pipe/i965simple/brw_wm_glsl.c
index f4b5c13c069..d95645d1085 100644
--- a/src/mesa/pipe/i965simple/brw_wm_glsl.c
+++ b/src/mesa/pipe/i965simple/brw_wm_glsl.c
@@ -982,7 +982,7 @@ static void brw_wm_emit_instruction( struct brw_wm_compile *c,
break;
default:
- _mesa_printf("unsupported IR in fragment shader %d\n",
+ debug_printf("unsupported IR in fragment shader %d\n",
inst->Instruction.Opcode);
}
#if 0
diff --git a/src/mesa/pipe/i965simple/brw_wm_sampler_state.c b/src/mesa/pipe/i965simple/brw_wm_sampler_state.c
index cfb430eb09c..de42ffc5b1e 100644
--- a/src/mesa/pipe/i965simple/brw_wm_sampler_state.c
+++ b/src/mesa/pipe/i965simple/brw_wm_sampler_state.c
@@ -71,7 +71,7 @@ static int intel_translate_shadow_compare_func(unsigned func)
return COMPAREFUNC_NEVER;
}
- fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, func);
+ debug_printf("Unknown value in %s: %x\n", __FUNCTION__, func);
return COMPAREFUNC_NEVER;
}
diff --git a/src/mesa/pipe/p_compiler.h b/src/mesa/pipe/p_compiler.h
index e939d9cd9b9..30cd729c564 100644
--- a/src/mesa/pipe/p_compiler.h
+++ b/src/mesa/pipe/p_compiler.h
@@ -28,10 +28,9 @@
#ifndef P_COMPILER_H
#define P_COMPILER_H
-#include <assert.h>
+
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
#if defined(_WIN32) && !defined(__WIN32__)
diff --git a/src/mesa/pipe/p_format.h b/src/mesa/pipe/p_format.h
index 9f60cdbb04d..c9ad3243158 100644
--- a/src/mesa/pipe/p_format.h
+++ b/src/mesa/pipe/p_format.h
@@ -28,7 +28,10 @@
#ifndef PIPE_FORMAT_H
#define PIPE_FORMAT_H
+#include <stdio.h> // for sprintf
+
#include "p_compiler.h"
+#include "p_debug.h"
/**
* The PIPE_FORMAT is a 32-bit wide bitfield that encodes all the information
diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h
index 059528787d6..4780ed78184 100644
--- a/src/mesa/pipe/p_util.h
+++ b/src/mesa/pipe/p_util.h
@@ -381,10 +381,6 @@ static INLINE int align(int value, int alignment)
return (value + alignment - 1) & ~(alignment - 1);
}
-/* Convenient...
- */
-extern void _mesa_printf(const char *str, ...);
-
/* util/p_util.c
*/
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer.h b/src/mesa/pipe/pipebuffer/pb_buffer.h
index 17551b3b50e..97beb5f72a9 100644
--- a/src/mesa/pipe/pipebuffer/pb_buffer.h
+++ b/src/mesa/pipe/pipebuffer/pb_buffer.h
@@ -44,10 +44,8 @@
#define PB_BUFFER_H_
-#include <assert.h>
-#include <stdlib.h>
-
#include "pipe/p_compiler.h"
+#include "pipe/p_debug.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.c b/src/mesa/pipe/pipebuffer/pb_buffer_fenced.c
index 4cf4222db9d..f4fc3f6d714 100644
--- a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.c
+++ b/src/mesa/pipe/pipebuffer/pb_buffer_fenced.c
@@ -34,12 +34,10 @@
*/
-#include <assert.h>
-#include <stdlib.h>
-
#include "linked_list.h"
#include "p_compiler.h"
+#include "p_debug.h"
#include "p_winsys.h"
#include "p_thread.h"
#include "p_util.h"
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.h b/src/mesa/pipe/pipebuffer/pb_buffer_fenced.h
index 09082a53909..c40b9c75e18 100644
--- a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.h
+++ b/src/mesa/pipe/pipebuffer/pb_buffer_fenced.h
@@ -51,7 +51,7 @@
#define PB_BUFFER_FENCED_H_
-#include <assert.h>
+#include "pipe/p_debug.h"
struct pipe_winsys;
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c b/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c
index 2151f1d691e..c1b7759874c 100644
--- a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c
+++ b/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c
@@ -34,9 +34,7 @@
*/
-#include <assert.h>
-#include <stdlib.h>
-
+#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "pb_buffer.h"
diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c b/src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c
index 3b341c64c28..c535d3276c9 100644
--- a/src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c
+++ b/src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c
@@ -34,9 +34,7 @@
*/
-#include <assert.h>
-#include <stdlib.h>
-
+#include "p_debug.h"
#include "p_util.h"
#include "pb_buffer.h"
diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c b/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c
index b6af7cdedc2..8b1b51c0e28 100644
--- a/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c
+++ b/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c
@@ -34,11 +34,10 @@
*/
-#include <assert.h>
-
#include "linked_list.h"
#include "p_defines.h"
+#include "p_debug.h"
#include "p_thread.h"
#include "p_util.h"
#include "pb_buffer.h"
@@ -69,28 +68,28 @@ struct mem_block
static void
mmDumpMemInfo(const struct mem_block *heap)
{
- fprintf(stderr, "Memory heap %p:\n", (void *)heap);
+ debug_printf("Memory heap %p:\n", (void *)heap);
if (heap == 0) {
- fprintf(stderr, " heap == 0\n");
+ debug_printf(" heap == 0\n");
} else {
const struct mem_block *p;
for(p = heap->next; p != heap; p = p->next) {
- fprintf(stderr, " Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
+ debug_printf(" Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
p->free ? 'F':'.',
p->reserved ? 'R':'.');
}
- fprintf(stderr, "\nFree list:\n");
+ debug_printf("\nFree list:\n");
for(p = heap->next_free; p != heap; p = p->next_free) {
- fprintf(stderr, " FREE Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
+ debug_printf(" FREE Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
p->free ? 'F':'.',
p->reserved ? 'R':'.');
}
}
- fprintf(stderr, "End of memory blocks\n");
+ debug_printf("End of memory blocks\n");
}
#endif
@@ -308,11 +307,11 @@ mmFreeMem(struct mem_block *b)
return 0;
if (b->free) {
- fprintf(stderr, "block already free\n");
+ debug_printf("block already free\n");
return -1;
}
if (b->reserved) {
- fprintf(stderr, "block is reserved\n");
+ debug_printf("block is reserved\n");
return -1;
}
@@ -479,7 +478,7 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
mm_buf->block = mmAllocMem(mm->heap, size, mm->align2, 0);
if(!mm_buf->block) {
- fprintf(stderr, "warning: heap full\n");
+ debug_printf("warning: heap full\n");
#if 0
mmDumpMemInfo(mm->heap);
#endif
diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c b/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c
index f80c7e34c07..bcd4b3e2571 100644
--- a/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c
+++ b/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c
@@ -35,12 +35,10 @@
*/
-#include <assert.h>
-#include <stdlib.h>
-
#include "linked_list.h"
#include "p_compiler.h"
+#include "p_debug.h"
#include "p_thread.h"
#include "p_defines.h"
#include "p_util.h"
@@ -178,7 +176,7 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr,
if (pool->numFree == 0) {
_glthread_UNLOCK_MUTEX(pool->mutex);
- fprintf(stderr, "warning: out of fixed size buffer objects\n");
+ debug_printf("warning: out of fixed size buffer objects\n");
return NULL;
}
@@ -186,7 +184,7 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr,
if (item == &pool->free) {
_glthread_UNLOCK_MUTEX(pool->mutex);
- fprintf(stderr, "error: fixed size buffer pool corruption\n");
+ debug_printf("error: fixed size buffer pool corruption\n");
return NULL;
}
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index b17801d13da..7478b2336b6 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -251,9 +251,9 @@ static void print_vertex(const struct setup_stage *setup,
const struct vertex_header *v)
{
int i;
- fprintf(stderr, "Vertex: (%p)\n", v);
+ debug_printf("Vertex: (%p)\n", v);
for (i = 0; i < setup->quad.nr_attrs; i++) {
- fprintf(stderr, " %d: %f %f %f %f\n", i,
+ debug_printf(" %d: %f %f %f %f\n", i,
v->data[i][0], v->data[i][1], v->data[i][2], v->data[i][3]);
}
}
@@ -267,7 +267,7 @@ static boolean setup_sort_vertices( struct setup_stage *setup,
const struct vertex_header *v2 = prim->v[2];
#if DEBUG_VERTS
- fprintf(stderr, "Triangle:\n");
+ debug_printf("Triangle:\n");
print_vertex(setup, v0);
print_vertex(setup, v1);
print_vertex(setup, v2);
@@ -345,7 +345,7 @@ static boolean setup_sort_vertices( struct setup_stage *setup,
setup->oneoverarea = 1.0f / area;
/*
- _mesa_printf("%s one-over-area %f area %f det %f\n",
+ debug_printf("%s one-over-area %f area %f det %f\n",
__FUNCTION__, setup->oneoverarea, area, prim->det );
*/
}
@@ -419,7 +419,7 @@ static void tri_linear_coeff( struct setup_stage *setup,
dady * (setup->vmin->data[0][1] - 0.5f)));
/*
- _mesa_printf("attr[%d].%c: %f dx:%f dy:%f\n",
+ debug_printf("attr[%d].%c: %f dx:%f dy:%f\n",
slot, "xyzw"[i],
setup->coef[slot].a0[i],
setup->coef[slot].dadx[i],
@@ -453,10 +453,10 @@ static void tri_persp_coeff( struct setup_stage *setup,
float dady = b * setup->oneoverarea;
/*
- printf("tri persp %d,%d: %f %f %f\n", vertSlot, i,
- setup->vmin->data[vertSlot][i],
- setup->vmid->data[vertSlot][i],
- setup->vmax->data[vertSlot][i]
+ debug_printf("tri persp %d,%d: %f %f %f\n", vertSlot, i,
+ setup->vmin->data[vertSlot][i],
+ setup->vmid->data[vertSlot][i],
+ setup->vmax->data[vertSlot][i]
);
*/
assert(i <= 3);
@@ -619,7 +619,7 @@ static void subtriangle( struct setup_stage *setup,
finish_y -= sy;
/*
- _mesa_printf("%s %d %d\n", __FUNCTION__, start_y, finish_y);
+ debug_printf("%s %d %d\n", __FUNCTION__, start_y, finish_y);
*/
for (y = start_y; y < finish_y; y++) {
@@ -671,7 +671,7 @@ static void setup_tri( struct draw_stage *stage,
struct setup_stage *setup = setup_stage( stage );
/*
- _mesa_printf("%s\n", __FUNCTION__ );
+ debug_printf("%s\n", __FUNCTION__ );
*/
setup_sort_vertices( setup, prim );
@@ -1124,7 +1124,7 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
int ix, iy;
/*
- printf("(%f, %f) -> X:%d..%d Y:%d..%d\n", x, y, xmin, xmax,ymin,ymax);
+ debug_printf("(%f, %f) -> X:%d..%d Y:%d..%d\n", x, y, xmin, xmax,ymin,ymax);
*/
for (iy = iymin; iy <= iymax; iy += 2) {
uint rowMask = 0xf;
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index 90691c6065d..b5d7dfca1ca 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -223,13 +223,13 @@ shade_quad_llvm(struct quad_stage *qs,
inputs[2][0][1] = fy + 1.0f;
inputs[3][0][1] = fy + 1.0f;
#if DLLVM
- printf("MASK = %d\n", quad->mask);
+ debug_printf("MASK = %d\n", quad->mask);
#endif
gallivm_prog_inputs_interpolate(llvm, inputs, quad->coef);
#if DLLVM
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 2; ++j) {
- printf("IN(%d,%d) [%f %f %f %f]\n", i, j,
+ debug_printf("IN(%d,%d) [%f %f %f %f]\n", i, j,
inputs[i][j][0], inputs[i][j][1], inputs[i][j][2], inputs[i][j][3]);
}
}
@@ -240,7 +240,7 @@ shade_quad_llvm(struct quad_stage *qs,
softpipe->mapped_constants[PIPE_SHADER_FRAGMENT],
qss->samplers);
#if DLLVM
- printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n",
+ debug_printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n",
dests[0][0][0], dests[0][0][1], dests[0][0][2], dests[0][0][3],
dests[0][1][0], dests[0][1][1], dests[0][1][2], dests[0][1][3]);
#endif
@@ -260,7 +260,7 @@ shade_quad_llvm(struct quad_stage *qs,
}
#if DLLVM
for (int i = 0; i < QUAD_SIZE; ++i) {
- printf("QLLVM%d(%d) [%f, %f, %f, %f]\n", i, qss->colorOutSlot,
+ debug_printf("QLLVM%d(%d) [%f, %f, %f, %f]\n", i, qss->colorOutSlot,
quad->outputs.color[0][i],
quad->outputs.color[1][i],
quad->outputs.color[2][i],
@@ -284,7 +284,7 @@ shade_quad_llvm(struct quad_stage *qs,
}
}
#if DLLVM
- printf("D [%f, %f, %f, %f] mask = %d\n",
+ debug_printf("D [%f, %f, %f, %f] mask = %d\n",
quad->outputs.depth[0],
quad->outputs.depth[1],
quad->outputs.depth[2],
diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.c b/src/mesa/pipe/softpipe/sp_tile_cache.c
index ccf367a5e4f..1597361b82f 100644
--- a/src/mesa/pipe/softpipe/sp_tile_cache.c
+++ b/src/mesa/pipe/softpipe/sp_tile_cache.c
@@ -341,7 +341,7 @@ sp_tile_cache_flush_clear(struct pipe_context *pipe,
}
}
#if 0
- printf("num cleared: %u\n", numCleared);
+ debug_printf("num cleared: %u\n", numCleared);
#endif
}
@@ -384,7 +384,7 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
#endif
#if 0
- printf("flushed tiles in use: %d\n", inuse);
+ debug_printf("flushed tiles in use: %d\n", inuse);
#endif
}
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
index dcc39362a9b..463ff0d9dab 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
@@ -143,7 +143,7 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
k = tgsi_parse_init( &parse, mach->Tokens );
if (k != TGSI_PARSE_OK) {
- fprintf(stderr, "Problem parsing!\n");
+ debug_printf("Problem parsing!\n");
return;
}
@@ -249,7 +249,7 @@ tgsi_exec_machine_init(
k = tgsi_parse_init (&parse, mach->Tokens);
if (k != TGSI_PARSE_OK) {
- fprintf( stderr, "Problem parsing!\n" );
+ debug_printf( "Problem parsing!\n" );
return;
}
@@ -1236,7 +1236,7 @@ exec_tex(struct tgsi_exec_machine *mach,
uint chan_index;
float lodBias;
- /* printf("Sampler %u unit %u\n", sampler, unit); */
+ /* debug_printf("Sampler %u unit %u\n", sampler, unit); */
switch (inst->InstructionExtTexture.Texture) {
case TGSI_TEXTURE_1D:
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
index df0c6983013..f2180082f15 100755
--- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
@@ -48,28 +48,28 @@ _print_reg(
case file_REG32:
switch( reg.idx ) {
case reg_AX:
- printf( "EAX" );
+ debug_printf( "EAX" );
break;
case reg_CX:
- printf( "ECX" );
+ debug_printf( "ECX" );
break;
case reg_DX:
- printf( "EDX" );
+ debug_printf( "EDX" );
break;
case reg_BX:
- printf( "EBX" );
+ debug_printf( "EBX" );
break;
case reg_SP:
- printf( "ESP" );
+ debug_printf( "ESP" );
break;
case reg_BP:
- printf( "EBP" );
+ debug_printf( "EBP" );
break;
case reg_SI:
- printf( "ESI" );
+ debug_printf( "ESI" );
break;
case reg_DI:
- printf( "EDI" );
+ debug_printf( "EDI" );
break;
}
break;
@@ -77,7 +77,7 @@ _print_reg(
assert( 0 );
break;
case file_XMM:
- printf( "XMM%u", reg.idx );
+ debug_printf( "XMM%u", reg.idx );
break;
case file_x87:
assert( 0 );
@@ -92,35 +92,35 @@ _fill(
unsigned count = 10 - strlen( op );
while( count-- ) {
- printf( " " );
+ debug_printf( " " );
}
}
-#define DUMP_START() printf( "\nsse-dump start ----------------" )
-#define DUMP_END() printf( "\nsse-dump end ----------------\n" )
-#define DUMP( OP ) printf( "\n%s", OP )
+#define DUMP_START() debug_printf( "\nsse-dump start ----------------" )
+#define DUMP_END() debug_printf( "\nsse-dump end ----------------\n" )
+#define DUMP( OP ) debug_printf( "\n%s", OP )
#define DUMP_I( OP, I ) do {\
- printf( "\n%s", OP );\
+ debug_printf( "\n%s", OP );\
_fill( OP );\
- printf( "%u", I ); } while( 0 )
+ debug_printf( "%u", I ); } while( 0 )
#define DUMP_R( OP, R0 ) do {\
- printf( "\n%s", OP );\
+ debug_printf( "\n%s", OP );\
_fill( OP );\
_print_reg( R0 ); } while( 0 )
#define DUMP_RR( OP, R0, R1 ) do {\
- printf( "\n%s", OP );\
+ debug_printf( "\n%s", OP );\
_fill( OP );\
_print_reg( R0 );\
- printf( ", " );\
+ debug_printf( ", " );\
_print_reg( R1 ); } while( 0 )
#define DUMP_RRI( OP, R0, R1, I ) do {\
- printf( "\n%s", OP );\
+ debug_printf( "\n%s", OP );\
_fill( OP );\
_print_reg( R0 );\
- printf( ", " );\
+ debug_printf( ", " );\
_print_reg( R1 );\
- printf( ", " );\
- printf( "%u", I ); } while( 0 )
+ debug_printf( ", " );\
+ debug_printf( "%u", I ); } while( 0 )
#else
diff --git a/src/mesa/pipe/tgsi/util/tgsi_build.c b/src/mesa/pipe/tgsi/util/tgsi_build.c
index 67f7d2c2c28..a00ff1c2a5f 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_build.c
+++ b/src/mesa/pipe/tgsi/util/tgsi_build.c
@@ -1,3 +1,4 @@
+#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
#include "tgsi_build.h"
diff --git a/src/mesa/pipe/tgsi/util/tgsi_dump.c b/src/mesa/pipe/tgsi/util/tgsi_dump.c
index cdbc0dbc9ca..b5c54847e0b 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_dump.c
+++ b/src/mesa/pipe/tgsi/util/tgsi_dump.c
@@ -25,6 +25,9 @@
*
**************************************************************************/
+#include <stdio.h>
+
+#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
#include "tgsi_dump.h"
diff --git a/src/mesa/pipe/tgsi/util/tgsi_parse.c b/src/mesa/pipe/tgsi/util/tgsi_parse.c
index f0f8d44ac20..bf6b89ce564 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_parse.c
+++ b/src/mesa/pipe/tgsi/util/tgsi_parse.c
@@ -25,6 +25,7 @@
*
**************************************************************************/
+#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
#include "tgsi_parse.h"
diff --git a/src/mesa/pipe/tgsi/util/tgsi_util.c b/src/mesa/pipe/tgsi/util/tgsi_util.c
index 1e76b0f133a..4cdd89182ad 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_util.c
+++ b/src/mesa/pipe/tgsi/util/tgsi_util.c
@@ -1,3 +1,4 @@
+#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
#include "tgsi_parse.h"