aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r200/r200_state_init.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2004-09-22 06:27:02 +0000
committerEric Anholt <[email protected]>2004-09-22 06:27:02 +0000
commit0c8f8d3dc9d60ed34eeca7f3606651420a81753c (patch)
tree3876839944c4194d4eac39863e96b64c4cfd7683 /src/mesa/drivers/dri/r200/r200_state_init.c
parent029ee9c680cd097b82d3d301b3854d57993d4464 (diff)
The previous code would emit a full set of state during the first EmitState on
a new cmdbuf, to ensure that state wasn't lost across UNLOCK/LOCK pairs (in the case of context switching). This was rather inefficient. Instead, after flushing a cmdbuf, mark the state as needing to be saved on UNLOCK. Then, at the beginning of flushing a cmdbuf, if we actually have lost the context, go back and emit a new cmdbuf with the full set of state, before continuing with the cmdbuf flush. Also, remove the dirty/clean atom lists, since atoms are emitted in a fixed order these days, and go with a simpler single list. Provides a 14% improvement in ipers performance in my tests, along with other apps.
Diffstat (limited to 'src/mesa/drivers/dri/r200/r200_state_init.c')
-rw-r--r--src/mesa/drivers/dri/r200/r200_state_init.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index 3b6893aeee9..e97a2f4d995 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -65,8 +65,9 @@ void r200PrintDirty( r200ContextPtr rmesa, const char *msg )
fprintf(stderr, msg);
fprintf(stderr, ": ");
- foreach(l, &(rmesa->hw.dirty)) {
- fprintf(stderr, "%s, ", l->name);
+ foreach(l, &rmesa->hw.atomlist) {
+ if (l->dirty || rmesa->hw.all_dirty)
+ fprintf(stderr, "%s, ", l->name);
}
fprintf(stderr, "\n");
@@ -200,11 +201,6 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
- /* Initialize lists:
- */
- make_empty_list(&(rmesa->hw.dirty)); rmesa->hw.dirty.name = "DIRTY";
- make_empty_list(&(rmesa->hw.clean)); rmesa->hw.clean.name = "CLEAN";
-
rmesa->hw.max_state_size = 0;
#define ALLOC_STATE( ATOM, CHK, SZ, NM, IDX ) \
@@ -212,10 +208,11 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->hw.ATOM.cmd_size = SZ; \
rmesa->hw.ATOM.cmd = (int *)CALLOC(SZ * sizeof(int)); \
rmesa->hw.ATOM.lastcmd = (int *)CALLOC(SZ * sizeof(int)); \
+ rmesa->hw.ATOM.savedcmd = (int *)CALLOC(SZ * sizeof(int)); \
rmesa->hw.ATOM.name = NM; \
rmesa->hw.ATOM.idx = IDX; \
- rmesa->hw.ATOM.check = check_##CHK; \
- insert_at_head(&(rmesa->hw.dirty), &(rmesa->hw.ATOM)); \
+ rmesa->hw.ATOM.check = check_##CHK; \
+ rmesa->hw.ATOM.dirty = GL_FALSE; \
rmesa->hw.max_state_size += SZ * sizeof(int); \
} while (0)
@@ -308,6 +305,7 @@ void r200InitState( r200ContextPtr rmesa )
ALLOC_STATE( pix[4], tex, PIX_STATE_SIZE, "PIX/pixstage-4", 4 );
ALLOC_STATE( pix[5], tex, PIX_STATE_SIZE, "PIX/pixstage-5", 5 );
+ r200SetUpAtomList( rmesa );
/* Fill in the packet headers:
*/
@@ -772,5 +770,6 @@ void r200InitState( r200ContextPtr rmesa )
r200LightingSpaceChange( ctx );
- rmesa->lost_context = 1;
+ r200SaveHwState( rmesa );
+ rmesa->hw.all_dirty = GL_TRUE;
}