summaryrefslogtreecommitdiff
path: root/xc
diff options
context:
space:
mode:
Diffstat (limited to 'xc')
-rw-r--r--xc/lib/GL/dri/dri_glx.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/common/hwlog.c1
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/Imakefile2
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc8
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c317
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h223
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c8
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c122
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h145
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h2
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c30
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c443
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c32
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c14
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c4
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c43
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c47
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h14
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h23
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c146
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h164
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c29
-rw-r--r--xc/programs/Xserver/GL/dri/dri.c13
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c241
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h192
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c9
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c62
-rw-r--r--xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c440
34 files changed, 1726 insertions, 1086 deletions
diff --git a/xc/lib/GL/dri/dri_glx.c b/xc/lib/GL/dri/dri_glx.c
index 75b3347b3..fac386f20 100644
--- a/xc/lib/GL/dri/dri_glx.c
+++ b/xc/lib/GL/dri/dri_glx.c
@@ -224,7 +224,7 @@ static void *OpenDriver(const char *driverName)
if (!libDir[0])
return NULL;
snprintf(realDriverName, 200, "%s/%s_dri.so", libDir, driverName);
- InfoMessageF("trying %s\n", realDriverName);
+ InfoMessageF("OpenDriver: trying %s\n", realDriverName);
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
if (handle) {
return handle;
@@ -434,8 +434,8 @@ register_extensions_on_screen(Display *dpy, int scrNum)
return;
}
else {
- InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s\n", driverMajor,
- driverMinor, driverPatch, driverName);
+ InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n",
+ driverMajor, driverMinor, driverPatch, driverName, scrNum);
}
/*
diff --git a/xc/lib/GL/mesa/src/drv/common/hwlog.c b/xc/lib/GL/mesa/src/drv/common/hwlog.c
index e78803c26..0285a295f 100644
--- a/xc/lib/GL/mesa/src/drv/common/hwlog.c
+++ b/xc/lib/GL/mesa/src/drv/common/hwlog.c
@@ -33,6 +33,7 @@ hwlog_t hwlog = { 0,0,0, "[???] "};
/* Should be shared, but is this a good place for it?
*/
#include <sys/time.h>
+#include <stdarg.h>
int usec( void )
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile
index 1017e80ee..b7f4346e4 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile
@@ -49,7 +49,7 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.25.2.1 2001/06/01 07:4
OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \
$(MESA_ASM_OBJS) $(TDFXOBJS) $(HIOBJS)
-REQUIREDLIBS = -l$(GLIDE3LIBNAME) MathLibrary $(LDPRELIB) $(GLXLIB)
+REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB)
#include <Library.tmpl>
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc
index 79653b8eb..88ad0d988 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc
+++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc
@@ -16,7 +16,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#if BuildXF86DRI
- DRI_DEFINES = GlxDefines -DFX_GLIDE3
+ DRI_DEFINES = GlxDefines
DRI_INCLUDES = -I$(GLXLIBSRC)/dri -I$(GLXLIBSRC)/glx \
-I$(INCLUDESRC) -I$(INCLUDESRC)/GL \
-I$(GLXLIBSRC)/mesa/dri \
@@ -34,7 +34,6 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \
$(MESADRVTDFXBUILDDIR)tdfx_dd.c \
$(MESADRVTDFXBUILDDIR)tdfx_pixels.c \
$(MESADRVTDFXBUILDDIR)tdfx_fastpath.c \
- $(MESADRVTDFXBUILDDIR)tdfx_g3ext.c \
$(MESADRVTDFXBUILDDIR)tdfx_lock.c \
$(MESADRVTDFXBUILDDIR)tdfx_pipeline.c \
$(MESADRVTDFXBUILDDIR)tdfx_render.c \
@@ -53,7 +52,6 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \
$(MESADRVTDFXBUILDDIR)tdfx_dd.o \
$(MESADRVTDFXBUILDDIR)tdfx_pixels.o \
$(MESADRVTDFXBUILDDIR)tdfx_fastpath.o \
- $(MESADRVTDFXBUILDDIR)tdfx_g3ext.o \
$(MESADRVTDFXBUILDDIR)tdfx_lock.o \
$(MESADRVTDFXBUILDDIR)tdfx_pipeline.o \
$(MESADRVTDFXBUILDDIR)tdfx_render.o \
@@ -72,7 +70,6 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \
$(MESADRVTDFXBUILDDIR)unshared/tdfx_dd.o \
$(MESADRVTDFXBUILDDIR)unshared/tdfx_pixels.o \
$(MESADRVTDFXBUILDDIR)unshared/tdfx_fastpath.o \
- $(MESADRVTDFXBUILDDIR)unshared/tdfx_g3ext.o \
$(MESADRVTDFXBUILDDIR)unshared/tdfx_lock.o \
$(MESADRVTDFXBUILDDIR)unshared/tdfx_pipeline.o \
$(MESADRVTDFXBUILDDIR)unshared/tdfx_render.o \
@@ -91,7 +88,6 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \
$(MESADRVTDFXBUILDDIR)debugger/tdfx_dd.o \
$(MESADRVTDFXBUILDDIR)debugger/tdfx_pixels.o \
$(MESADRVTDFXBUILDDIR)debugger/tdfx_fastpath.o \
- $(MESADRVTDFXBUILDDIR)debugger/tdfx_g3ext.o \
$(MESADRVTDFXBUILDDIR)debugger/tdfx_lock.o \
$(MESADRVTDFXBUILDDIR)debugger/tdfx_pipeline.o \
$(MESADRVTDFXBUILDDIR)debugger/tdfx_render.o \
@@ -110,7 +106,6 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \
$(MESADRVTDFXBUILDDIR)profiled/tdfx_dd.o \
$(MESADRVTDFXBUILDDIR)profiled/tdfx_pixels.o \
$(MESADRVTDFXBUILDDIR)profiled/tdfx_fastpath.o \
- $(MESADRVTDFXBUILDDIR)profiled/tdfx_g3ext.o \
$(MESADRVTDFXBUILDDIR)profiled/tdfx_lock.o \
$(MESADRVTDFXBUILDDIR)profiled/tdfx_pipeline.o \
$(MESADRVTDFXBUILDDIR)profiled/tdfx_render.o \
@@ -130,7 +125,6 @@ LinkSourceFile(tdfx_context.c, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_dd.c, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_pixels.c, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_fastpath.c, $(MESADRVSRCDIR)/tdfx)
-LinkSourceFile(tdfx_g3ext.c, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_lock.c, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_pipeline.c, $(MESADRVSRCDIR)/tdfx)
LinkSourceFile(tdfx_render.c, $(MESADRVSRCDIR)/tdfx)
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c
index 76e6eabbd..0615b4a34 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c
@@ -35,6 +35,7 @@
*
*/
+#include <dlfcn.h>
#include "dri_glide.h"
#include "tdfx_context.h"
#include "tdfx_dd.h"
@@ -134,7 +135,7 @@ GLboolean tdfxCreateContext( Display *dpy, GLvisual *mesaVis,
fxScreen->sarea_priv_offset);
- fxMesa = (tdfxContextPtr) Xmalloc( sizeof(tdfxContextRec) );
+ fxMesa = (tdfxContextPtr) MALLOC( sizeof(tdfxContextRec) );
if ( !fxMesa ) {
return GL_FALSE;
}
@@ -168,7 +169,13 @@ GLboolean tdfxCreateContext( Display *dpy, GLvisual *mesaVis,
fxMesa->glCtx = driContextPriv->mesaContext;
fxMesa->glVis = mesaVis;
- grDRIOpen( sPriv->pFB, fxScreen->regs.map, fxScreen->deviceID,
+ /* NOTE: This MUST be called before any Glide functions are called! */
+ if (!tdfxInitGlide(fxMesa)) {
+ FREE(fxMesa);
+ return GL_FALSE;
+ }
+
+ fxMesa->Glide.grDRIOpen( sPriv->pFB, fxScreen->regs.map, fxScreen->deviceID,
fxScreen->width, fxScreen->height, fxScreen->mem, fxScreen->cpp,
fxScreen->stride, fxScreen->fifoOffset, fxScreen->fifoSize,
fxScreen->fbOffset, fxScreen->backOffset, fxScreen->depthOffset,
@@ -268,7 +275,7 @@ static GLboolean tdfxInitVertexFormats( tdfxContextPtr fxMesa )
LOCK_HARDWARE( fxMesa );
- grGet( GR_GLIDE_VERTEXLAYOUT_SIZE, sizeof(FxI32), &result );
+ fxMesa->Glide.grGet( GR_GLIDE_VERTEXLAYOUT_SIZE, sizeof(FxI32), &result );
for ( i = 0 ; i < TDFX_NUM_LAYOUTS ; i++ ) {
fxMesa->layout[i] = MALLOC( result );
if ( !fxMesa->layout[i] ) {
@@ -279,55 +286,55 @@ static GLboolean tdfxInitVertexFormats( tdfxContextPtr fxMesa )
/* Single textured vertex format - 32 bytes.
*/
- grReset( GR_VERTEX_PARAMETER );
-
- grCoordinateSpace( GR_WINDOW_COORDS );
- grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
+
+ fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
#if 0
- grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE );
#endif
- grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_SINGLE] );
+ fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_SINGLE] );
/* Multitextured vertex format - 40 bytes.
*/
- grReset( GR_VERTEX_PARAMETER );
-
- grCoordinateSpace( GR_WINDOW_COORDS );
- grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
+
+ fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE );
#if 0
- grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE );
#endif
- grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_MULTI] );
+ fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_MULTI] );
/* Projected texture vertex format - 48 bytes.
*/
- grReset( GR_VERTEX_PARAMETER );
-
- grCoordinateSpace( GR_WINDOW_COORDS );
- grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_Q0, TDFX_Q0_OFFSET, GR_PARAM_ENABLE );
- grVertexLayout( GR_PARAM_Q1, TDFX_Q1_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
+
+ fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_Q0, TDFX_Q0_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_Q1, TDFX_Q1_OFFSET, GR_PARAM_ENABLE );
#if 0
- grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE );
+ fxMesa->Glide.grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE );
#endif
- grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_PROJECT] );
+ fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_PROJECT] );
UNLOCK_HARDWARE( fxMesa );
@@ -364,17 +371,17 @@ GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv,
*/
DRM_LIGHT_LOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext );
- grGlideInit();
- grSstSelect( fxMesa->Glide.Board );
+ fxMesa->Glide.grGlideInit();
+ fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
- fxMesa->Glide.Context = grSstWinOpen( (FxU32) -1,
+ fxMesa->Glide.Context = fxMesa->Glide.grSstWinOpen( (FxU32) -1,
GR_RESOLUTION_NONE,
GR_REFRESH_NONE,
fxMesa->Glide.ColorFormat,
fxMesa->Glide.Origin,
2, 1 );
- grDRIResetSAREA();
+ fxMesa->Glide.grDRIResetSAREA();
DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext );
@@ -391,22 +398,22 @@ GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv,
LOCK_HARDWARE( fxMesa );
if ( fxMesa->glVis->DepthBits > 0 ) {
- grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
+ fxMesa->Glide.grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
} else {
- grDepthBufferMode(GR_DEPTHBUFFER_DISABLE);
+ fxMesa->Glide.grDepthBufferMode(GR_DEPTHBUFFER_DISABLE);
}
- grLfbWriteColorFormat( GR_COLORFORMAT_ABGR );
+ fxMesa->Glide.grLfbWriteColorFormat( GR_COLORFORMAT_ABGR );
- grGet( GR_TEXTURE_ALIGN, sizeof(FxI32), result );
+ fxMesa->Glide.grGet( GR_TEXTURE_ALIGN, sizeof(FxI32), result );
fxMesa->Glide.TextureAlign = result[0];
fxMesa->Glide.State = NULL;
- grGet( GR_GLIDE_STATE_SIZE, sizeof(FxI32), result );
+ fxMesa->Glide.grGet( GR_GLIDE_STATE_SIZE, sizeof(FxI32), result );
fxMesa->Glide.State = MALLOC( result[0] );
fxMesa->Fog.Table = NULL;
- grGet( GR_FOG_TABLE_ENTRIES, sizeof(FxI32), result );
+ fxMesa->Glide.grGet( GR_FOG_TABLE_ENTRIES, sizeof(FxI32), result );
fxMesa->Fog.Table = MALLOC( result[0] * sizeof(GrFog_t) );
UNLOCK_HARDWARE( fxMesa );
@@ -425,14 +432,14 @@ GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv,
LOCK_HARDWARE( fxMesa );
- grGlideGetState( fxMesa->Glide.State );
+ fxMesa->Glide.grGlideGetState( fxMesa->Glide.State );
if ( getenv( "FX_GLIDE_INFO" ) ) {
- printf( "GR_RENDERER = %s\n", (char *) grGetString( GR_RENDERER ) );
- printf( "GR_VERSION = %s\n", (char *) grGetString( GR_VERSION ) );
- printf( "GR_VENDOR = %s\n", (char *) grGetString( GR_VENDOR ) );
- printf( "GR_HARDWARE = %s\n", (char *) grGetString( GR_HARDWARE ) );
- printf( "GR_EXTENSION = %s\n", (char *) grGetString( GR_EXTENSION ) );
+ printf( "GR_RENDERER = %s\n", (char *) fxMesa->Glide.grGetString( GR_RENDERER ) );
+ printf( "GR_VERSION = %s\n", (char *) fxMesa->Glide.grGetString( GR_VERSION ) );
+ printf( "GR_VENDOR = %s\n", (char *) fxMesa->Glide.grGetString( GR_VENDOR ) );
+ printf( "GR_HARDWARE = %s\n", (char *) fxMesa->Glide.grGetString( GR_HARDWARE ) );
+ printf( "GR_EXTENSION = %s\n", (char *) fxMesa->Glide.grGetString( GR_EXTENSION ) );
}
UNLOCK_HARDWARE( fxMesa );
@@ -469,10 +476,212 @@ void tdfxDestroyContext( tdfxContextPtr fxMesa )
}
tdfxTMClose( fxMesa ); /* free texture memory */
- XFree( fxMesa );
+ FREE( fxMesa );
}
#if 0
glx_fini_prof();
#endif
}
+
+
+
+/*
+ * Examine the context's deviceID to determine what kind of 3dfx hardware
+ * is installed. dlopen() the appropriate Glide library and initialize
+ * this context's Glide function pointers.
+ * Return: true/false = success/failure
+ */
+GLboolean tdfxInitGlide(tdfxContextPtr tmesa)
+{
+ static const char *defaultGlide = "libglide3.so";
+ const char *libName;
+ void *libHandle;
+
+ /*
+ * XXX this code which selects a Glide library filename given the
+ * deviceID may need to be cleaned up a bit.
+ * Non-Linux systems may have different filenames, for example.
+ */
+ switch (tmesa->fxScreen->deviceID) {
+ case PCI_CHIP_BANSHEE:
+ case PCI_CHIP_VOODOO3:
+ libName = "libglide3-v3.so";
+ break;
+ case PCI_CHIP_VOODOO5: /* same as PCI_CHIP_VOODOO4 */
+ libName = "libglide3-v5.so";
+ break;
+ default:
+ {
+ char err[1000];
+ sprintf(err, "unrecognized 3dfx deviceID: 0x%x",
+ tmesa->fxScreen->deviceID);
+ __driMesaMessage(err);
+ }
+ return GL_FALSE;
+ }
+
+ libHandle = dlopen(libName, 0);
+ if (!libHandle) {
+ /* The device-specific Glide library filename didn't work, try the
+ * old, generic libglide3.so library.
+ */
+ libHandle = dlopen(defaultGlide, 0);
+ if (!libHandle) {
+ char err[1000];
+ sprintf(err,
+ "can't find Glide library, dlopen(%s) and dlopen(%s) both failed.",
+ libName, defaultGlide);
+ __driMesaMessage(err);
+ return GL_FALSE;
+ }
+ libName = defaultGlide;
+ }
+
+ {
+ const char *env = getenv("LIBGL_DEBUG");
+ if (env && strstr(env, "verbose")) {
+ fprintf(stderr, "libGL: using Glide library %s\n", libName);
+ }
+ }
+
+#define GET_FUNCTION(PTR, NAME) \
+ tmesa->Glide.PTR = dlsym(libHandle, NAME); \
+ if (!tmesa->Glide.PTR) { \
+ char err[1000]; \
+ sprintf(err, "couldn't find Glide function %s in %s.", \
+ NAME, libName); \
+ __driMesaMessage(err); \
+ }
+
+ GET_FUNCTION(grDrawPoint, "grDrawPoint");
+ GET_FUNCTION(grDrawLine, "grDrawLine");
+ GET_FUNCTION(grDrawTriangle, "grDrawTriangle");
+ GET_FUNCTION(grVertexLayout, "grVertexLayout");
+ GET_FUNCTION(grDrawVertexArray, "grDrawVertexArray");
+ GET_FUNCTION(grDrawVertexArrayContiguous, "grDrawVertexArrayContiguous");
+ GET_FUNCTION(grBufferClear, "grBufferClear");
+ /*GET_FUNCTION(grBufferSwap, "grBufferSwap");*/
+ GET_FUNCTION(grRenderBuffer, "grRenderBuffer");
+ GET_FUNCTION(grErrorSetCallback, "grErrorSetCallback");
+ GET_FUNCTION(grFinish, "grFinish");
+ GET_FUNCTION(grFlush, "grFlush");
+ GET_FUNCTION(grSstWinOpen, "grSstWinOpen");
+ GET_FUNCTION(grSstWinClose, "grSstWinClose");
+#if 0
+ /* Not in V3 lib, and not used anyway. */
+ GET_FUNCTION(grSetNumPendingBuffers, "grSetNumPendingBuffers");
+#endif
+ GET_FUNCTION(grSelectContext, "grSelectContext");
+ GET_FUNCTION(grSstOrigin, "grSstOrigin");
+ GET_FUNCTION(grSstSelect, "grSstSelect");
+ GET_FUNCTION(grAlphaBlendFunction, "grAlphaBlendFunction");
+ GET_FUNCTION(grAlphaCombine, "grAlphaCombine");
+ GET_FUNCTION(grAlphaControlsITRGBLighting, "grAlphaControlsITRGBLighting");
+ GET_FUNCTION(grAlphaTestFunction, "grAlphaTestFunction");
+ GET_FUNCTION(grAlphaTestReferenceValue, "grAlphaTestReferenceValue");
+ GET_FUNCTION(grChromakeyMode, "grChromakeyMode");
+ GET_FUNCTION(grChromakeyValue, "grChromakeyValue");
+ GET_FUNCTION(grClipWindow, "grClipWindow");
+ GET_FUNCTION(grColorCombine, "grColorCombine");
+ GET_FUNCTION(grColorMask, "grColorMask");
+ GET_FUNCTION(grCullMode, "grCullMode");
+ GET_FUNCTION(grConstantColorValue, "grConstantColorValue");
+ GET_FUNCTION(grDepthBiasLevel, "grDepthBiasLevel");
+ GET_FUNCTION(grDepthBufferFunction, "grDepthBufferFunction");
+ GET_FUNCTION(grDepthBufferMode, "grDepthBufferMode");
+ GET_FUNCTION(grDepthMask, "grDepthMask");
+ GET_FUNCTION(grDisableAllEffects, "grDisableAllEffects");
+ GET_FUNCTION(grDitherMode, "grDitherMode");
+ GET_FUNCTION(grFogColorValue, "grFogColorValue");
+ GET_FUNCTION(grFogMode, "grFogMode");
+ GET_FUNCTION(grFogTable, "grFogTable");
+ GET_FUNCTION(grLoadGammaTable, "grLoadGammaTable");
+ GET_FUNCTION(grSplash, "grSplash");
+ GET_FUNCTION(grGet, "grGet");
+ GET_FUNCTION(grGetString, "grGetString");
+ GET_FUNCTION(grQueryResolutions, "grQueryResolutions");
+ GET_FUNCTION(grReset, "grReset");
+ GET_FUNCTION(grGetProcAddress, "grGetProcAddress");
+ GET_FUNCTION(grEnable, "grEnable");
+ GET_FUNCTION(grDisable, "grDisable");
+ GET_FUNCTION(grCoordinateSpace, "grCoordinateSpace");
+ GET_FUNCTION(grDepthRange, "grDepthRange");
+#ifdef __linux__
+ GET_FUNCTION(grStippleMode, "grStippleMode");
+ GET_FUNCTION(grStipplePattern, "grStipplePattern");
+#endif /* __linux__ */
+ GET_FUNCTION(grViewport, "grViewport");
+ GET_FUNCTION(grTexCalcMemRequired, "grTexCalcMemRequired");
+ GET_FUNCTION(grTexTextureMemRequired, "grTexTextureMemRequired");
+ GET_FUNCTION(grTexMinAddress, "grTexMinAddress");
+ GET_FUNCTION(grTexMaxAddress, "grTexMaxAddress");
+ GET_FUNCTION(grTexNCCTable, "grTexNCCTable");
+ GET_FUNCTION(grTexSource, "grTexSource");
+ GET_FUNCTION(grTexClampMode, "grTexClampMode");
+ GET_FUNCTION(grTexCombine, "grTexCombine");
+ GET_FUNCTION(grTexDetailControl, "grTexDetailControl");
+ GET_FUNCTION(grTexFilterMode, "grTexFilterMode");
+ GET_FUNCTION(grTexLodBiasValue, "grTexLodBiasValue");
+ GET_FUNCTION(grTexDownloadMipMap, "grTexDownloadMipMap");
+ GET_FUNCTION(grTexDownloadMipMapLevel, "grTexDownloadMipMapLevel");
+ GET_FUNCTION(grTexDownloadMipMapLevelPartial, "grTexDownloadMipMapLevelPartial");
+ GET_FUNCTION(grTexDownloadTable, "grTexDownloadTable");
+ GET_FUNCTION(grTexDownloadTablePartial, "grTexDownloadTablePartial");
+ GET_FUNCTION(grTexMipMapMode, "grTexMipMapMode");
+ GET_FUNCTION(grTexMultibase, "grTexMultibase");
+ GET_FUNCTION(grTexMultibaseAddress, "grTexMultibaseAddress");
+ GET_FUNCTION(grLfbLock, "grLfbLock");
+ GET_FUNCTION(grLfbUnlock, "grLfbUnlock");
+ GET_FUNCTION(grLfbConstantAlpha, "grLfbConstantAlpha");
+ GET_FUNCTION(grLfbConstantDepth, "grLfbConstantDepth");
+ GET_FUNCTION(grLfbWriteColorSwizzle, "grLfbWriteColorSwizzle");
+ GET_FUNCTION(grLfbWriteColorFormat, "grLfbWriteColorFormat");
+ GET_FUNCTION(grLfbWriteRegion, "grLfbWriteRegion");
+ GET_FUNCTION(grLfbReadRegion, "grLfbReadRegion");
+ GET_FUNCTION(grGlideInit, "grGlideInit");
+ GET_FUNCTION(grGlideShutdown, "grGlideShutdown");
+ GET_FUNCTION(grGlideGetState, "grGlideGetState");
+ GET_FUNCTION(grGlideSetState, "grGlideSetState");
+ GET_FUNCTION(grGlideGetVertexLayout, "grGlideGetVertexLayout");
+ GET_FUNCTION(grGlideSetVertexLayout, "grGlideSetVertexLayout");
+
+ /* Glide utility functions */
+ GET_FUNCTION(guFogGenerateExp, "guFogGenerateExp");
+ GET_FUNCTION(guFogGenerateExp2, "guFogGenerateExp2");
+ GET_FUNCTION(guFogGenerateLinear, "guFogGenerateLinear");
+
+ /* DRI functions */
+ GET_FUNCTION(grDRIOpen, "grDRIOpen");
+ GET_FUNCTION(grDRIPosition, "grDRIPosition");
+ /*GET_FUNCTION(grDRILostContext, "grDRILostContext");*/
+ GET_FUNCTION(grDRIImportFifo, "grDRIImportFifo");
+ GET_FUNCTION(grDRIInvalidateAll, "grDRIInvalidateAll");
+ GET_FUNCTION(grDRIResetSAREA, "grDRIResetSAREA");
+ GET_FUNCTION(grDRIBufferSwap, "grDRIBufferSwap");
+
+ /*
+ * Extension functions:
+ * Just use dlysm() because we want a NULL pointer if the function is
+ * not found.
+ */
+ /* PIXEXT extension */
+ tmesa->Glide.grStencilFunc = dlsym(libHandle, "grStencilFunc");
+ tmesa->Glide.grStencilMask = dlsym(libHandle, "grStencilMask");
+ tmesa->Glide.grStencilOp = dlsym(libHandle, "grStencilOp");
+ tmesa->Glide.grBufferClearExt = dlsym(libHandle, "grBufferClearExt");
+ tmesa->Glide.grColorMaskExt = dlsym(libHandle, "grColorMaskExt");
+ /* COMBINE extension */
+ tmesa->Glide.grColorCombineExt = dlsym(libHandle, "grColorCombineExt");
+ tmesa->Glide.grTexColorCombineExt = dlsym(libHandle, "grTexColorCombineExt");
+ tmesa->Glide.grAlphaCombineExt = dlsym(libHandle, "grAlphaCombineExt");
+ tmesa->Glide.grTexAlphaCombineExt = dlsym(libHandle, "grTexAlphaCombineExt");
+ tmesa->Glide.grAlphaBlendFunctionExt = dlsym(libHandle, "grAlphaBlendFunctionExt");
+ tmesa->Glide.grConstantColorValueExt = dlsym(libHandle, "grConstantColorValueExt");
+ /* Texus 2 */
+ tmesa->Glide.txImgQuantize = dlsym(libHandle, "txImgQuantize");
+ tmesa->Glide.txImgDequantizeFXT1 = dlsym(libHandle, "_txImgDequantizeFXT1");
+ tmesa->Glide.txErrorSetCallback = dlsym(libHandle, "txErrorSetCallback");
+
+ return GL_TRUE;
+}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h
index 88727f6ae..07f7703b2 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h
@@ -67,7 +67,6 @@
#include "tdfx_wrapper.h"
#include "tdfx_screen.h"
#include "tdfx_lock.h"
-#include "tdfx_g3ext.h"
@@ -578,6 +577,226 @@ struct tdfx_glide {
FxBool HaveTexFmtExt; /* TEXFMT */
FxBool HaveTexUMAExt; /* TEXUMA */
FxBool HaveTexus2; /* Texus 2 - FXT1 */
+
+ /* Glide library function pointers */
+ void (*grDrawPoint)( const void *pt );
+ void (*grDrawLine)( const void *v1, const void *v2 );
+ void (*grDrawTriangle)( const void *a, const void *b, const void *c );
+ void (*grVertexLayout)(FxU32 param, FxI32 offset, FxU32 mode);
+ void (*grDrawVertexArray)(FxU32 mode, FxU32 Count, void *pointers);
+ void (*grDrawVertexArrayContiguous)(FxU32 mode, FxU32 Count,
+ void *pointers, FxU32 stride);
+ void (*grBufferClear)( GrColor_t color, GrAlpha_t alpha, FxU32 depth );
+ void (*grBufferSwap)( FxU32 swap_interval );
+ void (*grRenderBuffer)( GrBuffer_t buffer );
+ void (*grErrorSetCallback)( GrErrorCallbackFnc_t fnc );
+ void (*grFinish)(void);
+ void (*grFlush)(void);
+ GrContext_t (*grSstWinOpen)(FxU32 hWnd,
+ GrScreenResolution_t screen_resolution,
+ GrScreenRefresh_t refresh_rate,
+ GrColorFormat_t color_format,
+ GrOriginLocation_t origin_location,
+ int nColBuffers,
+ int nAuxBuffers);
+ void (*grSstWinClose)( GrContext_t context );
+/* Not used */
+#if 0
+ void (*grSetNumPendingBuffers)(FxI32 NumPendingBuffers);
+#endif
+ void (*grSelectContext)( GrContext_t context );
+ void (*grSstOrigin)(GrOriginLocation_t origin);
+ void (*grSstSelect)( int which_sst );
+ void (*grAlphaBlendFunction)(GrAlphaBlendFnc_t rgb_sf,
+ GrAlphaBlendFnc_t rgb_df,
+ GrAlphaBlendFnc_t alpha_sf,
+ GrAlphaBlendFnc_t alpha_df);
+ void (*grAlphaCombine)(GrCombineFunction_t function,
+ GrCombineFactor_t factor,
+ GrCombineLocal_t local, GrCombineOther_t other,
+ FxBool invert);
+ void (*grAlphaControlsITRGBLighting)( FxBool enable );
+ void (*grAlphaTestFunction)( GrCmpFnc_t function );
+ void (*grAlphaTestReferenceValue)( GrAlpha_t value );
+ void (*grChromakeyMode)( GrChromakeyMode_t mode );
+ void (*grChromakeyValue)( GrColor_t value );
+ void (*grClipWindow)( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );
+ void (*grColorCombine)( GrCombineFunction_t function,
+ GrCombineFactor_t factor,
+ GrCombineLocal_t local,
+ GrCombineOther_t other,
+ FxBool invert );
+ void (*grColorMask)( FxBool rgb, FxBool a );
+ void (*grCullMode)( GrCullMode_t mode );
+ void (*grConstantColorValue)( GrColor_t value );
+ void (*grDepthBiasLevel)( FxI32 level );
+ void (*grDepthBufferFunction)( GrCmpFnc_t function );
+ void (*grDepthBufferMode)( GrDepthBufferMode_t mode );
+ void (*grDepthMask)( FxBool mask );
+ void (*grDisableAllEffects)( void );
+ void (*grDitherMode)( GrDitherMode_t mode );
+ void (*grFogColorValue)( GrColor_t fogcolor );
+ void (*grFogMode)( GrFogMode_t mode );
+ void (*grFogTable)( const GrFog_t ft[] );
+ void (*grLoadGammaTable)( FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
+ void (*grSplash)(float x, float y, float width, float height, FxU32 frame);
+ FxU32 (*grGet)( FxU32 pname, FxU32 plength, FxI32 *params );
+ const char * (*grGetString)( FxU32 pname );
+ FxI32 (*grQueryResolutions)( const GrResolution *resTemplate,
+ GrResolution *output );
+ FxBool (*grReset)( FxU32 what );
+ GrProc (*grGetProcAddress)( char *procName );
+ void (*grEnable)( GrEnableMode_t mode );
+ void (*grDisable)( GrEnableMode_t mode );
+ void (*grCoordinateSpace)( GrCoordinateSpaceMode_t mode );
+ void (*grDepthRange)( FxFloat n, FxFloat f );
+#ifdef __linux__
+ void (*grStippleMode)( GrStippleMode_t mode );
+ void (*grStipplePattern)( GrStipplePattern_t mode );
+#endif /* __linux__ */
+ void (*grViewport)( FxI32 x, FxI32 y, FxI32 width, FxI32 height );
+ FxU32 (*grTexCalcMemRequired)(GrLOD_t lodmin, GrLOD_t lodmax,
+ GrAspectRatio_t aspect, GrTextureFormat_t fmt);
+ FxU32 (*grTexTextureMemRequired)( FxU32 evenOdd, GrTexInfo *info );
+ FxU32 (*grTexMinAddress)( GrChipID_t tmu );
+ FxU32 (*grTexMaxAddress)( GrChipID_t tmu );
+ void (*grTexNCCTable)( GrNCCTable_t table );
+ void (*grTexSource)( GrChipID_t tmu, FxU32 startAddress,
+ FxU32 evenOdd, GrTexInfo *info );
+ void (*grTexClampMode)( GrChipID_t tmu,
+ GrTextureClampMode_t s_clampmode,
+ GrTextureClampMode_t t_clampmode );
+ void (*grTexCombine)( GrChipID_t tmu,
+ GrCombineFunction_t rgb_function,
+ GrCombineFactor_t rgb_factor,
+ GrCombineFunction_t alpha_function,
+ GrCombineFactor_t alpha_factor,
+ FxBool rgb_invert,
+ FxBool alpha_invert);
+ void (*grTexDetailControl)( GrChipID_t tmu, int lod_bias,
+ FxU8 detail_scale, float detail_max );
+ void (*grTexFilterMode)( GrChipID_t tmu,
+ GrTextureFilterMode_t minfilter_mode,
+ GrTextureFilterMode_t magfilter_mode );
+ void (*grTexLodBiasValue)(GrChipID_t tmu, float bias );
+ void (*grTexDownloadMipMap)( GrChipID_t tmu, FxU32 startAddress,
+ FxU32 evenOdd, GrTexInfo *info );
+ void (*grTexDownloadMipMapLevel)( GrChipID_t tmu,
+ FxU32 startAddress,
+ GrLOD_t thisLod,
+ GrLOD_t largeLod,
+ GrAspectRatio_t aspectRatio,
+ GrTextureFormat_t format,
+ FxU32 evenOdd,
+ void *data );
+ FxBool (*grTexDownloadMipMapLevelPartial)( GrChipID_t tmu,
+ FxU32 startAddress,
+ GrLOD_t thisLod,
+ GrLOD_t largeLod,
+ GrAspectRatio_t aspectRatio,
+ GrTextureFormat_t format,
+ FxU32 evenOdd,
+ void *data,
+ int start,
+ int end );
+ void (*grTexDownloadTable)( GrTexTable_t type, void *data );
+ void (*grTexDownloadTablePartial)( GrTexTable_t type,
+ void *data, int start, int end );
+ void (*grTexMipMapMode)( GrChipID_t tmu, GrMipMapMode_t mode,
+ FxBool lodBlend );
+ void (*grTexMultibase)( GrChipID_t tmu, FxBool enable );
+ void (*grTexMultibaseAddress)( GrChipID_t tmu,
+ GrTexBaseRange_t range,
+ FxU32 startAddress,
+ FxU32 evenOdd,
+ GrTexInfo *info );
+ FxBool (*grLfbLock)( GrLock_t type, GrBuffer_t buffer,
+ GrLfbWriteMode_t writeMode,
+ GrOriginLocation_t origin, FxBool pixelPipeline,
+ GrLfbInfo_t *info );
+ FxBool (*grLfbUnlock)( GrLock_t type, GrBuffer_t buffer );
+ void (*grLfbConstantAlpha)( GrAlpha_t alpha );
+ void (*grLfbConstantDepth)( FxU32 depth );
+ void (*grLfbWriteColorSwizzle)(FxBool swizzleBytes, FxBool swapWords);
+ void (*grLfbWriteColorFormat)(GrColorFormat_t colorFormat);
+ FxBool (*grLfbWriteRegion)( GrBuffer_t dst_buffer,
+ FxU32 dst_x, FxU32 dst_y,
+ GrLfbSrcFmt_t src_format,
+ FxU32 src_width, FxU32 src_height,
+ FxBool pixelPipeline,
+ FxI32 src_stride, void *src_data );
+ FxBool (*grLfbReadRegion)( GrBuffer_t src_buffer,
+ FxU32 src_x, FxU32 src_y,
+ FxU32 src_width, FxU32 src_height,
+ FxU32 dst_stride, void *dst_data );
+ void (*grGlideInit)( void );
+ void (*grGlideShutdown)( void );
+ void (*grGlideGetState)( void *state );
+ void (*grGlideSetState)( const void *state );
+ void (*grGlideGetVertexLayout)( void *layout );
+ void (*grGlideSetVertexLayout)( const void *layout );
+ /* Glide utility functions */
+ void (*guFogGenerateExp)( GrFog_t *fogtable, float density );
+ void (*guFogGenerateExp2)( GrFog_t *fogtable, float density );
+ void (*guFogGenerateLinear)(GrFog_t *fogtable, float nearZ, float farZ );
+ /* DRI functions */
+ void (*grDRIOpen)( char *pFB, char *pRegs, int deviceID,
+ int width, int height,
+ int mem, int cpp, int stride,
+ int fifoOffset, int fifoSize,
+ int fbOffset, int backOffset, int depthOffset,
+ int textureOffset, int textureSize,
+ volatile int *fifoPtr, volatile int *fifoRead );
+ void (*grDRIPosition)( int x, int y, int w, int h,
+ int numClip, XF86DRIClipRectPtr pClip );
+ void (*grDRILostContext)( void );
+ void (*grDRIImportFifo)( int fifoPtr, int fifoRead );
+ void (*grDRIInvalidateAll)( void );
+ void (*grDRIResetSAREA)( void );
+ void (*grDRIBufferSwap)( FxU32 swapInterval );
+ /* Glide extensions */
+ /* PIXEXT extension */
+ void (*grStencilFunc)( GrCmpFnc_t func, GrStencil_t ref, GrStencil_t mask );
+ void (*grStencilMask)( GrStencil_t mask );
+ void (*grStencilOp)( GrStencilOp_t fail, GrStencilOp_t zfail,
+ GrStencilOp_t zpass );
+ void (*grBufferClearExt)( GrColor_t color, GrAlpha_t alpha,
+ FxU32 depth, GrStencil_t stencil );
+ void (*grColorMaskExt)( FxBool r, FxBool g, FxBool b, FxBool a );
+ /* COMBINE extension */
+ void (*grColorCombineExt)( GrCCUColor_t a, GrCombineMode_t a_mode,
+ GrCCUColor_t b, GrCombineMode_t b_mode,
+ GrCCUColor_t c, FxBool c_invert,
+ GrCCUColor_t d, FxBool d_invert,
+ FxU32 shift, FxBool invert );
+ void (*grTexColorCombineExt)( FxU32 tmu,
+ GrTCCUColor_t a, GrCombineMode_t a_mode,
+ GrTCCUColor_t b, GrCombineMode_t b_mode,
+ GrTCCUColor_t c, FxBool c_invert,
+ GrTCCUColor_t d, FxBool d_invert,
+ FxU32 shift, FxBool invert );
+ void (*grAlphaCombineExt)( GrACUColor_t a, GrCombineMode_t a_mode,
+ GrACUColor_t b, GrCombineMode_t b_mode,
+ GrACUColor_t c, FxBool c_invert,
+ GrACUColor_t d, FxBool d_invert,
+ FxU32 shift, FxBool invert );
+ void (*grTexAlphaCombineExt)( FxU32 tmu,
+ GrTACUColor_t a, GrCombineMode_t a_mode,
+ GrTACUColor_t b, GrCombineMode_t b_mode,
+ GrTACUColor_t c, FxBool c_invert,
+ GrTACUColor_t d, FxBool d_invert,
+ FxU32 shift, FxBool invert );
+ void (*grAlphaBlendFunctionExt)( GrAlphaBlendFnc_t rgb_sf,
+ GrAlphaBlendFnc_t rgb_df,
+ GrAlphaBlendOp_t rgb_op,
+ GrAlphaBlendFnc_t alpha_sf,
+ GrAlphaBlendFnc_t alpha_df,
+ GrAlphaBlendOp_t alpha_op );
+ void (*grConstantColorValueExt)( FxU32 tmu, GrColor_t value );
+ /* Texus 2 */
+ void (*txImgQuantize)( void *xxx_unknown_arguments );
+ void (*txImgDequantizeFXT1)( void *txMip, void *pxMip );
+ void (*txErrorSetCallback)( void *fnc );
};
@@ -710,6 +929,8 @@ extern void tdfxDestroyContext( tdfxContextPtr fxMesa );
extern GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv,
tdfxContextPtr fxMesa );
+extern GLboolean tdfxInitGlide(tdfxContextPtr tmesa);
+
/* Color packing utilities
*/
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c
index 955f25e3e..797ec88d6 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c
@@ -167,8 +167,10 @@ static GLboolean get_occlusion_result( GLcontext *ctx )
}
else {
FxI32 zfail, in;
- zfail = FX_grGetInteger_NoLock(GR_STATS_PIXELS_DEPTHFUNC_FAIL);
- in = FX_grGetInteger_NoLock(GR_STATS_PIXELS_IN);
+ fxMesa->Glide.grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &zfail);
+ /*zfail = FX_grGetInteger_NoLock(GR_STATS_PIXELS_DEPTHFUNC_FAIL);*/
+ fxMesa->Glide.grGet(GR_STATS_PIXELS_IN, 4, &in);
+ /*in = FX_grGetInteger_NoLock(GR_STATS_PIXELS_IN);*/
if (in == zfail)
result = GL_FALSE; /* geom was completely occluded */
else
@@ -180,7 +182,7 @@ static GLboolean get_occlusion_result( GLcontext *ctx )
}
/* reset results now */
- grReset(GR_STATS_PIXELS);
+ fxMesa->Glide.grReset(GR_STATS_PIXELS);
ctx->OcclusionResult = GL_FALSE;
ctx->OcclusionResultSaved = GL_FALSE;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c
index 8d91dfb88..d6a44dc0f 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c
@@ -58,7 +58,7 @@ struct tdfx_fast_tab {
#define POINT(x) tdfx_draw_point( fxMesa, &vert[x], psize )
#define LINE(x,y) tdfx_draw_line( fxMesa, &vert[x], &vert[y], lwidth )
-#define TRI(x,y,z) grDrawTriangle( &vert[x], &vert[y], &vert[z] );
+#define TRI(x,y,z) fxMesa->Glide.grDrawTriangle( &vert[x], &vert[y], &vert[z] );
#define INDIRECT_TRI(x,y,z) \
@@ -509,7 +509,7 @@ static void tdfx_render_elements_indirect( struct vertex_buffer *VB )
ctx->Driver.MultipassFunc( VB, ++p ) );
BEGIN_CLIP_LOOP( fxMesa );
- grDrawVertexArray( GR_TRIANGLES, fxVB->last_elt, fxVB->elts );
+ fxMesa->Glide.grDrawVertexArray( GR_TRIANGLES, fxVB->last_elt, fxVB->elts );
END_CLIP_LOOP( fxMesa );
fxVB->last_elt = 0;
@@ -556,7 +556,7 @@ void tdfxDDFastPath( struct vertex_buffer *VB )
* in the other drivers. -BP
*/
LOCK_HARDWARE( fxMesa );
- grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] );
+ fxMesa->Glide.grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] );
fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT;
UNLOCK_HARDWARE( fxMesa );
}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c
deleted file mode 100644
index 50d055b7f..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-
-#include "tdfx_context.h"
-#include "tdfx_g3ext.h"
-
-
-/* STENCIL extension
- */
-GrProc grStencilFuncProc = NULL;
-GrProc grStencilMaskProc = NULL;
-GrProc grStencilOpProc = NULL;
-GrProc grBufferClearExtProc = NULL;
-GrProc grColorMaskExtProc = NULL;
-
-/* COMBINE extension
- */
-GrProc grColorCombineExtProc = NULL;
-GrProc grTexColorCombineExtProc = NULL;
-GrProc grAlphaCombineExtProc = NULL;
-GrProc grTexAlphaCombineExtProc = NULL;
-GrProc grAlphaBlendFunctionExtProc = NULL;
-GrProc grConstantColorValueExtProc = NULL;
-
-/* Texus 2
- */
-GrProc txImgQuantizeProc = NULL;
-GrProc txImgDequantizeFXT1Proc = NULL;
-GrProc txErrorSetCallbackProc = NULL;
-
-
-/* Initialize the Glide extensions not exported in the Glide headers.
- * This is just plain evil stuff...
- */
-void tdfxDDGlideExtensionsInit( void )
-{
- void *handle;
-
- /* Get Glide3 extension function pointers */
- handle = dlopen( NULL, RTLD_NOW | RTLD_GLOBAL );
-
- if ( handle ) {
- /* PIXEXT extension */
- grStencilFuncProc = dlsym( handle, "grStencilFunc" );
- grStencilMaskProc = dlsym( handle, "grStencilMask" );
- grStencilOpProc = dlsym( handle, "grStencilOp" );
- grBufferClearExtProc = dlsym( handle, "grBufferClearExt" );
- grColorMaskExtProc = dlsym( handle, "grColorMaskExt" );
-
- /* COMBINE extension */
- grColorCombineExtProc = dlsym( handle, "grColorCombineExt" );
- grTexColorCombineExtProc = dlsym( handle, "grTexColorCombineExt" );
- grAlphaCombineExtProc = dlsym( handle, "grAlphaCombineExt" );
- grTexAlphaCombineExtProc = dlsym( handle, "grTexAlphaCombineExt" );
- grAlphaBlendFunctionExtProc = dlsym( handle, "grAlphaBlendFunctionExt" );
- grConstantColorValueExtProc = dlsym( handle, "grConstantColorValueExt" );
-
- /* Texus 2 */
- txImgQuantizeProc = dlsym( handle, "txImgQuantize" );
- txImgDequantizeFXT1Proc = dlsym( handle, "_txImgDequantizeFXT1" );
- txErrorSetCallbackProc = dlsym( handle, "txErrorSetCallback" );
- } else {
- /* PIXEXT extension */
- grStencilFuncProc = NULL;
- grStencilMaskProc = NULL;
- grStencilOpProc = NULL;
- grBufferClearExtProc = NULL;
- grColorMaskExtProc = NULL;
-
- /* COMBINE extension */
- grColorCombineExtProc = NULL;
- grTexColorCombineExtProc = NULL;
- grAlphaCombineExtProc = NULL;
- grTexAlphaCombineExtProc = NULL;
- grAlphaBlendFunctionExtProc = NULL;
- grConstantColorValueExtProc = NULL;
-
- /* Texus 2 */
- txImgQuantizeProc = NULL;
- txImgDequantizeFXT1Proc = NULL;
- txErrorSetCallbackProc = NULL;
- }
-
- dlclose( handle );
-}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h
deleted file mode 100644
index 1595051c9..000000000
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_G3EXT_H__
-#define __TDFX_G3EXT_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <glide.h>
-#include <g3ext.h>
-
-/*
- * These are glide extension definitions. These are not
- * defined in glide.h. They should really be defined in
- * g3ext.h, but they are not.
- */
-typedef void (*grStencilFunc_t)( GrCmpFnc_t fnc, GrStencil_t ref,
- GrStencil_t mask );
-typedef void (*grStencilMask_t)( GrStencil_t write_mask );
-typedef void (*grStencilOp_t)( GrStencilOp_t stencil_fail,
- GrStencilOp_t depth_fail,
- GrStencilOp_t depth_pass );
-typedef void (*grBufferClearExt_t)( GrColor_t color, GrAlpha_t alpha,
- FxU32 depth, GrStencil_t stencil );
-typedef void (*grColorMaskExt_t)( FxBool r, FxBool g, FxBool b, FxBool a );
-
-/*
- * "COMBINE" extension for Napalm
- */
-typedef void (*grColorCombineExt_t)( GrCCUColor_t a, GrCombineMode_t a_mode,
- GrCCUColor_t b, GrCombineMode_t b_mode,
- GrCCUColor_t c, FxBool c_invert,
- GrCCUColor_t d, FxBool d_invert,
- FxU32 shift, FxBool invert );
-typedef void (*grTexColorCombineExt_t)( FxU32 tmu,
- GrTCCUColor_t a,
- GrCombineMode_t a_mode,
- GrTCCUColor_t b,
- GrCombineMode_t b_mode,
- GrTCCUColor_t c, FxBool c_invert,
- GrTCCUColor_t d, FxBool d_invert,
- FxU32 shift, FxBool invert );
-typedef void (*grAlphaCombineExt_t)( GrACUColor_t a, GrCombineMode_t a_mode,
- GrACUColor_t b, GrCombineMode_t b_mode,
- GrACUColor_t c, FxBool c_invert,
- GrACUColor_t d, FxBool d_invert,
- FxU32 shift, FxBool invert );
-typedef void (*grTexAlphaCombineExt_t)( FxU32 tmu,
- GrTACUColor_t a,
- GrCombineMode_t a_mode,
- GrTACUColor_t b,
- GrCombineMode_t b_mode,
- GrTACUColor_t c, FxBool c_invert,
- GrTACUColor_t d, FxBool d_invert,
- FxU32 shift, FxBool invert );
-typedef void (*grAlphaBlendFunctionExt_t)( GrAlphaBlendFnc_t rgb_sf,
- GrAlphaBlendFnc_t rgb_df,
- GrAlphaBlendOp_t rgb_op,
- GrAlphaBlendFnc_t alpha_sf,
- GrAlphaBlendFnc_t alpha_df,
- GrAlphaBlendOp_t alpha_op);
-typedef void (*grConstantColorValueExt_t)( FxU32 tmu, GrColor_t value );
-
-
-
-/*
- * These are functions to compress and decompress images.
- * The types of the first and second parameters are not exactly
- * right. The texus library declares them to be "char *", not
- * "void *". However, "void *" is more correct, and more convenient.
- */
-typedef void (*txImgQuantize_t)( void *dst, void *src,
- int w, int h,
- FxU32 format, FxU32 dither );
-typedef void (*txImgDeQuantize_t)( void *dst, void *src, int w, int h );
-
-/*
- * These next three declarations should probably be taken from
- * texus.h. However, there are duplicate declarations in g3ext.h
- * and texus.h which make it hard to include them both.
- */
-typedef void (*TxErrorCallbackFnc_t)( const char *string, FxBool fatal );
-typedef void (*txErrorSetCallback_t)( TxErrorCallbackFnc_t fnc,
- TxErrorCallbackFnc_t *old_fnc );
-
-/* PIXEXT extension
- */
-GrProc grStencilFuncProc;
-GrProc grStencilMaskProc;
-GrProc grStencilOpProc;
-GrProc grBufferClearExtProc;
-GrProc grColorMaskExtProc;
-
-/* COMBINE extension
- */
-GrProc grColorCombineExtProc;
-GrProc grTexColorCombineExtProc;
-GrProc grAlphaCombineExtProc;
-GrProc grTexAlphaCombineExtProc;
-GrProc grAlphaBlendFunctionExtProc;
-GrProc grConstantColorValueExtProc;
-
-/* Texus extensions???
- */
-GrProc txImgQuantizeProc;
-GrProc txImgDequantizeFXT1Proc;
-GrProc txErrorSetCallbackProc;
-
-extern void tdfxDDGlideExtensionsInit( void );
-
-#endif
-#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c
index d98231629..94119f7c3 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c
@@ -59,7 +59,7 @@ void tdfxGetLock( tdfxContextPtr fxMesa )
XMESA_VALIDATE_DRAWABLE_INFO( cPriv->display, sPriv, dPriv );
if ( saPriv->fifoOwner != fxMesa->hHWContext ) {
- grDRIImportFifo( saPriv->fifoPtr, saPriv->fifoRead );
+ fxMesa->Glide.grDRIImportFifo( saPriv->fifoPtr, saPriv->fifoRead );
}
if ( saPriv->ctxOwner != fxMesa->hHWContext ) {
@@ -69,7 +69,9 @@ void tdfxGetLock( tdfxContextPtr fxMesa )
* that state onto the hardware when you set the state.
*/
void *state;
- state = malloc( FX_grGetInteger_NoLock( FX_GLIDE_STATE_SIZE ) );
+ FxU32 size;
+ fxMesa->Glide.grGet( GR_GLIDE_STATE_SIZE, 4, &size );
+ state = malloc( size );
FX_grGlideGetState_NoLock( state );
FX_grGlideSetState_NoLock( state );
free( state );
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h
index 19e57f092..249384f81 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h
@@ -127,7 +127,7 @@ extern void tdfxGetLock( tdfxContextPtr fxMesa );
while (_nc--) { \
if (fxMesa->numClipRects > 1) { \
int _height = fxMesa->screen_height; \
- grClipWindow(fxMesa->pClipRects[_nc].x1, \
+ fxMesa->Glide.grClipWindow(fxMesa->pClipRects[_nc].x1, \
_height - fxMesa->pClipRects[_nc].y2, \
fxMesa->pClipRects[_nc].x2, \
_height - fxMesa->pClipRects[_nc].y1); \
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c
index 2afc90f93..6c3efa501 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c
@@ -459,10 +459,10 @@ tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y,
LOCK_HARDWARE( fxMesa );
info.size = sizeof(info);
- if (grLfbLock(GR_LFB_READ_ONLY,
- fxMesa->ReadBuffer,
- GR_LFBWRITEMODE_ANY,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
+ if (fxMesa->Glide.grLfbLock(GR_LFB_READ_ONLY,
+ fxMesa->ReadBuffer,
+ GR_LFBWRITEMODE_ANY,
+ GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer ==
GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes / 2);
const GLushort *src = (const GLushort *) info.lfbPtr
@@ -484,7 +484,7 @@ tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y,
result = GL_TRUE;
}
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer);
+ fxMesa->Glide.grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer);
}
UNLOCK_HARDWARE( fxMesa );
return result;
@@ -519,10 +519,10 @@ tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
LOCK_HARDWARE(fxMesa);
info.size = sizeof(info);
- if (grLfbLock(GR_LFB_READ_ONLY,
- fxMesa->ReadBuffer,
- GR_LFBWRITEMODE_ANY,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info))
+ if (fxMesa->Glide.grLfbLock(GR_LFB_READ_ONLY,
+ fxMesa->ReadBuffer,
+ GR_LFBWRITEMODE_ANY,
+ GR_ORIGIN_UPPER_LEFT, FXFALSE, &info))
{
const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
? (fxMesa->screen_width) : (info.strideInBytes / 4);
@@ -545,7 +545,7 @@ tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
result = GL_TRUE;
}
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer);
+ fxMesa->Glide.grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer);
}
UNLOCK_HARDWARE(fxMesa);
return result;
@@ -604,10 +604,10 @@ tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
}
info.size = sizeof(info);
- if (grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->DrawBuffer,
- GR_LFBWRITEMODE_8888,
- GR_ORIGIN_UPPER_LEFT, FXTRUE, &info))
+ if (fxMesa->Glide.grLfbLock(GR_LFB_WRITE_ONLY,
+ fxMesa->DrawBuffer,
+ GR_LFBWRITEMODE_8888,
+ GR_ORIGIN_UPPER_LEFT, FXTRUE, &info))
{
const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
? (fxMesa->screen_width * 4) : (info.strideInBytes);
@@ -630,7 +630,7 @@ tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
result = GL_TRUE;
}
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer);
+ fxMesa->Glide.grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer);
}
UNLOCK_HARDWARE(fxMesa);
return result;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c
index 473646d10..64dcadb78 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c
@@ -96,30 +96,30 @@ static GLbitfield tdfxDDClear( GLcontext *ctx,
}
if ( flags & TDFX_STENCIL ) {
- grStencilMask( fxMesa->Stencil.WriteMask );
+ fxMesa->Glide.grStencilMask( fxMesa->Stencil.WriteMask );
/* set stencil ref value = desired clear value */
- grStencilFunc( GR_CMP_ALWAYS, fxMesa->Stencil.Clear, 0xff );
- grStencilOp( GR_STENCILOP_REPLACE,
- GR_STENCILOP_REPLACE,
- GR_STENCILOP_REPLACE );
- grEnable( GR_STENCIL_MODE_EXT );
+ fxMesa->Glide.grStencilFunc( GR_CMP_ALWAYS, fxMesa->Stencil.Clear, 0xff );
+ fxMesa->Glide.grStencilOp( GR_STENCILOP_REPLACE,
+ GR_STENCILOP_REPLACE,
+ GR_STENCILOP_REPLACE );
+ fxMesa->Glide.grEnable( GR_STENCIL_MODE_EXT );
if ( ctx->Stencil.Enabled ) {
- grStencilOp( fxMesa->Stencil.FailFunc,
- fxMesa->Stencil.ZFailFunc,
- fxMesa->Stencil.ZPassFunc );
- grStencilMask( fxMesa->Stencil.WriteMask );
- grStencilFunc( fxMesa->Stencil.Function,
- fxMesa->Stencil.RefValue,
- fxMesa->Stencil.ValueMask );
- grEnable_NoLock( GR_STENCIL_MODE_EXT );
+ fxMesa->Glide.grStencilOp( fxMesa->Stencil.FailFunc,
+ fxMesa->Stencil.ZFailFunc,
+ fxMesa->Stencil.ZPassFunc );
+ fxMesa->Glide.grStencilMask( fxMesa->Stencil.WriteMask );
+ fxMesa->Glide.grStencilFunc( fxMesa->Stencil.Function,
+ fxMesa->Stencil.RefValue,
+ fxMesa->Stencil.ValueMask );
+ fxMesa->Glide.grEnable_NoLock( GR_STENCIL_MODE_EXT );
} else {
- grDisable( GR_STENCIL_MODE_EXT );
+ fxMesa->Glide.grDisable( GR_STENCIL_MODE_EXT );
}
-
+
}
UNLOCK_HARDWARE( fxMesa );
-
+
#else
if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
@@ -162,15 +162,15 @@ static GLbitfield tdfxDDClear( GLcontext *ctx,
*/
LOCK_HARDWARE(fxMesa);
if (mask & DD_STENCIL_BIT) {
- FX_grStencilMask_NoLock(/*ctx->Stencil.WriteMask*/ 0xff);
+ fxMesa->Glide.grStencilMask(/*ctx->Stencil.WriteMask*/ 0xff);
/* set stencil ref value = desired clear value */
- FX_grStencilFunc_NoLock(GR_CMP_ALWAYS, ctx->Stencil.Clear, 0xff);
- FX_grStencilOp_NoLock(GR_STENCILOP_REPLACE,
- GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE);
- FX_grEnable_NoLock(GR_STENCIL_MODE_EXT);
+ fxMesa->Glide.grStencilFunc(GR_CMP_ALWAYS, ctx->Stencil.Clear, 0xff);
+ fxMesa->Glide.grStencilOp(GR_STENCILOP_REPLACE,
+ GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE);
+ fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT);
}
else {
- FX_grDisable_NoLock(GR_STENCIL_MODE_EXT);
+ fxMesa->Glide.grDisable(GR_STENCIL_MODE_EXT);
}
UNLOCK_HARDWARE(fxMesa);
}
@@ -188,20 +188,20 @@ static GLbitfield tdfxDDClear( GLcontext *ctx,
case DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
/* back buffer & depth */
FX_grColorMaskv_NoLock(ctx, true4); /* work around Voodoo3 bug */
- FX_grDepthMask_NoLock(FXTRUE);
- FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
+ fxMesa->Glide.grDepthMask(FXTRUE);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
if (stencil_size > 0) {
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
}
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
if (!ctx->Depth.Mask || !ctx->Depth.Test) {
- FX_grDepthMask_NoLock(FXFALSE);
+ fxMesa->Glide.grDepthMask(FXFALSE);
}
break;
case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT:
@@ -210,161 +210,161 @@ static GLbitfield tdfxDDClear( GLcontext *ctx,
* This is a work-around/
*/
/* clear depth */
- FX_grDepthMask_NoLock(FXTRUE);
- FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
+ fxMesa->Glide.grDepthMask(FXTRUE);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
FX_grColorMaskv_NoLock(ctx, false4);
if (stencil_size > 0)
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
/* clear front */
FX_grColorMaskv_NoLock(ctx, true4);
- FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
if (!ctx->Depth.Mask || !ctx->Depth.Test) {
- FX_grDepthMask_NoLock(FXFALSE);
+ fxMesa->Glide.grDepthMask(FXFALSE);
}
break;
case DD_BACK_LEFT_BIT:
/* back buffer only */
- FX_grDepthMask_NoLock(FXFALSE);
- FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
+ fxMesa->Glide.grDepthMask(FXFALSE);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
if (ctx->Depth.Mask && ctx->Depth.Test) {
- FX_grDepthMask_NoLock(FXTRUE);
+ fxMesa->Glide.grDepthMask(FXTRUE);
}
break;
case DD_FRONT_LEFT_BIT:
/* front buffer only */
- FX_grDepthMask_NoLock(FXFALSE);
- FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
+ fxMesa->Glide.grDepthMask(FXFALSE);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
if (ctx->Depth.Mask && ctx->Depth.Test) {
- FX_grDepthMask_NoLock(FXTRUE);
+ fxMesa->Glide.grDepthMask(FXTRUE);
}
break;
case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT:
/* front and back */
- FX_grDepthMask_NoLock(FXFALSE);
- FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
+ fxMesa->Glide.grDepthMask(FXFALSE);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
if (ctx->Depth.Mask && ctx->Depth.Test) {
- FX_grDepthMask_NoLock(FXTRUE);
+ fxMesa->Glide.grDepthMask(FXTRUE);
}
break;
case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
/* clear front */
- FX_grDepthMask_NoLock(FXFALSE);
- FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
+ fxMesa->Glide.grDepthMask(FXFALSE);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
/* clear back and depth */
- FX_grDepthMask_NoLock(FXTRUE);
- FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
+ fxMesa->Glide.grDepthMask(FXTRUE);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
if (!ctx->Depth.Mask || !ctx->Depth.Mask) {
- FX_grDepthMask_NoLock(FXFALSE);
+ fxMesa->Glide.grDepthMask(FXFALSE);
}
break;
case DD_DEPTH_BIT:
/* just the depth buffer */
- FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
FX_grColorMaskv_NoLock(ctx, false4);
- FX_grDepthMask_NoLock(FXTRUE);
+ fxMesa->Glide.grDepthMask(FXTRUE);
if (stencil_size > 0)
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
else
- FX_grBufferClear_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear);
FX_grColorMaskv_NoLock(ctx, true4);
if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT)
- FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (!ctx->Depth.Test || !ctx->Depth.Mask)
- FX_grDepthMask_NoLock(FXFALSE);
+ fxMesa->Glide.grDepthMask(FXFALSE);
break;
default:
/* clear no color buffers or depth buffer but might clear stencil */
if (stencil_size > 0 && (mask & DD_STENCIL_BIT)) {
/* XXX need this RenderBuffer call to work around Glide bug */
- FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
- FX_grDepthMask_NoLock(FXFALSE);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ fxMesa->Glide.grDepthMask(FXFALSE);
FX_grColorMaskv_NoLock(ctx, false4);
- FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
+ fxMesa->Color.ClearAlpha,
+ fxMesa->Depth.Clear,
+ (FxU32) ctx->Stencil.Clear);
if (ctx->Depth.Mask && ctx->Depth.Test) {
- FX_grDepthMask_NoLock(FXTRUE);
+ fxMesa->Glide.grDepthMask(FXTRUE);
}
FX_grColorMaskv_NoLock(ctx, true4);
if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT)
- FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
+ fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
}
}
@@ -390,7 +390,7 @@ static void tdfxDDFinish( GLcontext *ctx )
FLUSH_BATCH( fxMesa );
LOCK_HARDWARE( fxMesa );
- grFinish();
+ fxMesa->Glide.grFinish();
UNLOCK_HARDWARE( fxMesa );
}
@@ -401,7 +401,7 @@ static void tdfxDDFlush( GLcontext *ctx )
FLUSH_BATCH( fxMesa );
LOCK_HARDWARE( fxMesa );
- grFlush();
+ fxMesa->Glide.grFlush();
UNLOCK_HARDWARE( fxMesa );
}
@@ -503,7 +503,7 @@ static void uploadTextureEnv( tdfxContextPtr fxMesa )
printf(" aInvert = %d\n", fxMesa->TexCombineExt[unit].Alpha.Invert);
printf(" Color = 0x%08x\n", fxMesa->TexCombineExt[unit].EnvColor);
#endif
- (*grTexColorCombineExtProc)(TDFX_TMU0 + unit,
+ fxMesa->Glide.grTexColorCombineExt(TDFX_TMU0 + unit,
fxMesa->TexCombineExt[unit].Color.SourceA,
fxMesa->TexCombineExt[unit].Color.ModeA,
fxMesa->TexCombineExt[unit].Color.SourceB,
@@ -514,7 +514,7 @@ static void uploadTextureEnv( tdfxContextPtr fxMesa )
fxMesa->TexCombineExt[unit].Color.InvertD,
fxMesa->TexCombineExt[unit].Color.Shift,
fxMesa->TexCombineExt[unit].Color.Invert);
- (*grTexAlphaCombineExtProc)(TDFX_TMU0 + unit,
+ fxMesa->Glide.grTexAlphaCombineExt(TDFX_TMU0 + unit,
fxMesa->TexCombineExt[unit].Alpha.SourceA,
fxMesa->TexCombineExt[unit].Alpha.ModeA,
fxMesa->TexCombineExt[unit].Alpha.SourceB,
@@ -525,8 +525,8 @@ static void uploadTextureEnv( tdfxContextPtr fxMesa )
fxMesa->TexCombineExt[unit].Alpha.InvertD,
fxMesa->TexCombineExt[unit].Alpha.Shift,
fxMesa->TexCombineExt[unit].Alpha.Invert);
- (*grConstantColorValueExtProc)(TDFX_TMU0 + unit,
- fxMesa->TexCombineExt[unit].EnvColor);
+ fxMesa->Glide.grConstantColorValueExt(TDFX_TMU0 + unit,
+ fxMesa->TexCombineExt[unit].EnvColor);
}
}
else {
@@ -534,13 +534,13 @@ static void uploadTextureEnv( tdfxContextPtr fxMesa )
int unit;
for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
struct tdfx_texcombine *comb = &fxMesa->TexCombine[unit];
- FX_grTexCombine_NoLock(TDFX_TMU0 + unit,
- comb->FunctionRGB,
- comb->FactorRGB,
- comb->FunctionAlpha,
- comb->FactorAlpha,
- comb->InvertRGB,
- comb->InvertAlpha);
+ fxMesa->Glide.grTexCombine(TDFX_TMU0 + unit,
+ comb->FunctionRGB,
+ comb->FactorRGB,
+ comb->FunctionAlpha,
+ comb->FactorAlpha,
+ comb->InvertRGB,
+ comb->InvertAlpha);
}
}
}
@@ -558,10 +558,10 @@ static void uploadTextureParams( tdfxContextPtr fxMesa )
printf(" mipmap %x %x\n", env->mmMode, env->LODblend);
printf(" lod bias %f\n", env->LodBias);
*/
- FX_grTexClampMode_NoLock(GR_TMU0 + unit, p->sClamp, p->tClamp);
- FX_grTexFilterMode_NoLock(GR_TMU0 + unit, p->minFilt, p->magFilt);
- FX_grTexMipMapMode_NoLock(GR_TMU0 + unit, p->mmMode, p->LODblend);
- FX_grTexLodBiasValue_NoLock(GR_TMU0 + unit, p->LodBias);
+ fxMesa->Glide.grTexClampMode(GR_TMU0 + unit, p->sClamp, p->tClamp);
+ fxMesa->Glide.grTexFilterMode(GR_TMU0 + unit, p->minFilt, p->magFilt);
+ fxMesa->Glide.grTexMipMapMode(GR_TMU0 + unit, p->mmMode, p->LODblend);
+ fxMesa->Glide.grTexLodBiasValue(GR_TMU0 + unit, p->LodBias);
}
}
@@ -581,10 +581,10 @@ static void uploadTextureSource( tdfxContextPtr fxMesa )
src->Info->aspectRatioLog2, src->Info->format,
src->Info->data);
*/
- FX_grTexSource_NoLock(GR_TMU0 + unit,
- src->StartAddress,
- src->EvenOdd,
- src->Info);
+ fxMesa->Glide.grTexSource(GR_TMU0 + unit,
+ src->StartAddress,
+ src->EvenOdd,
+ src->Info);
}
}
}
@@ -623,18 +623,18 @@ void tdfxUploadClipping( tdfxContextPtr fxMesa )
if (fxMesa->numClipRects == 0) {
/* all drawing clipped away */
- grClipWindow(0, 0, 0, 0);
+ fxMesa->Glide.grClipWindow(0, 0, 0, 0);
}
else if (fxMesa->numClipRects == 1) {
- grClipWindow(fxMesa->pClipRects[0].x1,
+ fxMesa->Glide.grClipWindow(fxMesa->pClipRects[0].x1,
fxMesa->screen_height - fxMesa->pClipRects[0].y2,
fxMesa->pClipRects[0].x2,
fxMesa->screen_height - fxMesa->pClipRects[0].y1);
}
/* else, we'll do a cliprect loop around all drawing */
- grDRIPosition( dPriv->x, dPriv->y, dPriv->w, dPriv->h,
- fxMesa->numClipRects, fxMesa->pClipRects );
+ fxMesa->Glide.grDRIPosition( dPriv->x, dPriv->y, dPriv->w, dPriv->h,
+ fxMesa->numClipRects, fxMesa->pClipRects );
}
@@ -645,7 +645,7 @@ void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa )
if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_COMBINE ) {
if (TDFX_IS_NAPALM(fxMesa)) {
- (*grColorCombineExtProc)(fxMesa->ColorCombineExt.SourceA,
+ fxMesa->Glide.grColorCombineExt(fxMesa->ColorCombineExt.SourceA,
fxMesa->ColorCombineExt.ModeA,
fxMesa->ColorCombineExt.SourceB,
fxMesa->ColorCombineExt.ModeB,
@@ -658,111 +658,111 @@ void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa )
}
else {
/* Voodoo 3 */
- grColorCombine( fxMesa->ColorCombine.Function,
- fxMesa->ColorCombine.Factor,
- fxMesa->ColorCombine.Local,
- fxMesa->ColorCombine.Other,
- fxMesa->ColorCombine.Invert );
+ fxMesa->Glide.grColorCombine(fxMesa->ColorCombine.Function,
+ fxMesa->ColorCombine.Factor,
+ fxMesa->ColorCombine.Local,
+ fxMesa->ColorCombine.Other,
+ fxMesa->ColorCombine.Invert);
}
fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_COMBINE;
}
if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_COMBINE ) {
if (TDFX_IS_NAPALM(fxMesa)) {
- (*grAlphaCombineExtProc)(fxMesa->AlphaCombineExt.SourceA,
- fxMesa->AlphaCombineExt.ModeA,
- fxMesa->AlphaCombineExt.SourceB,
- fxMesa->AlphaCombineExt.ModeB,
- fxMesa->AlphaCombineExt.SourceC,
- fxMesa->AlphaCombineExt.InvertC,
- fxMesa->AlphaCombineExt.SourceD,
- fxMesa->AlphaCombineExt.InvertD,
- fxMesa->AlphaCombineExt.Shift,
- fxMesa->AlphaCombineExt.Invert);
+ fxMesa->Glide.grAlphaCombineExt(fxMesa->AlphaCombineExt.SourceA,
+ fxMesa->AlphaCombineExt.ModeA,
+ fxMesa->AlphaCombineExt.SourceB,
+ fxMesa->AlphaCombineExt.ModeB,
+ fxMesa->AlphaCombineExt.SourceC,
+ fxMesa->AlphaCombineExt.InvertC,
+ fxMesa->AlphaCombineExt.SourceD,
+ fxMesa->AlphaCombineExt.InvertD,
+ fxMesa->AlphaCombineExt.Shift,
+ fxMesa->AlphaCombineExt.Invert);
}
else {
/* Voodoo 3 */
- grAlphaCombine( fxMesa->AlphaCombine.Function,
- fxMesa->AlphaCombine.Factor,
- fxMesa->AlphaCombine.Local,
- fxMesa->AlphaCombine.Other,
- fxMesa->AlphaCombine.Invert );
+ fxMesa->Glide.grAlphaCombine( fxMesa->AlphaCombine.Function,
+ fxMesa->AlphaCombine.Factor,
+ fxMesa->AlphaCombine.Local,
+ fxMesa->AlphaCombine.Other,
+ fxMesa->AlphaCombine.Invert );
}
fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_COMBINE;
}
if ( fxMesa->dirty & TDFX_UPLOAD_RENDER_BUFFER ) {
- grRenderBuffer( fxMesa->DrawBuffer );
+ fxMesa->Glide.grRenderBuffer( fxMesa->DrawBuffer );
fxMesa->dirty &= ~TDFX_UPLOAD_RENDER_BUFFER;
}
if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE) {
- grStipplePattern( fxMesa->Stipple.Pattern );
- grStippleMode( fxMesa->Stipple.Mode );
+ fxMesa->Glide.grStipplePattern( fxMesa->Stipple.Pattern );
+ fxMesa->Glide.grStippleMode( fxMesa->Stipple.Mode );
fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE;
}
if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_TEST ) {
- grAlphaTestFunction( fxMesa->Color.AlphaFunc );
+ fxMesa->Glide.grAlphaTestFunction( fxMesa->Color.AlphaFunc );
fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_TEST;
}
if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_REF ) {
- grAlphaTestReferenceValue( fxMesa->Color.AlphaRef );
+ fxMesa->Glide.grAlphaTestReferenceValue( fxMesa->Color.AlphaRef );
fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_REF;
}
if ( fxMesa->dirty & TDFX_UPLOAD_BLEND_FUNC ) {
- if (grAlphaBlendFunctionExtProc) {
- (*grAlphaBlendFunctionExtProc)( fxMesa->Color.BlendSrcRGB,
- fxMesa->Color.BlendDstRGB,
- GR_BLEND_OP_ADD,
- fxMesa->Color.BlendSrcA,
- fxMesa->Color.BlendDstA,
- GR_BLEND_OP_ADD );
+ if (fxMesa->Glide.grAlphaBlendFunctionExt) {
+ fxMesa->Glide.grAlphaBlendFunctionExt( fxMesa->Color.BlendSrcRGB,
+ fxMesa->Color.BlendDstRGB,
+ GR_BLEND_OP_ADD,
+ fxMesa->Color.BlendSrcA,
+ fxMesa->Color.BlendDstA,
+ GR_BLEND_OP_ADD );
}
else {
- grAlphaBlendFunction( fxMesa->Color.BlendSrcRGB,
- fxMesa->Color.BlendDstRGB,
- fxMesa->Color.BlendSrcA,
- fxMesa->Color.BlendDstA );
+ fxMesa->Glide.grAlphaBlendFunction( fxMesa->Color.BlendSrcRGB,
+ fxMesa->Color.BlendDstRGB,
+ fxMesa->Color.BlendSrcA,
+ fxMesa->Color.BlendDstA );
}
fxMesa->dirty &= ~TDFX_UPLOAD_BLEND_FUNC;
}
if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MODE ) {
- grDepthBufferMode( fxMesa->Depth.Mode );
+ fxMesa->Glide.grDepthBufferMode( fxMesa->Depth.Mode );
fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MODE;
}
if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_BIAS ) {
- grDepthBiasLevel( fxMesa->Depth.Bias );
+ fxMesa->Glide.grDepthBiasLevel( fxMesa->Depth.Bias );
fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_BIAS;
}
if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_FUNC ) {
- grDepthBufferFunction( fxMesa->Depth.Func );
+ fxMesa->Glide.grDepthBufferFunction( fxMesa->Depth.Func );
fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_FUNC;
}
if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MASK ) {
- grDepthMask( fxMesa->Depth.Mask );
+ fxMesa->Glide.grDepthMask( fxMesa->Depth.Mask );
fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MASK;
}
if ( fxMesa->dirty & TDFX_UPLOAD_DITHER) {
- grDitherMode( fxMesa->Color.Dither );
+ fxMesa->Glide.grDitherMode( fxMesa->Color.Dither );
}
if ( fxMesa->dirty & TDFX_UPLOAD_FOG_MODE ) {
- grFogMode( fxMesa->Fog.Mode );
+ fxMesa->Glide.grFogMode( fxMesa->Fog.Mode );
fxMesa->dirty &= ~TDFX_UPLOAD_FOG_MODE;
}
if ( fxMesa->dirty & TDFX_UPLOAD_FOG_COLOR ) {
- grFogColorValue( fxMesa->Fog.Color );
+ fxMesa->Glide.grFogColorValue( fxMesa->Fog.Color );
fxMesa->dirty &= ~TDFX_UPLOAD_FOG_COLOR;
}
if ( fxMesa->dirty & TDFX_UPLOAD_FOG_TABLE ) {
- grFogTable( fxMesa->Fog.Table );
+ fxMesa->Glide.grFogTable( fxMesa->Fog.Table );
fxMesa->dirty &= ~TDFX_UPLOAD_FOG_TABLE;
}
if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) {
- grCullMode( fxMesa->CullMode );
+ fxMesa->Glide.grCullMode( fxMesa->CullMode );
fxMesa->dirty &= ~TDFX_UPLOAD_CULL;
}
@@ -772,52 +772,53 @@ void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa )
}
if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK ) {
- if ( grColorMaskExtProc && fxMesa->glCtx->Visual->RedBits == 8) {
- grColorMaskExtProc( fxMesa->Color.ColorMask[RCOMP],
- fxMesa->Color.ColorMask[GCOMP],
- fxMesa->Color.ColorMask[BCOMP],
- fxMesa->Color.ColorMask[ACOMP] );
+ if ( fxMesa->Glide.grColorMaskExt
+ && fxMesa->glCtx->Visual->RedBits == 8) {
+ fxMesa->Glide.grColorMaskExt( fxMesa->Color.ColorMask[RCOMP],
+ fxMesa->Color.ColorMask[GCOMP],
+ fxMesa->Color.ColorMask[BCOMP],
+ fxMesa->Color.ColorMask[ACOMP] );
} else {
- grColorMask( fxMesa->Color.ColorMask[RCOMP] ||
- fxMesa->Color.ColorMask[GCOMP] ||
- fxMesa->Color.ColorMask[BCOMP],
- fxMesa->Color.ColorMask[ACOMP] );
+ fxMesa->Glide.grColorMask( fxMesa->Color.ColorMask[RCOMP] ||
+ fxMesa->Color.ColorMask[GCOMP] ||
+ fxMesa->Color.ColorMask[BCOMP],
+ fxMesa->Color.ColorMask[ACOMP] );
}
fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_MASK;
}
if ( fxMesa->dirty & TDFX_UPLOAD_CONSTANT_COLOR ) {
- grConstantColorValue( fxMesa->Color.MonoColor );
+ fxMesa->Glide.grConstantColorValue( fxMesa->Color.MonoColor );
fxMesa->dirty &= ~TDFX_UPLOAD_CONSTANT_COLOR;
}
if ( fxMesa->dirty & TDFX_UPLOAD_LINE ) {
if (fxMesa->glCtx->Line.SmoothFlag && fxMesa->glCtx->Line.Width == 1.0)
- grEnable(GR_AA_ORDERED);
+ fxMesa->Glide.grEnable(GR_AA_ORDERED);
else
- grDisable(GR_AA_ORDERED);
+ fxMesa->Glide.grDisable(GR_AA_ORDERED);
fxMesa->dirty &= ~TDFX_UPLOAD_LINE;
}
if ( fxMesa->dirty & TDFX_UPLOAD_STENCIL ) {
if (fxMesa->glCtx->Stencil.Enabled) {
- grEnable(GR_STENCIL_MODE_EXT);
- FX_grStencilOp_NoLock(fxMesa->Stencil.FailFunc,
- fxMesa->Stencil.ZFailFunc,
- fxMesa->Stencil.ZPassFunc);
- FX_grStencilFunc_NoLock(fxMesa->Stencil.Function,
- fxMesa->Stencil.RefValue,
- fxMesa->Stencil.ValueMask);
- FX_grStencilMask_NoLock(fxMesa->Stencil.WriteMask);
+ fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT);
+ fxMesa->Glide.grStencilOp(fxMesa->Stencil.FailFunc,
+ fxMesa->Stencil.ZFailFunc,
+ fxMesa->Stencil.ZPassFunc);
+ fxMesa->Glide.grStencilFunc(fxMesa->Stencil.Function,
+ fxMesa->Stencil.RefValue,
+ fxMesa->Stencil.ValueMask);
+ fxMesa->Glide.grStencilMask(fxMesa->Stencil.WriteMask);
}
else {
- grDisable(GR_STENCIL_MODE_EXT);
+ fxMesa->Glide.grDisable(GR_STENCIL_MODE_EXT);
}
fxMesa->dirty &= ~TDFX_UPLOAD_STENCIL;
}
if ( fxMesa->dirty & TDFX_UPLOAD_VERTEX_LAYOUT ) {
- grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] );
+ fxMesa->Glide.grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] );
fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT;
}
@@ -833,7 +834,7 @@ void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa )
if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PALETTE ) {
if (fxMesa->TexPalette.Data) {
- grTexDownloadTable(fxMesa->TexPalette.Type, fxMesa->TexPalette.Data);
+ fxMesa->Glide.grTexDownloadTable(fxMesa->TexPalette.Type, fxMesa->TexPalette.Data);
}
fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PALETTE;
}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c
index b770423af..600ba1432 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c
@@ -88,8 +88,9 @@ GLboolean tdfxCreateScreen( __DRIscreenPrivate *sPriv )
tdfxDDTriangleFuncsInit();
tdfxDDFastPathInit();
+ /***
tdfxDDGlideExtensionsInit();
-
+ **/
return GL_TRUE;
}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
index 7dce5112f..18c75965e 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c
@@ -83,12 +83,12 @@
UNLOCK_HARDWARE( fxMesa ); \
LOCK_HARDWARE( fxMesa ); \
info.size = sizeof(GrLfbInfo_t); \
- if ( grLfbLock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer, LFB_MODE, \
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \
+ if ( fxMesa->Glide.grLfbLock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer, \
+ LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \
{
#define HW_WRITE_UNLOCK() \
- grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer ); \
+ fxMesa->Glide.grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer );\
}
@@ -99,12 +99,12 @@
UNLOCK_HARDWARE( fxMesa ); \
LOCK_HARDWARE( fxMesa ); \
info.size = sizeof(GrLfbInfo_t); \
- if ( grLfbLock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer, LFB_MODE, \
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \
+ if ( fxMesa->Glide.grLfbLock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer, \
+ LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \
{
#define HW_READ_UNLOCK() \
- grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer ); \
+ fxMesa->Glide.grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer );\
}
@@ -344,10 +344,10 @@ visible_pixel(const tdfxContextPtr fxMesa, int scrX, int scrY)
* what's the point after all.
*/
#define READ_FB_SPAN_LOCK(fxMesa, info, target_buffer) \
- UNLOCK_HARDWARE(fxMesa); \
- LOCK_HARDWARE(fxMesa); \
+ UNLOCK_HARDWARE(fxMesa); \
+ LOCK_HARDWARE(fxMesa); \
(info).size=sizeof(info); \
- if (grLfbLock(GR_LFB_READ_ONLY, \
+ if (fxMesa->Glide.grLfbLock(GR_LFB_READ_ONLY, \
target_buffer, \
GR_LFBWRITEMODE_ANY, \
GR_ORIGIN_UPPER_LEFT, \
@@ -355,9 +355,9 @@ visible_pixel(const tdfxContextPtr fxMesa, int scrX, int scrY)
&(info))) {
#define READ_FB_SPAN_UNLOCK(fxMesa, target_buffer) \
- grLfbUnlock(GR_LFB_READ_ONLY, target_buffer); \
+ fxMesa->Glide.grLfbUnlock(GR_LFB_READ_ONLY, target_buffer); \
} else { \
- fprintf(stderr, "tdfxDriver: Can't get %s (%d) read lock\n", \
+ fprintf(stderr, "tdfxDriver: Can't get %s (%d) read lock\n", \
(target_buffer == GR_BUFFER_BACKBUFFER) \
? "back buffer" \
: ((target_buffer == GR_BUFFER_AUXBUFFER) \
@@ -367,10 +367,10 @@ visible_pixel(const tdfxContextPtr fxMesa, int scrX, int scrY)
}
#define WRITE_FB_SPAN_LOCK(fxMesa, info, target_buffer, write_mode) \
- UNLOCK_HARDWARE(fxMesa); \
- LOCK_HARDWARE(fxMesa); \
+ UNLOCK_HARDWARE(fxMesa); \
+ LOCK_HARDWARE(fxMesa); \
info.size=sizeof(info); \
- if (grLfbLock(GR_LFB_WRITE_ONLY, \
+ if (fxMesa->Glide.grLfbLock(GR_LFB_WRITE_ONLY, \
target_buffer, \
write_mode, \
GR_ORIGIN_UPPER_LEFT, \
@@ -378,9 +378,9 @@ visible_pixel(const tdfxContextPtr fxMesa, int scrX, int scrY)
&info)) {
#define WRITE_FB_SPAN_UNLOCK(fxMesa, target_buffer) \
- grLfbUnlock(GR_LFB_WRITE_ONLY, target_buffer); \
+ fxMesa->Glide.grLfbUnlock(GR_LFB_WRITE_ONLY, target_buffer); \
} else { \
- fprintf(stderr, "tdfxDriver: Can't get %s (%d) write lock\n", \
+ fprintf(stderr, "tdfxDriver: Can't get %s (%d) write lock\n", \
(target_buffer == GR_BUFFER_BACKBUFFER) \
? "back buffer" \
: ((target_buffer == GR_BUFFER_AUXBUFFER) \
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c
index bb8f6e8e9..10316454b 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c
@@ -547,14 +547,14 @@ static void tdfxUpdateFogAttrib( GLcontext *ctx )
{
switch( ctx->Fog.Mode ) {
case GL_EXP:
- guFogGenerateExp( fxMesa->Fog.Table, ctx->Fog.Density );
+ fxMesa->Glide.guFogGenerateExp(fxMesa->Fog.Table, ctx->Fog.Density);
break;
case GL_EXP2:
- guFogGenerateExp2( fxMesa->Fog.Table, ctx->Fog.Density );
+ fxMesa->Glide.guFogGenerateExp2(fxMesa->Fog.Table, ctx->Fog.Density);
break;
case GL_LINEAR:
- guFogGenerateLinear( fxMesa->Fog.Table,
- ctx->Fog.Start, ctx->Fog.End );
+ fxMesa->Glide.guFogGenerateLinear(fxMesa->Fog.Table,
+ ctx->Fog.Start, ctx->Fog.End);
break;
}
@@ -1151,14 +1151,14 @@ static void tdfxDDReducedPrimitiveChange( GLcontext *ctx, GLenum prim )
tdfxUpdateCull(ctx);
if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) {
- grCullMode( fxMesa->CullMode );
+ fxMesa->Glide.grCullMode( fxMesa->CullMode );
fxMesa->dirty &= ~TDFX_UPLOAD_CULL;
}
tdfxUpdateStipple(ctx);
if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE ) {
- grStipplePattern ( fxMesa->Stipple.Pattern );
- grStippleMode ( fxMesa->Stipple.Mode );
+ fxMesa->Glide.grStipplePattern ( fxMesa->Stipple.Pattern );
+ fxMesa->Glide.grStippleMode ( fxMesa->Stipple.Mode );
fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE;
}
}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c
index 34617be00..b54e6b387 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c
@@ -982,12 +982,12 @@ tdfxDDTestProxyTexImage( GLcontext *ctx, GLenum target,
/* determine where texture will reside */
if (t->LODblend && !tss->umaTexMemory) {
/* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */
- memNeeded = FX_grTexTextureMemRequired_NoLock(
+ memNeeded = fxMesa->Glide.grTexTextureMemRequired(
GR_MIPMAPLEVELMASK_BOTH, &(t->info));
}
else {
/* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */
- memNeeded = FX_grTexTextureMemRequired_NoLock(
+ memNeeded = fxMesa->Glide.grTexTextureMemRequired(
GR_MIPMAPLEVELMASK_BOTH, &(t->info));
}
/*
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
index 16e1fb10a..d3d2275af 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
@@ -258,17 +258,17 @@ void tdfxTMInit( tdfxContextPtr fxMesa )
LOCK_HARDWARE( fxMesa );
- extensions = grGetString( GR_EXTENSION );
+ extensions = fxMesa->Glide.grGetString( GR_EXTENSION );
if ( strstr( extensions, " TEXUMA " ) ) {
FxU32 start, end;
tss->umaTexMemory = GL_TRUE;
- grEnable( GR_TEXTURE_UMA_EXT );
+ fxMesa->Glide.grEnable( GR_TEXTURE_UMA_EXT );
- start = grTexMinAddress( 0 );
- end = grTexMaxAddress( 0 );
+ start = fxMesa->Glide.grTexMinAddress( 0 );
+ end = fxMesa->Glide.grTexMaxAddress( 0 );
if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE )
fprintf( stderr, " UMA tex memory: %d\n", (int)(end - start) );
@@ -287,8 +287,8 @@ void tdfxTMInit( tdfxContextPtr fxMesa )
for ( unit = 0 ; unit < fxMesa->numTMUs ; unit++ ) {
FxU32 start, end;
- start = grTexMinAddress( unit );
- end = grTexMaxAddress( unit );
+ start = fxMesa->Glide.grTexMinAddress( unit );
+ end = fxMesa->Glide.grTexMaxAddress( unit );
tss->totalTexMem[unit] = end - start;
tss->freeTexMem[unit] = end - start;
@@ -596,7 +596,7 @@ void tdfxTMDownloadTextureLocked( tdfxContextPtr fxMesa,
for ( l = t->minLevel ; l <= t->maxLevel && t->image[l].data ; l++ ) {
GrLOD_t glideLod = t->info.largeLodLog2 - l + tObj->BaseLevel;
- grTexDownloadMipMapLevel( targetTMU,
+ fxMesa->Glide.grTexDownloadMipMapLevel( targetTMU,
t->range[targetTMU]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -613,7 +613,7 @@ void tdfxTMDownloadTextureLocked( tdfxContextPtr fxMesa,
for ( l = t->minLevel ; l <= t->maxLevel && t->image[l].data ; l++ ) {
GrLOD_t glideLod = t->info.largeLodLog2 - l + tObj->BaseLevel;
- grTexDownloadMipMapLevel( GR_TMU0,
+ fxMesa->Glide.grTexDownloadMipMapLevel( GR_TMU0,
t->range[TDFX_TMU0]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -622,7 +622,7 @@ void tdfxTMDownloadTextureLocked( tdfxContextPtr fxMesa,
GR_MIPMAPLEVELMASK_ODD,
t->image[l].data );
- grTexDownloadMipMapLevel( GR_TMU1,
+ fxMesa->Glide.grTexDownloadMipMapLevel( GR_TMU1,
t->range[TDFX_TMU1]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -639,7 +639,7 @@ void tdfxTMDownloadTextureLocked( tdfxContextPtr fxMesa,
for ( l = t->minLevel ; l <= t->maxLevel && t->image[l].data ; l++ ) {
GrLOD_t glideLod = t->info.largeLodLog2 - l + tObj->BaseLevel;
- grTexDownloadMipMapLevel( GR_TMU0,
+ fxMesa->Glide.grTexDownloadMipMapLevel( GR_TMU0,
t->range[TDFX_TMU0]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -648,7 +648,7 @@ void tdfxTMDownloadTextureLocked( tdfxContextPtr fxMesa,
GR_MIPMAPLEVELMASK_BOTH,
t->image[l].data );
- grTexDownloadMipMapLevel( GR_TMU1,
+ fxMesa->Glide.grTexDownloadMipMapLevel( GR_TMU1,
t->range[TDFX_TMU1]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -671,6 +671,7 @@ void tdfxTMReloadMipMapLevelLocked( GLcontext *ctx,
struct gl_texture_object *tObj,
GLint level )
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj);
GrLOD_t glideLod;
FxU32 unit;
@@ -683,7 +684,7 @@ void tdfxTMReloadMipMapLevelLocked( GLcontext *ctx,
switch ( unit ) {
case TDFX_TMU0:
case TDFX_TMU1:
- grTexDownloadMipMapLevel( unit,
+ fxMesa->Glide.grTexDownloadMipMapLevel( unit,
t->range[unit]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -694,7 +695,7 @@ void tdfxTMReloadMipMapLevelLocked( GLcontext *ctx,
break;
case TDFX_TMU_SPLIT:
- grTexDownloadMipMapLevel( GR_TMU0,
+ fxMesa->Glide.grTexDownloadMipMapLevel( GR_TMU0,
t->range[GR_TMU0]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -703,7 +704,7 @@ void tdfxTMReloadMipMapLevelLocked( GLcontext *ctx,
GR_MIPMAPLEVELMASK_ODD,
t->image[level].data );
- grTexDownloadMipMapLevel( GR_TMU1,
+ fxMesa->Glide.grTexDownloadMipMapLevel( GR_TMU1,
t->range[GR_TMU1]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -714,7 +715,7 @@ void tdfxTMReloadMipMapLevelLocked( GLcontext *ctx,
break;
case TDFX_TMU_BOTH:
- grTexDownloadMipMapLevel( GR_TMU0,
+ fxMesa->Glide.grTexDownloadMipMapLevel( GR_TMU0,
t->range[GR_TMU0]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -723,7 +724,7 @@ void tdfxTMReloadMipMapLevelLocked( GLcontext *ctx,
GR_MIPMAPLEVELMASK_BOTH,
t->image[level].data );
- grTexDownloadMipMapLevel( GR_TMU1,
+ fxMesa->Glide.grTexDownloadMipMapLevel( GR_TMU1,
t->range[GR_TMU1]->startAddr,
glideLod,
t->info.largeLodLog2,
@@ -769,27 +770,27 @@ void tdfxTMMoveInTMLocked( tdfxContextPtr fxMesa,
switch ( targetTMU ) {
case TDFX_TMU0:
case TDFX_TMU1:
- size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info );
+ size = fxMesa->Glide.grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info );
t->range[targetTMU] = tdfxTMAllocTexMem(fxMesa, targetTMU, size);
break;
case TDFX_TMU_SPLIT:
- size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_ODD, &t->info );
+ size = fxMesa->Glide.grTexTextureMemRequired( GR_MIPMAPLEVELMASK_ODD, &t->info );
t->range[TDFX_TMU0] = tdfxTMAllocTexMem( fxMesa, TDFX_TMU0, size );
if ( t->range[TDFX_TMU0] )
fxMesa->stats.memTexUpload += size;
- size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_EVEN, &t->info );
+ size = fxMesa->Glide.grTexTextureMemRequired( GR_MIPMAPLEVELMASK_EVEN, &t->info );
t->range[TDFX_TMU1] = tdfxTMAllocTexMem( fxMesa, TDFX_TMU1, size );
break;
case TDFX_TMU_BOTH:
- size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info );
+ size = fxMesa->Glide.grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info );
t->range[TDFX_TMU0] = tdfxTMAllocTexMem( fxMesa, TDFX_TMU0, size );
if ( t->range[TDFX_TMU0] )
fxMesa->stats.memTexUpload += size;
- size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info );
+ size = fxMesa->Glide.grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info );
t->range[TDFX_TMU1] = tdfxTMAllocTexMem( fxMesa, TDFX_TMU1, size );
break;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c
index b5dbaea64..e75866529 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c
@@ -149,8 +149,8 @@ static void tdfx_render_vb_points( struct vertex_buffer *VB,
fxVB[i].v.x += PNT_X_OFFSET - TRI_X_OFFSET;
fxVB[i].v.y += PNT_Y_OFFSET - TRI_Y_OFFSET;
}
- grDrawVertexArrayContiguous( GR_POINTS, count-start, fxVB+start,
- sizeof(*fxVB));
+ fxMesa->Glide.grDrawVertexArrayContiguous( GR_POINTS, count-start,
+ fxVB+start, sizeof(*fxVB));
/* restore point coords */
for (i = start; i < count; i++) {
fxVB[i].v.x -= PNT_X_OFFSET - TRI_X_OFFSET;
@@ -163,6 +163,7 @@ static void tdfx_render_vb_line_strip( struct vertex_buffer *VB,
GLuint count,
GLuint parity )
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx);
tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts;
GLint i;
(void) parity;
@@ -171,8 +172,8 @@ static void tdfx_render_vb_line_strip( struct vertex_buffer *VB,
fxVB[i].v.x += LINE_X_OFFSET - TRI_X_OFFSET;
fxVB[i].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
}
- grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start, fxVB+start,
- sizeof(*fxVB));
+ fxMesa->Glide.grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start,
+ fxVB+start, sizeof(*fxVB));
/* restore line coords */
for (i = start; i < count; i++) {
fxVB[i].v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
@@ -185,6 +186,7 @@ static void tdfx_render_vb_lines( struct vertex_buffer *VB,
GLuint count,
GLuint parity )
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx);
tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts;
GLint i;
(void) parity;
@@ -193,8 +195,8 @@ static void tdfx_render_vb_lines( struct vertex_buffer *VB,
fxVB[i].v.x += LINE_X_OFFSET - TRI_X_OFFSET;
fxVB[i].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
}
- grDrawVertexArrayContiguous( GR_LINES, count-start, fxVB+start,
- sizeof(*fxVB));
+ fxMesa->Glide.grDrawVertexArrayContiguous( GR_LINES, count-start,
+ fxVB+start, sizeof(*fxVB));
/* restore line coords */
for (i = start; i < count; i++) {
fxVB[i].v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
@@ -207,9 +209,10 @@ static void tdfx_render_vb_triangles( struct vertex_buffer *VB,
GLuint count,
GLuint parity )
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx);
tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts;
- grDrawVertexArrayContiguous( GR_TRIANGLES, count-start, fxVB+start,
- sizeof(*fxVB));
+ fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLES, count-start,
+ fxVB+start, sizeof(*fxVB));
(void) parity;
}
@@ -219,9 +222,10 @@ static void tdfx_render_vb_tri_strip( struct vertex_buffer *VB,
GLuint count,
GLuint parity )
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx);
tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts;
- grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP, count-start, fxVB+start,
- sizeof(*fxVB));
+ fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP, count-start,
+ fxVB+start, sizeof(*fxVB));
(void) parity;
}
@@ -231,9 +235,10 @@ static void tdfx_render_vb_tri_fan( struct vertex_buffer *VB,
GLuint count,
GLuint parity )
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx);
tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts;
- grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start, fxVB+start,
- sizeof(*fxVB) );
+ fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start,
+ fxVB+start, sizeof(*fxVB) );
(void) parity;
}
@@ -243,9 +248,10 @@ static void tdfx_render_vb_poly( struct vertex_buffer *VB,
GLuint count,
GLuint parity )
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx);
tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts;
- grDrawVertexArrayContiguous( GR_POLYGON, count-start, fxVB+start,
- sizeof(*fxVB));
+ fxMesa->Glide.grDrawVertexArrayContiguous( GR_POLYGON, count-start,
+ fxVB+start, sizeof(*fxVB));
(void) parity;
}
@@ -256,7 +262,7 @@ do { \
for (i = start ; i < count ; i++) { \
v[elt[i]].v.x += PNT_X_OFFSET - TRI_X_OFFSET; \
v[elt[i]].v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; \
- grDrawPoint(&v[elt[i]]); \
+ fxMesa->Glide.grDrawPoint(&v[elt[i]]); \
v[elt[i]].v.x -= PNT_X_OFFSET - TRI_X_OFFSET; \
v[elt[i]].v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET; \
} \
@@ -268,7 +274,7 @@ do { \
v[elt[i0]].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \
v[elt[i1]].v.x += LINE_X_OFFSET - TRI_X_OFFSET; \
v[elt[i1]].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \
- grDrawLine( &v[elt[i0]], &v[elt[i1]] ); \
+ fxMesa->Glide.grDrawLine( &v[elt[i0]], &v[elt[i1]] );\
v[elt[i0]].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \
v[elt[i0]].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \
v[elt[i1]].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \
@@ -277,19 +283,20 @@ do { \
#define RENDER_TRI( i2, i1, i, pv, parity ) \
do { \
- if (parity) grDrawTriangle( &v[elt[i1]], &v[elt[i2]], &v[elt[i]] ); \
- else grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \
+ if (parity) fxMesa->Glide.grDrawTriangle( &v[elt[i1]], &v[elt[i2]], &v[elt[i]] ); \
+ else fxMesa->Glide.grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \
} while (0)
#define RENDER_QUAD( i3, i2, i1, i, pv ) \
do { \
- grDrawTriangle( &v[elt[i3]], &v[elt[i2]], &v[elt[i]] ); \
- grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \
+ fxMesa->Glide.grDrawTriangle( &v[elt[i3]], &v[elt[i2]], &v[elt[i]] ); \
+ fxMesa->Glide.grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \
} while (0)
#define LOCAL_VARS \
GLcontext *ctx = VB->ctx; \
+ tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); \
const GLuint *elt = VB->EltPtr->data; \
tdfxVertexPtr v = TDFX_DRIVER_DATA(VB)->verts; \
(void) v; (void) ctx;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h
index 442acf877..da7f9fc81 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h
@@ -61,7 +61,7 @@ static __inline void tdfx_draw_triangle( tdfxContextPtr fxMesa,
tdfxVertex *v1,
tdfxVertex *v2 )
{
- grDrawTriangle( v0, v1, v2 );
+ fxMesa->Glide.grDrawTriangle( v0, v1, v2 );
}
@@ -75,7 +75,7 @@ static __inline void tdfx_draw_point( tdfxContextPtr fxMesa,
GLfloat x = tmp->v.x, y = tmp->v.y;
tmp->v.x += PNT_X_OFFSET - TRI_X_OFFSET;
tmp->v.y += PNT_Y_OFFSET - TRI_Y_OFFSET;
- grDrawPoint( tmp );
+ fxMesa->Glide.grDrawPoint( tmp );
tmp->v.x = x;
tmp->v.y = y;
}
@@ -103,8 +103,8 @@ static __inline void tdfx_draw_point( tdfxContextPtr fxMesa,
verts[3].v.x = xLeft;
verts[3].v.y = yTop;
- grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts,
- sizeof(tdfxVertex) );
+ fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts,
+ sizeof(tdfxVertex) );
}
}
@@ -124,7 +124,7 @@ static __inline void tdfx_draw_line( tdfxContextPtr fxMesa,
tmp0->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
tmp1->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
tmp1->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
- grDrawLine(tmp0, tmp1);
+ fxMesa->Glide.grDrawLine(tmp0, tmp1);
tmp0->v.x = x0;
tmp0->v.y = y0;
tmp1->v.x = x1;
@@ -163,8 +163,8 @@ static __inline void tdfx_draw_line( tdfxContextPtr fxMesa,
verts[3].v.x = tmp1->v.x - ix;
verts[3].v.y = tmp1->v.y - iy;
- grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts,
- sizeof(tdfxVertex) );
+ fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts,
+ sizeof(tdfxVertex) );
}
}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h
index 53b8c07b2..0fbf52ef6 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h
@@ -39,6 +39,7 @@ static __inline void TAG(triangle)( GLcontext *ctx,
GLuint e0, GLuint e1, GLuint e2,
GLuint pv )
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
struct vertex_buffer *VB = ctx->VB;
tdfxVertexPtr fxverts = TDFX_DRIVER_DATA(VB)->verts;
tdfxVertex *v[3];
@@ -52,10 +53,6 @@ static __inline void TAG(triangle)( GLcontext *ctx,
GLuint c[3];
#endif
-#if (IND & TDFX_CLIPRECT_BIT)
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-#endif
-
v[0] = &fxverts[e0];
v[1] = &fxverts[e1];
v[2] = &fxverts[e2];
@@ -126,10 +123,10 @@ static __inline void TAG(triangle)( GLcontext *ctx,
#if (IND & TDFX_CLIPRECT_BIT)
BEGIN_CLIP_LOOP_LOCKED( fxMesa );
- grDrawTriangle( v[0], v[1], v[2] );
+ fxMesa->Glide.grDrawTriangle( v[0], v[1], v[2] );
END_CLIP_LOOP_LOCKED( fxMesa );
#else
- grDrawTriangle( v[0], v[1], v[2] );
+ fxMesa->Glide.grDrawTriangle( v[0], v[1], v[2] );
#endif
#if (IND & TDFX_OFFSET_BIT)
@@ -152,6 +149,7 @@ static __inline void TAG(quad)( GLcontext *ctx, GLuint e0,
GLuint e1, GLuint e2, GLuint e3,
GLuint pv )
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
struct vertex_buffer *VB = ctx->VB;
tdfxVertexPtr fxverts = TDFX_DRIVER_DATA(VB)->verts;
tdfxVertex *v[4];
@@ -165,11 +163,6 @@ static __inline void TAG(quad)( GLcontext *ctx, GLuint e0,
GLuint c[4];
#endif
-#if (IND & TDFX_CLIPRECT_BIT)
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-#endif
-
-
v[0] = &fxverts[e0];
v[1] = &fxverts[e1];
v[2] = &fxverts[e2];
@@ -253,13 +246,13 @@ static __inline void TAG(quad)( GLcontext *ctx, GLuint e0,
#if (IND & TDFX_CLIPRECT_BIT)
BEGIN_CLIP_LOOP_LOCKED( fxMesa );
/* grDrawVertexArray( GR_TRIANGLE_FAN, 4, v ); */
- grDrawTriangle( v[0], v[1], v[3] );
- grDrawTriangle( v[1], v[2], v[3] );
+ fxMesa->Glide.grDrawTriangle( v[0], v[1], v[3] );
+ fxMesa->Glide.grDrawTriangle( v[1], v[2], v[3] );
END_CLIP_LOOP_LOCKED( fxMesa );
#else
/* grDrawVertexArray( GR_TRIANGLE_FAN, 4, v ); */
- grDrawTriangle( v[0], v[1], v[3] );
- grDrawTriangle( v[1], v[2], v[3] );
+ fxMesa->Glide.grDrawTriangle( v[0], v[1], v[3] );
+ fxMesa->Glide.grDrawTriangle( v[1], v[2], v[3] );
#endif
#if (IND & TDFX_OFFSET_BIT)
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c
index 52a7a1755..96d1e06c3 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c
@@ -42,7 +42,7 @@
FxI32
-FX_grGetInteger_NoLock(FxU32 pname)
+FX_grGetInteger_NoLock(tdfxContextPtr fxMesa, FxU32 pname)
{
switch (pname) {
case FX_FOG_TABLE_ENTRIES:
@@ -56,13 +56,13 @@ FX_grGetInteger_NoLock(FxU32 pname)
{
FxI32 result;
FxU32 grname = pname;
- grGet(grname, 4, &result);
+ fxMesa->Glide.grGet(grname, 4, &result);
return result;
}
case FX_ZDEPTH_MAX:
{
FxI32 zvals[2];
- grGet(GR_ZDEPTH_MIN_MAX, 8, zvals);
+ fxMesa->Glide.grGet(GR_ZDEPTH_MIN_MAX, 8, zvals);
return zvals[0];
}
default:
@@ -80,7 +80,7 @@ FX_grGetInteger(tdfxContextPtr fxMesa, FxU32 pname)
{
int result;
LOCK_HARDWARE(fxMesa);
- result = FX_grGetInteger_NoLock(pname);
+ result = FX_grGetInteger_NoLock(fxMesa, pname);
UNLOCK_HARDWARE(fxMesa);
return result;
}
@@ -91,7 +91,7 @@ FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname)
{
const char *s;
LOCK_HARDWARE(fxMesa);
- s = grGetString(pname);
+ s = fxMesa->Glide.grGetString(pname);
UNLOCK_HARDWARE(fxMesa);
return s;
}
@@ -108,13 +108,13 @@ FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g,
LOCK_HARDWARE(fxMesa);
if (ctx->Visual->RedBits == 8) {
/* 32bpp mode */
- ASSERT( grColorMaskExtProc );
- grColorMaskExtProc(r, g, b, a);
+ ASSERT( fxMesa->Glide.grColorMaskExt );
+ fxMesa->Glide.grColorMaskExt(r, g, b, a);
}
else {
/* 16 bpp mode */
/* we never have an alpha buffer */
- grColorMask(r || g || b, GL_FALSE);
+ fxMesa->Glide.grColorMask(r || g || b, GL_FALSE);
}
UNLOCK_HARDWARE(fxMesa);
}
@@ -124,15 +124,16 @@ void
FX_grColorMask_NoLock(GLcontext *ctx, GLboolean r, GLboolean g,
GLboolean b, GLboolean a)
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
if (ctx->Visual->RedBits == 8) {
/* 32bpp mode */
- ASSERT( grColorMaskExtProc );
- grColorMaskExtProc(r, g, b, a);
+ ASSERT( fxMesa->Glide.grColorMaskExt );
+ fxMesa->Glide.grColorMaskExt(r, g, b, a);
}
else {
/* 16 bpp mode */
/* we never have an alpha buffer */
- grColorMask(r || g || b, GL_FALSE);
+ fxMesa->Glide.grColorMask(r || g || b, GL_FALSE);
}
}
@@ -146,14 +147,14 @@ FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4])
LOCK_HARDWARE(fxMesa);
if (ctx->Visual->RedBits == 8) {
/* 32bpp mode */
- ASSERT( grColorMaskExtProc );
- grColorMaskExtProc(rgba[RCOMP], rgba[GCOMP],
+ ASSERT( fxMesa->Glide.grColorMaskExt );
+ fxMesa->Glide.grColorMaskExt(rgba[RCOMP], rgba[GCOMP],
rgba[BCOMP], rgba[ACOMP]);
}
else {
/* 16 bpp mode */
/* we never have an alpha buffer */
- grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE);
+ fxMesa->Glide.grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE);
}
UNLOCK_HARDWARE(fxMesa);
}
@@ -161,16 +162,17 @@ FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4])
void
FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4])
{
+ tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
if (ctx->Visual->RedBits == 8) {
/* 32bpp mode */
- ASSERT( grColorMaskExtProc );
- grColorMaskExtProc(rgba[RCOMP], rgba[GCOMP],
- rgba[BCOMP], rgba[ACOMP]);
+ ASSERT( fxMesa->Glide.grColorMaskExt );
+ fxMesa->Glide.grColorMaskExt(rgba[RCOMP], rgba[GCOMP],
+ rgba[BCOMP], rgba[ACOMP]);
}
else {
/* 16 bpp mode */
/* we never have an alpha buffer */
- grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE);
+ fxMesa->Glide.grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE);
}
}
@@ -184,7 +186,8 @@ FX_grLfbLock(tdfxContextPtr fxMesa, GrLock_t type, GrBuffer_t buffer,
FxBool result;
LOCK_HARDWARE(fxMesa);
- result = grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
+ result = fxMesa->Glide.grLfbLock(type, buffer, writeMode,
+ origin, pixelPipeline, info);
UNLOCK_HARDWARE(fxMesa);
return result;
}
@@ -195,7 +198,7 @@ FX_grTexTextureMemRequired(tdfxContextPtr fxMesa, FxU32 evenOdd, GrTexInfo * inf
FxU32 result;
LOCK_HARDWARE(fxMesa);
- result = grTexTextureMemRequired(evenOdd, info);
+ result = fxMesa->Glide.grTexTextureMemRequired(evenOdd, info);
UNLOCK_HARDWARE(fxMesa);
return result;
}
@@ -206,7 +209,7 @@ FX_grTexMinAddress(tdfxContextPtr fxMesa, GrChipID_t tmu)
FxU32 result;
LOCK_HARDWARE(fxMesa);
- result = grTexMinAddress(tmu);
+ result = fxMesa->Glide.grTexMinAddress(tmu);
UNLOCK_HARDWARE(fxMesa);
return result;
}
@@ -217,7 +220,7 @@ FX_grTexMaxAddress(tdfxContextPtr fxMesa, GrChipID_t tmu)
FxU32 result;
LOCK_HARDWARE(fxMesa);
- result = grTexMaxAddress(tmu);
+ result = fxMesa->Glide.grTexMaxAddress(tmu);
UNLOCK_HARDWARE(fxMesa);
return result;
}
@@ -228,7 +231,7 @@ FX_getFogTableSize(tdfxContextPtr fxMesa)
{
int result;
LOCK_HARDWARE(fxMesa);
- grGet(GR_FOG_TABLE_ENTRIES, sizeof(int), (void *) &result);
+ fxMesa->Glide.grGet(GR_FOG_TABLE_ENTRIES, sizeof(int), (void *) &result);
UNLOCK_HARDWARE(fxMesa);
return result;
}
@@ -238,7 +241,7 @@ FX_getGrStateSize(tdfxContextPtr fxMesa)
{
int result;
LOCK_HARDWARE(fxMesa);
- grGet(GR_GLIDE_STATE_SIZE, sizeof(int), (void *) &result);
+ fxMesa->Glide.grGet(GR_GLIDE_STATE_SIZE, sizeof(int), (void *) &result);
UNLOCK_HARDWARE(fxMesa);
return result;
}
@@ -248,7 +251,7 @@ FX_grAADrawLine(tdfxContextPtr fxMesa, GrVertex * a, GrVertex * b)
{
/* ToDo */
BEGIN_CLIP_LOOP(fxMesa);
- grDrawLine(a, b);
+ fxMesa->Glide.grDrawLine(a, b);
END_CLIP_LOOP(fxMesa);
}
@@ -256,7 +259,7 @@ void
FX_grAADrawPoint(tdfxContextPtr fxMesa, GrVertex * a)
{
BEGIN_CLIP_LOOP(fxMesa);
- grDrawPoint(a);
+ fxMesa->Glide.grDrawPoint(a);
END_CLIP_LOOP(fxMesa);
}
@@ -264,7 +267,7 @@ void
FX_grDrawPolygonVertexList(tdfxContextPtr fxMesa, int n, GrVertex * verts)
{
BEGIN_CLIP_LOOP(fxMesa);
- grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex));
+ fxMesa->Glide.grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex));
END_CLIP_LOOP(fxMesa);
}
@@ -273,17 +276,17 @@ void
FX_setupGrVertexLayout(tdfxContextPtr fxMesa)
{
LOCK_HARDWARE(fxMesa);
- grReset(GR_VERTEX_PARAMETER);
-
- grCoordinateSpace(GR_WINDOW_COORDS);
- grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ fxMesa->Glide.grReset(GR_VERTEX_PARAMETER);
+
+ fxMesa->Glide.grCoordinateSpace(GR_WINDOW_COORDS);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
UNLOCK_HARDWARE(fxMesa);
}
#else /* TDFX_USE_PARGB */
@@ -291,48 +294,54 @@ void
FX_setupGrVertexLayout(tdfxContextPtr fxMesa)
{
LOCK_HARDWARE(fxMesa);
- grReset(GR_VERTEX_PARAMETER);
-
- grCoordinateSpace(GR_WINDOW_COORDS);
- grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ fxMesa->Glide.grReset(GR_VERTEX_PARAMETER);
+
+ fxMesa->Glide.grCoordinateSpace(GR_WINDOW_COORDS);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
UNLOCK_HARDWARE(fxMesa);
}
#endif /* TDFX_USE_PARGB */
void
-FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask)
+FX_grHints_NoLock(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask)
{
switch (hintType) {
case GR_HINT_STWHINT:
{
if (hintMask & GR_STWHINT_W_DIFF_TMU0)
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
- GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q0,
+ GR_VERTEX_OOW_TMU0_OFFSET << 2,
+ GR_PARAM_ENABLE);
else
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
- GR_PARAM_DISABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q0,
+ GR_VERTEX_OOW_TMU0_OFFSET << 2,
+ GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
- GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_ST1,
+ GR_VERTEX_SOW_TMU1_OFFSET << 2,
+ GR_PARAM_ENABLE);
else
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_ST1,
+ GR_VERTEX_SOW_TMU1_OFFSET << 2,
+ GR_PARAM_DISABLE);
if (hintMask & GR_STWHINT_W_DIFF_TMU1)
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
- GR_PARAM_ENABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q1,
+ GR_VERTEX_OOW_TMU1_OFFSET << 2,
+ GR_PARAM_ENABLE);
else
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
+ fxMesa->Glide.grVertexLayout(GR_PARAM_Q1,
+ GR_VERTEX_OOW_TMU1_OFFSET << 2,
+ GR_PARAM_DISABLE);
}
}
@@ -342,7 +351,7 @@ void
FX_grHints(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask)
{
LOCK_HARDWARE(fxMesa);
- FX_grHints_NoLock(hintType, hintMask);
+ FX_grHints_NoLock(fxMesa, hintType, hintMask);
UNLOCK_HARDWARE(fxMesa);
}
@@ -358,10 +367,11 @@ FX_grSstWinOpen(tdfxContextPtr fxMesa,
{
FX_GrContext_t i;
LOCK_HARDWARE(fxMesa);
- i = grSstWinOpen(hWnd,
- screen_resolution,
- refresh_rate,
- color_format, origin_location, nColBuffers, nAuxBuffers);
+ i = fxMesa->Glide.grSstWinOpen(hWnd,
+ screen_resolution,
+ refresh_rate,
+ color_format, origin_location,
+ nColBuffers, nAuxBuffers);
/*
fprintf(stderr,
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h
index 0adb85b41..23a9b5bc7 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h
@@ -44,8 +44,8 @@
#ifndef __FX_GLIDE_WARPER__
#define __FX_GLIDE_WARPER__
-#include <glide.h>
-#include <g3ext.h>
+#include "glide.h"
+#include "g3ext.h"
typedef struct tdfx_context tdfxContextRec;
typedef struct tdfx_context *tdfxContextPtr;
@@ -207,7 +207,7 @@ GrVertex;
-extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
+extern FxI32 FX_grGetInteger_NoLock(tdfxContextPtr fxMesa, FxU32 pname);
extern FxI32 FX_grGetInteger(tdfxContextPtr fxMesa, FxU32 pname);
@@ -217,25 +217,25 @@ extern const char *FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname);
#define FX_grTexDownloadTable(fxMesa, type, data) \
do { \
LOCK_HARDWARE(fxMesa); \
- grTexDownloadTable(type,data); \
+ fxMesa->Glide.grTexDownloadTable(type,data); \
UNLOCK_HARDWARE(fxMesa); \
} while (0);
#define FX_grTexDownloadTable_NoLock(type, data) \
- grTexDownloadTable(type, data)
+ fxMesa->Glide.grTexDownloadTable(type, data)
#define FX_grFlush(fxMesa) \
do { \
LOCK_HARDWARE(fxMesa); \
- grFlush(); \
+ fxMesa->Glide.grFlush(); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grFinish(fxMesa) \
do { \
- LOCK_HARDWARE(fxMesa); \
- grFinish(); \
+ LOCK_HARDWARE(fxMesa); \
+ fxMes->Glide.grFinish(); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
@@ -243,7 +243,7 @@ extern const char *FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname);
#define FX_grLfbWriteRegion(fxMesa,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
do { \
LOCK_HARDWARE(fxMesa); \
- grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \
+ fxMesa->Glide.grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \
UNLOCK_HARDWARE(fxMesa); \
} while(0)
@@ -251,12 +251,12 @@ extern const char *FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname);
#define FX_grLfbReadRegion(fxMesa,src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \
do { \
LOCK_HARDWARE(fxMesa); \
- grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \
+ fxMesa->Glide.grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \
UNLOCK_HARDWARE(fxMesa); \
} while (0);
-#define FX_grDrawTriangle_NoLock(a,b,c) grDrawTriangle(a,b,c)
+#define FX_grDrawTriangle_NoLock(a,b,c) fxMesa->Glide.grDrawTriangle(a,b,c)
#define FX_grDrawTriangle(fxMesa, a,b,c) \
do { \
BEGIN_CLIP_LOOP(fxMesa); \
@@ -266,7 +266,7 @@ extern const char *FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname);
-extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
+extern void FX_grHints_NoLock(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask);
extern void FX_grHints(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask);
@@ -287,7 +287,7 @@ extern FX_GrContext_t FX_grSstWinOpen(tdfxContextPtr fxMesa,
int nColBuffers, int nAuxBuffers);
-#define FX_grDrawLine_NoLock(v1, v2) grDrawLine(v1, v2)
+#define FX_grDrawLine_NoLock(v1, v2) fxMesa->Glide.grDrawLine(v1, v2)
#define FX_grDrawLine(fxMesa, v1, v2) \
do { \
BEGIN_CLIP_LOOP(fxMesa); \
@@ -295,7 +295,7 @@ extern FX_GrContext_t FX_grSstWinOpen(tdfxContextPtr fxMesa,
END_CLIP_LOOP(fxMesa); \
} while (0)
-#define FX_grDrawPoint_NoLock(p) grDrawPoint(p)
+#define FX_grDrawPoint_NoLock(p) fxMesa->Glide.grDrawPoint(p)
#define FX_grDrawPoint(fxMesa, p) \
do { \
BEGIN_CLIP_LOOP(fxMesa); \
@@ -309,92 +309,92 @@ extern void FX_grDrawPolygonVertexList(tdfxContextPtr fxMesa,
#define FX_grDitherMode(fxMesa, m) \
do { \
LOCK_HARDWARE(fxMesa); \
- grDitherMode(m); \
+ fxMesa->Glide.grDitherMode(m); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grRenderBuffer(fxMesa, b) \
do { \
LOCK_HARDWARE(fxMesa); \
- grRenderBuffer(b); \
+ fxMesa->Glide.grRenderBuffer(b); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grRenderBuffer_NoLock(b) grRenderBuffer(b)
+#define FX_grRenderBuffer_NoLock(b) fxMesa->Glide.grRenderBuffer(b)
#define FX_grBufferClear(fxMesa, c, a, d) \
do { \
BEGIN_CLIP_LOOP(fxMesa); \
- grBufferClear(c, a, d); \
+ fxMesa->Glide.grBufferClear(c, a, d); \
END_CLIP_LOOP(fxMesa); \
} while (0)
-#define FX_grBufferClear_NoLock(c, a, d) grBufferClear(c, a, d)
+#define FX_grBufferClear_NoLock(c, a, d) fxMesa->Glide.grBufferClear(c, a, d)
-#define FX_grBufferClearExt_NoLock(c, a, d, s) grBufferClearExtProc(c, a, d, s)
+#define FX_grBufferClearExt_NoLock(c, a, d, s) fxMesa->Glide.grBufferClearExt(c, a, d, s)
#define FX_grBufferClearExt(fxMesa, c, a, d, s) \
do { \
BEGIN_CLIP_LOOP(fxMesa); \
- grBufferClearExtProc(c, a, d, s); \
+ fxMesa->Glide.grBufferClearExt(c, a, d, s); \
END_CLIP_LOOP(fxMesa); \
} while (0)
#define FX_grEnable(fxMesa, m) \
do { \
LOCK_HARDWARE(fxMesa); \
- grEnable(m); \
+ fxMesa->Glide.grEnable(m); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grEnable_NoLock(m) grEnable(m)
+#define FX_grEnable_NoLock(m) fxMesa->Glide.grEnable(m)
#define FX_grDisable(fxMesa, m) \
do { \
LOCK_HARDWARE(fxMesa); \
- grDisable(m); \
+ fxMesa->Glide.grDisable(m); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grDisable_NoLock(m) grDisable(m)
+#define FX_grDisable_NoLock(m) fxMesa->Glide.grDisable(m)
#define FX_grStencilFunc(fxMesa, fnc, ref, mask) \
do { \
LOCK_HARDWARE(fxMesa); \
- grStencilFuncProc((fnc), (ref), (mask)); \
+ fxMesa->Glide.grStencilFunc((fnc), (ref), (mask)); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grStencilFunc_NoLock(f, r, m) grStencilFuncProc(f, r, m)
+#define FX_grStencilFunc_NoLock(f, r, m) fxMesa->grStencilFunc(f, r, m)
#define FX_grStencilMask(fxMesa, write_mask) \
do { \
LOCK_HARDWARE(fxMesa); \
- grStencilMaskProc(write_mask); \
+ fxMesa->Glide.grStencilMask(write_mask); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grStencilMask_NoLock(m) grStencilMaskProc(m)
+#define FX_grStencilMask_NoLock(m) fxMesa->Glide.grStencilMask(m)
#define FX_grStencilOp(fxMesa, stencil_fail, depth_fail, depth_pass) \
do { \
LOCK_HARDWARE(fxMesa); \
- grStencilOpProc((stencil_fail), (depth_fail), (depth_pass)); \
+ fxMesa->Glide.grStencilOp((stencil_fail), (depth_fail), (depth_pass));\
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grStencilOp_NoLock(sf, df, dp) grStencilOpProc(sf, df, dp)
+#define FX_grStencilOp_NoLock(sf, df, dp) fxMesa->Glide.grStencilOp(sf, df, dp)
#define FX_grDepthMask(fxMesa, m) \
do { \
LOCK_HARDWARE(fxMesa); \
- grDepthMask(m); \
+ fxMesa->Glide.grDepthMask(m); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grDepthMask_NoLock(m) grDepthMask(m)
+#define FX_grDepthMask_NoLock(m) fxMesa->Glide.grDepthMask(m)
extern void FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g,
@@ -417,156 +417,156 @@ extern FxBool FX_grLfbLock(tdfxContextPtr fxMesa,
#define FX_grLfbUnlock(fxMesa, t, b) \
do { \
LOCK_HARDWARE(fxMesa); \
- grLfbUnlock(t, b); \
+ fxMesa->Glide.grLfbUnlock(t, b); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grConstantColorValue(fxMesa, v) \
do { \
LOCK_HARDWARE(fxMesa); \
- grConstantColorValue(v); \
+ fxMesa->Glide.grConstantColorValue(v); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grConstantColorValue_NoLock grConstantColorValue
+#define FX_grConstantColorValue_NoLock fxMesa->Glide.grConstantColorValue
#define FX_grAADrawTriangle(fxMesa, a, b, c, ab, bc, ca) \
do { \
BEGIN_CLIP_LOOP(fxMesa); \
- grAADrawTriangle(a, b, c, ab, bc, ca); \
+ fxMesa->Glide.grAADrawTriangle(a, b, c, ab, bc, ca); \
END_CLIP_LOOP(fxMesa); \
} while (0)
#define FX_grAlphaBlendFunction(rs, rd, as, ad) \
do { \
LOCK_HARDWARE(fxMesa); \
- grAlphaBlendFunction(rs, rd, as, ad); \
+ fxMesa->Glide.grAlphaBlendFunction(rs, rd, as, ad); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grAlphaCombine(func, fact, loc, oth, inv) \
do { \
LOCK_HARDWARE(fxMesa); \
- grAlphaCombine(func, fact, loc, oth, inv); \
+ fxMesa->Glide.grAlphaCombine(func, fact, loc, oth, inv); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grAlphaCombine_NoLock grAlphaCombine
+#define FX_grAlphaCombine_NoLock fxMesa->Glide.grAlphaCombine
#define FX_grAlphaTestFunction(fxMesa, f) \
do { \
LOCK_HARDWARE(fxMesa); \
- grAlphaTestFunction(f); \
+ fxMesa->Glide.grAlphaTestFunction(f); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grAlphaTestReferenceValue(fxMesa, v) \
do { \
LOCK_HARDWARE(fxMesa); \
- grAlphaTestReferenceValue(v); \
+ fxMesa->Glide.grAlphaTestReferenceValue(v); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grClipWindow(fxMesa, minx, miny, maxx, maxy) \
do { \
LOCK_HARDWARE(fxMesa); \
- grClipWindow(minx, miny, maxx, maxy); \
+ fxMesa->Glide.grClipWindow(minx, miny, maxx, maxy); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grClipWindow_NoLock grClipWindow
+#define FX_grClipWindow_NoLock fxMesa->Glide.grClipWindow
#define FX_grColorCombine(fxMesa, func, fact, loc, oth, inv) \
do { \
LOCK_HARDWARE(fxMesa); \
- grColorCombine(func, fact, loc, oth, inv); \
+ fxMesa->Glide.grColorCombine(func, fact, loc, oth, inv); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grColorCombine_NoLock grColorCombine
+#define FX_grColorCombine_NoLock fxMesa->Glide.grColorCombine
#define FX_grCullMode(fxMesa, m) \
do { \
LOCK_HARDWARE(fxMesa); \
- grCullMode(m); \
+ fxMesa->Glide.grCullMode(m); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grDepthBiasLevel(fxMesa, lev) \
do { \
LOCK_HARDWARE(fxMesa); \
- grDepthBiasLevel(lev); \
+ fxMesa->Glide.grDepthBiasLevel(lev); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grDepthBufferFunction(fxMesa, func) \
do { \
LOCK_HARDWARE(fxMesa); \
- grDepthBufferFunction(func); \
+ fxMesa->Glide.grDepthBufferFunction(func); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grFogColorValue(fxMesa, c) \
do { \
LOCK_HARDWARE(fxMesa); \
- grFogColorValue(c); \
+ fxMesa->Glide.grFogColorValue(c); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grFogMode(fxMesa, m) \
do { \
LOCK_HARDWARE(fxMesa); \
- grFogMode(m); \
+ fxMesa->Glide.grFogMode(m); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grFogTable(fxMesa, t)\
do { \
LOCK_HARDWARE(fxMesa); \
- grFogTable(t); \
+ fxMesa->Glide.grFogTable(t);\
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grTexClampMode(fxMesa, t, sc, tc) \
do { \
LOCK_HARDWARE(fxMesa); \
- grTexClampMode(t, sc, tc); \
+ fxMesa->Glide.grTexClampMode(t, sc, tc); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grTexClampMode_NoLock grTexClampMode
+#define FX_grTexClampMode_NoLock fxMesa->Glide.grTexClampMode
-#define FX_grTexCombine(fxMesa, t, rfunc, rfact, afunc, afact, rinv, ainv) \
+#define FX_grTexCombine(fxMesa, t, rfunc, rfact, afunc, afact, rinv, ainv)\
do { \
LOCK_HARDWARE(fxMesa); \
- grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \
+ fxMesa->Glide.grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv);\
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grTexCombine_NoLock grTexCombine
+#define FX_grTexCombine_NoLock fxMesa->Glide.grTexCombine
-#define FX_grTexDownloadMipMapLevel(fxMesa, t, sa, tlod, llod, ar, f, eo, d) \
+#define FX_grTexDownloadMipMapLevel(fxMesa, t, sa, tlod, llod, ar, f, eo, d)\
do { \
LOCK_HARDWARE(fxMesa); \
- grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \
+ fxMesa->Glide.grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d);\
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grTexDownloadMipMapLevelPartial(fxMesa, t, sa, tlod, llod, ar, f, eo, d, s, e); \
do { \
LOCK_HARDWARE(fxMesa); \
- grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
+ fxMesa->Glide.grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grTexFilterMode(fxMesa, t, minf, magf) \
do { \
LOCK_HARDWARE(fxMesa); \
- grTexFilterMode(t, minf, magf); \
+ fxMesa->Glide.grTexFilterMode(t, minf, magf); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grTexFilterMode_NoLock grTexFilterMode
+#define FX_grTexFilterMode_NoLock fxMesa->Glide.grTexFilterMode
extern FxU32 FX_grTexMinAddress(tdfxContextPtr fxMesa, GrChipID_t tmu);
extern FxU32 FX_grTexMaxAddress(tdfxContextPtr fxMesa, GrChipID_t tmu);
@@ -574,97 +574,97 @@ extern FxU32 FX_grTexMaxAddress(tdfxContextPtr fxMesa, GrChipID_t tmu);
#define FX_grTexMipMapMode(t, m, lod) \
do { \
LOCK_HARDWARE(fxMesa); \
- grTexMipMapMode(t, m, lod); \
+ fxMesa->Glide.grTexMipMapMode(t, m, lod);\
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grTexMipMapMode_NoLock grTexMipMapMode
+#define FX_grTexMipMapMode_NoLock fxMesa->Glide.grTexMipMapMode
#define FX_grTexSource(t, sa, eo, i) \
do { \
LOCK_HARDWARE(fxMesa); \
- grTexSource(t, sa, eo, i); \
+ fxMesa->Glide.grTexSource(t, sa, eo, i);\
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grTexSource_NoLock grTexSource
+#define FX_grTexSource_NoLock fxMesa->Glide.grTexSource
extern FxU32 FX_grTexTextureMemRequired(tdfxContextPtr fxMesa,
FxU32 evenOdd, GrTexInfo * info);
-#define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired
+#define FX_grTexTextureMemRequired_NoLock fxMesa->Glide.grTexTextureMemRequired
#define FX_grGlideGetState(fxMesa, s) \
do { \
LOCK_HARDWARE(fxMesa); \
- grGlideGetState(s); \
+ fxMesa->Glide.grGlideGetState(s); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grGlideGetState_NoLock(s) grGlideGetState(s);
+#define FX_grGlideGetState_NoLock(s) fxMesa->Glide.grGlideGetState(s);
#define FX_grDRIBufferSwap(fxMesa, i) \
do { \
LOCK_HARDWARE(fxMesa); \
- grDRIBufferSwap(i); \
+ fxMesa->Glide.grDRIBufferSwap(i); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grSstSelect(fxMesa, b) \
do { \
LOCK_HARDWARE(fxMesa); \
- grSstSelect(b); \
+ fxMesa->Glide.grSstSelect(b); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grSstSelect_NoLock grSstSelect
+#define FX_grSstSelect_NoLock fxMesa->Glide.grSstSelect
#define FX_grGlideSetState(fxMesa, s) \
do { \
LOCK_HARDWARE(fxMesa); \
- grGlideSetState(s); \
+ fxMesa->Glide.grGlideSetState(s); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grGlideSetState_NoLock(s) grGlideSetState(s);
+#define FX_grGlideSetState_NoLock(s) fxMesa->Glide.grGlideSetState(s);
#define FX_grDepthBufferMode(fxMesa, m) \
do { \
LOCK_HARDWARE(fxMesa); \
- grDepthBufferMode(m); \
+ fxMesa->Glide.grDepthBufferMode(m); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grLfbWriteColorFormat(fxMesa, f) \
do { \
LOCK_HARDWARE(fxMesa); \
- grLfbWriteColorFormat(f); \
+ fxMesa->Glide.grLfbWriteColorFormat(f); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
#define FX_grDrawVertexArray(fxMesa, m, c, p) \
do { \
BEGIN_CLIP_LOOP(fxMesa); \
- grDrawVertexArray(m, c, p); \
+ fxMesa->Glide.grDrawVertexArray(m, c, p); \
END_CLIP_LOOP(fxMesa); \
} while (0)
#define FX_grGlideShutdown(fxMesa) \
do { \
LOCK_HARDWARE(fxMesa); \
- grGlideShutdown(); \
+ fxMesa->Glide.grGlideShutdown(); \
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grTexLodBiasValue_NoLock(t, v) grTexLodBiasValue(t, v)
+#define FX_grTexLodBiasValue_NoLock(t, v) fxMesa->Glide.grTexLodBiasValue(t, v)
#define FX_grTexLodBiasValue(t, v) \
do { \
LOCK_HARDWARE(fxMesa); \
- grTexLodBiasValue(t, v); \
+ fxMesa->Glide.grTexLodBiasValue(t, v);\
UNLOCK_HARDWARE(fxMesa); \
} while (0)
-#define FX_grGlideInit_NoLock grGlideInit
-#define FX_grSstWinOpen_NoLock grSstWinOpen
+#define FX_grGlideInit_NoLock fxMesa->Glide.grGlideInit
+#define FX_grSstWinOpen_NoLock fxMesa->Glide.grSstWinOpen
extern int FX_getFogTableSize(tdfxContextPtr fxMesa);
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c
index 5b97c54bc..c32e4dc04 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c
@@ -237,8 +237,8 @@ XMesaSwapBuffers( __DRIdrawablePrivate *driDrawPriv )
if (!fxMesa)
return;
LOCK_HARDWARE( fxMesa );
- grSstSelect( fxMesa->Glide.Board );
- grGlideSetState( (GrState *) fxMesa->Glide.State );
+ fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
+ fxMesa->Glide.grGlideSetState( (GrState *) fxMesa->Glide.State );
}
}
@@ -247,7 +247,7 @@ XMesaSwapBuffers( __DRIdrawablePrivate *driDrawPriv )
int stalls;
static int prevStalls = 0;
- stalls = grFifoGetStalls();
+ stalls = fxMesa->Glide.grFifoGetStalls();
fprintf( stderr, "%s:\n", __FUNCTION__ );
if ( stalls != prevStalls ) {
@@ -265,18 +265,19 @@ XMesaSwapBuffers( __DRIdrawablePrivate *driDrawPriv )
if (fxMesa->scissoredClipRects) {
/* restore clip rects without scissor box */
- grDRIPosition( driDrawPriv->x, driDrawPriv->y,
- driDrawPriv->w, driDrawPriv->h,
- driDrawPriv->numClipRects, driDrawPriv->pClipRects );
+ fxMesa->Glide.grDRIPosition( driDrawPriv->x, driDrawPriv->y,
+ driDrawPriv->w, driDrawPriv->h,
+ driDrawPriv->numClipRects,
+ driDrawPriv->pClipRects );
}
- grDRIBufferSwap( fxMesa->Glide.SwapInterval );
+ fxMesa->Glide.grDRIBufferSwap( fxMesa->Glide.SwapInterval );
if (fxMesa->scissoredClipRects) {
/* restore clip rects WITH scissor box */
- grDRIPosition( driDrawPriv->x, driDrawPriv->y,
- driDrawPriv->w, driDrawPriv->h,
- fxMesa->numClipRects, fxMesa->pClipRects );
+ fxMesa->Glide.grDRIPosition( driDrawPriv->x, driDrawPriv->y,
+ driDrawPriv->w, driDrawPriv->h,
+ fxMesa->numClipRects, fxMesa->pClipRects );
}
@@ -294,8 +295,8 @@ XMesaSwapBuffers( __DRIdrawablePrivate *driDrawPriv )
if (ctx) {
if (ctx->DriverCtx != fxMesa) {
fxMesa = TDFX_CONTEXT(ctx);
- grSstSelect( fxMesa->Glide.Board );
- grGlideSetState( (GrState *) fxMesa->Glide.State );
+ fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
+ fxMesa->Glide.grGlideSetState( (GrState *) fxMesa->Glide.State );
}
UNLOCK_HARDWARE( fxMesa );
}
@@ -352,8 +353,8 @@ XMesaMakeCurrent( __DRIcontextPrivate *driContextPriv,
} else {
LOCK_HARDWARE( fxMesa );
- grSstSelect( fxMesa->Glide.Board );
- grGlideSetState( fxMesa->Glide.State );
+ fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
+ fxMesa->Glide.grGlideSetState( fxMesa->Glide.State );
tdfxUpdateClipping(ctx);
tdfxUploadClipping(fxMesa);
diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c
index e9363773d..12d7a8df1 100644
--- a/xc/programs/Xserver/GL/dri/dri.c
+++ b/xc/programs/Xserver/GL/dri/dri.c
@@ -112,11 +112,12 @@ DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
Bool
DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
{
- DRIScreenPrivPtr pDRIPriv;
+ DRIScreenPrivPtr pDRIPriv;
drmContextPtr reserved;
int reserved_count;
- int i, fd, drmWasAvailable;
+ int i, fd, drmWasAvailable;
Bool xineramaInCore = FALSE;
+ int err = 0;
if (DRIGeneration != serverGeneration) {
if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
@@ -148,7 +149,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
drmWasAvailable = drmAvailable();
/* Note that drmOpen will try to load the kernel module, if needed. */
- fd = drmOpen(pDRIInfo->drmDriverName, NULL /*pDRIInfo->busIdString*/);
+ fd = drmOpen(pDRIInfo->drmDriverName, NULL );
if (fd < 0) {
/* failed to open DRM */
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
@@ -180,13 +181,13 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx;
pDRIPriv->createDummyCtxPriv = pDRIInfo->createDummyCtxPriv;
- if (drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString) < 0) {
+ if ((err = drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString)) < 0) {
pDRIPriv->directRenderingSupport = FALSE;
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
- "[drm] drmSetBusid failed (%d, %s)\n",
- pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString);
+ "[drm] drmSetBusid failed (%d, %s), %s\n",
+ pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString, strerror(-err));
return FALSE;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
index 25570ab3d..1eb6d6fae 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
@@ -109,7 +109,9 @@ typedef struct {
unsigned int vidpll;
unsigned int dacmode;
unsigned int vgainit0;
+ unsigned int vgainit1;
unsigned int miscinit0;
+ unsigned int miscinit1;
unsigned int screensize;
unsigned int stride;
unsigned int cursloc;
@@ -150,6 +152,7 @@ typedef struct _TDFXRec {
EntityInfoPtr pEnt;
int numChips;
PCITAG PciTag[MAXCHIPS];
+ Bool Primary;
int HasSGRAM;
int PciCnt;
int PrevDrawState;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
index 95568ab34..3480dc937 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
@@ -1,3 +1,5 @@
+#define USE_INT10 1
+#define USE_PCIVGAIO 1
/**************************************************************************
@@ -364,7 +366,7 @@ TDFXIdentify(int flags) {
static const OptionInfoRec *
TDFXAvailableOptions(int chipid, int busid)
{
- return TDFXOptions;
+ return (OptionInfoPtr)TDFXOptions;
}
static void
@@ -423,7 +425,7 @@ TDFXProbe(DriverPtr drv, int flags) {
/* Allocate new ScrnInfoRec and claim the slot */
pScrn = NULL;
if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
- TDFXPciChipsets, 0, 0, 0, 0, 0))) {
+ TDFXPciChipsets, NULL, NULL, NULL, NULL, NULL))) {
pScrn->driverVersion = TDFX_VERSION;
pScrn->driverName = TDFX_DRIVER_NAME;
@@ -584,6 +586,8 @@ TDFXFindChips(ScrnInfoPtr pScrn, pciVideoPtr match)
pTDFX->numChips++;
}
}
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "TDFXFindChips: found %d chip(s)\n", pTDFX->numChips);
/* Disable the secondary chips for now */
pTDFX->numChips=1;
}
@@ -600,24 +604,48 @@ TDFXInitChips(ScrnInfoPtr pScrn)
mem0base=pciReadLong(pTDFX->PciTag[0], CFG_MEM0BASE);
mem1base=pciReadLong(pTDFX->PciTag[0], CFG_MEM1BASE);
initbits=pciReadLong(pTDFX->PciTag[0], CFG_INIT_ENABLE);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "TDFXInitChips: numchips = %d\n", pTDFX->numChips);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "TDFXInitChips: cfgbits = 0x%08lx, initbits = 0x%08lx\n",
+ cfgbits, initbits);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "TDFXInitChips: mem0base = 0x%08lx, mem1base = 0x%08lx\n",
+ mem0base, mem1base);
mem0size=32*1024*1024; /* Registers are always 32MB */
mem1size=pScrn->videoRam*1024*2; /* Linear mapping is 2x memory */
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "TDFXInitChips: mem0size = 0x%08lx, mem1size = 0x%08lx\n",
+ mem0size, mem1size);
mem0bits=TDFXSizeToCfg(mem0size);
mem1bits=TDFXSizeToCfg(mem1size)<<4;
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "TDFXInitChips: mem0bits = 0x%08lx, mem1bits = 0x%08lx\n",
+ mem0bits, mem1bits);
cfgbits=(cfgbits&~(0xFF))|mem0bits|mem1bits;
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "TDFXInitChips: cfgbits = 0x%08lx\n", cfgbits);
for (i=0; i<pTDFX->numChips; i++) {
initbits|=BIT(10);
pciWriteLong(pTDFX->PciTag[i], CFG_INIT_ENABLE, initbits);
v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND);
+#if 0
if (!i)
pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x3);
else
pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x2);
+#endif
pTDFX->MMIOAddr[i]=mem0base+i*mem0size;
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "TDFXInitChips: MMIOAddr[%d] = 0x%08lx\n",
+ i, pTDFX->MMIOAddr[i]);
pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, pTDFX->MMIOAddr[i]);
pTDFX->MMIOAddr[i]&=0xFFFFFF00;
pTDFX->LinearAddr[i]=mem1base+i*mem1size;
pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, pTDFX->LinearAddr[i]);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "TDFXInitChips: LinearAddr[%d] = 0x%08lx\n",
+ i, pTDFX->LinearAddr[i]);
pTDFX->LinearAddr[i]&=0xFFFFFF00;
pciWriteLong(pTDFX->PciTag[i], CFG_PCI_DECODE, cfgbits);
initbits&=~BIT(10);
@@ -676,6 +704,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
/* Allocate a vgaHWRec */
if (!vgaHWGetHWRec(pScrn)) return FALSE;
+#if USE_INT10
#if !defined(__powerpc__)
if (xf86LoadSubModule(pScrn, "int10")) {
xf86Int10InfoPtr pInt;
@@ -697,9 +726,11 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
}
}
#endif
+#endif
match=pTDFX->PciInfo=xf86GetPciInfoForEntity(pTDFX->pEnt->index);
TDFXFindChips(pScrn, match);
+ pTDFX->Primary = xf86IsPrimaryPci(pTDFX->PciInfo);
if (xf86RegisterResources(pTDFX->pEnt->index, NULL, ResExclusive)) {
TDFXFreeRec(pScrn);
@@ -709,7 +740,12 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
* We don't need VGA resources during OPERATING state. However I'm
* not sure if they are disabled.
*/
- xf86SetOperatingState(RES_SHARED_VGA, pTDFX->pEnt->index, ResUnusedOpr);
+ xf86SetOperatingState(RES_SHARED_VGA, pTDFX->pEnt->index, ResDisableOpr);
+#if 0
+ pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
+ pScrn->racMemFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
+#endif
+#if 0
#if 1
/* Is VGA memory disabled during OPERATING state? */
@@ -718,6 +754,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
#else
pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
#endif
+#endif
#if 0
/*
@@ -1001,6 +1038,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
xf86LoaderReqSymLists(ramdacSymbols, NULL);
}
+#if USE_INT10
#if !defined(__powerpc__)
/* Load DDC if needed */
/* This gives us DDC1 - we should be able to get DDC2B using i2c */
@@ -1021,6 +1059,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon));
}
#endif
+#endif
if (xf86ReturnOptValBool(pTDFX->Options, OPTION_USE_PIO, FALSE)) {
pTDFX->usePIO=TRUE;
@@ -1108,42 +1147,34 @@ TDFXUnmapMem(ScrnInfoPtr pScrn)
return TRUE;
}
-#ifdef DEBUG
static void
PrintRegisters(ScrnInfoPtr pScrn, TDFXRegPtr regs)
{
#ifdef TRACE
int i;
TDFXPtr pTDFX;
+ vgaHWPtr pHW = VGAHWPTR(pScrn);
+ vgaRegPtr pVga = &VGAHWPTR(pScrn)->ModeReg;
+
pTDFX = TDFXPTR(pScrn);
-#if 0
+#if 1
ErrorF("VGA Registers\n");
-#ifdef VB_PCI_IO
- ErrorF("Using PCI I/O Registers\n");
-#endif
- ErrorF("MiscOutReg = %x versus %x\n", inb(VGA_REG(0x3cc)), regs->std.MiscOutReg);
- ErrorF("Noclock is %d\n", regs->std.NoClock);
+ ErrorF("MiscOutReg = %x versus %x\n", pHW->readMiscOut(pHW), pVga->MiscOutReg);
+ ErrorF("EnableReg = %x\n", pHW->readEnable(pHW));
for (i=0; i<25; i++) {
- outb(VGA_REG(0x3D4), i);
- ErrorF("CRTC[%d]=%d versus %d\n", i, inb(VGA_REG(0x3D5)), regs->std.CRTC[i]);
+ int x;
+ x = pHW->readCrtc(pHW, i);
+ ErrorF("CRTC[%d]=%d versus %d\n", i, x, pVga->CRTC[i]);
}
- if (!vgaIOBase)
- vgaIOBase = (inb(VGA_REG(0x3cc)) & 0x1) ? 0x3D0 : 0x3B0;
for (i=0; i<21; i++) {
- inb(VGA_REG(vgaIOBase+0xA));
- outb(VGA_REG(0x3C0), i);
- ErrorF("Attribute[%d]=%d versus %d\n", i, inb(VGA_REG(0x3C1)), regs->std.Attribute[i]);
+ ErrorF("Attribute[%d]=%d versus %d\n", i, pHW->readAttr(pHW, i), pVga->Attribute[i]);
}
- inb(VGA_REG(vgaIOBase+0xA));
- outb(VGA_REG(0x3C0), BIT(5));
for (i=0; i<9; i++) {
- outb(VGA_REG(0x3CE), i);
- ErrorF("Graphics[%d]=%d versus %d\n", i, inb(VGA_REG(0x3CF)), regs->std.Graphics[i]);
+ ErrorF("Graphics[%d]=%d versus %d\n", i, pHW->readGr(pHW, i), pVga->Graphics[i]);
}
for (i=0; i<5; i++) {
- outb(VGA_REG(0x3C4), i);
- ErrorF("Sequencer[%d]=%d versus %d\n", i, inb(VGA_REG(0x3C5)), regs->std.Sequencer[i]);
+ ErrorF("Sequencer[%d]=%d versus %d\n", i, pHW->readSeq(pHW, i), pVga->Sequencer[i]);
}
#endif
#if 1
@@ -1151,6 +1182,9 @@ PrintRegisters(ScrnInfoPtr pScrn, TDFXRegPtr regs)
ErrorF("VidCfg = %x versus %x\n", pTDFX->readLong(pTDFX, VIDPROCCFG), regs->vidcfg);
ErrorF("DACmode = %x versus %x\n", pTDFX->readLong(pTDFX, DACMODE), regs->dacmode);
ErrorF("Vgainit0 = %x versus %x\n", pTDFX->readLong(pTDFX, VGAINIT0), regs->vgainit0);
+ ErrorF("Vgainit1 = %x versus %x\n", pTDFX->readLong(pTDFX, VGAINIT1), regs->vgainit1);
+ ErrorF("Miscinit0 = %x versus %x\n", pTDFX->readLong(pTDFX, MISCINIT0), regs->miscinit0);
+ ErrorF("Miscinit1 = %x versus %x\n", pTDFX->readLong(pTDFX, MISCINIT1), regs->miscinit1);
ErrorF("DramInit0 = %x\n", pTDFX->readLong(pTDFX, DRAMINIT0));
ErrorF("DramInit1 = %x\n", pTDFX->readLong(pTDFX, DRAMINIT1));
ErrorF("VidPLL = %x versus %x\n", pTDFX->readLong(pTDFX, PLLCTRL0), regs->vidpll);
@@ -1164,7 +1198,6 @@ PrintRegisters(ScrnInfoPtr pScrn, TDFXRegPtr regs)
#endif
#endif
}
-#endif
/*
* TDFXSave --
@@ -1188,14 +1221,18 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts)
* This function will handle creating the data structure and filling
* in the generic VGA portion.
*/
- if (saveFonts)
+ if (saveFonts && pTDFX->Primary) {
+ /* Enable legacy VGA to access font memory. */
+ dummy = pTDFX->readLong(pTDFX, VGAINIT0);
+ pTDFX->writeLong(pTDFX, VGAINIT0, dummy & ~SST_VGA0_LEGACY_DECODE);
vgaHWSave(pScrn, vgaReg, VGA_SR_MODE|VGA_SR_FONTS);
- else
+ pTDFX->writeLong(pTDFX, VGAINIT0, dummy);
+ } else
vgaHWSave(pScrn, vgaReg, VGA_SR_MODE);
tdfxReg->ExtVga[0] = hwp->readCrtc(hwp, 0x1a);
tdfxReg->ExtVga[1] = hwp->readCrtc(hwp, 0x1b);
- tdfxReg->vgainit0=pTDFX->readLong(pTDFX, VGAINIT0);
+ tdfxReg->miscinit1=pTDFX->readLong(pTDFX, MISCINIT1);
tdfxReg->vidcfg=pTDFX->readLong(pTDFX, VIDPROCCFG);
tdfxReg->vidpll=pTDFX->readLong(pTDFX, PLLCTRL0);
tdfxReg->dacmode=pTDFX->readLong(pTDFX, DACMODE);
@@ -1217,6 +1254,7 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts)
} while (count++<100 && dummy!=i);
tdfxReg->dactable[i]=TDFXReadLongMMIO(pTDFX, DACDATA);
}
+ PrintRegisters(pScrn, tdfxReg);
}
static void
@@ -1228,6 +1266,17 @@ TDFXSave(ScrnInfoPtr pScrn)
TDFXTRACE("TDFXSave start\n");
hwp = VGAHWPTR(pScrn);
pTDFX = TDFXPTR(pScrn);
+ /* Make sure VGA functionality is enabled */
+ pTDFX->SavedReg.vgainit0=pTDFX->readLong(pTDFX, VGAINIT0);
+#if 0
+ pTDFX->SavedReg.vgainit1=pTDFX->readLong(pTDFX, VGAINIT1);
+#endif
+ pTDFX->writeLong(pTDFX, VGAINIT0, pTDFX->ModeReg.vgainit0);
+#if 0
+ pTDFX->writeLong(pTDFX, VGAINIT1, pTDFX->ModeReg.vgainit1);
+#endif
+ vgaHWEnable(hwp);
+
DoSave(pScrn, &hwp->SavedReg, &pTDFX->SavedReg, TRUE);
}
@@ -1246,9 +1295,13 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg,
vgaHWProtect(pScrn, TRUE);
- if (restoreFonts)
+ if (restoreFonts && pTDFX->Primary) {
+ /* Enable legacy VGA to access font memory. */
+ dummy = pTDFX->readLong(pTDFX, VGAINIT0);
+ pTDFX->writeLong(pTDFX, VGAINIT0, dummy & ~SST_VGA0_LEGACY_DECODE);
vgaHWRestore(pScrn, vgaReg, VGA_SR_FONTS|VGA_SR_MODE);
- else
+ pTDFX->writeLong(pTDFX, VGAINIT0, dummy);
+ } else
vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE);
hwp->writeCrtc(hwp, 0x1a, tdfxReg->ExtVga[0]);
@@ -1263,14 +1316,12 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg,
TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP0MAX, tdfxReg->clip0max);
TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP1MIN, tdfxReg->clip1min);
TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP1MAX, tdfxReg->clip1max);
- pTDFX->writeLong(pTDFX, VGAINIT0, tdfxReg->vgainit0);
#if X_BYTE_ORDER == X_BIG_ENDIAN
pTDFX->writeLong(pTDFX, MISCINIT0, tdfxReg->miscinit0);
#endif
pTDFX->writeLong(pTDFX, VIDPROCCFG, tdfxReg->vidcfg);
TDFXWriteLongMMIO(pTDFX, SST_2D_SRCBASEADDR, tdfxReg->srcbaseaddr);
TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, tdfxReg->dstbaseaddr);
- vgaHWProtect(pScrn, FALSE);
for (i=0; i<512; i++) {
count=0;
do {
@@ -1283,8 +1334,15 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg,
dummy=TDFXReadLongMMIO(pTDFX, DACDATA);
} while (count++<100 && dummy!=tdfxReg->dactable[i]);
}
+ pTDFX->writeLong(pTDFX, VGAINIT0, tdfxReg->vgainit0);
+#if 0
+ pTDFX->writeLong(pTDFX, VGAINIT1, tdfxReg->vgainit1);
+ pTDFX->writeLong(pTDFX, MISCINIT1, tdfxReg->miscinit1);
+#endif
+ vgaHWProtect(pScrn, FALSE);
pTDFX->sync(pScrn);
+ PrintRegisters(pScrn, tdfxReg);
}
static void
@@ -1413,6 +1471,101 @@ SetupGfxPLL(int freq) {
}
#endif
+#if 0
+static Bool
+TDFXInitWithBIOSData(ScrnInfoPtr pScrn)
+{
+ TDFXPtr pTDFX;
+ unsigned char *bios = NULL;
+ int offset1, offset2;
+ int i;
+ CARD32 uint[9];
+
+ pTDFX=TDFXPTR(pScrn);
+
+ if (pTDFX->initDone)
+ return TRUE;
+
+ if (pTDFX->Primary) {
+ uint[0] = pTDFX->readLong(pTDFX, PCIINIT0);
+ uint[1] = pTDFX->readLong(pTDFX, MISCINIT0);
+ uint[2] = pTDFX->readLong(pTDFX, MISCINIT1);
+ uint[3] = pTDFX->readLong(pTDFX, DRAMINIT0);
+ uint[4] = pTDFX->readLong(pTDFX, DRAMINIT1);
+ uint[5] = pTDFX->readLong(pTDFX, AGPINIT);
+ uint[6] = pTDFX->readLong(pTDFX, PLLCTRL1);
+ uint[7] = pTDFX->readLong(pTDFX, PLLCTRL2);
+ for (i = 0; i < 8; i++) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Primary UINT32[%d] is 0x%08lx\n", i, uint[i]);
+ }
+ return TRUE;
+ }
+
+#define T_B_SIZE (64 * 1024)
+ bios = xcalloc(T_B_SIZE, 1);
+ if (!bios)
+ return FALSE;
+
+ if (!xf86ReadPciBIOS(0, pTDFX->PciTag[0], 1, bios, T_B_SIZE)) {
+#if 0
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Bad BIOS read.\n");
+ xfree(bios);
+ return FALSE;
+#endif
+ }
+
+ if (bios[0] != 0x55 || bios[1] != 0xAA) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Bad BIOS signature.\n");
+ xfree(bios);
+ return FALSE;
+ }
+
+ offset1 = bios[0x50] | (bios[0x51] << 8);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Offset 1 is (0x%04x)\n", offset1);
+ offset2 = bios[offset1] | (bios[offset1 + 1] << 8);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Offset 2 is (0x%04x)\n", offset2);
+
+ for (i = 0; i < 9; i++) {
+ int o;
+
+ o = offset2 + i * 4;
+ uint[i] = bios[o] | (bios[o+1] << 8) | (bios[o+2] << 16) | (bios[o+3] << 24);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UINT32[%d] is 0x%08lx\n", i, uint[i]);
+ }
+
+#if 1
+ uint[0] = 0x0584fb04;
+ uint[1] = 0x00000000;
+ uint[2] = 0x03000001;
+ uint[3] = 0x0c17a9e9;
+ uint[4] = 0x00202031;
+ uint[5] = 0x8000049e;
+ uint[6] = 0x00003a05;
+ uint[7] = 0x00000c00;
+#endif
+
+ pTDFX->writeLong(pTDFX, PCIINIT0, uint[0]);
+ pTDFX->writeLong(pTDFX, MISCINIT0, uint[1]);
+ pTDFX->writeLong(pTDFX, MISCINIT1, uint[2]);
+ pTDFX->writeLong(pTDFX, DRAMINIT0, uint[3]);
+ pTDFX->writeLong(pTDFX, DRAMINIT1, uint[4]);
+ pTDFX->writeLong(pTDFX, AGPINIT, uint[5]);
+ pTDFX->writeLong(pTDFX, PLLCTRL1, uint[6]);
+ pTDFX->writeLong(pTDFX, PLLCTRL2, uint[7]);
+#if 0
+ pTDFX->writeLong(pTDFX, DRAMCOMMAND, uint[8]);
+#endif
+
+ /* reset */
+ pTDFX->writeLong(pTDFX, MISCINIT0, 0xF3);
+ pTDFX->writeLong(pTDFX, MISCINIT0, uint[1]);
+
+ xfree(bios);
+ return TRUE;
+}
+#endif
+
+
static Bool
TDFXInitVGA(ScrnInfoPtr pScrn)
{
@@ -1423,17 +1576,22 @@ TDFXInitVGA(ScrnInfoPtr pScrn)
pTDFX=TDFXPTR(pScrn);
if (pTDFX->initDone) return TRUE;
pTDFX->initDone=TRUE;
+
tdfxReg = &pTDFX->ModeReg;
tdfxReg->vgainit0 = 0;
tdfxReg->vgainit0 |= SST_VGA0_EXTENSIONS;
tdfxReg->vgainit0 |= SST_WAKEUP_3C3 << SST_VGA0_WAKEUP_SELECT_SHIFT;
- if (pTDFX->usePIO) {
- tdfxReg->vgainit0 |= SST_VGA0_ENABLE_DECODE << SST_VGA0_LEGACY_DECODE_SHIFT;
- }
+#if USE_PCIVGAIO
+ tdfxReg->vgainit0 |= SST_VGA0_LEGACY_DECODE;
+#endif
tdfxReg->vgainit0 |= SST_ENABLE_ALT_READBACK << SST_VGA0_CONFIG_READBACK_SHIFT;
tdfxReg->vgainit0 |= SST_CLUT_SELECT_8BIT << SST_VGA0_CLUT_SELECT_SHIFT;
tdfxReg->vgainit0 |= BIT(12);
+#if 0
+ tdfxReg->vgainit1 |= 0;
+ tdfxReg->miscinit1 = 0;
+#endif
tdfxReg->vidcfg = SST_VIDEO_PROCESSOR_EN | SST_CURSOR_X11 | SST_DESKTOP_EN |
(pTDFX->cpp-1)<<SST_DESKTOP_PIXEL_FORMAT_SHIFT;
@@ -1458,7 +1616,6 @@ TDFXSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) {
TDFXTRACE("TDFXSetMode start\n");
- TDFXInitVGA(pScrn);
pTDFX = TDFXPTR(pScrn);
tdfxReg = &pTDFX->ModeReg;
pVga = &VGAHWPTR(pScrn)->ModeReg;
@@ -1873,8 +2030,16 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
pScrn->memPhysBase = (int)pTDFX->LinearAddr[0];
if (!pTDFX->usePIO) TDFXSetMMIOAccess(pTDFX);
+
+#if USE_PCIVGAIO
+ hwp->PIOOffset = pTDFX->PIOBase[0] - 0x300;
+#endif
vgaHWGetIOBase(hwp);
- if (!vgaHWMapMem(pScrn)) return FALSE;
+ /* Map VGA memory only for primary cards (to save/restore textmode data). */
+ if (pTDFX->Primary) {
+ if (!vgaHWMapMem(pScrn))
+ return FALSE;
+ }
pTDFX->stride = pScrn->displayWidth*pTDFX->cpp;
@@ -1941,6 +2106,10 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
pTDFX->maxClip = MemBox.x2 | (MemBox.y2 << 16);
+#if 0
+ TDFXInitWithBIOSData(pScrn);
+#endif
+ TDFXInitVGA(pScrn);
TDFXSave(pScrn);
if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h
index c5f231c71..dd46f227e 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h
@@ -101,9 +101,16 @@
#define DRIVER_IOCTLS
#endif
+/*
+ * The default number of instances (minor numbers) to initialize.
+ */
+#ifndef DRIVER_NUM_CARDS
+#define DRIVER_NUM_CARDS 1
+#endif
-static drm_device_t DRM(device);
-static int DRM(minor);
+static drm_device_t *DRM(device);
+static int *DRM(minor);
+static int DRM(numdevs) = 0;
static struct file_operations DRM(fops) = {
#if LINUX_VERSION_CODE >= 0x020400
@@ -460,46 +467,102 @@ static int DRM(takedown)( drm_device_t *dev )
return 0;
}
+/*
+ * Figure out how many instances to initialize.
+ */
+static int drm_count_cards(void)
+{
+ int num = 0;
+#if defined(DRIVER_CARD_LIST)
+ u_int *l;
+ u_int device, vendor;
+ struct pci_dev *pdev = NULL;
+#endif
+
+ DRM_DEBUG( "\n" );
+
+#if defined(DRIVER_COUNT_CARDS)
+ num = DRIVER_COUNT_CARDS();
+#elif defined(DRIVER_CARD_LIST)
+ for (l = DRIVER_CARD_LIST; *l; l++) {
+ pdev = NULL;
+ device = *l & 0xFFFF;
+ if (device == 0xFFFF)
+ device = PCI_ANY_ID;
+ vendor = (*l >> 16) & 0xFFFF;
+ if (vendor == 0xFFFF)
+ vendor = PCI_ANY_ID;
+ while ((pdev = pci_find_device(vendor, device, pdev))) {
+ num++;
+ }
+ }
+#else
+ num = DRIVER_NUM_CARDS;
+#endif
+ DRM_DEBUG("numdevs = %d\n", num);
+ return num;
+}
+
/* drm_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported).
*/
static int __init drm_init( void )
{
- drm_device_t *dev = &DRM(device);
+
+ drm_device_t *dev;
+ int i;
#if __HAVE_CTX_BITMAP
int retcode;
#endif
DRM_DEBUG( "\n" );
- memset( (void *)dev, 0, sizeof(*dev) );
- dev->count_lock = SPIN_LOCK_UNLOCKED;
- sema_init( &dev->struct_sem, 1 );
-
#ifdef MODULE
DRM(parse_options)( drm_opts );
#endif
+
+ DRM(numdevs) = drm_count_cards();
+ /* Force at least one instance. */
+ if (DRM(numdevs) <= 0)
+ DRM(numdevs) = 1;
+
+ DRM(device) = kmalloc(sizeof(*DRM(device)) * DRM(numdevs), GFP_KERNEL);
+ if (!DRM(device)) {
+ return -ENOMEM;
+ }
+ DRM(minor) = kmalloc(sizeof(*DRM(minor)) * DRM(numdevs), GFP_KERNEL);
+ if (!DRM(minor)) {
+ kfree(DRM(device));
+ return -ENOMEM;
+ }
+
DRIVER_PREINIT();
DRM(mem_init)();
- if ((DRM(minor) = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
- return -EPERM;
- dev->device = MKDEV(DRM_MAJOR, DRM(minor) );
- dev->name = DRIVER_NAME;
+ for (i = 0; i < DRM(numdevs); i++) {
+ dev = &(DRM(device)[i]);
+ memset( (void *)dev, 0, sizeof(*dev) );
+ dev->count_lock = SPIN_LOCK_UNLOCKED;
+ sema_init( &dev->struct_sem, 1 );
+
+ if ((DRM(minor)[i] = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
+ return -EPERM;
+ dev->device = MKDEV(DRM_MAJOR, DRM(minor)[i] );
+ dev->name = DRIVER_NAME;
#if __REALLY_HAVE_AGP
- dev->agp = DRM(agp_init)();
+ dev->agp = DRM(agp_init)();
#if __MUST_HAVE_AGP
- if ( dev->agp == NULL ) {
- DRM_ERROR( "Cannot initialize the agpgart module.\n" );
- DRM(stub_unregister)(DRM(minor));
- DRM(takedown)( dev );
- return -ENOMEM;
- }
+ if ( dev->agp == NULL ) {
+ DRM_ERROR( "Cannot initialize the agpgart module.\n" );
+ DRM(stub_unregister)(DRM(minor)[i]);
+ DRM(takedown)( dev );
+ return -ENOMEM;
+ }
#endif
#if __REALLY_HAVE_MTRR
- if (dev->agp)
- dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
+ if (dev->agp)
+ dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
dev->agp->agp_info.aper_size*1024*1024,
MTRR_TYPE_WRCOMB,
1 );
@@ -507,25 +570,25 @@ static int __init drm_init( void )
#endif
#if __HAVE_CTX_BITMAP
- retcode = DRM(ctxbitmap_init)( dev );
- if( retcode ) {
- DRM_ERROR( "Cannot allocate memory for context bitmap.\n" );
- DRM(stub_unregister)(DRM(minor));
- DRM(takedown)( dev );
- return retcode;
- }
+ retcode = DRM(ctxbitmap_init)( dev );
+ if( retcode ) {
+ DRM_ERROR( "Cannot allocate memory for context bitmap.\n" );
+ DRM(stub_unregister)(DRM(minor)[i]);
+ DRM(takedown)( dev );
+ return retcode;
+ }
#endif
+ DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n",
+ DRIVER_NAME,
+ DRIVER_MAJOR,
+ DRIVER_MINOR,
+ DRIVER_PATCHLEVEL,
+ DRIVER_DATE,
+ DRM(minor)[i] );
+ }
DRIVER_POSTINIT();
- DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n",
- DRIVER_NAME,
- DRIVER_MAJOR,
- DRIVER_MINOR,
- DRIVER_PATCHLEVEL,
- DRIVER_DATE,
- DRM(minor) );
-
return 0;
}
@@ -533,38 +596,48 @@ static int __init drm_init( void )
*/
static void __exit drm_cleanup( void )
{
- drm_device_t *dev = &DRM(device);
+ drm_device_t *dev;
+ int i;
DRM_DEBUG( "\n" );
- if ( DRM(stub_unregister)(DRM(minor)) ) {
- DRM_ERROR( "Cannot unload module\n" );
- } else {
- DRM_INFO( "Module unloaded\n" );
- }
+ for (i = DRM(numdevs) - 1; i >= 0; i--) {
+ dev = &(DRM(device)[i]);
+ if ( DRM(stub_unregister)(DRM(minor)[i]) ) {
+ DRM_ERROR( "Cannot unload module\n" );
+ } else {
+ DRM_DEBUG("minor %d unregistered\n", DRM(minor)[i]);
+ if (i == 0) {
+ DRM_INFO( "Module unloaded\n" );
+ }
+ }
#if __HAVE_CTX_BITMAP
- DRM(ctxbitmap_cleanup)( dev );
+ DRM(ctxbitmap_cleanup)( dev );
#endif
#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR
- if ( dev->agp && dev->agp->agp_mtrr ) {
- int retval;
- retval = mtrr_del( dev->agp->agp_mtrr,
+ if ( dev->agp && dev->agp->agp_mtrr ) {
+ int retval;
+ retval = mtrr_del( dev->agp->agp_mtrr,
dev->agp->agp_info.aper_base,
dev->agp->agp_info.aper_size*1024*1024 );
- DRM_DEBUG( "mtrr_del=%d\n", retval );
- }
+ DRM_DEBUG( "mtrr_del=%d\n", retval );
+ }
#endif
- DRM(takedown)( dev );
+ DRM(takedown)( dev );
#if __REALLY_HAVE_AGP
- if ( dev->agp ) {
- DRM(agp_uninit)();
- DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS );
- dev->agp = NULL;
- }
+ if ( dev->agp ) {
+ DRM(agp_uninit)();
+ DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS );
+ dev->agp = NULL;
+ }
#endif
+ }
+ kfree(DRM(minor));
+ kfree(DRM(device));
+ DRM(numdevs) = 0;
}
module_init( drm_init );
@@ -608,8 +681,19 @@ int DRM(version)( struct inode *inode, struct file *filp,
int DRM(open)( struct inode *inode, struct file *filp )
{
- drm_device_t *dev = &DRM(device);
+ drm_device_t *dev = NULL;
int retcode = 0;
+ int i;
+
+ for (i = 0; i < DRM(numdevs); i++) {
+ if (MINOR(inode->i_rdev) == DRM(minor)[i]) {
+ dev = &(DRM(device)[i]);
+ break;
+ }
+ }
+ if (!dev) {
+ return -ENODEV;
+ }
DRM_DEBUG( "open_count = %d\n", dev->open_count );
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h
index d9d8e3a23..2d6b6a3c9 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h
@@ -64,18 +64,18 @@ static void DRM(parse_option)(char *s)
return;
}
-/* drm_parse_options parse the insmod "drm=" options, or the command-line
+/* drm_parse_options parse the insmod "drm_opts=" options, or the command-line
* options passed to the kernel via LILO. The grammar of the format is as
* follows:
*
- * drm ::= 'drm=' option_list
+ * drm ::= 'drm_opts=' option_list
* option_list ::= option [ ';' option_list ]
* option ::= 'device:' major
* | 'debug'
* | 'noctx'
* major ::= INTEGER
*
- * Note that 's' contains option_list without the 'drm=' part.
+ * Note that 's' contains option_list without the 'drm_opts=' part.
*
* device=major,minor specifies the device number used for /dev/drm
* if major == 0 then the misc device is used
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h
index bc9587963..6811d6ba0 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h
@@ -121,11 +121,13 @@ static int DRM(stub_putminor)(int minor)
return 0;
}
+
int DRM(stub_register)(const char *name, struct file_operations *fops,
drm_device_t *dev)
{
struct drm_stub_info *i = NULL;
-
+
+ DRM_DEBUG("\n");
if (register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops)))
i = (struct drm_stub_info *)inter_module_get("drm");
@@ -133,9 +135,11 @@ int DRM(stub_register)(const char *name, struct file_operations *fops,
/* Already registered */
DRM(stub_info).info_register = i->info_register;
DRM(stub_info).info_unregister = i->info_unregister;
- } else {
+ DRM_DEBUG("already registered\n");
+ } else if (DRM(stub_info).info_register != DRM(stub_getminor)) {
DRM(stub_info).info_register = DRM(stub_getminor);
DRM(stub_info).info_unregister = DRM(stub_putminor);
+ DRM_DEBUG("calling inter_module_register\n");
inter_module_register("drm", THIS_MODULE, &DRM(stub_info));
}
if (DRM(stub_info).info_register)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c
index b6c95498a..94e5d41c5 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c
@@ -44,6 +44,15 @@
#define DRIVER_MINOR 0
#define DRIVER_PATCHLEVEL 0
+static u_int DRM(idlist)[] = {
+ 0x121A0003, /* Banshee */
+ 0x121A0005, /* Voodoo3 */
+ 0x121A0009, /* Voodoo5 */
+ 0
+};
+
+#define DRIVER_CARD_LIST DRM(idlist)
+
#include "drm_auth.h"
#include "drm_bufs.h"
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
index a04cf7ae6..5ed8f1f86 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
@@ -55,6 +55,7 @@
# include <sys/ioctl.h>
# include <sys/mman.h>
# include <sys/time.h>
+# include <stdarg.h>
# ifdef DRM_USE_MALLOC
# define _DRM_MALLOC malloc
# define _DRM_FREE free
@@ -107,6 +108,28 @@ extern unsigned long _bus_base(void);
#define makedev(x,y) ((dev_t)(((x) << 8) | (y)))
#endif
+#define DRM_MSG_VERBOSITY 3
+
+static void
+drmMsg(const char *format, ...)
+{
+ va_list ap;
+
+#ifndef XFree86Server
+ const char *env;
+ if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose"))
+#endif
+ {
+ va_start(ap, format);
+#ifdef XFree86Server
+ xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap);
+#else
+ vfprintf(stderr, format, ap);
+#endif
+ va_end(ap);
+ }
+}
+
static void *drmHashTable = NULL; /* Context switch callbacks */
typedef struct drmHashEntry {
@@ -182,6 +205,8 @@ static int drmOpenDevice(long dev, int minor)
gid_t group = DRM_DEV_GID;
#endif
+ drmMsg("drmOpenDevice: minor is %d\n", minor);
+
#if defined(XFree86Server)
devmode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE;
dirmode = (devmode & S_IRUSR) ? S_IXUSR : 0;
@@ -203,6 +228,7 @@ static int drmOpenDevice(long dev, int minor)
#endif
sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
+ drmMsg("drmOpenDevice: node name is %s\n", buf);
if (stat(buf, &st) || st.st_rdev != dev) {
if (!isroot) return DRM_ERR_NOT_ROOT;
remove(buf);
@@ -213,7 +239,11 @@ static int drmOpenDevice(long dev, int minor)
chmod(buf, devmode);
#endif
- if ((fd = open(buf, O_RDWR, 0)) >= 0) return fd;
+ fd = open(buf, O_RDWR, 0);
+ drmMsg("drmOpenDevice: open result is %d, (%s)\n",
+ fd, fd < 0 ? strerror(errno) : "OK");
+ if (fd >= 0) return fd;
+ drmMsg("drmOpenDevice: Open failed\n");
remove(buf);
return -errno;
}
@@ -261,9 +291,13 @@ static int drmOpenByBusid(const char *busid)
int fd;
const char *buf;
+ drmMsg("drmOpenByBusid: busid is %s\n", busid);
for (i = 0; i < DRM_MAX_MINOR; i++) {
- if ((fd = drmOpenMinor(i, 0)) >= 0) {
+ fd = drmOpenMinor(i, 1);
+ drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd);
+ if (fd >= 0) {
buf = drmGetBusid(fd);
+ drmMsg("drmOpenByBusid: drmGetBusid reports %s\n", buf);
if (buf && !strcmp(buf, busid)) {
drmFreeBusid(buf);
return fd;
@@ -280,6 +314,7 @@ static int drmOpenByName(const char *name)
int i;
int fd;
drmVersionPtr version;
+ char * id;
if (!drmAvailable()) {
#if !defined(XFree86Server)
@@ -294,15 +329,30 @@ static int drmOpenByName(const char *name)
#endif
}
+ /*
+ * Open the first minor number that matches the driver name and isn't
+ * already in use. If it's in use it will have a busid assigned already.
+ */
for (i = 0; i < DRM_MAX_MINOR; i++) {
if ((fd = drmOpenMinor(i, 1)) >= 0) {
if ((version = drmGetVersion(fd))) {
if (!strcmp(version->name, name)) {
drmFreeVersion(version);
- return fd;
+ id = drmGetBusid(fd);
+ drmMsg("drmGetBusid returned '%s'\n", id ? id : "NULL");
+ if (!id || !*id) {
+ if (id) {
+ drmFreeBusid(id);
+ }
+ return fd;
+ } else {
+ drmFreeBusid(id);
+ }
+ } else {
+ drmFreeVersion(version);
}
- drmFreeVersion(version);
}
+ close(fd);
}
}
@@ -459,7 +509,9 @@ int drmSetBusid(int fd, const char *busid)
u.unique = (char *)busid;
u.unique_len = strlen(busid);
- if (ioctl(fd, DRM_IOCTL_SET_UNIQUE, &u)) return -errno;
+ if (ioctl(fd, DRM_IOCTL_SET_UNIQUE, &u)) {
+ return -errno;
+ }
return 0;
}
diff --git a/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c b/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c
index 2da052dbd..8eeb95169 100644
--- a/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c
+++ b/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.31 1999/08/21 13:48:42 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.50 2001/05/10 22:18:57 dbateman Exp $ */
/*
*
@@ -17,28 +17,20 @@
#include "X.h"
#include "misc.h"
-#include "compiler.h"
-
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
#include "vgaHW.h"
-#include "xf86cmap.h"
-
-/*
- * XXX The PC98 bits have been removed for now. The structure of the
- * code here has been reorganised to the point where they need to be
- * redone anyway. In the meantime the older version can be found in
- * xfree86/olddrivers/vgahw/.
- */
+#include "compiler.h"
+#include "xf86cmap.h"
#ifndef SAVE_FONT1
#define SAVE_FONT1
#endif
-#if defined(Lynx) || defined(CSRG_BASED) || defined(MACH386) || defined(linux) || defined(AMOEBA) || defined(MINIX)
+#if defined(Lynx) || defined(CSRG_BASED) || defined(MACH386) || defined(linux) || defined(AMOEBA) || defined(MINIX) || defined(__QNX__) || defined(sun) || defined(__GNU__)
#ifndef NEED_SAVED_CMAP
#define NEED_SAVED_CMAP
#endif
@@ -158,68 +150,72 @@ static CARD8 defaultDAC[768] =
#endif /* NEED_SAVED_CMAP */
/*
- * With Intel, the version in os-support/misc/SlowBcopy.s is used.
- * This avoids port I/O during the copy (which causes problems with
- * some hardware).
- */
-#ifdef __alpha__
-#define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
-#define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
-#else /* __alpha__ */
-#define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
-#define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
-#endif /* __alpha__ */
-
-
-/*
* Standard VGA versions of the register access functions.
*/
static void
stdWriteCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value)
{
- outb(hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index);
- outb(hwp->IOBase + VGA_CRTC_DATA_OFFSET, value);
+ outb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_INDEX_OFFSET, index);
+ outb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_DATA_OFFSET, value);
}
static CARD8
stdReadCrtc(vgaHWPtr hwp, CARD8 index)
{
- outb(hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index);
- return inb(hwp->IOBase + VGA_CRTC_DATA_OFFSET);
+ outb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_INDEX_OFFSET, index);
+ return inb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_DATA_OFFSET);
}
static void
stdWriteGr(vgaHWPtr hwp, CARD8 index, CARD8 value)
{
- outb(VGA_GRAPH_INDEX, index);
- outb(VGA_GRAPH_DATA, value);
+ outb(hwp->PIOOffset + VGA_GRAPH_INDEX, index);
+ outb(hwp->PIOOffset + VGA_GRAPH_DATA, value);
}
static CARD8
stdReadGr(vgaHWPtr hwp, CARD8 index)
{
- outb(VGA_GRAPH_INDEX, index);
- return inb(VGA_GRAPH_DATA);
+ outb(hwp->PIOOffset + VGA_GRAPH_INDEX, index);
+ return inb(hwp->PIOOffset + VGA_GRAPH_DATA);
}
static void
stdWriteSeq(vgaHWPtr hwp, CARD8 index, CARD8 value)
{
- outb(VGA_SEQ_INDEX, index);
- outb(VGA_SEQ_DATA, value);
+ outb(hwp->PIOOffset + VGA_SEQ_INDEX, index);
+ outb(hwp->PIOOffset + VGA_SEQ_DATA, value);
}
static CARD8
stdReadSeq(vgaHWPtr hwp, CARD8 index)
{
- outb(VGA_SEQ_INDEX, index);
- return inb(VGA_SEQ_DATA);
+ outb(hwp->PIOOffset + VGA_SEQ_INDEX, index);
+ return inb(hwp->PIOOffset + VGA_SEQ_DATA);
+}
+
+static CARD8
+stdReadST00(vgaHWPtr hwp)
+{
+ return inb(hwp->PIOOffset + VGA_IN_STAT_0);
}
static CARD8
stdReadST01(vgaHWPtr hwp)
{
- return inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+ return inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+}
+
+static CARD8
+stdReadFCR(vgaHWPtr hwp)
+{
+ return inb(hwp->PIOOffset + VGA_FEATURE_R);
+}
+
+static void
+stdWriteFCR(vgaHWPtr hwp, CARD8 value)
+{
+ outb(hwp->IOBase + hwp->PIOOffset + VGA_FEATURE_W_OFFSET,value);
}
static void
@@ -232,9 +228,9 @@ stdWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value)
else
index |= 0x20;
- tmp = inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
- outb(VGA_ATTR_INDEX, index);
- outb(VGA_ATTR_DATA_W, value);
+ tmp = inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+ outb(hwp->PIOOffset + VGA_ATTR_INDEX, index);
+ outb(hwp->PIOOffset + VGA_ATTR_DATA_W, value);
}
static CARD8
@@ -247,21 +243,21 @@ stdReadAttr(vgaHWPtr hwp, CARD8 index)
else
index |= 0x20;
- tmp = inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
- outb(VGA_ATTR_INDEX, index);
- return inb(VGA_ATTR_DATA_R);
+ tmp = inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+ outb(hwp->PIOOffset + VGA_ATTR_INDEX, index);
+ return inb(hwp->PIOOffset + VGA_ATTR_DATA_R);
}
static void
stdWriteMiscOut(vgaHWPtr hwp, CARD8 value)
{
- outb(VGA_MISC_OUT_W, value);
+ outb(hwp->PIOOffset + VGA_MISC_OUT_W, value);
}
static CARD8
stdReadMiscOut(vgaHWPtr hwp)
{
- return inb(VGA_MISC_OUT_R);
+ return inb(hwp->PIOOffset + VGA_MISC_OUT_R);
}
static void
@@ -269,8 +265,8 @@ stdEnablePalette(vgaHWPtr hwp)
{
CARD8 tmp;
- tmp = inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
- outb(VGA_ATTR_INDEX, 0x00);
+ tmp = inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+ outb(hwp->PIOOffset + VGA_ATTR_INDEX, 0x00);
hwp->paletteEnabled = TRUE;
}
@@ -279,45 +275,57 @@ stdDisablePalette(vgaHWPtr hwp)
{
CARD8 tmp;
- tmp = inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
- outb(VGA_ATTR_INDEX, 0x20);
+ tmp = inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+ outb(hwp->PIOOffset + VGA_ATTR_INDEX, 0x20);
hwp->paletteEnabled = FALSE;
}
static void
stdWriteDacMask(vgaHWPtr hwp, CARD8 value)
{
- outb(VGA_DAC_MASK, value);
+ outb(hwp->PIOOffset + VGA_DAC_MASK, value);
}
static CARD8
stdReadDacMask(vgaHWPtr hwp)
{
- return inb(VGA_DAC_MASK);
+ return inb(hwp->PIOOffset + VGA_DAC_MASK);
}
static void
stdWriteDacReadAddr(vgaHWPtr hwp, CARD8 value)
{
- outb(VGA_DAC_READ_ADDR, value);
+ outb(hwp->PIOOffset + VGA_DAC_READ_ADDR, value);
}
static void
stdWriteDacWriteAddr(vgaHWPtr hwp, CARD8 value)
{
- outb(VGA_DAC_WRITE_ADDR, value);
+ outb(hwp->PIOOffset + VGA_DAC_WRITE_ADDR, value);
}
static void
stdWriteDacData(vgaHWPtr hwp, CARD8 value)
{
- outb(VGA_DAC_DATA, value);
+ outb(hwp->PIOOffset + VGA_DAC_DATA, value);
}
static CARD8
stdReadDacData(vgaHWPtr hwp)
{
- return inb(VGA_DAC_DATA);
+ return inb(hwp->PIOOffset + VGA_DAC_DATA);
+}
+
+static CARD8
+stdReadEnable(vgaHWPtr hwp)
+{
+ return inb(hwp->PIOOffset + VGA_ENABLE);
+}
+
+static void
+stdWriteEnable(vgaHWPtr hwp, CARD8 value)
+{
+ outb(hwp->PIOOffset + VGA_ENABLE, value);
}
void
@@ -327,7 +335,10 @@ vgaHWSetStdFuncs(vgaHWPtr hwp)
hwp->readCrtc = stdReadCrtc;
hwp->writeGr = stdWriteGr;
hwp->readGr = stdReadGr;
+ hwp->readST00 = stdReadST00;
hwp->readST01 = stdReadST01;
+ hwp->readFCR = stdReadFCR;
+ hwp->writeFCR = stdWriteFCR;
hwp->writeAttr = stdWriteAttr;
hwp->readAttr = stdReadAttr;
hwp->writeSeq = stdWriteSeq;
@@ -342,6 +353,9 @@ vgaHWSetStdFuncs(vgaHWPtr hwp)
hwp->writeDacReadAddr = stdWriteDacReadAddr;
hwp->writeDacData = stdWriteDacData;
hwp->readDacData = stdReadDacData;
+ hwp->PIOOffset = 0;
+ hwp->readEnable = stdReadEnable;
+ hwp->writeEnable = stdWriteEnable;
}
/*
@@ -350,15 +364,8 @@ vgaHWSetStdFuncs(vgaHWPtr hwp)
* adderss is added the correct memory address results.
*/
-#ifndef __alpha__
-#define minb(p) *(volatile CARD8 *)(hwp->MMIOBase + hwp->MMIOOffset + (p))
-#define moutb(p,v) \
- *(volatile CARD8 *)(hwp->MMIOBase + hwp->MMIOOffset + (p)) = (v)
-#else
-#define minb(p) xf86ReadSparse8(hwp->MMIOBase, hwp->MMIOOffset + (p))
-#define moutb(p,v) \
- xf86WriteSparse8((v), hwp->MMIOBase, hwp->MMIOOffset + (p))
-#endif
+#define minb(p) MMIO_IN8(hwp->MMIOBase, (hwp->MMIOOffset + (p)))
+#define moutb(p,v) MMIO_OUT8(hwp->MMIOBase, (hwp->MMIOOffset + (p)),(v))
static void
mmioWriteCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value)
@@ -403,11 +410,29 @@ mmioReadSeq(vgaHWPtr hwp, CARD8 index)
}
static CARD8
+mmioReadST00(vgaHWPtr hwp)
+{
+ return minb(VGA_IN_STAT_0);
+}
+
+static CARD8
mmioReadST01(vgaHWPtr hwp)
{
return minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
}
+static CARD8
+mmioReadFCR(vgaHWPtr hwp)
+{
+ return minb(VGA_FEATURE_R);
+}
+
+static void
+mmioWriteFCR(vgaHWPtr hwp, CARD8 value)
+{
+ moutb(hwp->IOBase + VGA_FEATURE_W_OFFSET,value);
+}
+
static void
mmioWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value)
{
@@ -506,6 +531,18 @@ mmioReadDacData(vgaHWPtr hwp)
return minb(VGA_DAC_DATA);
}
+static CARD8
+mmioReadEnable(vgaHWPtr hwp)
+{
+ return minb(VGA_ENABLE);
+}
+
+static void
+mmioWriteEnable(vgaHWPtr hwp, CARD8 value)
+{
+ moutb(VGA_ENABLE, value);
+}
+
void
vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset)
{
@@ -513,7 +550,10 @@ vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset)
hwp->readCrtc = mmioReadCrtc;
hwp->writeGr = mmioWriteGr;
hwp->readGr = mmioReadGr;
+ hwp->readST00 = mmioReadST00;
hwp->readST01 = mmioReadST01;
+ hwp->readFCR = mmioReadFCR;
+ hwp->writeFCR = mmioWriteFCR;
hwp->writeAttr = mmioWriteAttr;
hwp->readAttr = mmioReadAttr;
hwp->writeSeq = mmioWriteSeq;
@@ -530,6 +570,8 @@ vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset)
hwp->readDacData = mmioReadDacData;
hwp->MMIOBase = base;
hwp->MMIOOffset = offset;
+ hwp->readEnable = mmioReadEnable;
+ hwp->writeEnable = mmioWriteEnable;
}
/*
@@ -600,13 +642,16 @@ vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on)
*/
Bool
-vgaHWSaveScreen(ScreenPtr pScreen, Bool on)
+vgaHWSaveScreen(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = NULL;
+ Bool on;
if (pScreen != NULL)
pScrn = xf86Screens[pScreen->myNum];
+ on = xf86IsUnblank(mode);
+
if (on)
SetTimeSinceLastInputEvent();
@@ -628,7 +673,6 @@ vgaHWSaveScreen(ScreenPtr pScreen, Bool on)
void
vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
{
-#ifdef DPMSExtension
unsigned char seq1 = 0, crtc17 = 0;
vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -663,7 +707,6 @@ vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
usleep(10000);
hwp->writeCrtc(hwp, 0x17, crtc17);
hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */
-#endif
}
@@ -732,8 +775,9 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
*
* BUG ALERT: The (S)VGA's segment-select register MUST be set correctly!
*/
-
+#if 0
hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */
+#endif
if (scrninfp->depth == 4) {
/* GJA */
hwp->writeGr(hwp, 0x03, 0x00); /* don't rotate, write unmodified */
@@ -925,9 +969,9 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
*
* BUG ALERT: The (S)VGA's segment-select register MUST be set correctly!
*/
-
+#if 0
hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */
-
+#endif
#ifdef SAVE_FONT1
if (hwp->FontInfo1 || (hwp->FontInfo1 = xalloc(FONT_AMOUNT))) {
hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
@@ -1054,11 +1098,12 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save)
#endif
hwp->writeDacMask(hwp, 0xFF);
+
/*
* check if we can read the lookup table
*/
hwp->writeDacReadAddr(hwp, 0x00);
- for (i = 0; i < 3; i++) {
+ for (i = 0; i < 6; i++) {
save->DAC[i] = hwp->readDacData(hwp);
#ifdef DEBUG
switch (i % 3) {
@@ -1073,15 +1118,23 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save)
}
#endif
}
- hwp->writeDacWriteAddr(hwp, 0x00);
- for (i = 0; i < 3; i++)
+
+ /*
+ * Check if we can read the palette -
+ * use foreground color to prevent flashing.
+ */
+ hwp->writeDacWriteAddr(hwp, 0x01);
+ for (i = 3; i < 6; i++)
hwp->writeDacData(hwp, ~save->DAC[i] & DAC_TEST_MASK);
- hwp->writeDacReadAddr(hwp, 0x00);
- for (i = 0; i < 3; i++) {
+ hwp->writeDacReadAddr(hwp, 0x01);
+ for (i = 3; i < 6; i++) {
if (hwp->readDacData(hwp) != (~save->DAC[i] & DAC_TEST_MASK))
readError = TRUE;
}
-
+ hwp->writeDacWriteAddr(hwp, 0x01);
+ for (i = 3; i < 6; i++)
+ hwp->writeDacData(hwp, save->DAC[i]);
+
if (readError) {
/*
* save the default lookup table
@@ -1091,8 +1144,8 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save)
"Cannot read colourmap from VGA. Will restore with default\n");
} else {
/* save the colourmap */
- hwp->writeDacReadAddr(hwp, 0x01);
- for (i = 3; i < 768; i++) {
+ hwp->writeDacReadAddr(hwp, 0x02);
+ for (i = 6; i < 768; i++) {
save->DAC[i] = hwp->readDacData(hwp);
DACDelay(hwp);
#ifdef DEBUG
@@ -1109,6 +1162,7 @@ vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save)
#endif
}
}
+
hwp->disablePalette(hwp);
hwp->cmapSaved = TRUE;
#endif
@@ -1257,67 +1311,8 @@ vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
regp->CRTC[23] = 0xC3;
regp->CRTC[24] = 0xFF;
- /*
- * OK, so much for theory. Now, let's deal with the >real< world...
- *
- * The above CRTC settings are precise in theory, except that many, if not
- * most, VGA clones fail to reset the blanking signal when the character or
- * line counter reaches [HV]Total. In this case, the signal is only
- * unblanked when the counter reaches [HV]BlankEnd (mod 64, 128 or 256 as
- * the case may be) at the start of the >next< scanline or frame, which
- * means only part of the screen shows. This affects how null overscans
- * are to be implemented on such adapters.
- *
- * Henceforth, VGA cores that implement this broken, but unfortunately
- * common, behaviour are to be designated as KGA's, in honour of Koen
- * Gadeyne, whose zeal to eliminate overscans (read: fury) set in motion
- * a series of events that led to the discovery of this problem.
- *
- * Some VGA's are KGA's only in the horizontal, or only in the vertical,
- * some in both, others in neither. Don't let anyone tell you there is
- * such a thing as a VGA "standard"... And, thank the Creator for the fact
- * that Hilbert spaces are not yet implemented in this industry.
- *
- * The following implements a trick suggested by David Dawes. This sets
- * [HV]BlankEnd to zero if the blanking interval does not already contain a
- * 0-point, and decrements it by one otherwise. In the latter case, this
- * will produce a left and/or top overscan which the colourmap code will
- * (still) need to ensure is as close to black as possible. This will make
- * the behaviour consistent across all chipsets, while allowing all
- * chipsets to display the entire screen. Non-KGA drivers can ignore the
- * following in their own copy of this code.
- *
- * -- TSI @ UQV, 1998.08.21
- */
-
- /* First the horizontal case */
- if ((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3))
- {
- i = (regp->CRTC[3] & 0x1F) | ((regp->CRTC[5] & 0x80) >> 2);
- if ((i-- > (regp->CRTC[2] & 0x3F)) &&
- (mode->CrtcHBlankEnd == mode->CrtcHTotal))
- i = 0;
- regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (i & 0x1F);
- regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((i << 2) & 0x80);
- }
-
- /*
- * The vertical case is a little trickier. Some VGA's ignore bit 0x80 of
- * CRTC[22]. Also, in some cases, a zero CRTC[22] will still blank the
- * very first scanline in a double- or multi-scanned mode. This last case
- * needs further investigation.
- */
- if (mode->CrtcVBlankEnd == mode->CrtcVTotal) /* Null top overscan */
- {
- i = regp->CRTC[22];
- if ((i > regp->CRTC[21]) && /* 8-bit case */
- ((i & 0x7F) > (regp->CRTC[21] & 0x7F)) && /* 7-bit case */
- !(regp->CRTC[9] & 0x9F)) /* 1 scanline/row */
- i = 0;
- else
- i = (CARD8)(i - 1);
- regp->CRTC[22] = i;
- }
+ vgaHWHBlankKGA(mode, regp, 0, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO);
+ vgaHWVBlankKGA(mode, regp, 0, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO);
/*
* Theory resumes here....
@@ -1388,6 +1383,110 @@ vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
return(TRUE);
}
+ /*
+ * OK, so much for theory. Now, let's deal with the >real< world...
+ *
+ * The above CRTC settings are precise in theory, except that many, if not
+ * most, VGA clones fail to reset the blanking signal when the character or
+ * line counter reaches [HV]Total. In this case, the signal is only
+ * unblanked when the counter reaches [HV]BlankEnd (mod 64, 128 or 256 as
+ * the case may be) at the start of the >next< scanline or frame, which
+ * means only part of the screen shows. This affects how null overscans
+ * are to be implemented on such adapters.
+ *
+ * Henceforth, VGA cores that implement this broken, but unfortunately
+ * common, behaviour are to be designated as KGA's, in honour of Koen
+ * Gadeyne, whose zeal to eliminate overscans (read: fury) set in motion
+ * a series of events that led to the discovery of this problem.
+ *
+ * Some VGA's are KGA's only in the horizontal, or only in the vertical,
+ * some in both, others in neither. Don't let anyone tell you there is
+ * such a thing as a VGA "standard"... And, thank the Creator for the fact
+ * that Hilbert spaces are not yet implemented in this industry.
+ *
+ * The following implements a trick suggested by David Dawes. This sets
+ * [HV]BlankEnd to zero if the blanking interval does not already contain a
+ * 0-point, and decrements it by one otherwise. In the latter case, this
+ * will produce a left and/or top overscan which the colourmap code will
+ * (still) need to ensure is as close to black as possible. This will make
+ * the behaviour consistent across all chipsets, while allowing all
+ * chipsets to display the entire screen. Non-KGA drivers can ignore the
+ * following in their own copy of this code.
+ *
+ * -- TSI @ UQV, 1998.08.21
+ */
+
+CARD32
+vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
+ unsigned int Flags)
+{
+ int nExtBits = (nBits < 6) ? 0 : nBits - 6;
+ CARD32 ExtBits;
+ CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 6;
+
+ regp->CRTC[3] = (regp->CRTC[3] & ~0x1F)
+ | (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F);
+ regp->CRTC[5] = (regp->CRTC[5] & ~0x80)
+ | ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2);
+ ExtBits = ((mode->CrtcHBlankEnd >> 3) - 1) & ExtBitMask;
+
+ /* First the horizontal case */
+ if ((Flags & KGA_FIX_OVERSCAN)
+ && ((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3)))
+ {
+ int i = (regp->CRTC[3] & 0x1F)
+ | ((regp->CRTC[5] & 0x80) >> 2)
+ | ExtBits;
+ if ((Flags & KGA_ENABLE_ON_ZERO)
+ && (i-- > (((mode->CrtcHBlankStart >> 3) - 1)
+ & (0x3F | ExtBitMask)))
+ && (mode->CrtcHBlankEnd == mode->CrtcHTotal))
+ i = 0;
+ regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (i & 0x1F);
+ regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((i << 2) & 0x80);
+ ExtBits = i & ExtBitMask;
+ }
+ return ExtBits >> 6;
+}
+
+ /*
+ * The vertical case is a little trickier. Some VGA's ignore bit 0x80 of
+ * CRTC[22]. Also, in some cases, a zero CRTC[22] will still blank the
+ * very first scanline in a double- or multi-scanned mode. This last case
+ * needs further investigation.
+ */
+CARD32
+vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
+ unsigned int Flags)
+{
+ CARD32 ExtBits;
+ CARD32 nExtBits = (nBits < 8) ? 0 : (nBits - 8);
+ CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 8;
+ /* If width is not known nBits should be 0. In this
+ * case BitMask is set to 0 so we can check for it. */
+ CARD32 BitMask = (nBits < 7) ? 0 : ((1 << nExtBits) - 1);
+ int VBlankStart = (mode->CrtcVBlankStart - 1) & 0xFF;
+ regp->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF;
+ ExtBits = (mode->CrtcVBlankEnd - 1) & ExtBitMask;
+
+ if ((Flags & KGA_FIX_OVERSCAN)
+ && (mode->CrtcVBlankEnd == mode->CrtcVTotal))
+ /* Null top overscan */
+ {
+ int i = regp->CRTC[22] | ExtBits;
+ if ((Flags & KGA_ENABLE_ON_ZERO)
+ && ((BitMask && ((i & BitMask) > (VBlankStart & BitMask)))
+ || ((i > VBlankStart) && /* 8-bit case */
+ ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */
+ !(regp->CRTC[9] & 0x9F)) /* 1 scanline/row */
+ i = 0;
+ else
+ i = (i - 1);
+ regp->CRTC[22] = i & 0xFF;
+ ExtBits = i & 0xFF00;
+ }
+ return ExtBits >> 8;
+}
/*
* these are some more hardware specific helpers, formerly in vga.c
@@ -1445,7 +1544,7 @@ vgaHWAllocRegs(vgaRegPtr regp)
}
-static Bool
+Bool
vgaHWAllocDefaultRegs(vgaRegPtr regp)
{
regp->numCRTC = VGA_NUM_CRTC;
@@ -1576,10 +1675,21 @@ vgaHWGetHWRec(ScrnInfoPtr scrp)
rgb blackColour = scrp->display->blackColour,
whiteColour = scrp->display->whiteColour;
- /* Detect default for black & white */
- if (!blackColour.red && !blackColour.green && !blackColour.blue &&
- !whiteColour.red && !whiteColour.green && !whiteColour.blue)
- whiteColour.red = whiteColour.green = whiteColour.blue = 0x3F;
+ if (blackColour.red > 0x3F) blackColour.red = 0x3F;
+ if (blackColour.green > 0x3F) blackColour.green = 0x3F;
+ if (blackColour.blue > 0x3F) blackColour.blue = 0x3F;
+
+ if (whiteColour.red > 0x3F) whiteColour.red = 0x3F;
+ if (whiteColour.green > 0x3F) whiteColour.green = 0x3F;
+ if (whiteColour.blue > 0x3F) whiteColour.blue = 0x3F;
+
+ if ((blackColour.red == whiteColour.red ) &&
+ (blackColour.green == whiteColour.green) &&
+ (blackColour.blue == whiteColour.blue )) {
+ blackColour.red ^= 0x3F;
+ blackColour.green ^= 0x3F;
+ blackColour.blue ^= 0x3F;
+ }
/*
* initialize default colormap for monochrome
@@ -1634,6 +1744,9 @@ vgaHWFreeHWRec(ScrnInfoPtr scrp)
if (vgaHWPrivateIndex >= 0) {
vgaHWPtr hwp = VGAHWPTR(scrp);
+ if (!hwp)
+ return;
+
xfree(hwp->FontInfo1);
xfree(hwp->FontInfo2);
xfree(hwp->TextInfo);
@@ -1662,8 +1775,16 @@ vgaHWMapMem(ScrnInfoPtr scrp)
if (hwp->MapPhys == 0)
hwp->MapPhys = VGA_DEFAULT_PHYS_ADDR;
- /* Map as VIDMEM_MMIO because WC is bad when there is page flipping */
- hwp->Base = xf86MapVidMem(scr_index, VIDMEM_MMIO,
+ /*
+ * Map as VIDMEM_MMIO_32BIT because WC
+ * is bad when there is page flipping.
+ * XXX This is not correct but we do it
+ * for now.
+ */
+#ifdef DEBUG
+ ErrorF("Mapping VGAMem\n");
+#endif
+ hwp->Base = xf86MapVidMem(scr_index, VIDMEM_MMIO_32BIT,
hwp->MapPhys, hwp->MapSize);
return hwp->Base != NULL;
}
@@ -1677,7 +1798,10 @@ vgaHWUnmapMem(ScrnInfoPtr scrp)
if (hwp->Base == NULL)
return;
-
+
+#ifdef DEBUG
+ ErrorF("Unmapping VGAMem\n");
+#endif
xf86UnMapVidMem(scr_index, hwp->Base, hwp->MapSize);
hwp->Base = NULL;
}
@@ -1694,6 +1818,9 @@ vgaHWGetIOBase(vgaHWPtr hwp)
{
hwp->IOBase = (hwp->readMiscOut(hwp) & 0x01) ?
VGA_IOBASE_COLOR : VGA_IOBASE_MONO;
+ xf86DrvMsgVerb(hwp->pScrn->scrnIndex, X_INFO, 3,
+ "vgaHWGetIOBase: hwp->IOBase is 0x%04x, hwp->PIOOffset is 0x%04x\n",
+ hwp->IOBase, hwp->PIOOffset);
}
@@ -1712,6 +1839,20 @@ vgaHWUnlock(vgaHWPtr hwp)
}
+void
+vgaHWEnable(vgaHWPtr hwp)
+{
+ hwp->writeEnable(hwp, hwp->readEnable(hwp) | 0x01);
+}
+
+
+void
+vgaHWDisable(vgaHWPtr hwp)
+{
+ hwp->writeEnable(hwp, hwp->readEnable(hwp) & ~0x01);
+}
+
+
static void
vgaHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
VisualPtr pVisual)
@@ -1866,3 +2007,4 @@ vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
break;
}
}
+