diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2007-08-10 10:37:20 +0100 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2007-08-10 10:37:20 +0100 |
commit | 30e506eb04ec9d82dbb879f27547475a875d50d7 (patch) | |
tree | da80f4530a39ec6a8e7f444c3c50a232b7bc66e6 /src/mesa | |
parent | a27c0db260fb289ec7994a8c66b002443bc8a96b (diff) |
Clean up / sanitize debugging
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_blit.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_buffers.c | 13 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_context.c | 29 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_context.h | 32 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_ioctl.c | 9 |
6 files changed, 40 insertions, 64 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c index d1fb2907a9..30511bcba1 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c @@ -71,11 +71,10 @@ static void intel_dump_batchbuffer(GLuint offset, GLuint * ptr, GLuint count) { int i; - fprintf(stderr, "\n\n\nSTART BATCH (%d dwords):\n", count / 4); + _mesa_printf("\n\n\nSTART BATCH (%d dwords):\n", count / 4); for (i = 0; i < count / 4; i += 1) - fprintf(stderr, "\t0x%08x\n", - ptr[i]); - fprintf(stderr, "END BATCH\n\n\n"); + _mesa_printf("\t0x%08x\n", ptr[i]); + _mesa_printf("END BATCH\n\n\n"); } void @@ -193,7 +192,7 @@ do_flush_locked(struct intel_batchbuffer *batch, ptr[r->offset / 4] = driBOOffset(r->buf) + r->delta; } - if (INTEL_DEBUG & DEBUG_BATCH) + if (0) intel_dump_batchbuffer(0, ptr, used); driBOUnmap(batch->buffer); diff --git a/src/mesa/drivers/dri/intel_winsys/intel_blit.c b/src/mesa/drivers/dri/intel_winsys/intel_blit.c index f099eb2483..1578340e17 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_blit.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_blit.c @@ -41,8 +41,6 @@ #include "state_tracker/st_cb_fbo.h" -#define FILE_DEBUG_FLAG DEBUG_BLIT - /** * Copy the back color buffer to the front color buffer. * Used for SwapBuffers(). @@ -55,7 +53,7 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv, struct intel_context *intel; const intelScreenPrivate *intelScreen; - DBG("%s\n", __FUNCTION__); + DBG(SWAP, "%s\n", __FUNCTION__); assert(dPriv); @@ -127,8 +125,8 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv, ASSERT(backRegion); ASSERT(backRegion->cpp == cpp); - DBG("front pitch %d back pitch %d\n", - pitch, backRegion->pitch); + DBG(SWAP, "front pitch %d back pitch %d\n", + pitch, backRegion->pitch); if (cpp == 2) { BR13 = (pitch * cpp) | (0xCC << 16) | (1 << 24); @@ -178,8 +176,8 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv, if (box.y2 - box.y1 > backHeight) box.y2 = backHeight + box.y1; - DBG("box x1 x2 y1 y2 %d %d %d %d\n", - box.x1, box.x2, box.y1, box.y2); + DBG(SWAP, "box x1 x2 y1 y2 %d %d %d %d\n", + box.x1, box.x2, box.y1, box.y2); sbox.x1 = box.x1 - dPriv->x; sbox.y1 = box.y1 - dPriv->y; diff --git a/src/mesa/drivers/dri/intel_winsys/intel_buffers.c b/src/mesa/drivers/dri/intel_winsys/intel_buffers.c index eb42be98e5..1bd2a36738 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_buffers.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_buffers.c @@ -145,10 +145,9 @@ intelWindowMoved(struct intel_context *intel) pf_active = pf_pipes && (pf_pipes & intel->sarea->pf_active) == pf_pipes; - if (INTEL_DEBUG & DEBUG_LOCK) - if (pf_active != intel_fb->pf_active) - _mesa_printf("%s - Page flipping %sactive\n", __progname, - pf_active ? "" : "in"); + if (pf_active != intel_fb->pf_active) + DBG(LOCK, "%s - Page flipping %sactive\n", + __progname, pf_active ? "" : "in"); if (pf_active) { /* Sync pages between pipes if we're flipping on both at the same time */ @@ -283,8 +282,7 @@ intelPageFlip(const __DRIdrawablePrivate * dPriv) int ret; struct intel_framebuffer *intel_fb = dPriv->driverPrivate; - if (INTEL_DEBUG & DEBUG_IOCTL) - fprintf(stderr, "%s\n", __FUNCTION__); + DBG(SWAP, "%s\n", __FUNCTION__); assert(dPriv); assert(dPriv->driContextPriv); @@ -332,8 +330,7 @@ intelPageFlip(const __DRIdrawablePrivate * dPriv) intel_draw_buffer(&intel->ctx, &intel_fb->Base); #endif - if (INTEL_DEBUG & DEBUG_IOCTL) - fprintf(stderr, "%s: success\n", __FUNCTION__); + DBG(SWAP, "%s: success\n", __FUNCTION__); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/mesa/drivers/dri/intel_winsys/intel_context.c index 3782148001..1032fc2d0f 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_context.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_context.c @@ -59,8 +59,8 @@ -#ifndef INTEL_DEBUG -int INTEL_DEBUG = (0); +#if DEBUG +int __intel_debug = 0; #endif #define need_GL_ARB_multisample @@ -210,18 +210,10 @@ const struct dri_extension card_extensions[] = { static const struct dri_debug_control debug_control[] = { - {"tex", DEBUG_TEXTURE}, - {"state", DEBUG_STATE}, {"ioctl", DEBUG_IOCTL}, - {"blit", DEBUG_BLIT}, - {"mip", DEBUG_MIPTREE}, - {"verb", DEBUG_VERBOSE}, {"bat", DEBUG_BATCH}, - {"pix", DEBUG_PIXEL}, - {"buf", DEBUG_BUFMGR}, - {"reg", DEBUG_REGION}, - {"fbo", DEBUG_FBO}, {"lock", DEBUG_LOCK}, + {"swap", DEBUG_SWAP}, {NULL, 0} }; @@ -397,8 +389,8 @@ intelCreateContext(const __GLcontextModes * mesaVis, _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); } -#if DO_DEBUG - INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control); +#if DEBUG + __intel_debug = driParseDebugString(getenv("INTEL_DEBUG"), debug_control); #endif @@ -470,8 +462,6 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) /* This share group is about to go away, free our private * texture object data. */ - if (INTEL_DEBUG & DEBUG_TEXTURE) - fprintf(stderr, "do something to free texture heaps\n"); } /* free the Mesa context */ @@ -570,8 +560,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags) drmGetLock(intel->driFd, intel->hHWContext, flags); - if (INTEL_DEBUG & DEBUG_LOCK) - _mesa_printf("%s - got contended lock\n", __progname); + DBG(LOCK, "%s - got contended lock\n", __progname); /* If the window moved, may need to set a new cliprect now. * @@ -660,8 +649,7 @@ void LOCK_HARDWARE( struct intel_context *intel ) if (__ret) intelContendedLock( intel, 0 ); - if (INTEL_DEBUG & DEBUG_LOCK) - _mesa_printf("%s - locked\n", __progname); + DBG(LOCK, "%s - locked\n", __progname); intel->locked = 1; } @@ -678,7 +666,6 @@ void UNLOCK_HARDWARE( struct intel_context *intel ) _glthread_UNLOCK_MUTEX(lockMutex); - if (INTEL_DEBUG & DEBUG_LOCK) - _mesa_printf("%s - unlocked\n", __progname); + DBG(LOCK, "%s - unlocked\n", __progname); } diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.h b/src/mesa/drivers/dri/intel_winsys/intel_context.h index e84f53d1dc..924b7ca05a 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_context.h +++ b/src/mesa/drivers/dri/intel_winsys/intel_context.h @@ -109,27 +109,23 @@ extern char *__progname; /* ================================================================ * Debugging: */ -#define DO_DEBUG 0 -#if DO_DEBUG -extern int INTEL_DEBUG; +#if DEBUG +extern int __intel_debug; + +#define DEBUG_SWAP 0x1 +#define DEBUG_LOCK 0x2 +#define DEBUG_IOCTL 0x4 +#define DEBUG_BATCH 0x8 + +#define DBG(flag, ...) do { \ + if (__intel_debug & (DEBUG_##flag)) \ + _mesa_printf(__VA_ARGS__); \ +} while(0) + #else -#define INTEL_DEBUG 0 +#define DBG(flag, ...) #endif -#define DEBUG_TEXTURE 0x1 -#define DEBUG_STATE 0x2 -#define DEBUG_IOCTL 0x4 -#define DEBUG_BLIT 0x8 -#define DEBUG_MIPTREE 0x10 -#define DEBUG_VERBOSE 0x40 -#define DEBUG_BATCH 0x80 -#define DEBUG_PIXEL 0x100 -#define DEBUG_BUFMGR 0x200 -#define DEBUG_REGION 0x400 -#define DEBUG_FBO 0x800 -#define DEBUG_LOCK 0x1000 - -#define DBG(...) do { if (INTEL_DEBUG & FILE_DEBUG_FLAG) _mesa_printf(__VA_ARGS__); } while(0) #define PCI_CHIP_845_G 0x2562 diff --git a/src/mesa/drivers/dri/intel_winsys/intel_ioctl.c b/src/mesa/drivers/dri/intel_winsys/intel_ioctl.c index 154a3e289f..6e4d134b80 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_ioctl.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_ioctl.c @@ -40,7 +40,6 @@ #include "intel_blit.h" #include "drm.h" -#define FILE_DEBUG_FLAG DEBUG_IOCTL int intelEmitIrqLocked(struct intel_context *intel) @@ -60,7 +59,7 @@ intelEmitIrqLocked(struct intel_context *intel) exit(1); } - DBG("%s --> %d\n", __FUNCTION__, seq); + DBG(IOCTL, "%s --> %d\n", __FUNCTION__, seq); return seq; } @@ -70,7 +69,7 @@ intelWaitIrq(struct intel_context *intel, int seq) { int ret; - DBG("%s %d\n", __FUNCTION__, seq); + DBG(IOCTL, "%s %d\n", __FUNCTION__, seq); intel->iw.irq_seq = seq; @@ -98,7 +97,7 @@ intel_batch_ioctl(struct intel_context *intel, assert(intel->locked); assert(used); - DBG("%s used %d offset %x..%x ignore_cliprects %d\n", + DBG(IOCTL, "%s used %d offset %x..%x ignore_cliprects %d\n", __FUNCTION__, used, start_offset, start_offset + used, ignore_cliprects); @@ -116,7 +115,7 @@ intel_batch_ioctl(struct intel_context *intel, batch.DR1 = 0; batch.DR4 = 0; /* still need this ? */ - DBG("%s: 0x%x..0x%x DR4: %x cliprects: %d\n", + DBG(IOCTL, "%s: 0x%x..0x%x DR4: %x cliprects: %d\n", __FUNCTION__, batch.start, batch.start + batch.used * 4, batch.DR4, batch.num_cliprects); |