From 9dff2ca07a6a74f65d831269b1cee8c3ee2c0103 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 31 May 2005 03:47:39 +0000 Subject: [PATCH] Move fallback debugging under MACH64_DEBUG=fall (matching other drivers) and add pretty descriptions of the bits. GC one of the bits that was unused. Also, now only the first thing triggering a fallback and the last thing requiring one do the debug output. This also matches other drivers. --- src/mesa/drivers/dri/mach64/mach64_context.c | 1 + src/mesa/drivers/dri/mach64/mach64_context.h | 12 +++---- src/mesa/drivers/dri/mach64/mach64_tris.c | 36 +++++++++++++++++--- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 524046ce431..a7093bbf7b6 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -72,6 +72,7 @@ static const struct dri_debug_control debug_control[] = { "prims", DEBUG_VERBOSE_PRIMS }, { "count", DEBUG_VERBOSE_COUNT }, { "nowait", DEBUG_NOWAIT }, + { "fall", DEBUG_VERBOSE_FALLBACK }, { NULL, 0 } }; diff --git a/src/mesa/drivers/dri/mach64/mach64_context.h b/src/mesa/drivers/dri/mach64/mach64_context.h index 4145d6b3111..c541f77ab98 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.h +++ b/src/mesa/drivers/dri/mach64/mach64_context.h @@ -79,12 +79,11 @@ typedef struct mach64_context *mach64ContextPtr; #define MACH64_FALLBACK_READ_BUFFER 0x0004 #define MACH64_FALLBACK_STENCIL 0x0008 #define MACH64_FALLBACK_RENDER_MODE 0x0010 -#define MACH64_FALLBACK_MULTIDRAW 0x0020 -#define MACH64_FALLBACK_LOGICOP 0x0040 -#define MACH64_FALLBACK_SEP_SPECULAR 0x0080 -#define MACH64_FALLBACK_BLEND_EQ 0x0100 -#define MACH64_FALLBACK_BLEND_FUNC 0x0200 -#define MACH64_FALLBACK_DISABLE 0x0400 +#define MACH64_FALLBACK_LOGICOP 0x0020 +#define MACH64_FALLBACK_SEP_SPECULAR 0x0040 +#define MACH64_FALLBACK_BLEND_EQ 0x0080 +#define MACH64_FALLBACK_BLEND_FUNC 0x0100 +#define MACH64_FALLBACK_DISABLE 0x0200 #define CARD32 GLuint /* KW: For building in mesa tree */ @@ -402,4 +401,5 @@ extern int MACH64_DEBUG; #define DEBUG_VERBOSE_PRIMS 0x040 #define DEBUG_VERBOSE_COUNT 0x080 #define DEBUG_NOWAIT 0x100 +#define DEBUG_VERBOSE_FALLBACK 0x200 #endif /* __MACH64_CONTEXT_H__ */ diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c index 5553d02ac90..4a0044be88c 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.c +++ b/src/mesa/drivers/dri/mach64/mach64_tris.c @@ -1838,6 +1838,30 @@ static void mach64RenderFinish( 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 (mode != ADD)", + "glBlendFunc", + "Rasterization disable", +}; + + +static const char *getFallbackString(GLuint bit) +{ + int i = 0; + while (bit > 1) { + i++; + bit >>= 1; + } + return fallbackStrings[i]; +} + void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -1845,18 +1869,18 @@ void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) GLuint oldfallback = mmesa->Fallback; if (mode) { - if (MACH64_DEBUG & DEBUG_VERBOSE_MSG) - fprintf(stderr,"Set Fallback: %d\n", bit); mmesa->Fallback |= bit; if (oldfallback == 0) { FLUSH_BATCH( mmesa ); _swsetup_Wakeup( ctx ); mmesa->RenderIndex = ~0; + if (MACH64_DEBUG & DEBUG_VERBOSE_FALLBACK) { + fprintf(stderr, "Mach64 begin rasterization fallback: 0x%x %s\n", + bit, getFallbackString(bit)); + } } } else { - if (MACH64_DEBUG & DEBUG_VERBOSE_MSG) - fprintf(stderr,"Clear Fallback: %d\n", bit); mmesa->Fallback &= ~bit; if (oldfallback == bit) { _swrast_flush( ctx ); @@ -1866,6 +1890,10 @@ void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) tnl->Driver.Render.BuildVertices = mach64BuildVertices; mmesa->NewGLState |= (_MACH64_NEW_RENDER_STATE| _MACH64_NEW_VERTEX_STATE); + if (MACH64_DEBUG & DEBUG_VERBOSE_FALLBACK) { + fprintf(stderr, "Mach64 end rasterization fallback: 0x%x %s\n", + bit, getFallbackString(bit)); + } } } } -- 2.30.2