diff options
author | Felix Kuehling <fxkuehl@gmx.de> | 2004-03-25 01:16:27 +0000 |
---|---|---|
committer | Felix Kuehling <fxkuehl@gmx.de> | 2004-03-25 01:16:27 +0000 |
commit | 6e963e965cd00d69de0d868882c2c5322b39f578 (patch) | |
tree | 071a2deeeaf18f90473257ef4c8d63977f30c9f7 | |
parent | adf33a1c6f087075b65f0fbc756839481a38e10d (diff) | |
download | external_mesa3d-6e963e965cd00d69de0d868882c2c5322b39f578.zip external_mesa3d-6e963e965cd00d69de0d868882c2c5322b39f578.tar.gz external_mesa3d-6e963e965cd00d69de0d868882c2c5322b39f578.tar.bz2 |
More state management changes:
- Don't lock in savageDDUpdateStatte, don't call savageEmitHwStateLocked
- Need to grab the lock for texture uploads now
- New SAVAGE_NEW_CULL bit in new_state to make sure that culling state and
raster_primitive are not examined at the wrong times.
-rw-r--r-- | src/mesa/drivers/dri/savage/savagecontext.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/savage/savagestate.c | 35 | ||||
-rw-r--r-- | src/mesa/drivers/dri/savage/savagetex.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/savage/savagetris.c | 10 |
4 files changed, 21 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/savage/savagecontext.h b/src/mesa/drivers/dri/savage/savagecontext.h index 13f3d4a..68a966a 100644 --- a/src/mesa/drivers/dri/savage/savagecontext.h +++ b/src/mesa/drivers/dri/savage/savagecontext.h @@ -66,6 +66,7 @@ typedef struct savage_texture_object_t *savageTextureObjectPtr; /* for savagectx.new_state - manage GL->driver state changes */ #define SAVAGE_NEW_TEXTURE 0x1 +#define SAVAGE_NEW_CULL 0x2 /*define the max numer of vertex in vertex buf*/ diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index cd6ba7e..e4e608d 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -791,6 +791,7 @@ static void savageDDCullFaceFrontFace(GLcontext *ctx, GLenum unused) break; } imesa->LcsCullMode = cullMode; + imesa->new_state |= SAVAGE_NEW_CULL; } #endif /* end #if HW_CULL */ @@ -1210,6 +1211,7 @@ static void savageDDEnable_s4(GLcontext *ctx, GLenum cap, GLboolean state) else { imesa->LcsCullMode = BCM_None; + imesa->new_state |= SAVAGE_NEW_CULL; } #endif break; @@ -1326,25 +1328,17 @@ static void savageDDEnable_s3d(GLcontext *ctx, GLenum cap, GLboolean state) void savageDDUpdateHwState( GLcontext *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); - - /*FLUSH_BATCH(imesa);*/ - if(imesa->driDrawable) - { - LOCK_HARDWARE(imesa); - } - - if (imesa->new_state & SAVAGE_NEW_TEXTURE) { - savageUpdateTextureState( ctx ); - } - if((imesa->dirty!=0)|| (imesa->new_state!=0)) - { - savageEmitHwStateLocked(imesa); - imesa->new_state = 0; - } - if(imesa->driDrawable) - { - UNLOCK_HARDWARE(imesa); + if (imesa->new_state) { + FLUSH_BATCH(imesa); + + if (imesa->new_state & SAVAGE_NEW_TEXTURE) { + savageUpdateTextureState( ctx ); + } + if ((imesa->new_state & SAVAGE_NEW_CULL)) { + savageUpdateCull(ctx); + } + imesa->new_state = 0; } } @@ -1584,7 +1578,6 @@ void savageEmitHwStateLocked( savageContextPtr imesa ) if (imesa->dirty & ~SAVAGE_UPLOAD_CLIPRECTS) { - savageUpdateCull(imesa->glCtx); if (imesa->dirty & (SAVAGE_UPLOAD_CTX | SAVAGE_UPLOAD_TEX0 | \ SAVAGE_UPLOAD_TEX1 | SAVAGE_UPLOAD_BUFFERS)) { @@ -1833,7 +1826,7 @@ void savageDDRenderStart(GLcontext *ctx) /* set scissor to the first clip box*/ savageDDScissor(ctx,pbox->x1,pbox->y1,pbox->x2,pbox->y2); - savageDDUpdateHwState(ctx); /* update to hardware register*/ + /*savageDDUpdateHwState(ctx);*/ /* update to hardware register*/ } else /* need not render at all*/ { @@ -1855,8 +1848,6 @@ void savageDDRenderEnd(GLcontext *ctx) static void savageDDInvalidateState( GLcontext *ctx, GLuint new_state ) { - FLUSH_BATCH(SAVAGE_CONTEXT(ctx)); - _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); _ac_InvalidateState( ctx, new_state ); diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 69cb5b8..aabf6f1 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -791,6 +791,7 @@ int savageUploadTexImages( savageContextPtr imesa, savageTextureObjectPtr t ) savageUpdateTexLRU( imesa, t ); if (t->dirty_images) { + LOCK_HARDWARE(imesa); savageFlushVerticesLocked (imesa); savageDmaFinish (imesa); if (SAVAGE_DEBUG & DEBUG_VERBOSE_LRU) @@ -799,6 +800,7 @@ int savageUploadTexImages( savageContextPtr imesa, savageTextureObjectPtr t ) for (i = t->min_level ; i <= t->max_level ; i++) if (t->dirty_images & (1<<i)) savageUploadTexLevel( t, i ); + UNLOCK_HARDWARE(imesa); } diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c index 13772df..6ed2b0f 100644 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@ -673,13 +673,13 @@ static void savageRasterPrimitive( GLcontext *ctx, GLuint prim ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); - FLUSH_BATCH(imesa); - /* Update culling */ - if (imesa->raster_primitive != prim) - imesa->dirty |= SAVAGE_UPLOAD_CTX; + if (imesa->raster_primitive != prim) { + imesa->raster_primitive = prim; + imesa->new_state |= SAVAGE_NEW_CULL; + savageDDUpdateHwState (ctx); + } - imesa->raster_primitive = prim; #if 0 if (ctx->Polygon.StippleFlag && mmesa->haveHwStipple) { |