From: Dave Airlie Date: Thu, 15 Jan 2009 06:25:37 +0000 (+1000) Subject: r100/r200: move to new atom style emission X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0c0a55a21158e1f97cf140c0a1c0531c06751873;p=mesa.git r100/r200: move to new atom style emission --- diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index 4f0275cc875..53c6ecf6eea 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -120,18 +120,24 @@ static void r200SaveHwState( r200ContextPtr rmesa ) { struct radeon_state_atom *atom; char * dest = rmesa->backup_store.cmd_buf; - + uint32_t dwords; if (R200_DEBUG & DEBUG_STATE) fprintf(stderr, "%s\n", __FUNCTION__); rmesa->backup_store.cmd_used = 0; foreach( atom, &rmesa->hw.atomlist ) { - if ( atom->check( rmesa->radeon.glCtx, atom ) ) { + dwords = atom->check( rmesa->radeon.glCtx, atom ); + if ( dwords ) { int size = atom->cmd_size * 4; - memcpy( dest, atom->cmd, size); - dest += size; - rmesa->backup_store.cmd_used += size; + + if (atom->emit) { + (*atom->emit)(rmesa->radeon.glCtx, atom); + } else { + memcpy( dest, atom->cmd, size); + dest += size; + rmesa->backup_store.cmd_used += size; + } if (R200_DEBUG & DEBUG_STATE) print_state_atom( atom ); } @@ -147,6 +153,7 @@ void r200EmitState( r200ContextPtr rmesa ) char *dest; int mtu; struct radeon_state_atom *atom; + uint32_t dwords; if (R200_DEBUG & (DEBUG_STATE|DEBUG_PRIMS)) fprintf(stderr, "%s\n", __FUNCTION__); @@ -173,7 +180,8 @@ void r200EmitState( r200ContextPtr rmesa ) if (R200_DEBUG & DEBUG_STATE) { foreach( atom, &rmesa->hw.atomlist ) { if ( atom->dirty || rmesa->hw.all_dirty ) { - if ( atom->check( rmesa->radeon.glCtx, atom ) ) + dwords = atom->check( rmesa->radeon.glCtx, atom ); + if ( dwords ) print_state_atom( atom ); else fprintf(stderr, "skip state %s\n", atom->name); @@ -185,11 +193,16 @@ void r200EmitState( r200ContextPtr rmesa ) if ( rmesa->hw.all_dirty ) atom->dirty = GL_TRUE; if ( atom->dirty ) { - if ( atom->check( rmesa->radeon.glCtx, atom ) ) { + dwords = atom->check( rmesa->radeon.glCtx, atom ); + if ( dwords ) { int size = atom->cmd_size * 4; - memcpy( dest, atom->cmd, size); - dest += size; - rmesa->store.cmd_used += size; + if (atom->emit) { + (*atom->emit)(rmesa->radeon.glCtx, atom); + } else { + memcpy( dest, atom->cmd, size); + dest += size; + rmesa->store.cmd_used += size; + } atom->dirty = GL_FALSE; } } diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 775ccb74825..f68f5ae08ff 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -130,25 +130,22 @@ static int cmdscl2( int offset, int stride, int count ) static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ - (void) atom; \ (void) rmesa; \ - return FLAG; \ + return (FLAG) ? atom->cmd_size : 0; \ } #define TCL_CHECK( NM, FLAG ) \ static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ - (void) atom; \ - return !rmesa->radeon.TclFallback && !ctx->VertexProgram._Enabled && (FLAG); \ + return (!rmesa->radeon.TclFallback && !ctx->VertexProgram._Enabled && (FLAG)) ? atom->cmd_size : 0; \ } #define TCL_OR_VP_CHECK( NM, FLAG ) \ static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ - (void) atom; \ - return !rmesa->radeon.TclFallback && (FLAG); \ + return (!rmesa->radeon.TclFallback && (FLAG)) ? atom->cmd_size : 0; \ } #define VP_CHECK( NM, FLAG ) \ @@ -156,10 +153,9 @@ static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ (void) atom; \ - return !rmesa->radeon.TclFallback && ctx->VertexProgram._Enabled && (FLAG); \ + return (!rmesa->radeon.TclFallback && ctx->VertexProgram._Enabled && (FLAG)) ? atom->cmd_size : 0; \ } - CHECK( always, GL_TRUE ) CHECK( never, GL_FALSE ) CHECK( tex_any, ctx->Texture._EnabledUnits ) diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 2b02d0b71fc..cd0f90d748b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -170,6 +170,7 @@ void radeonEmitState( r100ContextPtr rmesa ) { struct radeon_state_atom *atom; char *dest; + uint32_t dwords; if (RADEON_DEBUG & (DEBUG_STATE|DEBUG_PRIMS)) fprintf(stderr, "%s\n", __FUNCTION__); @@ -212,11 +213,17 @@ void radeonEmitState( r100ContextPtr rmesa ) atom->is_tcl) atom->dirty = GL_FALSE; if (atom->dirty) { - if (atom->check(rmesa->radeon.glCtx, 0)) { + dwords = atom->check(rmesa->radeon.glCtx, atom); + if (dwords) { int size = atom->cmd_size * 4; - memcpy(dest, atom->cmd, size); - dest += size; - rmesa->store.cmd_used += size; + + if (atom->emit) { + (*atom->emit)(rmesa->radeon.glCtx, atom); + } else { + memcpy(dest, atom->cmd, size); + dest += size; + rmesa->store.cmd_used += size; + } atom->dirty = GL_FALSE; } } diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index affa9313c9e..f39fae8186c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -99,14 +99,14 @@ static int cmdscl( int offset, int stride, int count ) #define CHECK( NM, FLAG ) \ static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ { \ - return FLAG; \ + return FLAG ? atom->cmd_size : 0; \ } #define TCL_CHECK( NM, FLAG ) \ static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ { \ r100ContextPtr rmesa = R100_CONTEXT(ctx); \ - return !rmesa->radeon.TclFallback && (FLAG); \ + return (!rmesa->radeon.TclFallback && (FLAG)) ? atom->cmd_size : 0; \ }