diff options
Diffstat (limited to 'xc/lib/GL/mesa/src')
-rw-r--r-- | xc/lib/GL/mesa/src/Imakefile | 2 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/OSmesa/Imakefile | 249 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c | 50 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c | 55 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/i810/i810dd.c | 2 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/i810/i810tris.c | 1 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c | 57 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgadd.c | 11 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgafastpath.c | 8 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgalib.h | 8 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgaspan.c | 146 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgavb.c | 4 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r128/r128_dd.c | 2 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r128/r128_screen.c | 40 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c | 5 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c | 78 |
16 files changed, 602 insertions, 116 deletions
diff --git a/xc/lib/GL/mesa/src/Imakefile b/xc/lib/GL/mesa/src/Imakefile index 4f5af973c..1d42b4950 100644 --- a/xc/lib/GL/mesa/src/Imakefile +++ b/xc/lib/GL/mesa/src/Imakefile @@ -382,7 +382,7 @@ NormalLintTarget($(SRCS)) #define IHaveSubdirs #define PassCDebugFlags -SUBDIRS = $(MESASUBDIRS) $(ASMSUBDIRS) drv +SUBDIRS = $(MESASUBDIRS) $(ASMSUBDIRS) drv OSmesa MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) diff --git a/xc/lib/GL/mesa/src/OSmesa/Imakefile b/xc/lib/GL/mesa/src/OSmesa/Imakefile new file mode 100644 index 000000000..e92b9e3a8 --- /dev/null +++ b/xc/lib/GL/mesa/src/OSmesa/Imakefile @@ -0,0 +1,249 @@ + +#include <Threads.tmpl> + +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx +#define DoExtraLib SharedLibGlx +#define DoDebugLib DebugLibGlx +#define DoProfileLib ProfileLibGlx + +LinkSourceFile(osmesa.c, ../../../../../extras/Mesa/src/OSmesa) + + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +MESA_INCLUDES = -I. -I.. -I../../include -I../../../../../include + + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) + INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) + + MESASRCS = ../aatriangle.c \ + ../accum.c \ + ../alpha.c \ + ../alphabuf.c \ + ../attrib.c \ + ../bbox.c \ + ../bitmap.c \ + ../blend.c \ + ../buffers.c \ + ../clip.c \ + ../colortab.c \ + ../config.c \ + ../context.c \ + ../copypix.c \ + ../cva.c \ + ../debug_xform.c \ + ../depth.c \ + ../dlist.c \ + ../drawpix.c \ + ../enable.c \ + ../enums.c \ + ../eval.c \ + ../extensions.c \ + ../feedback.c \ + ../fog.c \ + ../get.c \ + ../glapi.c \ + ../glapinoop.c \ + ../glthread.c \ + ../hash.c \ + ../image.c \ + ../imaging.c \ + ../light.c \ + ../lines.c \ + ../logic.c \ + ../masking.c \ + ../matrix.c \ + ../mem.c \ + ../mmath.c \ + ../pb.c \ + ../pipeline.c \ + ../pixel.c \ + ../pixeltex.c \ + ../points.c \ + ../polygon.c \ + ../quads.c \ + ../rastpos.c \ + ../readpix.c \ + ../rect.c \ + ../scissor.c \ + ../shade.c \ + ../span.c \ + ../stages.c \ + ../state.c \ + ../stencil.c \ + ../teximage.c \ + ../texobj.c \ + ../texstate.c \ + ../texture.c \ + ../texutil.c \ + ../translate.c \ + ../triangle.c \ + ../varray.c \ + ../vb.c \ + ../vbcull.c \ + ../vbfill.c \ + ../vbindirect.c \ + ../vbrender.c \ + ../vbxform.c \ + ../vector.c \ + ../vertices.c \ + ../winpos.c \ + ../xform.c \ + ../zoom.c \ + ../X86/common_x86.c \ + osmesa.c + + MESAOBJS = ../aatriangle.o \ + ../accum.o \ + ../alpha.o \ + ../alphabuf.o \ + ../attrib.o \ + ../bbox.o \ + ../bitmap.o \ + ../blend.o \ + ../buffers.o \ + ../clip.o \ + ../colortab.o \ + ../config.o \ + ../context.o \ + ../copypix.o \ + ../cva.o \ + ../debug_xform.o \ + ../depth.o \ + ../dlist.o \ + ../drawpix.o \ + ../enable.o \ + ../enums.o \ + ../eval.o \ + ../extensions.o \ + ../feedback.o \ + ../fog.o \ + ../get.o \ + ../hash.o \ + ../hint.o \ + ../image.o \ + ../imaging.o \ + ../light.o \ + ../lines.o \ + ../logic.o \ + ../masking.o \ + ../matrix.o \ + ../mem.o \ + ../mmath.o \ + ../pb.o \ + ../pipeline.o \ + ../pixel.o \ + ../pixeltex.o \ + ../points.o \ + ../polygon.o \ + ../quads.o \ + ../rastpos.o \ + ../readpix.o \ + ../rect.o \ + ../scissor.o \ + ../shade.o \ + ../span.o \ + ../stages.o \ + ../state.o \ + ../stencil.o \ + ../teximage.o \ + ../texobj.o \ + ../texstate.o \ + ../texture.o \ + ../texutil.o \ + ../translate.o \ + ../triangle.o \ + ../varray.o \ + ../vb.o \ + ../vbcull.o \ + ../vbfill.o \ + ../vbindirect.o \ + ../vbrender.o \ + ../vbxform.o \ + ../vector.o \ + ../vertices.o \ + ../winpos.o \ + ../xform.o \ + ../zoom.o \ + osmesa.o + +#ifdef i386Architecture + X86_SRCS = ../X86/x86.c \ + ../X86/x86a.S \ + ../X86/common_x86.c \ + ../X86/common_x86asm.S \ + ../X86/vertex.S + + X86_OBJS = ../X86/x86.o \ + ../X86/x86a.o \ + ../X86/common_x86.o \ + ../X86/common_x86asm.o \ + ../X86/vertex.o + + MMX_SRCS = ../X86/mmx_blend.S + + MMX_OBJS = ../X86/mmx_blend.o + +XCOMM Disabling 3Dnow code for the time being. +#if 0 + 3DNOW_SRCS = ../X86/3dnow.c \ + ../X86/3dnow_norm_raw.S \ + ../X86/3dnow_xform_masked1.S \ + ../X86/3dnow_xform_masked2.S \ + ../X86/3dnow_xform_masked3.S \ + ../X86/3dnow_xform_masked4.S \ + ../X86/3dnow_xform_raw1.S \ + ../X86/3dnow_xform_raw2.S \ + ../X86/3dnow_xform_raw3.S \ + ../X86/3dnow_xform_raw4.S \ + ../X86/vertex_3dnow.S + + 3DNOW_OBJS = ../X86/3dnow.o \ + ../X86/3dnow_norm_raw.o \ + ../X86/3dnow_xform_masked1.o \ + ../X86/3dnow_xform_masked2.o \ + ../X86/3dnow_xform_masked3.o \ + ../X86/3dnow_xform_masked4.o \ + ../X86/3dnow_xform_raw1.o \ + ../X86/3dnow_xform_raw2.o \ + ../X86/3dnow_xform_raw3.o \ + ../X86/3dnow_xform_raw4.o \ + ../X86/vertex_3dnow.o +#endif + +#endif + + ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) + ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) + + SRCS = $(MESASRCS) $(ASMSRCS) + OBJS = $(MESAOBJS) $(ASMOBJS) + UOBJS = $(MESAOBJS) $(ASMOBJS) + DONES = DONE + +#if !GlxUseBuiltInDRIDriver + REQUIREDLIBS += -L../../.. -lGL +#endif + +#include <Library.tmpl> + +LibraryObjectRule() + +SubdirLibraryRule($(OBJS)) +NormalLintTarget($(SRCS)) + +LIBNAME = OSMesa +SOREV = 3.3 + + +/*NormalDepLibraryTarget($(LIBNAME), $(DONES), $(UOBJS))*/ +/*InstallLibrary($(LIBNAME),$(USRLIBDIR))*/ + +SharedDepLibraryTarget($(LIBNAME),$(SOREV), $(DONES), $(OBJS), ., .) +InstallSharedLibrary($(LIBNAME),$(SOREV),$(SHLIBDIR)) + + +DependTarget() diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c index 3c1fe64fc..b199bc073 100644 --- a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c @@ -51,31 +51,65 @@ gammaContextPrivate *gCCPriv = NULL; static struct _glapi_table *Dispatch = NULL; -GLboolean XMesaInitDriver(__DRIscreenPrivate *driScrnPriv) +GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) { gammaScreenPrivate *gsp; + /* Check the DRI version */ + { + int major, minor, patch; + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, "gamma DRI driver expected DRI version 3.0.x but got version %d.%d.%d", major, minor, patch); + __driMesaMessage(msg); + return GL_FALSE; + } + } + } + + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, "gamma DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, "gamm DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + /* Allocate the private area */ gsp = (gammaScreenPrivate *)Xmalloc(sizeof(gammaScreenPrivate)); if (!gsp) { return GL_FALSE; } - gsp->driScrnPriv = driScrnPriv; + gsp->driScrnPriv = sPriv; - driScrnPriv->private = (void *)gsp; + sPriv->private = (void *)gsp; - if (!gammaMapAllRegions(driScrnPriv)) { - Xfree(driScrnPriv->private); + if (!gammaMapAllRegions(sPriv)) { + Xfree(sPriv->private); return GL_FALSE; } return GL_TRUE; } -void XMesaResetDriver(__DRIscreenPrivate *driScrnPriv) +void XMesaResetDriver(__DRIscreenPrivate *sPriv) { - gammaUnmapAllRegions(driScrnPriv); - Xfree(driScrnPriv->private); + gammaUnmapAllRegions(sPriv); + Xfree(sPriv->private); + sPriv->private = NULL; } GLvisual *XMesaCreateVisual(Display *dpy, diff --git a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c index 5edcf2620..e5d95583b 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c @@ -104,7 +104,9 @@ static drmBufMapPtr i810_create_empty_buffers(void) return NULL; } memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR); + /* fprintf(stderr, "retval : %p, retval->list : %p\n", retval, retval->list); + */ return retval; } @@ -113,9 +115,43 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) i810ScreenPrivate *i810Screen; I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv; + /* Check the DRI version */ + { + int major, minor, patch; + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, "i810 DRI driver expected DRI version 3.0.x but got version %d.%d.%d", major, minor, patch); + __driMesaMessage(msg); + return GL_FALSE; + } + } + } + + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, "i810 DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, "i810 DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + /* Allocate the private area */ i810Screen = (i810ScreenPrivate *)Xmalloc(sizeof(i810ScreenPrivate)); - if (!i810Screen) return GL_FALSE; + if (!i810Screen) + return GL_FALSE; i810Screen->driScrnPriv = sPriv; sPriv->private = (void *)i810Screen; @@ -141,7 +177,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) i810Screen->textureSize=gDRIPriv->textureSize; i810Screen->logTextureGranularity = gDRIPriv->logTextureGranularity; - if (1) + if (0) fprintf(stderr, "Tex heap size %x, granularity %x bytes\n", i810Screen->textureSize, 1<<(i810Screen->logTextureGranularity)); @@ -161,6 +197,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&i810Screen->back.map) != 0) { Xfree(i810Screen); + sPriv->private = NULL; return GL_FALSE; } @@ -173,6 +210,8 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&i810Screen->depth.map) != 0) { Xfree(i810Screen); + drmUnmap(i810Screen->back.map, i810Screen->back.size); + sPriv->private = NULL; return GL_FALSE; } @@ -185,6 +224,9 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&i810Screen->tex.map) != 0) { Xfree(i810Screen); + drmUnmap(i810Screen->back.map, i810Screen->back.size); + drmUnmap(i810Screen->depth.map, i810Screen->depth.size); + sPriv->private = NULL; return GL_FALSE; } @@ -204,9 +246,12 @@ void XMesaResetDriver(__DRIscreenPrivate *sPriv) /* Need to unmap all the bufs and maps here: */ - + drmUnmap(i810Screen->back.map, i810Screen->back.size); + drmUnmap(i810Screen->depth.map, i810Screen->depth.size); + drmUnmap(i810Screen->tex.map, i810Screen->tex.size); Xfree(i810Screen); + sPriv->private = NULL; } @@ -459,7 +504,7 @@ void i810XMesaSetBackClipRects( i810ContextPtr imesa ) static void i810XMesaWindowMoved( i810ContextPtr imesa ) { if (0) - fprintf(stderr, "i810XMesaWindowMoved\n\n"); + fprintf(stderr, "i810XMesaWindowMoved\n\n"); switch (imesa->glCtx->Color.DriverDrawBuffer) { case GL_FRONT_LEFT: @@ -469,7 +514,7 @@ static void i810XMesaWindowMoved( i810ContextPtr imesa ) i810XMesaSetBackClipRects( imesa ); break; default: - fprintf(stderr, "fallback buffer\n"); + /*fprintf(stderr, "fallback buffer\n");*/ break; } } diff --git a/xc/lib/GL/mesa/src/drv/i810/i810dd.c b/xc/lib/GL/mesa/src/drv/i810/i810dd.c index 7c04f6d56..583eb630c 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810dd.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810dd.c @@ -56,7 +56,7 @@ static const GLubyte *i810DDGetString( GLcontext *ctx, GLenum name ) case GL_VENDOR: return "Keith Whitwell, Precision Insight Inc."; case GL_RENDERER: - return "Mesa DRI I810 20000415"; + return "Mesa DRI I810 20000510"; default: return 0; } diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tris.c b/xc/lib/GL/mesa/src/drv/i810/i810tris.c index df28991f1..c601ca492 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810tris.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810tris.c @@ -114,6 +114,7 @@ void i810DDChooseRenderState( GLcontext *ctx ) if (flags & DD_MULTIDRAW) shared |= I810_FALLBACK_BIT; if (flags & DD_SELECT) shared |= I810_FALLBACK_BIT; if (flags & DD_FEEDBACK) shared |= I810_FALLBACK_BIT; + if (flags & DD_STENCIL) shared |= I810_FALLBACK_BIT; imesa->renderindex = shared; imesa->PointsFunc = points_tab[shared]; diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c index c6aadc144..a0d9cdf73 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c @@ -99,9 +99,43 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreenPrivate *mgaScreen; MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; + /* Check the DRI version */ + { + int major, minor, patch; + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, "MGA DRI driver expected DRI version 3.0.x but got version %d.%d.%d", major, minor, patch); + __driMesaMessage(msg); + return GL_FALSE; + } + } + } + + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, "MGA DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, "MGA DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + /* Allocate the private area */ mgaScreen = (mgaScreenPrivate *)Xmalloc(sizeof(mgaScreenPrivate)); - if (!mgaScreen) return GL_FALSE; + if (!mgaScreen) + return GL_FALSE; mgaScreen->sPriv = sPriv; sPriv->private = (void *)mgaScreen; @@ -111,8 +145,12 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) */ if (serverInfo->chipset != MGA_CARD_TYPE_G200 && - serverInfo->chipset != MGA_CARD_TYPE_G400) - return GL_FALSE; + serverInfo->chipset != MGA_CARD_TYPE_G400) { + XFree(mgaScreen); + sPriv->private = NULL; + return GL_FALSE; + } + mgaScreen->chipset = serverInfo->chipset; mgaScreen->width = serverInfo->width; @@ -136,6 +174,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&mgaScreen->agp.map) != 0) { Xfree(mgaScreen); + sPriv->private = NULL; return GL_FALSE; } @@ -177,6 +216,12 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->Attrib = MGA_PF_565; mgaScreen->bufs = drmMapBufs(sPriv->fd); + if (!mgaScreen->bufs) { + /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/ + XFree(mgaScreen); + sPriv->private = NULL; + return GL_FALSE; + } /* Other mgaglx stuff, too?? */ @@ -190,11 +235,15 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) return GL_TRUE; } + /* Accessed by dlsym from dri_mesa_init.c */ void XMesaResetDriver(__DRIscreenPrivate *sPriv) { - Xfree(sPriv->private); + mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *) sPriv->private; + /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/ + Xfree(mgaScreen); + sPriv->private = NULL; } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c index ad56cbbc3..8eb717d5c 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgadd.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.c @@ -61,11 +61,11 @@ static const GLubyte *mgaDDGetString( GLcontext *ctx, GLenum name ) mgaContextPtr mmesa = MGA_CONTEXT( ctx ); switch (name) { case GL_VENDOR: - return "Utah GLX"; + return "Precision Insight, Inc."; case GL_RENDERER: - if (MGA_IS_G200(mmesa)) return "GLX-MGA-G200"; - if (MGA_IS_G400(mmesa)) return "GLX-MGA-G400"; - return "GLX-MGA"; + if (MGA_IS_G200(mmesa)) return "Mesa DRI G200 20000510"; + if (MGA_IS_G400(mmesa)) return "Mesa DRI G400 20000510"; + return "Mesa DRI MGA 20000510"; default: return 0; } @@ -123,10 +123,13 @@ void mgaDDExtensionsInit( GLcontext *ctx ) * a few rogue fallbacks. */ gl_extensions_disable( ctx, "ARB_imaging" ); + gl_extensions_disable( ctx, "GL_EXT_blend_color" ); gl_extensions_disable( ctx, "GL_EXT_blend_minmax" ); gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" ); gl_extensions_disable( ctx, "GL_EXT_blend_subtract" ); gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" ); + gl_extensions_disable( ctx, "GL_EXT_texture_lod_bias" ); + gl_extensions_disable( ctx, "GL_MESA_resize_buffers" ); } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c index 76e0047f8..73a939b74 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c @@ -383,9 +383,9 @@ static void mga_project_vertices( struct vertex_buffer *VB ) REFRESH_DRAWABLE_INFO(mmesa); m[MAT_SX] = mat->m[MAT_SX]; - m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX + .5; + m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX + SUBPIXEL_X; m[MAT_SY] = (- mat->m[MAT_SY]); - m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY - .5; + m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY + SUBPIXEL_Y; m[MAT_SZ] = mat->m[MAT_SZ] * (1.0 / 0x10000); m[MAT_TZ] = mat->m[MAT_TZ] * (1.0 / 0x10000); @@ -406,9 +406,9 @@ static void mga_project_clipped_vertices( struct vertex_buffer *VB ) REFRESH_DRAWABLE_INFO(mmesa); m[MAT_SX] = mat->m[MAT_SX]; - m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX + .5; + m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX + SUBPIXEL_X; m[MAT_SY] = (- mat->m[MAT_SY]); - m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY - .5; + m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY - SUBPIXEL_Y; m[MAT_SZ] = mat->m[MAT_SZ] * (1.0 / 0x10000); m[MAT_TZ] = mat->m[MAT_TZ] * (1.0 / 0x10000); diff --git a/xc/lib/GL/mesa/src/drv/mga/mgalib.h b/xc/lib/GL/mesa/src/drv/mga/mgalib.h index 7d086ae28..e00525f7b 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgalib.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgalib.h @@ -313,4 +313,12 @@ static __inline__ mgaUI32 mgaPackColor(mgaUI32 format, } } + +/* + * Subpixel offsets for window coordinates: + */ +#define SUBPIXEL_X (-0.5F) +#define SUBPIXEL_Y (-0.5F + 0.125) + + #endif diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c index 38e3cdde8..887e194d2 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c @@ -5,71 +5,100 @@ #include "mgalog.h" #include "mgaspan.h" +#define DBG 0 + #define LOCAL_VARS \ - mgaContextPtr mmesa = MGA_CONTEXT( ctx ); \ __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \ - __DRIscreenPrivate *sPriv = mmesa->driScreen; \ mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ - GLuint pitch = mgaScreen->backPitch; \ + __DRIscreenPrivate *sPriv = mmesa->driScreen; \ + GLuint pitch = mgaScreen->frontPitch; \ GLuint height = dPriv->h; \ + char *read_buf = (char *)(sPriv->pFB + \ + mmesa->readOffset + \ + dPriv->x * 2 + \ + dPriv->y * pitch); \ char *buf = (char *)(sPriv->pFB + \ mmesa->drawOffset + \ dPriv->x * 2 + \ + dPriv->y * pitch); \ + GLushort p = MGA_CONTEXT( ctx )->MonoColor; \ + (void) read_buf; (void) buf; (void) p + + + +#define LOCAL_DEPTH_VARS \ + __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \ + mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ + __DRIscreenPrivate *sPriv = mmesa->driScreen; \ + GLuint pitch = mgaScreen->frontPitch; \ + GLuint height = dPriv->h; \ + char *buf = (char *)(sPriv->pFB + \ + mgaScreen->depthOffset + \ + dPriv->x * 2 + \ dPriv->y * pitch) -#define INIT_MONO_PIXEL(p) \ - GLushort p = MGA_CONTEXT( ctx )->MonoColor; +#define INIT_MONO_PIXEL(p) -#define CLIPPIXEL(_x,_y) (_x >= minx && _x <= maxx && \ - _y >= miny && _y <= maxy) +#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ + _y >= miny && _y < maxy) -#define CLIPSPAN(_x,_y,_n,_x1,_n1) \ +#define CLIPSPAN(_x,_y,_n,_x1,_n1,_i) \ if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \ else { \ _n1 = _n; \ _x1 = _x; \ - if (_x1 < minx) _n1 -= (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 > maxx) n1 -= (_x1 + n1 - maxx); \ + if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ + if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx) + 1; \ } - +#define HW_LOCK() \ + mgaContextPtr mmesa = MGA_CONTEXT(ctx); \ + LOCK_HARDWARE_QUIESCENT(mmesa); #define HW_CLIPLOOP() \ do { \ int _nc = mmesa->numClipRects; \ - LOCK_HARDWARE_QUIESCENT(mmesa); \ while (_nc--) { \ - int minx = mmesa->pClipRects[_nc].x1 - mmesa->drawX; \ - int miny = mmesa->pClipRects[_nc].y1 - mmesa->drawY; \ - int maxx = mmesa->pClipRects[_nc].x2 - mmesa->drawX; \ + int minx = mmesa->pClipRects[_nc].x1 - mmesa->drawX; \ + int miny = mmesa->pClipRects[_nc].y1 - mmesa->drawY; \ + int maxx = mmesa->pClipRects[_nc].x2 - mmesa->drawX; \ int maxy = mmesa->pClipRects[_nc].y2 - mmesa->drawY; - #define HW_ENDCLIPLOOP() \ } \ - UNLOCK_HARDWARE(mmesa); \ } while (0) +#define HW_UNLOCK() \ + UNLOCK_HARDWARE(mmesa); + + -#define Y_FLIP(_y) (height - _y) + + + + +/* 16 bit, 565 rgb color spanline and pixel functions + */ +#define Y_FLIP(_y) (height - _y - 1) #define WRITE_RGBA( _x, _y, r, g, b, a ) \ - *(GLushort *)(buf + _x*2 + _y*pitch) = ( ((r & 0x1f) << 11) | \ - ((g & 0x3f) << 5) | \ - ((b & 0x1f))) + *(GLushort *)(buf + _x*2 + _y*pitch) = ( (((int)r & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)b & 0xf8) >> 3)) + #define WRITE_PIXEL( _x, _y, p ) \ *(GLushort *)(buf + _x*2 + _y*pitch) = p -#define READ_RGBA( rgba, _x, _y ) \ -do { \ - GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 11) & 0x1f; \ - rgba[1] = (p >> 5) & 0x3f; \ - rgba[2] = (p >> 0) & 0x1f; \ - rgba[3] = 0; /* or 255? */ \ +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ + rgba[0] = (p >> 8) & 0xf8; \ + rgba[1] = (p >> 3) & 0xfc; \ + rgba[2] = (p << 3) & 0xf8; \ + rgba[3] = 255; \ } while(0) #define TAG(x) mga##x##_565 @@ -78,22 +107,22 @@ do { \ - -#define WRITE_RGBA( _x, _y, r, g, b, a ) \ - *(GLushort *)(buf + _x*2 + _y*pitch) = ( ((r & 0x1f) << 10) | \ - ((g & 0x1f) << 5) | \ - ((b & 0x1f))) - +/* 15 bit, 555 rgb color spanline and pixel functions + */ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = (((r & 0xf8) << 7) | \ + ((g & 0xf8) << 3) | \ + ((b & 0xf8) >> 3)) #define WRITE_PIXEL( _x, _y, p ) \ *(GLushort *)(buf + _x*2 + _y*pitch) = p -#define READ_RGBA( rgba, _x, _y ) \ -do { \ - GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 10) & 0x1f; \ - rgba[1] = (p >> 5) & 0x1f; \ - rgba[2] = (p >> 0) & 0x1f; \ - rgba[3] = 0; /* or 255? */ \ +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ + rgba[0] = (p >> 7) & 0xf8; \ + rgba[1] = (p >> 3) & 0xf8; \ + rgba[2] = (p << 3) & 0xf8; \ + rgba[3] = 255; \ } while(0) #define TAG(x) mga##x##_555 @@ -101,27 +130,19 @@ do { \ -#if 0 -#define WRITE_RGBA( _x, _y, r, g, b, a ) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = ( ((r) << 16) | \ - ((g) << 8) | \ - ((b))) +/* 16 bit depthbuffer functions. + */ +#define WRITE_DEPTH( _x, _y, d ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = d; + +#define READ_DEPTH( d, _x, _y ) \ + d = *(GLushort *)(buf + _x*2 + _y*pitch); + +#define TAG(x) mga##x##_16 +#include "depthtmp.h" + -#define WRITE_PIXEL( _x, _y, p ) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = p - -#define READ_RGBA( rgba, _x, _y ) \ -do { \ - GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \ - rgba[0] = (p >> 16) & 0xff; \ - rgba[1] = (p >> 8) & 0xff; \ - rgba[2] = (p >> 0) & 0xff; \ - rgba[3] = 0; /* or 255? */ \ -} while(0) -#define TAG(x) mga##x##_888 -#include "spantmp.h" -#endif void mgaDDInitSpanFuncs( GLcontext *ctx ) { @@ -143,6 +164,11 @@ void mgaDDInitSpanFuncs( GLcontext *ctx ) ctx->Driver.ReadRGBAPixels = mgaReadRGBAPixels_555; } + ctx->Driver.ReadDepthSpan = mgaReadDepthSpan_16; + ctx->Driver.WriteDepthSpan = mgaWriteDepthSpan_16; + ctx->Driver.ReadDepthPixels = mgaReadDepthPixels_16; + ctx->Driver.WriteDepthPixels = mgaWriteDepthPixels_16; + ctx->Driver.WriteCI8Span =NULL; ctx->Driver.WriteCI32Span =NULL; ctx->Driver.WriteMonoCISpan =NULL; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.c b/xc/lib/GL/mesa/src/drv/mga/mgavb.c index 2d61f301d..3f246d9a7 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgavb.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.c @@ -100,8 +100,8 @@ static void name(struct vertex_buffer *VB, GLuint start, GLuint end) \ mgaVertexPtr v; \ GLfloat (*tc0)[4]; \ GLfloat (*tc1)[4]; \ - GLfloat xoffset = 0.5 + mmesa->drawX; \ - GLfloat yoffset = mmesa->driDrawable->h - 0.5 + mmesa->drawY; \ + GLfloat xoffset = mmesa->drawX + SUBPIXEL_X; \ + GLfloat yoffset = mmesa->driDrawable->h + mmesa->drawY + SUBPIXEL_Y; \ int i; \ (void) xoffset; (void) yoffset; \ if (0) fprintf(stderr, "V"); \ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c index 0ed7ae471..f270cbe13 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c @@ -100,7 +100,7 @@ static const GLubyte *r128DDGetString(GLcontext *ctx, GLenum name) case GL_VENDOR: return (GLubyte *)"Precision Insight, Inc."; case GL_RENDERER: - return (GLubyte *)"Mesa DRI Rage128 20000320"; + return (GLubyte *)"Mesa DRI Rage128 20000607"; default: return NULL; } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c index b385271f4..64fa94ebd 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c @@ -50,6 +50,46 @@ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) { r128ScreenPtr r128Screen; R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; + int major, minor, patch; + + /* Check that the DRI version is compatible */ + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, + "r128 DRI driver expected DRI version 3.0.x " + "but got version %d.%d.%d", + major, minor, patch); + __driMesaMessage(msg); + return NULL; + } + } + + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 3 || + sPriv->ddxMinor != 1 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, + "r128 DRI driver expected DDX driver version 3.1.x " + "but got version %d.%d.%d", + sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return NULL; + } + + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, + "r128 DRI driver expected DRM driver version 1.0.x " + "but got version %d.%d.%d", + sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return NULL; + } /* Allocate the private area */ r128Screen = (r128ScreenPtr)Xmalloc(sizeof(*r128Screen)); diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c index 60d528813..ff4f9df63 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c @@ -77,10 +77,7 @@ static r128ContextPtr r128Context = NULL; GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) { sPriv->private = (void *)r128CreateScreen(sPriv); - if (!sPriv->private) { - r128DestroyScreen(sPriv); - return GL_FALSE; - } + if (!sPriv->private) return GL_FALSE; return GL_TRUE; } 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 215d3903d..b40f0f054 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c @@ -45,30 +45,66 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. __DRIcontextPrivate *gCC = 0; -GLboolean XMesaInitDriver(__DRIscreenPrivate *driScrnPriv) +GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) { - tdfxScreenPrivate *gsp; + tdfxScreenPrivate *gsp; - /* Allocate the private area */ - gsp = (tdfxScreenPrivate *)Xmalloc(sizeof(tdfxScreenPrivate)); - if (!gsp) return GL_FALSE; + /* Check the DRI version */ + { + int major, minor, patch; + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, "3dfx DRI driver expected DRI version 3.0.x but got version %d.%d.%d", major, minor, patch); + __driMesaMessage(msg); + return GL_FALSE; + } + } + } - gsp->driScrnPriv = driScrnPriv; + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, "3dfx DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return GL_FALSE; + } - driScrnPriv->private = (void *)gsp; + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, "3dfx DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return GL_FALSE; + } - if (!tdfxMapAllRegions(driScrnPriv)) { - Xfree(driScrnPriv->private); - return GL_FALSE; - } + /* Allocate the private area */ + gsp = (tdfxScreenPrivate *)Xmalloc(sizeof(tdfxScreenPrivate)); + if (!gsp) + return GL_FALSE; - return GL_TRUE; + gsp->driScrnPriv = sPriv; + + sPriv->private = (void *) gsp; + + if (!tdfxMapAllRegions(sPriv)) { + Xfree(gsp); + sPriv->private = NULL; + return GL_FALSE; + } + + return GL_TRUE; } -void XMesaResetDriver(__DRIscreenPrivate *driScrnPriv) +void XMesaResetDriver(__DRIscreenPrivate *sPriv) { - tdfxUnmapAllRegions(driScrnPriv); - Xfree(driScrnPriv->private); + tdfxUnmapAllRegions(sPriv); + Xfree(sPriv->private); + sPriv->private = NULL; } GLvisual *XMesaCreateVisual(Display *dpy, @@ -146,11 +182,9 @@ GLboolean XMesaCreateContext(Display *dpy, GLvisual *mesaVis, void XMesaDestroyContext(__DRIcontextPrivate *driContextPriv) { - tdfxContextPrivate *cPriv; - - cPriv = (tdfxContextPrivate *) driContextPriv->driverPrivate; + tdfxContextPrivate *cPriv = (tdfxContextPrivate *) driContextPriv->driverPrivate; if (cPriv) { - /* XXX XFree the tdfxContextPrivate struct? */ + XFree(cPriv); driContextPriv->driverPrivate = NULL; } @@ -169,7 +203,7 @@ GLframebuffer *XMesaCreateWindowBuffer( Display *dpy, GL_FALSE, /* software depth buffer? */ mesaVis->StencilBits > 0, mesaVis->AccumRedBits > 0, - mesaVis->AlphaBits > 0 + GL_FALSE /* software alpha channel? */ ); } @@ -230,8 +264,8 @@ void XMesaSwapBuffers(__DRIdrawablePrivate *driDrawPriv) #endif FX_grDRIBufferSwap(gCCPriv->swapInterval); do { - result=FX_grGetInteger(FX_PENDING_BUFFERSWAPS); - } while (result>gCCPriv->maxPendingSwapBuffers); + result = FX_grGetInteger(FX_PENDING_BUFFERSWAPS); + } while (result > gCCPriv->maxPendingSwapBuffers); gCCPriv->stats.swapBuffer++; } } |