From e84f77be215ec1fc7a27388819b6c3a711057e4a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 8 Jun 2004 09:19:17 +0000 Subject: * Convert to use t_vertex.c instead of sis_vb.[ch] * Don't dispatch vertices directly to MMIO; queue them up in dma-like buffers first. This makes things more uniform between AGP and MMIO paths, cleans up some locking ugliness, and makes the driver look more like other drivers. * Don't use the AGP Cmd buffer provided by the server. Instead allocate one in the client, which avoids the need for lots of synchronization stuff. * Mark some MMIO accesses volatile that should have been. * Disable the AGP submission path by default (agp_disable=true) due to unresolved issues in the new code. The old code had its own (serious) errors with AGP, so this is not really a step backwards. --- src/mesa/drivers/dri/sis/sis_context.c | 39 ++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'src/mesa/drivers/dri/sis/sis_context.c') diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index c49db5fe34..a9b791f101 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -41,7 +41,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_stencil.h" #include "sis_tex.h" #include "sis_tris.h" -#include "sis_vb.h" +#include "sis_alloc.h" #include "imports.h" #include "matrix.h" @@ -199,18 +199,29 @@ sisCreateContext( const __GLcontextModes *glVisual, smesa->AGPBase = sisScreen->agp.map; smesa->AGPAddr = sisScreen->agp.handle; - /* set AGP command buffer */ - if (smesa->AGPSize != 0 && sisScreen->AGPCmdBufSize != 0 && + /* Create AGP command buffer */ + if (smesa->AGPSize != 0 && !driQueryOptionb(&smesa->optionCache, "agp_disable")) - { - smesa->AGPCmdBufBase = smesa->AGPBase + sisScreen->AGPCmdBufOffset; - smesa->AGPCmdBufAddr = smesa->AGPAddr + sisScreen->AGPCmdBufOffset; - smesa->AGPCmdBufSize = sisScreen->AGPCmdBufSize; - - smesa->pAGPCmdBufNext = (GLint *)&(smesa->sarea->AGPCmdBufNext); - smesa->AGPCmdModeEnabled = GL_TRUE; - } else { - smesa->AGPCmdModeEnabled = GL_FALSE; + { + smesa->vb = sisAllocAGP(smesa, 64 * 1024, &smesa->vb_agp_handle); + if (smesa->vb != NULL) { + smesa->using_agp = GL_TRUE; + smesa->vb_cur = smesa->vb; + smesa->vb_last = smesa->vb; + smesa->vb_end = smesa->vb + 64 * 1024; + smesa->vb_agp_offset = ((long)smesa->vb - (long)smesa->AGPBase + + (long)smesa->AGPAddr); + } + } + if (!smesa->using_agp) { + smesa->vb = malloc(64 * 1024); + if (smesa->vb == NULL) { + FREE(smesa); + return GL_FALSE; + } + smesa->vb_cur = smesa->vb; + smesa->vb_last = smesa->vb; + smesa->vb_end = smesa->vb + 64 * 1024; } smesa->GlobalFlag = 0L; @@ -232,7 +243,6 @@ sisCreateContext( const __GLcontextModes *glVisual, /* XXX these should really go right after _mesa_init_driver_functions() */ sisDDInitStateFuncs( ctx ); sisDDInitState( smesa ); /* Initializes smesa->zFormat, important */ - sisInitVB( ctx ); sisInitTriFuncs( ctx ); sisDDInitSpanFuncs( ctx ); sisDDInitStencilFuncs( ctx ); @@ -264,6 +274,9 @@ sisDestroyContext ( __DRIcontextPrivate *driContextPriv ) _ac_DestroyContext( smesa->glCtx ); _swrast_DestroyContext( smesa->glCtx ); + if (smesa->using_agp) + sisFreeAGP(smesa, smesa->vb_agp_handle); + /* free the Mesa context */ /* XXX: Is the next line needed? The DriverCtx (smesa) reference is * needed for sisDDDeleteTexture, since it needs to call the FB/AGP free -- cgit v1.2.3