r200: bring back single dma flush
authorDave Airlie <airlied@redhat.com>
Thu, 29 Jan 2009 10:33:07 +0000 (20:33 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 29 Jan 2009 10:33:07 +0000 (20:33 +1000)
src/mesa/drivers/dri/r200/r200_cmdbuf.c
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/r200/r200_context.h
src/mesa/drivers/dri/r200/r200_ioctl.c
src/mesa/drivers/dri/r200/r200_ioctl.h
src/mesa/drivers/dri/r200/r200_swtcl.c
src/mesa/drivers/dri/r200/r200_tcl.c

index fb8dddad3fa13caf01b47ab24163b609291d0987..eba5d6e0198cfeebfafe384907440d9da6ad920f 100644 (file)
@@ -281,8 +281,8 @@ void r200FlushElts(GLcontext *ctx)
    if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_PRIMS))
      fprintf(stderr, "%s %x %d\n", __FUNCTION__, rmesa->tcl.hw_primitive, elt_used);
 
-   assert( rmesa->tcl.flush == r200FlushElts );
-   rmesa->tcl.flush = NULL;
+   assert( rmesa->radeon.dma.flush == r200FlushElts );
+   rmesa->radeon.dma.flush = NULL;
 
    elt_used = (elt_used + 2) & ~2;
 
@@ -329,9 +329,9 @@ GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa,
       fprintf(stderr, "%s: header prim %x \n",
              __FUNCTION__, primitive);
 
-   assert(!rmesa->tcl.flush);
+   assert(!rmesa->radeon.dma.flush);
    rmesa->radeon.glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
-   rmesa->tcl.flush = r200FlushElts;
+   rmesa->radeon.dma.flush = r200FlushElts;
 
    return retval;
 }
index 53c64eb5a38d394380b65c8fc49a4be992dcaa12..c2b269880c68037cf8717a9d8e3306c4e9bf52ce 100644 (file)
@@ -584,8 +584,8 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
       r200DestroySwtcl( rmesa->radeon.glCtx );
       r200ReleaseArrays( rmesa->radeon.glCtx, ~0 );
 
