mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
Made debugging output controllable via environment variable
SAVAGE_DEBUG. Added fallback debugs. Added no_rast option to disable hardware rasterization (everything as software fallback).
This commit is contained in:
parent
538541e300
commit
3d04879801
4 changed files with 60 additions and 55 deletions
|
|
@ -70,27 +70,25 @@ DRI_CONF_BEGIN
|
|||
DRI_CONF_SECTION_PERFORMANCE
|
||||
DRI_CONF_MAX_TEXTURE_UNITS(2,1,2)
|
||||
DRI_CONF_SECTION_END
|
||||
DRI_CONF_SECTION_DEBUG
|
||||
DRI_CONF_NO_RAST(false)
|
||||
DRI_CONF_SECTION_END
|
||||
DRI_CONF_END;
|
||||
static const GLuint __driNConfigOptions = 3;
|
||||
static const GLuint __driNConfigOptions = 4;
|
||||
|
||||
#ifdef USE_NEW_INTERFACE
|
||||
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
|
||||
#endif /* USE_NEW_INTERFACE */
|
||||
|
||||
static const struct dri_debug_control debug_control[] =
|
||||
{
|
||||
{ "fall", DEBUG_FALLBACKS },
|
||||
{ "api", DEBUG_VERBOSE_API },
|
||||
{ "lru", DEBUG_VERBOSE_LRU },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
#ifndef SAVAGE_DEBUG
|
||||
int SAVAGE_DEBUG = (0
|
||||
/* | DEBUG_ALWAYS_SYNC */
|
||||
/* | DEBUG_VERBOSE_RING */
|
||||
/* | DEBUG_VERBOSE_OUTREG */
|
||||
/* | DEBUG_VERBOSE_MSG */
|
||||
/* | DEBUG_NO_OUTRING */
|
||||
/* | DEBUG_NO_OUTREG */
|
||||
/* | DEBUG_VERBOSE_API */
|
||||
/* | DEBUG_VERBOSE_2D */
|
||||
/* | DEBUG_VERBOSE_DRI */
|
||||
/* | DEBUG_VALIDATE_RING */
|
||||
/* | DEBUG_VERBOSE_IOCTL */
|
||||
);
|
||||
int SAVAGE_DEBUG = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -487,7 +485,12 @@ savageCreateContext( const __GLcontextModes *mesaVis,
|
|||
imesa->glCtx = ctx;
|
||||
if (savageDMAInit(imesa) == GL_FALSE)
|
||||
return GL_FALSE;
|
||||
|
||||
|
||||
#ifndef SAVAGE_DEBUG
|
||||
SAVAGE_DEBUG = driParseDebugString( getenv( "SAVAGE_DEBUG" ),
|
||||
debug_control );
|
||||
#endif
|
||||
|
||||
driInitExtensions( ctx, card_extensions, GL_TRUE );
|
||||
|
||||
savageDDInitStateFuncs( ctx );
|
||||
|
|
@ -498,6 +501,9 @@ savageCreateContext( const __GLcontextModes *mesaVis,
|
|||
|
||||
savageDDInitState( imesa );
|
||||
|
||||
if (driQueryOptionb(&imesa->optionCache, "no_rast"))
|
||||
FALLBACK(ctx, SAVAGE_FALLBACK_NORAST, GL_TRUE);
|
||||
|
||||
driContextPriv->driverPrivate = (void *) imesa;
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
|||
|
|
@ -52,13 +52,14 @@ typedef struct savage_texture_object_t *savageTextureObjectPtr;
|
|||
#define SAVAGE_FALLBACK_DRAW_BUFFER 0x2
|
||||
#define SAVAGE_FALLBACK_READ_BUFFER 0x4
|
||||
#define SAVAGE_FALLBACK_COLORMASK 0x8
|
||||
#define SAVAGE_FALLBACK_STIPPLE 0x10
|
||||
#define SAVAGE_FALLBACK_SPECULAR 0x20
|
||||
#define SAVAGE_FALLBACK_LOGICOP 0x40
|
||||
#define SAVAGE_FALLBACK_SPECULAR 0x10
|
||||
#define SAVAGE_FALLBACK_LOGICOP 0x20
|
||||
/*frank 2001/11/12 add the stencil fallbak*/
|
||||
#define SAVAGE_FALLBACK_STENCIL 0x80
|
||||
#define SAVAGE_FALLBACK_RENDERMODE 0x100
|
||||
#define SAVAGE_FALLBACK_BLEND_EQ 0x200
|
||||
#define SAVAGE_FALLBACK_STENCIL 0x40
|
||||
#define SAVAGE_FALLBACK_RENDERMODE 0x80
|
||||
#define SAVAGE_FALLBACK_BLEND_EQ 0x100
|
||||
#define SAVAGE_FALLBACK_NORAST 0x200
|
||||
#define SAVAGE_FALLBACK_PROJ_TEXTURE 0x400
|
||||
|
||||
|
||||
#define HW_CULL 1
|
||||
|
|
@ -273,38 +274,18 @@ struct savage_context_t {
|
|||
/* To remove all debugging, make sure SAVAGE_DEBUG is defined as a
|
||||
* preprocessor symbol, and equal to zero.
|
||||
*/
|
||||
#define SAVAGE_DEBUG 0
|
||||
#ifndef SAVAGE_DEBUG
|
||||
#warning "Debugging enabled - expect reduced performance"
|
||||
extern int SAVAGE_DEBUG;
|
||||
#endif
|
||||
|
||||
#define DEBUG_VERBOSE_2D 0x1
|
||||
#define DEBUG_VERBOSE_RING 0x8
|
||||
#define DEBUG_VERBOSE_OUTREG 0x10
|
||||
#define DEBUG_ALWAYS_SYNC 0x40
|
||||
#define DEBUG_VERBOSE_MSG 0x80
|
||||
#define DEBUG_NO_OUTRING 0x100
|
||||
#define DEBUG_NO_OUTREG 0x200
|
||||
#define DEBUG_VERBOSE_API 0x400
|
||||
#define DEBUG_VALIDATE_RING 0x800
|
||||
#define DEBUG_VERBOSE_LRU 0x1000
|
||||
#define DEBUG_VERBOSE_DRI 0x2000
|
||||
#define DEBUG_VERBOSE_IOCTL 0x4000
|
||||
#define DEBUG_FALLBACKS 0x001
|
||||
#define DEBUG_VERBOSE_API 0x002
|
||||
#define DEBUG_VERBOSE_LRU 0x004
|
||||
|
||||
#define TARGET_FRONT 0x0
|
||||
#define TARGET_BACK 0x1
|
||||
#define TARGET_DEPTH 0x2
|
||||
|
||||
#define SAVAGEDEBUG 0
|
||||
#define _SAVAGE_DEBUG
|
||||
/*frank remove the least debug information*/
|
||||
#ifdef _SAVAGE_DEBUG
|
||||
#define fprintf fprintf
|
||||
#else
|
||||
#define fprintf(...)
|
||||
#endif
|
||||
|
||||
#define SUBPIXEL_X -0.5
|
||||
#define SUBPIXEL_Y -0.375
|
||||
|
||||
|
|
|
|||
|
|
@ -1434,7 +1434,6 @@ static void savageUpdateTextureState_s4( GLcontext *ctx )
|
|||
if (imesa->CurrentTexObj[1]) imesa->CurrentTexObj[1]->bound &= ~2;
|
||||
imesa->CurrentTexObj[0] = 0;
|
||||
imesa->CurrentTexObj[1] = 0;
|
||||
FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_FALSE);
|
||||
savageUpdateTex0State_s4( ctx );
|
||||
savageUpdateTex1State_s4( ctx );
|
||||
imesa->dirty |= (SAVAGE_UPLOAD_CTX |
|
||||
|
|
@ -1446,18 +1445,15 @@ static void savageUpdateTextureState_s3d( GLcontext *ctx )
|
|||
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
|
||||
if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->bound &= ~1;
|
||||
imesa->CurrentTexObj[0] = 0;
|
||||
if (ctx->Texture.Unit[1]._ReallyEnabled) {
|
||||
FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
|
||||
} else {
|
||||
FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_FALSE);
|
||||
savageUpdateTexState_s3d( ctx );
|
||||
imesa->dirty |= (SAVAGE_UPLOAD_CTX |
|
||||
SAVAGE_UPLOAD_TEX0);
|
||||
}
|
||||
savageUpdateTexState_s3d( ctx );
|
||||
imesa->dirty |= (SAVAGE_UPLOAD_CTX |
|
||||
SAVAGE_UPLOAD_TEX0);
|
||||
}
|
||||
void savageUpdateTextureState( GLcontext *ctx)
|
||||
{
|
||||
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
|
||||
FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_FALSE);
|
||||
FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_FALSE);
|
||||
if (imesa->savageScreen->chipset >= S3_SAVAGE4)
|
||||
savageUpdateTextureState_s4 (ctx);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -781,7 +781,7 @@ static void savageRenderStart( GLcontext *ctx )
|
|||
if (index & _TNL_BIT_TEX(0)) {
|
||||
if (VB->TexCoordPtr[0]->size > 2) {
|
||||
/* projective textures are not supported by the hardware */
|
||||
FALLBACK(ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
|
||||
FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE);
|
||||
}
|
||||
if (VB->TexCoordPtr[0]->size == 2)
|
||||
EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, SAVAGE_EMIT_ST0, SAVAGE_HW_NO_UV0 );
|
||||
|
|
@ -791,7 +791,7 @@ static void savageRenderStart( GLcontext *ctx )
|
|||
if (index & _TNL_BIT_TEX(1)) {
|
||||
if (VB->TexCoordPtr[1]->size > 2) {
|
||||
/* projective textures are not supported by the hardware */
|
||||
FALLBACK(ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
|
||||
FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE);
|
||||
}
|
||||
if (VB->TexCoordPtr[1]->size == 2)
|
||||
EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F, SAVAGE_EMIT_ST1, SAVAGE_HW_NO_UV1 );
|
||||
|
|
@ -841,11 +841,27 @@ static void savageRenderFinish( GLcontext *ctx )
|
|||
/* Transition to/from hardware rasterization. */
|
||||
/**********************************************************************/
|
||||
|
||||
static const char * const fallbackStrings[] = {
|
||||
"Texture mode",
|
||||
"Draw buffer",
|
||||
"Read buffer",
|
||||
"Color mask",
|
||||
"Specular",
|
||||
"LogicOp",
|
||||
"glEnable(GL_STENCIL) without hw stencil buffer",
|
||||
"glRenderMode(selection or feedback)",
|
||||
"glBlendEquation",
|
||||
"Hardware rasterization disabled",
|
||||
"Projective texture",
|
||||
};
|
||||
|
||||
void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
|
||||
{
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
|
||||
GLuint oldfallback = imesa->Fallback;
|
||||
GLuint index;
|
||||
for (index = 0; (1 << index) < bit; ++index);
|
||||
|
||||
if (mode) {
|
||||
imesa->Fallback |= bit;
|
||||
|
|
@ -855,6 +871,9 @@ void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
|
|||
_swsetup_Wakeup( ctx );
|
||||
imesa->RenderIndex = ~0;
|
||||
}
|
||||
if (!(oldfallback & bit) && (SAVAGE_DEBUG & DEBUG_FALLBACKS))
|
||||
fprintf (stderr, "Savage begin fallback: 0x%x %s\n",
|
||||
bit, fallbackStrings[index]);
|
||||
}
|
||||
else {
|
||||
imesa->Fallback &= ~bit;
|
||||
|
|
@ -878,6 +897,9 @@ void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
|
|||
|
||||
imesa->new_gl_state |= _SAVAGE_NEW_RENDER_STATE;
|
||||
}
|
||||
if ((oldfallback & bit) && (SAVAGE_DEBUG & DEBUG_FALLBACKS))
|
||||
fprintf (stderr, "Savage end fallback: 0x%x %s\n",
|
||||
bit, fallbackStrings[index]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue