From f090fdc50b290566a5b6aaf57ddd31b340f58de5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Jun 2005 08:22:57 +0000 Subject: [PATCH] Move fallback and other debugging under TDFX_DEBUG using the same mechanism as other drivers. --- src/mesa/drivers/dri/tdfx/tdfx_context.c | 21 +++++++++++++-------- src/mesa/drivers/dri/tdfx/tdfx_context.h | 11 +++-------- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 10 +--------- src/mesa/drivers/dri/tdfx/tdfx_tris.c | 6 +++--- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index 12e35d7c2bf..9b4a79b858f 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -152,6 +152,15 @@ static const struct tnl_pipeline_stage *tdfx_pipeline[] = { 0, }; +static const struct dri_debug_control debug_control[] = +{ + { "dri", DEBUG_VERBOSE_DRI }, + { "sync", DEBUG_ALWAYS_SYNC }, + { "api", DEBUG_VERBOSE_API }, + { "fall", DEBUG_VERBOSE_FALL }, + { NULL, 0 } +}; + GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis, __DRIcontextPrivate *driContextPriv, void *sharedContextPrivate ) @@ -320,6 +329,10 @@ GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis, tdfxInitVB( ctx ); tdfxInitState( fxMesa ); +#if DO_DEBUG + TDFX_DEBUG = driParseDebugString( getenv( "TDFX_DEBUG" ), debug_control ); +#endif + if (driQueryOptionb(&fxMesa->optionCache, "no_rast")) { fprintf(stderr, "disabling 3D acceleration\n"); FALLBACK(fxMesa, TDFX_FALLBACK_DISABLE, 1); @@ -534,14 +547,6 @@ tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, tdfxContextPtr fxMesa ) UNLOCK_HARDWARE( fxMesa ); - { - const char *debug = getenv("LIBGL_DEBUG"); - if (debug && strstr(debug, "fallbacks")) { - fxMesa->debugFallbacks = GL_TRUE; - } - } - - fxMesa->numClipRects = 0; fxMesa->pClipRects = NULL; fxMesa->scissoredClipRects = GL_FALSE; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.h b/src/mesa/drivers/dri/tdfx/tdfx_context.h index 42a38f3bf0e..b8349fec73b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.h @@ -919,8 +919,6 @@ struct tdfx_context { tdfxStats stats; - GLboolean debugFallbacks; - /* Configuration cache */ driOptionCache optionCache; @@ -990,7 +988,7 @@ static __inline__ GrColor_t tdfxPackColor( GLuint cpp, } } -#define DO_DEBUG 0 +#define DO_DEBUG 1 #if DO_DEBUG extern int TDFX_DEBUG; #else @@ -999,11 +997,8 @@ extern int TDFX_DEBUG; #define DEBUG_ALWAYS_SYNC 0x01 #define DEBUG_VERBOSE_API 0x02 -#define DEBUG_VERBOSE_MSG 0x04 -#define DEBUG_VERBOSE_LRU 0x08 -#define DEBUG_VERBOSE_DRI 0x10 -#define DEBUG_VERBOSE_IOCTL 0x20 -#define DEBUG_VERBOSE_2D 0x40 +#define DEBUG_VERBOSE_DRI 0x04 +#define DEBUG_VERBOSE_FALL 0x08 /* conf */ #define FX_COMPRESS_S3TC_AS_FXT1_HACK 1 diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index fde17f1a87e..f0efc278cb3 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -53,15 +53,7 @@ int prevLockLine = 0; #endif #ifndef TDFX_DEBUG -int TDFX_DEBUG = (0 -/* | DEBUG_ALWAYS_SYNC */ -/* | DEBUG_VERBOSE_API */ -/* | DEBUG_VERBOSE_MSG */ -/* | DEBUG_VERBOSE_LRU */ -/* | DEBUG_VERBOSE_DRI */ -/* | DEBUG_VERBOSE_IOCTL */ -/* | DEBUG_VERBOSE_2D */ - ); +int TDFX_DEBUG = 0; #endif PUBLIC const char __driConfigOptions[] = diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c index 7909350a13d..ac8daf47497 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c @@ -1213,7 +1213,7 @@ static char *fallbackStrings[] = { "Texture border", "glColorMask", "blend mode", - "line stipple" + "line stipple", "Rasterization disable" }; @@ -1242,7 +1242,7 @@ void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) FLUSH_BATCH(fxMesa); _swsetup_Wakeup( ctx ); fxMesa->RenderIndex = ~0; - if (fxMesa->debugFallbacks) { + if (TDFX_DEBUG & DEBUG_VERBOSE_FALL) { fprintf(stderr, "Tdfx begin software fallback: 0x%x %s\n", bit, getFallbackString(bit)); } @@ -1259,7 +1259,7 @@ void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) tnl->Driver.Render.BuildVertices = tdfxBuildVertices; fxMesa->new_gl_state |= (_TDFX_NEW_RENDERSTATE| _TDFX_NEW_RASTERSETUP); - if (fxMesa->debugFallbacks) { + if (TDFX_DEBUG & DEBUG_VERBOSE_FALL) { fprintf(stderr, "Tdfx end software fallback: 0x%x %s\n", bit, getFallbackString(bit)); } -- 2.30.2