-      if (rmesa->dma.current) {
-        radeonReleaseDmaRegion(rmesa);
+      if (rmesa->radeon.dma.current) {
+        radeonReleaseDmaRegion(&rmesa->radeon);
         rcommonFlushCmdBuf( &rmesa->radeon, __FUNCTION__ );
       }
 
index 80981135ac6844cd938befd9f044dbe4050f5562..2df0ca1272907aaf69e17b43ad22dacea8a0821b 100644 (file)
@@ -544,7 +544,6 @@ struct r200_tcl_info {
    int elt_dma_offset; /** Offset into this buffer object, in bytes */
    int elt_used;
 
-   void (*flush) (GLcontext *ctx);
    struct radeon_dma_region vertex_data[15];
 };
 
@@ -602,7 +601,6 @@ struct r200_swtcl_info {
    GLboolean needproj;
 
    struct radeon_bo *bo;
-   void (*flush) (GLcontext *ctx);
 };
 
 
@@ -633,7 +631,6 @@ struct r200_context {
    /* Vertex buffers
     */
    struct radeon_ioctl ioctl;
-   struct radeon_dma dma;
    struct radeon_store store;
    /* A full state emit as of the first state emit in the main store, in case
     * the context is lost.
index cb2f50d5d87564fe6ea2e095248be02cb4aa3171..0b7f6644573bc5fa62a24bc93a1458ffa41f266d 100644 (file)
@@ -76,12 +76,12 @@ static void r200BackUpAndEmitLostStateLocked( r200ContextPtr rmesa )
 
    rmesa->radeon.lost_context = GL_FALSE;
 
-   nr_released_bufs = rmesa->dma.nr_released_bufs;
+   nr_released_bufs = rmesa->radeon.dma.nr_released_bufs;
    saved_store = rmesa->store;
-   rmesa->dma.nr_released_bufs = 0;
+   rmesa->radeon.dma.nr_released_bufs = 0;
    rmesa->store = rmesa->backup_store;
    rcommonFlushCmdBufLocked( &rmesa->radeon, __FUNCTION__ );
-   rmesa->dma.nr_released_bufs = nr_released_bufs;
+   rmesa->radeon.dma.nr_released_bufs = nr_released_bufs;
    rmesa->store = saved_store;
 }
 
@@ -302,11 +302,8 @@ void r200Flush( GLcontext *ctx )
    if (R200_DEBUG & DEBUG_IOCTL)
       fprintf(stderr, "%s\n", __FUNCTION__);
 
-   if (rmesa->swtcl.flush)
-      rmesa->swtcl.flush( ctx );
-
-   if (rmesa->tcl.flush)
-      rmesa->tcl.flush( ctx );
+   if (rmesa->radeon.dma.flush)
+      rmesa->radeon.dma.flush( ctx );
 
    r200EmitState( rmesa );
 
index ccc15c5b49de421641609258c7df69bcb1472177..0410fdf3c31df4926a9ed4c7c3e99d257619752a 100644 (file)
@@ -112,8 +112,8 @@ void r200SetUpAtomList( r200ContextPtr rmesa );
  */
 #define R200_NEWPRIM( rmesa )                  \
 do {                                           \
-   if ( rmesa->swtcl.flush )                   \
-      rmesa->swtcl.flush( rmesa->radeon.glCtx );       \
+   if ( rmesa->radeon.dma.flush )                      \
+      rmesa->radeon.dma.flush( rmesa->radeon.glCtx );  \
 } while (0)
 
 /* Can accomodate several state changes and primitive changes without
@@ -153,7 +153,7 @@ static INLINE int R200_DB_STATECHANGE(
  */
 #define R200_FIREVERTICES( rmesa )                     \
 do {                                                   \
-   if ( rmesa->swtcl.flush || rmesa->tcl.flush ) {     \
+   if ( rmesa->radeon.dma.flush ) {    \
       r200Flush( rmesa->radeon.glCtx );                        \
    }                                                   \
 } while (0)
index 3142f8b6c9486f3aab5d1e52c274c2492a889709..2a22bd297a4380efefaf5b2727d2137726658698 100644 (file)
@@ -279,7 +279,7 @@ static void flush_last_swtcl_prim(GLcontext *ctx)
    if (R200_DEBUG & DEBUG_IOCTL)
       fprintf(stderr, "%s\n", __FUNCTION__);
 
-   rmesa->swtcl.flush = NULL;
+   rmesa->radeon.dma.flush = NULL;
 
    radeon_bo_unmap(rmesa->swtcl.bo);
    rcommonEnsureCmdBufSpace(rmesa,
@@ -313,9 +313,9 @@ r200AllocDmaLowVerts( r200ContextPtr rmesa, int nverts, int vsize )
    rmesa->swtcl.bo = radeon_bo_open(rmesa->radeon.radeonScreen->bom,
                                    0, bytes, 4, RADEON_GEM_DOMAIN_GTT, 0);
    radeon_bo_map(rmesa->swtcl.bo, 1);
-   if (rmesa->swtcl.flush == NULL) {
+   if (rmesa->radeon.dma.flush == NULL) {
      rmesa->radeon.glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
-     rmesa->swtcl.flush = flush_last_swtcl_prim;
+     rmesa->radeon.dma.flush = flush_last_swtcl_prim;
    }
    return rmesa->swtcl.bo->ptr;
 
index 9562c8b315f4b345e33b75c0e59ea69250d79532..5bb25bc53a637f91babbfc474e2510a1cf824e9f 100644 (file)
@@ -143,7 +143,7 @@ static GLboolean discrete_prim[0x10] = {
 static GLushort *r200AllocElts( r200ContextPtr rmesa, GLuint nr ) 
 {
   //  fprintf(stderr,"alloc elts %d %d\n", nr, rmesa->tcl.elt_used);
-   if (rmesa->tcl.flush == r200FlushElts &&
+   if (rmesa->radeon.dma.flush == r200FlushElts &&
        rmesa->tcl.elt_used + nr*2 < R200_ELT_BUF_SZ) {
 
       GLushort *dest = (GLushort *)(rmesa->tcl.elt_dma_bo->ptr +
@@ -154,8 +154,8 @@ static GLushort *r200AllocElts( r200ContextPtr rmesa, GLuint nr )
       return dest;
    }
    else {
-      if (rmesa->tcl.flush)
-        rmesa->tcl.flush( rmesa->radeon.glCtx );
+      if (rmesa->radeon.dma.flush)
+        rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
 
       rcommonEnsureCmdBufSpace(rmesa, AOS_BUFSZ(rmesa->tcl.nr_aos_components));
 
@@ -188,7 +188,8 @@ static void r200EmitPrim( GLcontext *ctx,
    r200TclPrimitive( ctx, prim, hwprim );
    
    //   fprintf(stderr,"Emit prim %d\n", rmesa->tcl.nr_aos_components);
-   rcommonEnsureCmdBufSpace( rmesa, AOS_BUFSZ(rmesa->tcl.nr_aos_components) +
+   rcommonEnsureCmdBufSpace( &rmesa->radeon,
+                            AOS_BUFSZ(rmesa->tcl.nr_aos_components) +
                             rmesa->hw.max_state_size + VBUF_BUFSZ );
 
    r200EmitAOS( rmesa,
@@ -564,10 +565,10 @@ static void transition_to_hwtnl( GLcontext *ctx )
 
    tnl->Driver.NotifyMaterialChange = r200UpdateMaterial;
 
-   if ( rmesa->swtcl.flush )                   
-      rmesa->swtcl.flush( rmesa->radeon.glCtx );       
+   if ( rmesa->radeon.dma.flush )                      
+      rmesa->radeon.dma.flush( rmesa->radeon.glCtx );  
 
-   rmesa->swtcl.flush = NULL;
+   rmesa->radeon.dma.flush = NULL;
    
    R200_STATECHANGE( rmesa, vap );
    rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_TCL_ENABLE;