Make SiS a little more like other drivers: Add SIS_DEBUG (only option being
authorEric Anholt <anholt@FreeBSD.org>
Wed, 19 Oct 2005 03:23:29 +0000 (03:23 +0000)
committerEric Anholt <anholt@FreeBSD.org>
Wed, 19 Oct 2005 03:23:29 +0000 (03:23 +0000)
"fall" so far) and make the fallback_force option be no_rast like other drivers.
Incidentally, makes no_rast not crash (though it still fails to render).

src/mesa/drivers/dri/sis/sis_context.c
src/mesa/drivers/dri/sis/sis_context.h
src/mesa/drivers/dri/sis/sis_screen.c
src/mesa/drivers/dri/sis/sis_tris.c

index 101b97b7b8006a724e30fa402198351c50a169a9..948f15a94145ab33d67a476a9bbb51587f3751f2 100644 (file)
@@ -61,6 +61,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define need_GL_ARB_multisample
 #include "extension_helper.h"
 
+#ifndef SIS_DEBUG
+int SIS_DEBUG = 0;
+#endif
+
 int GlobalCurrentHwcx = -1;
 int GlobalHwcxCountBase = 1;
 int GlobalCmdQueueLen = 0;
@@ -74,6 +78,12 @@ struct dri_extension card_extensions[] =
     { NULL,                                NULL }
 };
 
+static const struct dri_debug_control debug_control[] =
+{
+    { "fall",  DEBUG_FALLBACKS },
+    { NULL,    0 }
+};
+
 void
 WaitEngIdle (sisContextPtr smesa)
 {
@@ -200,6 +210,10 @@ sisCreateContext( const __GLcontextModes *glVisual,
    driParseConfigFiles (&smesa->optionCache, &sisScreen->optionCache,
                        sisScreen->driScreen->myNum, "sis");
 
+#if DO_DEBUG
+   SIS_DEBUG = driParseDebugString(getenv("SIS_DEBUG"), debug_control);
+#endif
+
    /* TODO: index mode */
 
    smesa->CurrentQueueLenPtr = &(smesa->sarea->QueueLength);
@@ -269,6 +283,11 @@ sisCreateContext( const __GLcontextModes *glVisual,
       smesa->PrevTexFormat[i] = 0;
    }
 
+   if (driQueryOptionb(&smesa->optionCache, "no_rast")) {
+      fprintf(stderr, "disabling 3D acceleration\n");
+      FALLBACK(smesa, SIS_FALLBACK_DISABLE, 1);
+   }
+
    return GL_TRUE;
 }
 
index 5ef1895362d16ad75ab62de95dd3d4f304684296..17d283995fc9b38029493f5b043812c8b51f2013 100644 (file)
@@ -65,7 +65,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define SIS_FALLBACK_TEXENV1           0x0010
 #define SIS_FALLBACK_DRAW_BUFFER       0x0020
 #define SIS_FALLBACK_STENCIL           0x0040
-#define SIS_FALLBACK_FORCE             0x8000
+#define SIS_FALLBACK_DISABLE           0x0080
 
 /* Flags for hardware state that needs to be updated */
 #define GFLAG_ENABLESETTING            0x00000001
@@ -445,4 +445,17 @@ void WaitingFor3dIdle(sisContextPtr smesa, int wLen);
 extern void sis_update_texture_state( sisContextPtr smesa );
 extern void sis_update_render_state( sisContextPtr smesa );
 
+/* ================================================================
+ * Debugging:
+ */
+#define DO_DEBUG               1
+
+#if DO_DEBUG
+extern int SIS_DEBUG;
+#else
+#define SIS_DEBUG              0
 #endif
+
+#define DEBUG_FALLBACKS                0x01
+
+#endif /* _sis_ctx_h_ */
index 362c8696e3aff374a658cc37485e9672eb99fd8f..d213cc406ce0dcfa27d0190c2ac74aaa622a67fd 100644 (file)
@@ -52,9 +52,7 @@ DRI_CONF_BEGIN
                DRI_CONF_OPT_BEGIN(agp_disable,bool,false)
                DRI_CONF_DESC(en,"Disable AGP vertex dispatch")
                DRI_CONF_OPT_END
-               DRI_CONF_OPT_BEGIN(fallback_force,bool,false)
-               DRI_CONF_DESC(en,"Force software fallback")
-               DRI_CONF_OPT_END
+        DRI_CONF_NO_RAST(false)
        DRI_CONF_SECTION_END
 DRI_CONF_END;
 static const GLuint __driNConfigOptions = 2;
index fb0fd1ac099c6c0eeaf0abd3105cd0b8105b1641..0c70f26b6373573ff6d3ad24b7ad5df9eb15bade 100644 (file)
@@ -959,6 +959,27 @@ void sisFlushPrims(sisContextPtr smesa)
 /*           Transition to/from hardware rasterization.               */
 /**********************************************************************/
 
+static const char * const fallbackStrings[] = {
+   "Texture mode",
+   "Texture 0 mode",
+   "Texture 1 moder",
+   "Texture 0 env",
+   "Texture 1 env",
+   "glDrawBuffer(GL_FRONT_AND_BACK)",
+   "glEnable(GL_STENCIL) without hw stencil buffer",
+   "no_rast",
+};
+
+static const char *getFallbackString(GLuint bit)
+{
+   int i = 0;
+   while (bit > 1) {
+      i++;
+      bit >>= 1;
+   }
+   return fallbackStrings[i];
+}
+
 void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -971,6 +992,10 @@ void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
         SIS_FIREVERTICES(smesa);
         _swsetup_Wakeup( ctx );
         smesa->RenderIndex = ~0;
+         if (SIS_DEBUG & DEBUG_FALLBACKS) {
+            fprintf(stderr, "SiS begin rasterization fallback: 0x%x %s\n",
+                    bit, getFallbackString(bit));
+         }
       }
    }
    else {
@@ -993,6 +1018,10 @@ void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
                             smesa->hw_viewport, 0 ); 
 
         smesa->NewGLState |= _SIS_NEW_RENDER_STATE;
+         if (SIS_DEBUG & DEBUG_FALLBACKS) {
+            fprintf(stderr, "SiS end rasterization fallback: 0x%x %s\n",
+                    bit, getFallbackString(bit));
+         }
       }
    }
 }
@@ -1046,11 +1075,6 @@ void sisInitTriFuncs( GLcontext *ctx )
       sis_vert_init_gwst0t1();
    }
 
-   if (driQueryOptionb(&smesa->optionCache, "fallback_force"))
-      sisFallback(ctx, SIS_FALLBACK_FORCE, 1);
-   else
-      sisFallback(ctx, SIS_FALLBACK_FORCE, 0);
-
    smesa->RenderIndex = ~0;
    smesa->NewGLState |= _SIS_NEW_RENDER_STATE;