Move fallback debugging under MACH64_DEBUG=fall (matching other drivers) and
authorEric Anholt <anholt@FreeBSD.org>
Tue, 31 May 2005 03:47:39 +0000 (03:47 +0000)
committerEric Anholt <anholt@FreeBSD.org>
Tue, 31 May 2005 03:47:39 +0000 (03:47 +0000)
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
src/mesa/drivers/dri/mach64/mach64_context.h
src/mesa/drivers/dri/mach64/mach64_tris.c

index 524046c..a7093bb 100644 (file)
@@ -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 }
 };
 
index 4145d6b..c541f77 100644 (file)
@@ -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__ */
index 5553d02..4a0044b 100644 (file)
@@ -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));
+        }
       }
    }
 }