From: Eric Anholt Date: Sat, 2 Oct 2004 05:22:19 +0000 (+0000) Subject: If an application cleared before any state had been emitted, that clear would X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=599ea624a3b95f397d7837a0254c39c9bd0ab0ed;p=mesa.git If an application cleared before any state had been emitted, that clear would happen before any state had been set, causing a hang later on. Fix this by calling r200Flush instead of FIREVERTICES (which checks if any state has been emitted but not flushed, before calling Flush) in r200Clear. While here, add some more debugging info which was useful, and remove an unnecessary save/restore in BackUpAndEmit. --- diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index 5cdb3657f98..531ec8933a5 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -112,6 +112,9 @@ static void r200SaveHwState( r200ContextPtr rmesa ) struct r200_state_atom *atom; char * dest = rmesa->backup_store.cmd_buf; + if (R200_DEBUG & DEBUG_STATE) + fprintf(stderr, "%s\n", __FUNCTION__); + rmesa->backup_store.cmd_used = 0; foreach( atom, &rmesa->hw.atomlist ) { @@ -120,10 +123,14 @@ static void r200SaveHwState( r200ContextPtr rmesa ) memcpy( dest, atom->cmd, size); dest += size; rmesa->backup_store.cmd_used += size; + if (R200_DEBUG & DEBUG_STATE) + print_state_atom( atom ); } } assert( rmesa->backup_store.cmd_used <= R200_CMD_BUF_SZ ); + if (R200_DEBUG & DEBUG_STATE) + fprintf(stderr, "Returning to r200EmitState\n"); } void r200EmitState( r200ContextPtr rmesa ) diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 74cc40adcd5..077afd81e87 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -66,7 +66,7 @@ static void r200WaitForIdle( r200ContextPtr rmesa ); */ static void r200BackUpAndEmitLostStateLocked( r200ContextPtr rmesa ) { - GLuint nr_released_bufs, saved_cmd_used; + GLuint nr_released_bufs; struct r200_store saved_store; if (rmesa->backup_store.cmd_used == 0) @@ -81,9 +81,7 @@ static void r200BackUpAndEmitLostStateLocked( r200ContextPtr rmesa ) saved_store = rmesa->store; rmesa->dma.nr_released_bufs = 0; rmesa->store = rmesa->backup_store; - saved_cmd_used = rmesa->backup_store.cmd_used; r200FlushCmdBufLocked( rmesa, __FUNCTION__ ); - rmesa->backup_store.cmd_used = saved_cmd_used; rmesa->dma.nr_released_bufs = nr_released_bufs; rmesa->store = saved_store; } @@ -597,7 +595,7 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, return; } - R200_FIREVERTICES( rmesa ); + r200Flush( ctx ); if ( mask & DD_FRONT_LEFT_BIT ) { flags |= RADEON_FRONT;