Calling EnsureCmdBufSpace is not required because rendering pipeline has to 
quarentee free space.

Signed-off-by: Pauli Nieminen <[email protected]>
---
 src/mesa/drivers/dri/r200/r200_tcl.c        |    5 -----
 src/mesa/drivers/dri/radeon/radeon_common.c |   17 ++++++-----------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c 
b/src/mesa/drivers/dri/r200/r200_tcl.c
index 6597e4e..43c992c 100644
--- a/src/mesa/drivers/dri/r200/r200_tcl.c
+++ b/src/mesa/drivers/dri/r200/r200_tcl.c
@@ -156,8 +156,6 @@ static GLushort *r200AllocElts( r200ContextPtr rmesa, 
GLuint nr )
       if (rmesa->radeon.dma.flush)
         rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
 
-      rcommonEnsureCmdBufSpace(&rmesa->radeon, 
AOS_BUFSZ(rmesa->radeon.tcl.aos_count), __FUNCTION__);
-
       r200EmitAOS( rmesa,
                   rmesa->radeon.tcl.aos_count, 0 );
 
@@ -187,9 +185,6 @@ static void r200EmitPrim( GLcontext *ctx,
    r200TclPrimitive( ctx, prim, hwprim );
    
    //   fprintf(stderr,"Emit prim %d\n", rmesa->radeon.tcl.aos_count);
-   rcommonEnsureCmdBufSpace( &rmesa->radeon,
-                            AOS_BUFSZ(rmesa->radeon.tcl.aos_count) +
-                            rmesa->radeon.hw.max_state_size + VBUF_BUFSZ, 
__FUNCTION__ );
 
    r200EmitAOS( rmesa,
                rmesa->radeon.tcl.aos_count,
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index b65f5bc..2e34095 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -1057,12 +1057,6 @@ void radeonEmitState(radeonContextPtr radeon)
        if (radeon->cmdbuf.cs->cdw && !radeon->hw.is_dirty && 
!radeon->hw.all_dirty)
                return;
 
-       /* To avoid going across the entire set of states multiple times, just 
check
-        * for enough space for the case of emitting all state, and inline the
-        * radeonAllocCmdBuf code here without all the checks.
-        */
-       rcommonEnsureCmdBufSpace(radeon, radeon->hw.max_state_size, 
__FUNCTION__);
-
        if (!radeon->cmdbuf.cs->cdw) {
                if (RADEON_DEBUG & DEBUG_STATE)
                        fprintf(stderr, "Begin reemit state\n");
@@ -1217,10 +1211,12 @@ int rcommonFlushCmdBuf(radeonContextPtr rmesa, const 
char *caller)
  */
 void rcommonEnsureCmdBufSpace(radeonContextPtr rmesa, int dwords, const char 
*caller)
 {
-       if ((rmesa->cmdbuf.cs->cdw + dwords + 128) > rmesa->cmdbuf.size ||
-           radeon_cs_need_flush(rmesa->cmdbuf.cs)) {
-               rcommonFlushCmdBuf(rmesa, caller);
-       }
+   if ((rmesa->cmdbuf.cs->cdw + dwords + 128) > rmesa->cmdbuf.size 
+        || radeon_cs_need_flush(rmesa->cmdbuf.cs)) {
+      /* If wetry to flush empty buffer there is too big renderingoperation. */
+      assert(rmesa->cmdbuf.cs->cdw);
+      rcommonFlushCmdBuf(rmesa, caller);
+   }
 }
 
 void rcommonInitCmdBuf(radeonContextPtr rmesa)
@@ -1295,7 +1291,6 @@ void rcommonBeginBatch(radeonContextPtr rmesa, int n,
                       const char *function,
                       int line)
 {
-       rcommonEnsureCmdBufSpace(rmesa, n, function);
        if (!rmesa->cmdbuf.cs->cdw && dostate) {
                if (RADEON_DEBUG & DEBUG_IOCTL)
                        fprintf(stderr, "Reemit state after flush (from %s)\n", 
function);
-- 
1.6.3.3


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to