diff options
author | Eric Anholt <anholt@FreeBSD.org> | 2004-09-25 07:00:15 +0000 |
---|---|---|
committer | Eric Anholt <anholt@FreeBSD.org> | 2004-09-25 07:00:15 +0000 |
commit | 5562fe653cf88454bbf2c50f77a8b56b0dafe01b (patch) | |
tree | 159ffb9f519e550e45fc9442c9f21e557e19c681 /src/mesa/drivers/dri/radeon/radeon_compat.c | |
parent | 4010481ba3bce98d95a20e9a061fb62922bdcb83 (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. Provides a 10-15% improvement in ipers performance in my
tests, along with other apps.
Tested with: ipers, glxgears, quake3
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_compat.c')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_compat.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_compat.c b/src/mesa/drivers/dri/radeon/radeon_compat.c index 857d6edc39..1cbe3407ba 100644 --- a/src/mesa/drivers/dri/radeon/radeon_compat.c +++ b/src/mesa/drivers/dri/radeon/radeon_compat.c @@ -202,30 +202,28 @@ static void radeonCompatEmitPacket( radeonContextPtr rmesa, static void radeonCompatEmitStateLocked( radeonContextPtr rmesa ) { - struct radeon_state_atom *state, *tmp; + struct radeon_state_atom *atom; if (RADEON_DEBUG & (DEBUG_STATE|DEBUG_PRIMS)) fprintf(stderr, "%s\n", __FUNCTION__); - if (rmesa->lost_context) { - if (RADEON_DEBUG & (DEBUG_STATE|DEBUG_PRIMS|DEBUG_IOCTL)) - fprintf(stderr, "%s - lost context\n", __FUNCTION__); + if (!rmesa->hw.is_dirty && !rmesa->hw.all_dirty) + return; - foreach_s( state, tmp, &(rmesa->hw.clean) ) - move_to_tail(&(rmesa->hw.dirty), state ); - - rmesa->lost_context = 0; - } - - foreach_s( state, tmp, &(rmesa->hw.dirty) ) { - if (!state->is_tcl) - radeonCompatEmitPacket( rmesa, state ); - move_to_head( &(rmesa->hw.clean), state ); + foreach(atom, &rmesa->hw.atomlist) { + if (rmesa->hw.all_dirty) + atom->dirty = GL_TRUE; + if (atom->is_tcl) + atom->dirty = GL_FALSE; + if (atom->dirty) + radeonCompatEmitPacket(rmesa, atom); } + + rmesa->hw.is_dirty = GL_FALSE; + rmesa->hw.all_dirty = GL_FALSE; } - static void radeonCompatEmitPrimitiveLocked( radeonContextPtr rmesa, GLuint hw_primitive, GLuint nverts, |