If an application cleared before any state had been emitted, that clear would
authorEric Anholt <anholt@FreeBSD.org>
Sat, 2 Oct 2004 05:22:19 +0000 (05:22 +0000)
committerEric Anholt <anholt@FreeBSD.org>
Sat, 2 Oct 2004 05:22:19 +0000 (05:22 +0000)
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.

src/mesa/drivers/dri/r200/r200_cmdbuf.c
src/mesa/drivers/dri/r200/r200_ioctl.c

index 5cdb3657f98526479e51b5defcc8c9a322e8abea..531ec8933a5f868d4c9f657fb5ca9b4b8318c27c 100644 (file)
@@ -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 )
index 74cc40adcd5e0abc434e3a43d744e3aa06e55aeb..077afd81e877047e773117f4743ac0d2e2ced3fc 100644 (file)
@@ -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;