Make SiS a little more like other drivers: Add SIS_DEBUG (only option being

"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).
This commit is contained in:
Eric Anholt 2005-10-19 03:23:29 +00:00
parent e0cb784e03
commit 2420318cd9
4 changed files with 63 additions and 9 deletions

View 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;
}

View 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_ */

View 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;

View 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;