* Fixed handling of scissors

* Only set scissor regs directly if drmMinor < 1
* Don't set texaddr to 0 when a texture unit is disabled. That would trigger
  the tightened texture state check in the DRM if the texaddr and texdesc
  registers were not emitted atomically.
This commit is contained in:
Felix Kuehling 2005-01-05 23:56:16 +00:00
parent 1e21673ea1
commit 3e4d4aca77
3 changed files with 8 additions and 43 deletions

View file

@ -1202,6 +1202,8 @@ static void savageDDEnable_s4(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_SCISSOR_TEST:
imesa->scissor = state;
imesa->dirty |= SAVAGE_UPLOAD_CLIPRECTS;
savageDDScissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height);
break;
case GL_STENCIL_TEST:
if (!imesa->hw_stencil)
@ -1292,6 +1294,8 @@ static void savageDDEnable_s3d(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_SCISSOR_TEST:
imesa->scissor = state;
imesa->dirty |= SAVAGE_UPLOAD_CLIPRECTS;
savageDDScissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height);
break;
case GL_STENCIL_TEST:
FALLBACK (ctx, SAVAGE_FALLBACK_STENCIL, state);
@ -1505,7 +1509,7 @@ static void savageUpdateRegister_s4(savageContextPtr imesa)
/*
* Scissors updates drawctrl0 and drawctrl 1
*/
if (imesa->scissorChanged)
if (imesa->scissorChanged && imesa->savageScreen->driScrnPriv->drmMinor < 1)
{
if(imesa->scissor)
{
@ -1521,6 +1525,7 @@ static void savageUpdateRegister_s4(savageContextPtr imesa)
imesa->regs.s4.drawCtrl1.ni.scissorXEnd = imesa->draw_rect.x2-1;
imesa->regs.s4.drawCtrl1.ni.scissorYEnd = imesa->draw_rect.y2-1;
}
imesa->scissorChanged = GL_FALSE;
}
/* the savage4 uses the contiguous range of BCI registers 0x1e-0x39
@ -1531,7 +1536,7 @@ static void savageUpdateRegister_s4(savageContextPtr imesa)
}
static void savageUpdateRegister_s3d(savageContextPtr imesa)
{
if (imesa->scissorChanged)
if (imesa->scissorChanged && imesa->savageScreen->driScrnPriv->drmMinor < 1)
{
if(imesa->scissor)
{
@ -1555,6 +1560,7 @@ static void savageUpdateRegister_s3d(savageContextPtr imesa)
imesa->regs.s3d.scissorsEnd.ni.scissorYEnd =
imesa->draw_rect.y2-1;
}
imesa->scissorChanged = GL_FALSE;
}
/* Some temporary hacks to workaround lockups. Not sure if they are
@ -1845,37 +1851,6 @@ void savageDDInitState( savageContextPtr imesa ) {
NEW_TEXTURE_MATRIX|\
NEW_USER_CLIP|NEW_CLIENT_STATE))
void savageDDRenderStart(GLcontext *ctx)
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
drm_clip_rect_t *pbox;
GLint nbox;
/* if the screen is overrided by other application. set the scissor.
* In MulitPass, re-render the screen.
*/
pbox = dPriv->pClipRects;
nbox = dPriv->numClipRects;
if (nbox)
{
imesa->currentClip = nbox;
/* set scissor to the first clip box*/
savageDDScissor(ctx,pbox->x1,pbox->y1,pbox->x2,pbox->y2);
/*savageDDUpdateHwState(ctx);*/ /* update to hardware register*/
}
else /* need not render at all*/
{
/*ctx->VB->CopyStart = ctx->VB->Count;*/
}
}
void savageDDRenderEnd(GLcontext *ctx)
{
}
static void savageDDInvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );

View file

@ -837,7 +837,6 @@ static void savageUpdateTex0State_s4( GLcontext *ctx )
imesa->regs.s4.texDescr.ni.tex0En = GL_FALSE;
imesa->regs.s4.texBlendCtrl[0].ui = TBC_NoTexMap;
imesa->regs.s4.texCtrl[0].ui = 0x20f040;
imesa->regs.s4.texAddr[0].ui = 0;
return;
}
@ -1007,7 +1006,6 @@ static void savageUpdateTex0State_s4( GLcontext *ctx )
GL_ADD
*/
case GL_ADD:
printf("Add\n");
imesa->regs.s4.texCtrl[0].ni.clrArg1Invert = GL_FALSE;
imesa->regs.s4.texBlendCtrl[0].ui = TBC_AddAlpha;
__HWEnvCombineSingleUnitScale(imesa, 0, 0,
@ -1105,7 +1103,6 @@ static void savageUpdateTex1State_s4( GLcontext *ctx )
imesa->regs.s4.texDescr.ni.tex1En = GL_FALSE;
imesa->regs.s4.texBlendCtrl[1].ui = TBC_NoTexMap1;
imesa->regs.s4.texCtrl[1].ui = 0x20f040;
imesa->regs.s4.texAddr[1].ui = 0;
imesa->regs.s4.texDescr.ni.texBLoopEn = GL_FALSE;
return;
}
@ -1300,7 +1297,6 @@ static void savageUpdateTexState_s3d( GLcontext *ctx )
imesa->regs.s3d.texCtrl.ni.texEn = GL_FALSE;
imesa->regs.s3d.texCtrl.ni.dBias = 0x08;
imesa->regs.s3d.texCtrl.ni.texXprEn = GL_TRUE;
imesa->regs.s3d.texAddr.ui = 0;
return;
}

View file

@ -1069,16 +1069,10 @@ static void savageRenderStart( GLcontext *ctx )
imesa->HwVertexSize = hwVertexSize;
}
}
/* Update hardware state and get the lock */
savageDDRenderStart( ctx );
}
static void savageRenderFinish( GLcontext *ctx )
{
/* Release the lock */
savageDDRenderEnd( ctx );
/* Flush the last primitive now, before any state is changed.
* Alternatively state could be emitted in all state-changing
* functions in savagestate.c and when changing the vertex format