Add fallback debugging (R128_DEBUG=fall) output, and set DO_DEBUG=1 by default
authorEric Anholt <anholt@FreeBSD.org>
Fri, 8 Oct 2004 23:03:38 +0000 (23:03 +0000)
committerEric Anholt <anholt@FreeBSD.org>
Fri, 8 Oct 2004 23:03:38 +0000 (23:03 +0000)
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
src/mesa/drivers/dri/r128/r128_context.h
src/mesa/drivers/dri/r128/r128_screen.c
src/mesa/drivers/dri/r128/r128_tris.c

index 2b0363d..287f041 100644 (file)
@@ -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;
 }
 
index 7477b95..0b4eaa2 100644 (file)
@@ -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__ */
index 3ab4cd0..f4d069d 100644 (file)
@@ -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
index 34d7c7f..7e72467 100644 (file)
@@ -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 ); */
 }