From ea6f4f6079de8f35b6e3d597525d958bcedc7bad Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 8 Oct 2004 23:03:38 +0000 Subject: Add fallback debugging (R128_DEBUG=fall) output, and set DO_DEBUG=1 by default so that we can use the env var to get output. Add a no_rast driconf option to force software fallbacks. --- src/mesa/drivers/dri/r128/r128_context.c | 6 ++++++ src/mesa/drivers/dri/r128/r128_context.h | 15 +++++++------- src/mesa/drivers/dri/r128/r128_screen.c | 9 ++++---- src/mesa/drivers/dri/r128/r128_tris.c | 35 ++++++++++++++++++++++++++++++-- 4 files changed, 52 insertions(+), 13 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index 2b0363d292..287f041a81 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -89,6 +89,7 @@ static const struct dri_debug_control debug_control[] = { "2d", DEBUG_VERBOSE_2D }, { "sync", DEBUG_ALWAYS_SYNC }, { "api", DEBUG_VERBOSE_API }, + { "fall", DEBUG_VERBOSE_FALL }, { NULL, 0 } }; @@ -258,6 +259,11 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, debug_control ); #endif + if (driQueryOptionb(&rmesa->optionCache, "no_rast")) { + fprintf(stderr, "disabling 3D acceleration\n"); + FALLBACK(rmesa, R128_FALLBACK_DISABLE, 1); + } + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h index 7477b95fad..0b4eaa2d74 100644 --- a/src/mesa/drivers/dri/r128/r128_context.h +++ b/src/mesa/drivers/dri/r128/r128_context.h @@ -77,12 +77,12 @@ typedef struct r128_context *r128ContextPtr; #define R128_FALLBACK_READ_BUFFER 0x0004 #define R128_FALLBACK_STENCIL 0x0008 #define R128_FALLBACK_RENDER_MODE 0x0010 -#define R128_FALLBACK_MULTIDRAW 0x0020 -#define R128_FALLBACK_LOGICOP 0x0040 -#define R128_FALLBACK_SEP_SPECULAR 0x0080 -#define R128_FALLBACK_BLEND_EQ 0x0100 -#define R128_FALLBACK_BLEND_FUNC 0x0200 -#define R128_FALLBACK_PROJTEX 0x0400 +#define R128_FALLBACK_LOGICOP 0x0020 +#define R128_FALLBACK_SEP_SPECULAR 0x0040 +#define R128_FALLBACK_BLEND_EQ 0x0080 +#define R128_FALLBACK_BLEND_FUNC 0x0100 +#define R128_FALLBACK_PROJTEX 0x0200 +#define R128_FALLBACK_DISABLE 0x0400 /* Use the templated vertex format: @@ -250,7 +250,7 @@ extern GLboolean r128UnbindContext( __DRIcontextPrivate *driContextPriv ); /* ================================================================ * Debugging: */ -#define DO_DEBUG 0 +#define DO_DEBUG 1 #define ENABLE_PERF_BOXES 0 #if DO_DEBUG @@ -266,6 +266,7 @@ extern int R128_DEBUG; #define DEBUG_VERBOSE_DRI 0x10 #define DEBUG_VERBOSE_IOCTL 0x20 #define DEBUG_VERBOSE_2D 0x40 +#define DEBUG_VERBOSE_FALL 0x80 #endif #endif /* __R128_CONTEXT_H__ */ diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 3ab4cd0856..f4d069d139 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -59,16 +59,17 @@ DRI_CONF_BEGIN DRI_CONF_SECTION_QUALITY DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB) DRI_CONF_SECTION_END -#if ENABLE_PERF_BOXES DRI_CONF_SECTION_DEBUG + DRI_CONF_NO_RAST(false) +#if ENABLE_PERF_BOXES DRI_CONF_PERFORMANCE_BOXES(false) - DRI_CONF_SECTION_END #endif + DRI_CONF_SECTION_END DRI_CONF_END; #if ENABLE_PERF_BOXES -static const GLuint __driNConfigOptions = 3; +static const GLuint __driNConfigOptions = 4; #else -static const GLuint __driNConfigOptions = 2; +static const GLuint __driNConfigOptions = 3; #endif #if 1 diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c index 34d7c7ffee..7e72467da5 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.c +++ b/src/mesa/drivers/dri/r128/r128_tris.c @@ -650,6 +650,31 @@ static void r128RenderFinish( GLcontext *ctx ) /* Transition to/from hardware rasterization. */ /**********************************************************************/ +static const char * const fallbackStrings[] = { + "Texture mode", + "glDrawBuffer(GL_FRONT_AND_BACK)", + "glReadBuffer", + "glEnable(GL_STENCIL) without hw stencil buffer", + "glRenderMode(selection or feedback)", + "glLogicOp (mode != GL_COPY)", + "GL_SEPARATE_SPECULAR_COLOR", + "glBlendEquation", + "glBlendFunc(mode != ADD)", + "Projective texture", + "Rasterization disable", +}; + + +static const char *getFallbackString(GLuint bit) +{ + int i = 0; + while (bit > 1) { + i++; + bit >>= 1; + } + return fallbackStrings[i]; +} + void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -662,6 +687,10 @@ void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) FLUSH_BATCH( rmesa ); _swsetup_Wakeup( ctx ); rmesa->RenderIndex = ~0; + if ( R128_DEBUG & DEBUG_VERBOSE_FALL ) { + fprintf(stderr, "R128 begin rasterization fallback: 0x%x %s\n", + bit, getFallbackString(bit)); + } } } else { @@ -684,6 +713,10 @@ void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) rmesa->hw_viewport, 0 ); rmesa->NewGLState |= _R128_NEW_RENDER_STATE; + if ( R128_DEBUG & DEBUG_VERBOSE_FALL ) { + fprintf(stderr, "R128 end rasterization fallback: 0x%x %s\n", + bit, getFallbackString(bit)); + } } } } @@ -719,6 +752,4 @@ void r128InitTriFuncs( GLcontext *ctx ) rmesa->tnl_state = -1; rmesa->NewGLState |= _R128_NEW_RENDER_STATE; - -/* r128Fallback( ctx, 0x100000, 1 ); */ } -- cgit v1.2.3