From c9bb5cd20e5468168d54fe461c853926072fa813 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 29 Jan 2009 20:33:07 +1000 Subject: [PATCH] r200: bring back single dma flush --- src/mesa/drivers/dri/r200/r200_cmdbuf.c | 8 ++++---- src/mesa/drivers/dri/r200/r200_context.c | 4 ++-- src/mesa/drivers/dri/r200/r200_context.h | 3 --- src/mesa/drivers/dri/r200/r200_ioctl.c | 13 +++++-------- src/mesa/drivers/dri/r200/r200_ioctl.h | 6 +++--- src/mesa/drivers/dri/r200/r200_swtcl.c | 6 +++--- src/mesa/drivers/dri/r200/r200_tcl.c | 15 ++++++++------- 7 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index fb8dddad3fa..eba5d6e0198 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -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; } diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 53c64eb5a38..c2b269880c6 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -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__ ); } diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index 80981135ac6..2df0ca12729 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -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. diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index cb2f50d5d87..0b7f6644573 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -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 ); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index ccc15c5b49d..0410fdf3c31 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -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) diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 3142f8b6c94..2a22bd297a4 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -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; diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index 9562c8b315f..5bb25bc53a6 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -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; -- 2.30.2