Kristian Høgsberg wrote:
Keith Whitwell wrote:
It seems to me that whatever reason Xorg needs to build mesa for (I'm guessing the indirect GLX software rasterizer) is a mistake.

If mesa is to be built, it should be built within the tree it is developed. That might mean that Mesa should learn how to build itself in a form suitable for use as X.org's internal rasterizer, or better still now that we have AIGLX approaching, that Mesa grows a DRI software-only rasterizer that Xorg can use when a hardware driver for AIGLX isn't available.

Funny you should mention this :) I've been working on building the software rasterizer in mesa and at this point I have something that works, but I need to clean it up a bit, and there are a couple of issues that I'm not sure how to deal with. I've renamed GLcore to softgl, since now it is just one implmentation of GL. Also, this is not a software DRI driver, it's a implementation of the GLX provider interface that I added in the GLX module. For now, I've attached a mesa patch and an xorg patch with my current work.

Duh... here are the patches.

Kristian



? lib
? make-patch.sh
? configs/linux-softgl
? src/mesa/drivers/softgl
? src/mesa/drivers/dri/r200/server
? src/mesa/drivers/dri/r300/server
? src/mesa/drivers/x11/xorg_glx.c
? src/mesa/drivers/x11/xorg_glx_util.c
? src/mesa/drivers/x11/xorg_glx_util.h
? src/mesa/x86/gen_matypes
? src/mesa/x86/matypes.h
? src/mesa/x86-64/matypes.h
Index: Makefile
===================================================================
RCS file: /cvs/mesa/Mesa/Makefile,v
retrieving revision 1.62
diff -u -p -r1.62 Makefile
--- Makefile	19 Feb 2006 22:30:46 -0000	1.62
+++ Makefile	16 Mar 2006 17:12:53 -0000
@@ -100,6 +100,7 @@ linux-osmesa16-static \
 linux-osmesa32 \
 linux-ppc \
 linux-ppc-static \
+linux-softgl \
 linux-solo \
 linux-solo-x86 \
 linux-solo-ia64 \
@@ -232,6 +233,7 @@ MAIN_FILES = \
 	$(DIRECTORY)/src/mesa/drivers/windows/*/*.def			\
 	$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms			\
 	$(DIRECTORY)/src/mesa/drivers/x11/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/x11/Makefile			\
 	$(DIRECTORY)/src/mesa/ppc/*.[ch]				\
 	$(DIRECTORY)/src/mesa/sparc/*.[chS]				\
 	$(DIRECTORY)/src/mesa/x86/Makefile				\
Index: progs/xdemos/glxgears.c
===================================================================
RCS file: /cvs/mesa/Mesa/progs/xdemos/glxgears.c,v
retrieving revision 1.13
diff -u -p -r1.13 glxgears.c
--- progs/xdemos/glxgears.c	9 Aug 2005 15:14:51 -0000	1.13
+++ progs/xdemos/glxgears.c	16 Mar 2006 17:12:54 -0000
@@ -499,7 +499,7 @@ event_loop(Display *dpy, Window win)
                                     NULL, NULL);
                   if (buffer[0] == 27) {
                      /* escape */
-                     return;
+		     return;
                   }
                }
             }
Index: src/mesa/Makefile
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/Makefile,v
retrieving revision 1.34
diff -u -p -r1.34 Makefile
--- src/mesa/Makefile	14 Sep 2005 02:18:43 -0000	1.34
+++ src/mesa/Makefile	16 Mar 2006 17:12:57 -0000
@@ -33,6 +33,8 @@ default:
 		$(MAKE) beos ; \
 	elif [ "$(DRIVER_DIRS)" = "directfb" ]; then \
 		$(MAKE) directfb; \
+	elif [ "$(DRIVER_DIRS)" = "x11" ]; then \
+		$(MAKE) softgl; \
 	else \
 		$(MAKE) stand-alone ; \
 	fi
@@ -61,6 +63,13 @@ linux-solo: depend subdirs libmesa.a
 
 
 #####################################################################
+# Xorg softgl module
+
+softgl: depend subdirs libmesa.a
+	$(MAKE) -C drivers/softgl
+
+
+#####################################################################
 # Stand-alone Mesa libGL, no built-in drivers (DirectFB)
 
 libgl-core: $(CORE_OBJECTS)
Index: src/mesa/drivers/dri/common/glcontextmodes.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c,v
retrieving revision 1.10
diff -u -p -r1.10 glcontextmodes.c
--- src/mesa/drivers/dri/common/glcontextmodes.c	9 Feb 2006 14:28:40 -0000	1.10
+++ src/mesa/drivers/dri/common/glcontextmodes.c	16 Mar 2006 17:12:58 -0000
@@ -37,7 +37,7 @@
 # include <GL/gl.h>
 # include "GL/internal/dri_interface.h"
 # include "imports.h"
-# define __glXMemset  memset
+# define __mesa_memset  memset
 #else
 # if defined(HAVE_DIX_CONFIG_H)
 #  include <dix-config.h>
@@ -47,14 +47,14 @@
 # include "GL/glxint.h"
 
 # ifdef XFree86Server
-#  include "GL/glx_ansic.h"
-extern void * __glXMalloc( size_t size );
-extern void __glXFree( void * ptr );
-#  define _mesa_malloc(b) __glXMalloc(b)
-#  define _mesa_free(m)   __glXFree(m)
+# include <stdlib.h>
+# include <string.h>
+#  define _mesa_malloc(b) Xalloc(b)
+#  define _mesa_free(m)   Xfree(m)
+#  define _mesa_memset   memset
 # else
 #  include <X11/Xlibint.h>
-#  define __glXMemset  memset
+#  define _mesa_memset memset
 #  define _mesa_malloc(b) Xmalloc(b)
 #  define _mesa_free(m) Xfree(m)
 # endif /* XFree86Server */
@@ -129,7 +129,7 @@ _gl_copy_visual_to_context_mode( __GLcon
 {
     __GLcontextModes * const next = mode->next;
 
-    (void) __glXMemset( mode, 0, sizeof( __GLcontextModes ) );
+    (void) _mesa_memset( mode, 0, sizeof( __GLcontextModes ) );
     mode->next = next;
 
     mode->visualID = config->vid;
@@ -370,7 +370,7 @@ _gl_context_modes_create( unsigned count
 	 break;
       }
       
-      (void) __glXMemset( *next, 0, size );
+      (void) _mesa_memset( *next, 0, size );
       (*next)->visualID = GLX_DONT_CARE;
       (*next)->visualType = GLX_DONT_CARE;
       (*next)->visualRating = GLX_NONE;
Index: src/mesa/drivers/x11/glxheader.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/x11/glxheader.h,v
retrieving revision 1.9
diff -u -p -r1.9 glxheader.h
--- src/mesa/drivers/x11/glxheader.h	2 Sep 2005 13:42:49 -0000	1.9
+++ src/mesa/drivers/x11/glxheader.h	16 Mar 2006 17:12:58 -0000
@@ -38,8 +38,7 @@
 # include "resource.h"
 # include "windowstr.h"
 # include "gcstruct.h"
-# include "GL/xf86glx.h"
-# include "xf86glx_util.h"
+# include "xorg_glx_util.h"
 
 #else
 
Index: src/mesa/drivers/x11/xmesaP.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/x11/xmesaP.h,v
retrieving revision 1.51
diff -u -p -r1.51 xmesaP.h
--- src/mesa/drivers/x11/xmesaP.h	9 Jan 2006 17:56:55 -0000	1.51
+++ src/mesa/drivers/x11/xmesaP.h	16 Mar 2006 17:12:59 -0000
@@ -28,8 +28,7 @@
 
 
 #ifdef XFree86Server
-# include "GL/xf86glx.h"
-# include "xf86glx_util.h"
+# include "xorg_glx_util.h"
 #elif defined(USE_XSHM)
 # include <X11/extensions/XShm.h>
 #endif
--- /dev/null	2006-03-16 10:08:51.842272750 -0500
+++ configs/linux-softgl	2006-03-15 18:58:44.000000000 -0500
@@ -0,0 +1,32 @@
+# Configuration for linux Xorg softgl module		-*- makefile -*-
+
+include $(TOP)/configs/default
+
+CONFIG_NAME = linux-softgl
+
+# Compiler and flags
+CC = gcc
+CXX = g++
+
+OPT_FLAGS  = -O3 -g
+PIC_FLAGS  = -fPIC
+
+# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.  Add -m32
+# to build properly on 64-bit platforms.
+
+ARCH_FLAGS ?=
+
+DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
+	-D_BSD_SOURCE -DPTHREADS -DUSE_XSHM -DNO_LIBCWRAPPER
+
+XORG_CFLAGS    = $(shell pkg-config --cflags xorg-server)
+XORG_MODULEDIR = $(shell pkg-config --variable=moduledir xorg-server)
+
+CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
+	$(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math \
+	$(XORG_CFLAGS)
+
+CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
+	$(X11_INCLUDES) 
+
+DRIVER_DIRS = softgl
--- /dev/null	2006-03-16 10:08:51.842272750 -0500
+++ src/mesa/drivers/x11/Makefile	2006-03-16 11:32:58.000000000 -0500
@@ -0,0 +1,48 @@
+# src/mesa/drivers/softgl/Makefile
+
+TOP = ../../../..
+include $(TOP)/configs/current
+
+MESA_MODULES = $(TOP)/src/mesa/libmesa.a
+
+SOFTGL = softgl.so
+
+SOFTGL_SOURCES =				\
+	xm_api.c				\
+	xm_buffer.c				\
+	xm_dd.c					\
+	xm_line.c				\
+	xm_span.c				\
+	xm_tri.c				\
+	../common/driverfuncs.c			\
+	xorg_glx.c				\
+	xorg_glx_util.c
+
+SOFTGL_OBJECTS = $(SOFTGL_SOURCES:.c=.o)
+
+INCLUDES = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi
+
+$(SOFTGL): $(SOFTGL_OBJECTS)
+	$(CC) -shared $(CFLAGS) $(SOFTGL_OBJECTS) $(MESA_MODULES) \
+		-o $(SOFTGL) -Wl,-soname -Wl,$(SOFTGL)  -lm
+
+.c.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+install:
+	@if test -d $(XORG_MODULEDIR); then \
+		echo "Installing Xorg softgl module."; \
+	else \
+		echo "*** Failed to determine Xorgs module directory."; \
+		echo "*** Installation aborted."; \
+		exit 1; \
+	fi;
+	test -d $(XORG_MODULEDIR) || mkdir $(XORG_MODULEDIR)
+	install -m 755 $(SOFTGL) $(XORG_MODULEDIR)
+
+clean:
+	rm -rf *.o *.so
--- /dev/null	2006-03-16 10:08:51.842272750 -0500
+++ src/mesa/drivers/x11/xorg_glx.c	2006-03-16 11:49:50.000000000 -0500
@@ -0,0 +1,398 @@
+/*
+ * Copyright © 2006 Red Hat, Inc
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of Red Hat,
+ * Inc not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission.  Red Hat, Inc makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL RED HAT, INC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+#include <windowstr.h>
+#include <glxserver.h>
+#include <glxscreens.h>
+#include <glxdrawable.h>
+#include <glxcontext.h>
+#include <glxutil.h>
+#include "xmesaP.h"
+#include "context.h"
+
+#include "../dri/common/glcontextmodes.h"
+
+typedef struct __GLXMESAscreen   __GLXMESAscreen;
+typedef struct __GLXMESAcontext  __GLXMESAcontext;
+typedef struct __GLXMESAdrawable __GLXMESAdrawable;
+
+struct __GLXMESAscreen {
+    __GLXscreen   base;
+    int           index;
+    XMesaVisual  *xm_vis;
+};
+
+struct __GLXMESAcontext {
+    __GLXcontext base;
+    XMesaContext xmesa;
+};
+
+struct __GLXMESAdrawable {
+    __GLXdrawable base;
+    XMesaBuffer   xm_buf;
+};
+
+static XMesaVisual find_mesa_visual(__GLXscreen *screen, VisualID vid);
+
+
+static void
+__glXMesaDrawableDestroy(__GLXdrawable *base)
+{
+    __GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
+
+    if (glxPriv->xm_buf)
+	XMesaDestroyBuffer(glxPriv->xm_buf);
+    xfree(glxPriv);
+}
+
+static GLboolean
+__glXMesaDrawableResize(__GLXdrawable *base)
+{
+    __GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
+
+    XMesaResizeBuffers(glxPriv->xm_buf);
+
+    return GL_TRUE;
+}
+
+static GLboolean
+__glXMesaDrawableSwapBuffers(__GLXdrawable *base)
+{
+    __GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base;
+
+    /* This is terrifying: XMesaSwapBuffers() ends up calling CopyArea
+     * to do the buffer swap, but this assumes that the server holds
+     * the lock and has its context visible.  If another screen uses a
+     * DRI driver, that will have installed the DRI enter/leave server
+     * functions, which lifts the lock during GLX dispatch.  This is
+     * why we need to re-take the lock and swap in the server context
+     * before calling XMesaSwapBuffers() here.  /me shakes head. */
+
+    __glXenterServer();
+
+    XMesaSwapBuffers(glxPriv->xm_buf);
+
+    __glXleaveServer();
+
+    return GL_TRUE;
+}
+
+
+static __GLXdrawable *
+__glXMesaContextCreateDrawable(__GLXcontext *context,
+			       DrawablePtr pDraw,
+			       XID drawId)
+{
+    __GLXMESAdrawable *glxPriv;
+    __GLXscreen *pGlxScreen;
+    XMesaVisual xm_vis;
+
+    glxPriv = xalloc(sizeof *glxPriv);
+    if (glxPriv == NULL)
+	return NULL;
+
+    memset(glxPriv, 0, sizeof *glxPriv);
+
+    if (!__glXDrawableInit(&glxPriv->base, context, pDraw, drawId)) {
+        xfree(glxPriv);
+	return NULL;
+    }
+
+    glxPriv->base.destroy       = __glXMesaDrawableDestroy;
+    glxPriv->base.resize        = __glXMesaDrawableResize;
+    glxPriv->base.swapBuffers   = __glXMesaDrawableSwapBuffers;
+
+    pGlxScreen = __glXActiveScreens[pDraw->pScreen->myNum];
+
+    if (glxPriv->base.type == DRAWABLE_WINDOW) {
+	VisualID vid = wVisual((WindowPtr)pDraw);
+
+	glxPriv->base.modes = _gl_context_modes_find_visual(pGlxScreen->modes,
+							    vid);
+    } else {
+	glxPriv->base.modes = glxPriv->base.pGlxPixmap->modes;
+    }
+
+    xm_vis = find_mesa_visual(pGlxScreen, glxPriv->base.modes->visualID);
+    if (xm_vis == NULL) {
+	ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
+	       glxPriv->base.modes->visualID);
+	xfree(glxPriv);
+	return NULL;
+    }
+
+    if (glxPriv->base.type == DRAWABLE_WINDOW) {
+	glxPriv->xm_buf = XMesaCreateWindowBuffer(xm_vis, (WindowPtr)pDraw);
+    } else {
+	glxPriv->xm_buf = XMesaCreatePixmapBuffer(xm_vis, (PixmapPtr)pDraw, 0);
+    }
+
+    return &glxPriv->base;
+}
+
+static void
+__glXMesaContextDestroy(__GLXcontext *baseContext)
+{
+    __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
+
+    XMesaDestroyContext(context->xmesa);
+    xfree(context);
+}
+
+static int
+__glXMesaContextMakeCurrent(__GLXcontext *baseContext)
+
+{
+    __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
+    __GLXMESAdrawable *drawPriv = (__GLXMESAdrawable *) context->base.drawPriv;
+    __GLXMESAdrawable *readPriv = (__GLXMESAdrawable *) context->base.readPriv;
+
+    return XMesaMakeCurrent2(context->xmesa,
+			     drawPriv->xm_buf,
+			     readPriv->xm_buf);
+}
+
+static int
+__glXMesaContextLoseCurrent(__GLXcontext *baseContext)
+{
+    __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
+
+    return XMesaLoseCurrent(context->xmesa);
+}
+
+static int
+__glXMesaContextCopy(__GLXcontext *baseDst,
+		     __GLXcontext *baseSrc,
+		     unsigned long mask)
+{
+    __GLXMESAcontext *dst = (__GLXMESAcontext *) baseDst;
+    __GLXMESAcontext *src = (__GLXMESAcontext *) baseSrc;
+
+    _mesa_copy_context(&src->xmesa->mesa, &dst->xmesa->mesa, mask);
+    return GL_TRUE;
+}
+
+static int
+__glXMesaContextForceCurrent(__GLXcontext *baseContext)
+{
+    __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
+
+    return XMesaForceCurrent(context->xmesa);
+}
+
+static __GLXcontext *
+__glXMesaScreenCreateContext(__GLXscreen *screen,
+			     __GLcontextModes *modes,
+			     __GLXcontext *baseShareContext)
+{
+    __GLXMESAcontext *context;
+    __GLXMESAcontext *shareContext = (__GLXMESAcontext *) baseShareContext;
+    XMesaVisual xm_vis;
+    XMesaContext xm_share;
+
+    context = xalloc (sizeof (__GLXMESAcontext));
+    if (context == NULL)
+	return NULL;
+
+    memset(context, 0, sizeof *context);
+
+    context->base.pGlxScreen = screen;
+    context->base.modes      = modes;
+
+    context->base.destroy        = __glXMesaContextDestroy;
+    context->base.makeCurrent    = __glXMesaContextMakeCurrent;
+    context->base.loseCurrent    = __glXMesaContextLoseCurrent;
+    context->base.copy           = __glXMesaContextCopy;
+    context->base.forceCurrent   = __glXMesaContextForceCurrent;
+    context->base.createDrawable = __glXMesaContextCreateDrawable;
+
+    xm_vis = find_mesa_visual(screen, modes->visualID);
+    if (!xm_vis) {
+	ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
+	       modes->visualID);
+	xfree(context);
+	return NULL;
+    }
+
+    xm_share = shareContext ? shareContext->xmesa : NULL;
+    context->xmesa = XMesaCreateContext(xm_vis, xm_share);
+    if (!context->xmesa) {
+	xfree(context);
+	return NULL;
+    }
+
+    return &context->base;
+}
+
+static void
+__glXMesaScreenDestroy(__GLXscreen *screen)
+{
+    __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
+    int i;
+
+    for (i = 0; i < screen->numVisuals; i++) {
+	if (mesaScreen->xm_vis[i])
+	    XMesaDestroyVisual(mesaScreen->xm_vis[i]);
+    }
+
+    xfree(mesaScreen->xm_vis);
+
+    __glXScreenDestroy(screen);
+
+    xfree(screen);
+}
+
+static XMesaVisual
+find_mesa_visual(__GLXscreen *screen, VisualID vid)
+{
+    __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
+    const __GLcontextModes *modes;
+    unsigned i = 0;
+
+    for ( modes = screen->modes ; modes != NULL ; modes = modes->next ) {
+	if ( modes->visualID == vid ) {
+	    break;
+	}
+
+	i++;
+    }
+
+    return (modes != NULL) ? mesaScreen->xm_vis[i] : NULL;
+}
+
+static void init_screen_visuals(__GLXMESAscreen *screen)
+{
+    ScreenPtr pScreen = screen->base.pScreen;
+    __GLcontextModes *modes;
+    XMesaVisual *pXMesaVisual;
+    int *used;
+    int i, j, size;
+
+    /* Alloc space for the list of XMesa visuals */
+    size = screen->base.numVisuals * sizeof(XMesaVisual);
+    pXMesaVisual = (XMesaVisual *) xalloc(size);
+    memset(pXMesaVisual, 0, size);
+
+    /* FIXME: Change 'used' to be a array of bits (rather than of ints),
+     * FIXME: create a stack array of 8 or 16 bytes.  If 'numVisuals' is less
+     * FIXME: than 64 or 128 the stack array can be used instead of calling
+     * FIXME: __glXMalloc / __glXFree.  If nothing else, convert 'used' to
+     * FIXME: array of bytes instead of ints!
+     */
+    used = (int *) xalloc(pScreen->numVisuals * sizeof(int));
+    memset(used, 0, pScreen->numVisuals * sizeof(int));
+
+    i = 0;
+    for ( modes = screen->base.modes; modes != NULL; modes = modes->next ) {
+	const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
+	const int nplanes = (modes->rgbBits - modes->alphaBits);
+	const VisualPtr pVis = pScreen->visuals;
+
+	for (j = 0; j < pScreen->numVisuals; j++) {
+	    if (pVis[j].class     == vis_class &&
+		pVis[j].nplanes   == nplanes &&
+		pVis[j].redMask   == modes->redMask &&
+		pVis[j].greenMask == modes->greenMask &&
+		pVis[j].blueMask  == modes->blueMask &&
+		!used[j]) {
+
+		/* Create the XMesa visual */
+		pXMesaVisual[i] =
+		    XMesaCreateVisual(pScreen,
+				      pVis,
+				      modes->rgbMode,
+				      (modes->alphaBits > 0),
+				      modes->doubleBufferMode,
+				      modes->stereoMode,
+				      GL_TRUE, /* ximage_flag */
+				      modes->depthBits,
+				      modes->stencilBits,
+				      modes->accumRedBits,
+				      modes->accumGreenBits,
+				      modes->accumBlueBits,
+				      modes->accumAlphaBits,
+				      modes->samples,
+				      modes->level,
+				      modes->visualRating);
+		/* Set the VisualID */
+		modes->visualID = pVis[j].vid;
+
+		/* Mark this visual used */
+		used[j] = 1;
+		break;
+	    }
+	}
+
+	if ( j == pScreen->numVisuals ) {
+	    ErrorF("No matching visual for __GLcontextMode with "
+		   "visual class = %d (%d), nplanes = %u\n",
+		   vis_class, 
+		   modes->visualType,
+		   (modes->rgbBits - modes->alphaBits) );
+	}
+	else if ( modes->visualID == -1 ) {
+	    FatalError( "Matching visual found, but visualID still -1!\n" );
+	}
+
+	i++;
+    }
+
+    __glXFree(used);
+
+    screen->xm_vis = pXMesaVisual;
+}
+
+static __GLXscreen *
+__glXMesaScreenProbe(ScreenPtr pScreen)
+{
+    __GLXMESAscreen *screen;
+
+    screen = xalloc(sizeof *screen);
+    if (screen == NULL)
+	return NULL;
+
+    __glXScreenInit(&screen->base, pScreen);
+
+    screen->base.destroy       = __glXMesaScreenDestroy;
+    screen->base.createContext = __glXMesaScreenCreateContext;
+    screen->base.pScreen       = pScreen;
+
+    /*
+     * Find the GLX visuals that are supported by this screen and create
+     * XMesa's visuals.
+     */
+    init_screen_visuals(screen);
+
+    return &screen->base;
+}
+
+__GLXprovider __glXSoftGLProvider = {
+    __glXMesaScreenProbe,
+    "SoftGL",
+    NULL
+};
--- /dev/null	2006-03-16 10:08:51.842272750 -0500
+++ src/mesa/drivers/x11/xorg_glx_util.c	2006-03-16 11:33:12.000000000 -0500
@@ -0,0 +1,152 @@
+/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c,v 1.5 2000/03/02 16:07:39 martin Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+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, sub license, 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Kevin E. Martin <[EMAIL PROTECTED]>
+ *   Brian Paul <[EMAIL PROTECTED]>
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <gcstruct.h>
+#include "pixmapstr.h"
+#include "xorg_glx_util.h"
+#include <X11/Xmd.h>
+
+#ifdef ROUNDUP
+#undef ROUNDUP
+#endif
+
+#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3))
+
+XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data)
+{
+    XMesaImage *image;
+
+    image = (XMesaImage *)xalloc(sizeof(XMesaImage));
+
+    if (image) {
+	image->width = width;
+	image->height = height;
+	image->data = data;
+	/* Always pad to 32 bits */
+	image->bytes_per_line = ROUNDUP((bitsPerPixel * width), 32);
+	image->bits_per_pixel = bitsPerPixel;
+    }
+
+    return image;
+}
+
+void XMesaDestroyImage(XMesaImage *image)
+{
+    if (image->data)
+	free(image->data);
+    xfree(image);
+}
+
+unsigned long XMesaGetPixel(XMesaImage *image, int x, int y)
+{
+    CARD8  *row = (CARD8 *)(image->data + y*image->bytes_per_line);
+    CARD8  *i8;
+    CARD16 *i16;
+    CARD32 *i32;
+    switch (image->bits_per_pixel) {
+    case 8:
+	i8 = (CARD8 *)row;
+	return i8[x];
+	break;
+    case 15:
+    case 16:
+	i16 = (CARD16 *)row;
+	return i16[x];
+	break;
+    case 24: /* WARNING: architecture specific code */
+	i8 = (CARD8 *)row;
+	return (((CARD32)i8[x*3]) |
+		(((CARD32)i8[x*3+1])<<8) |
+		(((CARD32)i8[x*3+2])<<16));
+	break;
+    case 32:
+	i32 = (CARD32 *)row;
+	return i32[x];
+	break;
+    }
+    return 0;
+}
+
+#ifndef XMESA_USE_PUTPIXEL_MACRO
+void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel)
+{
+    CARD8  *row = (CARD8 *)(image->data + y*image->bytes_per_line);
+    CARD8  *i8;
+    CARD16 *i16;
+    CARD32 *i32;
+    switch (image->bits_per_pixel) {
+    case 8:
+	i8 = (CARD8 *)row;
+	i8[x] = (CARD8)pixel;
+	break;
+    case 15:
+    case 16:
+	i16 = (CARD16 *)row;
+	i16[x] = (CARD16)pixel;
+	break;
+    case 24: /* WARNING: architecture specific code */
+	i8 = (CARD8 *)__row;
+	i8[x*3]   = (CARD8)(p);
+	i8[x*3+1] = (CARD8)(p>>8);
+	i8[x*3+2] = (CARD8)(p>>16);
+    case 32:
+	i32 = (CARD32 *)row;
+	i32[x] = (CARD32)pixel;
+	break;
+    }
+}
+#endif
+
+void XMesaPutImageHelper(ScreenPtr display,
+			 DrawablePtr d, GCPtr gc,
+			 XMesaImage *image,
+			 int src_x, int src_y,
+			 int dest_x, int dest_y,
+			 unsigned int width, unsigned int height)
+{
+    /* NOT_DONE: Verify that the following works for all depths */
+    char *src = (image->data +
+		 src_y * image->bytes_per_line +
+		 ((src_x * image->bits_per_pixel) >> 3));
+
+    ValidateGC(d, gc);
+    (*gc->ops->PutImage)(d, gc, d->depth, dest_x, dest_y, width, height,
+			 0, ZPixmap, src);
+}
--- /dev/null	2006-03-16 10:08:51.842272750 -0500
+++ src/mesa/drivers/x11/xorg_glx_util.h	2006-03-16 11:33:10.000000000 -0500
@@ -0,0 +1,106 @@
+/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h,v 1.5 2000/08/10 17:40:29 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+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, sub license, 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Kevin E. Martin <[EMAIL PROTECTED]>
+ *   Brian Paul <[EMAIL PROTECTED]>
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _XF86GLX_UTIL_H_
+#define _XF86GLX_UTIL_H_
+
+#ifdef __CYGWIN__
+#undef WIN32
+#undef _WIN32
+#endif
+
+#include <screenint.h>
+#include <pixmap.h>
+#include <gc.h>
+#include "GL/xmesa.h"
+
+#define XMESA_USE_PUTPIXEL_MACRO
+
+struct _XMesaImageRec {
+    int width, height;
+    char *data;
+    int bytes_per_line; /* Padded to 32 bits */
+    int bits_per_pixel;
+};
+
+extern XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height,
+				    char *data);
+extern void XMesaDestroyImage(XMesaImage *image);
+extern unsigned long XMesaGetPixel(XMesaImage *image, int x, int y);
+#ifdef XMESA_USE_PUTPIXEL_MACRO
+#define XMesaPutPixel(__i,__x,__y,__p) \
+{ \
+    CARD8  *__row = (CARD8 *)(__i->data + __y*__i->bytes_per_line); \
+    CARD8  *__i8; \
+    CARD16 *__i16; \
+    CARD32 *__i32; \
+    switch (__i->bits_per_pixel) { \
+    case 8: \
+	__i8 = (CARD8 *)__row; \
+	__i8[__x] = (CARD8)__p; \
+	break; \
+    case 15: \
+    case 16: \
+	__i16 = (CARD16 *)__row; \
+	__i16[__x] = (CARD16)__p; \
+	break; \
+    case 24: /* WARNING: architecture specific code */ \
+	__i8 = (CARD8 *)__row; \
+	__i8[__x*3]   = (CARD8)(__p); \
+	__i8[__x*3+1] = (CARD8)(__p>>8); \
+	__i8[__x*3+2] = (CARD8)(__p>>16); \
+	break; \
+    case 32: \
+	__i32 = (CARD32 *)__row; \
+	__i32[__x] = (CARD32)__p; \
+	break; \
+    } \
+}
+#else
+extern void XMesaPutPixel(XMesaImage *image, int x, int y,
+			  unsigned long pixel);
+#endif
+
+extern void XMesaPutImageHelper(ScreenPtr display,
+				DrawablePtr d, GCPtr gc,
+				XMesaImage *image,
+				int src_x, int src_y,
+				int dest_x, int dest_y,
+				unsigned int width, unsigned int height);
+
+#endif /* _XF86GLX_UTIL_H_ */
? clog
? make-patch.sh
? GL/glx/config.h
? GL/glx/dispatch.h
? GL/glx/glapi.h
? GL/glx/glapioffsets.h
? GL/glx/glapitable.h
? GL/glx/glapitemp.h
? GL/glx/glheader.h
? GL/glx/glprocs.h
? GL/glx/glthread.h
? GL/glx/glx_ansic.h
? GL/glx/glxinterface.h
? GL/glx/glxsoftgl.c
? GL/glx/mesa-includes.txt
? GL/mesa/X/xf86glx.loT
? doc/Xserver.1x
? hw/dmx/Xdmx.1x
? hw/dmx/config/dmxtodmx.1x
? hw/dmx/config/vdltodmx.1x
? hw/dmx/config/xdmxconfig.1x
Index: configure.ac
===================================================================
RCS file: /cvs/xorg/xserver/xorg/configure.ac,v
retrieving revision 1.172
diff -u -p -r1.172 configure.ac
--- configure.ac	12 Mar 2006 00:11:33 -0000	1.172
+++ configure.ac	16 Mar 2006 17:24:34 -0000
@@ -343,9 +343,6 @@ AC_ARG_WITH(os-name,         AS_HELP_STR
 AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
 				[ OSVENDOR="$withval" ],
 				[ OSVENDOR="" ])
-AC_ARG_WITH(mesa-source,     AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [Path to Mesa source tree]),
-                                [ MESA_SOURCE="$withval" ],
-                                [ MESA_SOURCE="" ])
 AC_ARG_WITH(fontdir,         AS_HELP_STRING([--with-fontdir=FONTDIR], [Path to top level dir where fonts are installed (default: ${libdir}/X11/fonts)]),
                                 [ FONTDIR="$withval" ],
                                 [ FONTDIR="${libdir}/X11/fonts" ])
@@ -547,21 +544,15 @@ if test "x$RES" = xyes; then
 	REQUIRED_MODULES="$REQUIRED_MODULES resourceproto"
 fi
 
-if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then
+if test "x$GLX" = xyes; then
 	PKG_CHECK_MODULES([XLIB], [x11])
 	AC_SUBST(XLIB_CFLAGS)
 	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
-	GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la'
-	test -d GL || mkdir GL
-        $srcdir/GL/symlink-mesa.sh $MESA_SOURCE GL/
-	if test $? -ne 0; then
-		AC_MSG_ERROR([Failed to link Mesa source tree.  Please specify a proper path to Mesa sources, or disable GLX.])
-	fi
+	GLX_LIBS='$(top_builddir)/GL/glx/libglx.la'
 else
         GLX=no
 fi
 AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
-AC_SUBST([MESA_SOURCE])
 
 if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then
 	AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
@@ -1532,20 +1523,6 @@ AC_OUTPUT([
 Makefile
 GL/Makefile
 GL/glx/Makefile
-GL/include/Makefile
-GL/include/GL/Makefile
-GL/mesa/Makefile
-GL/mesa/array_cache/Makefile
-GL/mesa/glapi/Makefile
-GL/mesa/main/Makefile
-GL/mesa/math/Makefile
-GL/mesa/shader/Makefile
-GL/mesa/shader/grammar/Makefile
-GL/mesa/shader/slang/Makefile
-GL/mesa/swrast/Makefile
-GL/mesa/swrast_setup/Makefile
-GL/mesa/tnl/Makefile
-GL/mesa/X/Makefile
 include/Makefile
 afb/Makefile
 composite/Makefile
Index: GL/Makefile.am
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- GL/Makefile.am	17 Oct 2005 07:18:57 -0000	1.6
+++ GL/Makefile.am	16 Mar 2006 17:24:34 -0000
@@ -1,4 +1,4 @@
-SUBDIRS = glx mesa include
+SUBDIRS = glx
 
 # someone could get really crazy someday and add support for the SI...
 
Index: GL/glx/Makefile.am
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/Makefile.am,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile.am
--- GL/glx/Makefile.am	12 Mar 2006 00:11:33 -0000	1.12
+++ GL/glx/Makefile.am	16 Mar 2006 17:24:34 -0000
@@ -5,24 +5,25 @@ endif
 noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY)
 
 AM_CFLAGS = \
-	[EMAIL PROTECTED]@/include \
 	@DIX_CFLAGS@ \
 	@GL_CFLAGS@ \
 	@XLIB_CFLAGS@ \
 	@LIBDRM_CFLAGS@ \
-	@DRIPROTO_CFLAGS@ \
-	[EMAIL PROTECTED]@/src/mesa/glapi \
-	[EMAIL PROTECTED]@/src/mesa/main \
 	@SERVER_DEFINES@ \
 	@MODULE_DEFINES@ \
 	@LOADER_DEFINES@ \
 	-DNO_LIBCWRAPPER
 
-# none yet
-#sdk_HEADERS =
+sdk_HEADERS = \
+	glxserver.h \
+	glxscreens.h \
+	glxdrawable.h \
+	glxcontext.h \
+	glxext.h \
+	glxutil.h \
+	glxerror.h
 
 INCLUDES = \
-	-I$(top_srcdir)/GL/include \
 	-I$(top_srcdir)/hw/xfree86/os-support \
 	-I$(top_srcdir)/hw/xfree86/os-support/bus \
 	-I$(top_srcdir)/hw/xfree86/common \
@@ -58,6 +59,7 @@ libglx_la_SOURCES = \
         glxserver.h \
         glxutil.c \
         glxutil.h \
+	glxsoftgl.c \
         indirect_dispatch.c \
         indirect_dispatch.h \
         indirect_dispatch_swap.c \
Index: GL/glx/glxcmds.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/glxcmds.c,v
retrieving revision 1.12
diff -u -p -r1.12 glxcmds.c
--- GL/glx/glxcmds.c	13 Mar 2006 01:54:59 -0000	1.12
+++ GL/glx/glxcmds.c	16 Mar 2006 17:24:35 -0000
@@ -40,6 +40,7 @@
 #include <dix-config.h>
 #endif
 
+#include <assert.h>
 #include <string.h>
 
 #include "glxserver.h"
@@ -51,7 +52,7 @@
 #include "g_disptab_EXT.h"
 #include "glxutil.h"
 #include "glxext.h"
-#include "GL/glx_ansic.h"
+#include "glx_ansic.h"
 #include "glcontextmodes.h"
 #include "glapitable.h"
 #include "glapi.h"
Index: GL/glx/glxcmdsswap.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/glxcmdsswap.c,v
retrieving revision 1.7
diff -u -p -r1.7 glxcmdsswap.c
--- GL/glx/glxcmdsswap.c	13 Mar 2006 01:54:59 -0000	1.7
+++ GL/glx/glxcmdsswap.c	16 Mar 2006 17:24:35 -0000
@@ -50,7 +50,7 @@
 #include <pixmapstr.h>
 #include <windowstr.h>
 #include "glxext.h"
-#include "GL/glx_ansic.h"
+#include "glx_ansic.h"
 #include "glapitable.h"
 #include "glapi.h"
 #include "glthread.h"
Index: GL/glx/glxdri.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/glxdri.c,v
retrieving revision 1.3
diff -u -p -r1.3 glxdri.c
--- GL/glx/glxdri.c	14 Mar 2006 19:32:27 -0000	1.3
+++ GL/glx/glxdri.c	16 Mar 2006 17:24:35 -0000
@@ -42,8 +42,6 @@
 #define _XF86DRI_SERVER_
 #include <drm_sarea.h>
 #include <xf86drm.h>
-#include <xf86dristr.h>
-#include <xf86str.h>
 #include <xf86.h>
 #include <dri.h>
 
@@ -740,10 +738,13 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     screen->base.createContext = __glXDRIscreenCreateContext;
     screen->base.pScreen       = pScreen;
 
-    /* DRI protocol version. */
-    dri_version.major = XF86DRI_MAJOR_VERSION;
-    dri_version.minor = XF86DRI_MINOR_VERSION;
-    dri_version.patch = XF86DRI_PATCH_VERSION;
+    /* The dri driver shouldn't really worry about dri protocol or abi
+     * version, since it's the loader (either libGL or aiglx) that
+     * talks to the dri module.  We just hardcode something that'll
+     * work with current versions of dri drivers here. */
+    dri_version.major = 4;
+    dri_version.minor = 1;
+    dri_version.patch = 0;
 
     framebuffer.base = NULL;
     framebuffer.dev_priv = NULL;
Index: GL/glx/glxext.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/glxext.c,v
retrieving revision 1.7
diff -u -p -r1.7 glxext.c
--- GL/glx/glxext.c	12 Mar 2006 00:11:33 -0000	1.7
+++ GL/glx/glxext.c	16 Mar 2006 17:24:35 -0000
@@ -32,6 +32,7 @@
 #include "unpack.h"
 #include "glxutil.h"
 #include "glxext.h"
+#include "glx_ansic.h"
 
 static Bool inDispatch;
 
Index: GL/glx/glxscreens.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/glxscreens.c,v
retrieving revision 1.10
diff -u -p -r1.10 glxscreens.c
--- GL/glx/glxscreens.c	12 Mar 2006 00:11:33 -0000	1.10
+++ GL/glx/glxscreens.c	16 Mar 2006 17:24:35 -0000
@@ -45,6 +45,7 @@
 #include "glxserver.h"
 #include "glxutil.h"
 #include "glxext.h"
+#include "glx_ansic.h"
 
 const char GLServerVersion[] = "1.2";
 static const char GLServerExtensions[] = 
Index: GL/glx/glxserver.h
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/glxserver.h,v
retrieving revision 1.7
diff -u -p -r1.7 glxserver.h
--- GL/glx/glxserver.h	12 Mar 2006 00:11:33 -0000	1.7
+++ GL/glx/glxserver.h	16 Mar 2006 17:24:36 -0000
@@ -51,7 +51,6 @@
 #include <extnsionst.h>
 #include <resource.h>
 #include <scrnintstr.h>
-#include "GL/glx_ansic.h"
 
 /*
 ** The X header misc.h defines these math functions.
Index: GL/glx/glxutil.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/glxutil.c,v
retrieving revision 1.7
diff -u -p -r1.7 glxutil.c
--- GL/glx/glxutil.c	13 Mar 2006 01:54:59 -0000	1.7
+++ GL/glx/glxutil.c	16 Mar 2006 17:24:36 -0000
@@ -48,7 +48,7 @@
 #include <pixmapstr.h>
 #include <windowstr.h>
 #include "glxutil.h"
-#include "GL/glx_ansic.h"
+#include "glx_ansic.h"
 #include "GL/internal/glcore.h"
 #include "GL/glxint.h"
 #include "glcontextmodes.h"
Index: GL/glx/glxvisuals.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/glxvisuals.c,v
retrieving revision 1.3
diff -u -p -r1.3 glxvisuals.c
--- GL/glx/glxvisuals.c	13 Mar 2006 01:54:59 -0000	1.3
+++ GL/glx/glxvisuals.c	16 Mar 2006 17:24:36 -0000
@@ -35,6 +35,7 @@
 #include <dix-config.h>
 #endif
 
+#include <assert.h>
 #include <string.h>
 #include <regionstr.h>
 #include <resource.h>
@@ -43,7 +44,6 @@
 #include <GL/glxtokens.h>
 #include <GL/internal/glcore.h>
 #include <scrnintstr.h>
-#include <config.h>
 #include <glxserver.h>
 #include <glxscreens.h>
 #include <glxdrawable.h>
Index: GL/glx/single2.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/single2.c,v
retrieving revision 1.10
diff -u -p -r1.10 single2.c
--- GL/glx/single2.c	10 Feb 2006 22:00:19 -0000	1.10
+++ GL/glx/single2.c	16 Mar 2006 17:24:36 -0000
@@ -48,7 +48,7 @@
 #include "glxext.h"
 #include "indirect_dispatch.h"
 #include "unpack.h"
-#include "GL/glx_ansic.h"
+#include "glx_ansic.h"
 #include "glapitable.h"
 #include "glapi.h"
 #include "glthread.h"
Index: GL/glx/single2swap.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/GL/glx/single2swap.c,v
retrieving revision 1.4
diff -u -p -r1.4 single2swap.c
--- GL/glx/single2swap.c	12 Jan 2006 00:21:59 -0000	1.4
+++ GL/glx/single2swap.c	16 Mar 2006 17:24:36 -0000
@@ -44,7 +44,7 @@
 #include "glxext.h"
 #include "indirect_dispatch.h"
 #include "unpack.h"
-#include "GL/glx_ansic.h"
+#include "glx_ansic.h"
 #include "glapitable.h"
 #include "glapi.h"
 #include "glthread.h"
Index: hw/xfree86/dixmods/Makefile.am
===================================================================
RCS file: /cvs/xorg/xserver/xorg/hw/xfree86/dixmods/Makefile.am,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile.am
--- hw/xfree86/dixmods/Makefile.am	12 Mar 2006 17:14:03 -0000	1.28
+++ hw/xfree86/dixmods/Makefile.am	16 Mar 2006 17:24:37 -0000
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libdixmods.la libxo
 SUBDIRS = extmod
 
 if GLX
-GLXMODS = libglx.la libGLcore.la
+GLXMODS = libglx.la
 endif
 
 if XTRAP
@@ -39,10 +39,6 @@ INCLUDES = @XORG_INCS@ \
            -I$(top_srcdir)/miext/shadow \
            -I$(top_srcdir)/GL/glx
 
-libGLcore_la_LDFLAGS = -avoid-version
-libGLcore_la_LIBADD = $(top_builddir)/GL/mesa/libGLcore.la
-libGLcore_la_SOURCES = GLcoremodule.c
-
 libafb_la_LDFLAGS = -avoid-version
 libafb_la_LIBADD = $(top_builddir)/afb/libafb.la
 libafb_la_SOURCES = afbmodule.c
Index: hw/xfree86/dixmods/glxmodule.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/hw/xfree86/dixmods/glxmodule.c,v
retrieving revision 1.9
diff -u -p -r1.9 glxmodule.c
--- hw/xfree86/dixmods/glxmodule.c	12 Mar 2006 00:11:33 -0000	1.9
+++ hw/xfree86/dixmods/glxmodule.c	16 Mar 2006 17:24:37 -0000
@@ -43,13 +43,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
 #include "micmap.h"
 #include "globals.h"
 
-typedef struct __GLXscreen __GLXscreen;
 typedef struct __GLXprovider __GLXprovider;
-struct __GLXprovider {
-    __GLXscreen *(*screenProbe)(ScreenPtr pScreen);
-    const char    *name;
-    __GLXprovider *next;
-};
+extern __GLXprovider __glXSoftGLProvider;
 
 extern void GlxPushProvider(__GLXprovider *provider);
 extern void GlxExtensionInit(void);
@@ -84,38 +79,6 @@ static XF86ModuleVersionInfo VersRec =
 
 XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL };
 
-/* We do a little proxy dance here, so we can avoid loading GLcore
- * unless we really need to.*/
-
-static pointer glxModule;
-
-static __GLXscreen *
-__glXMesaProxyScreenProbe(ScreenPtr pScreen)
-{
-  pointer GLcore;
-  static __GLXprovider *provider;
-
-  if (provider == NULL) {
-    GLcore = LoadSubModuleLocal(glxModule, "GLcore", NULL, NULL, NULL, NULL, 
-				NULL, NULL);
-    if (GLcore == NULL)
-      return NULL;
-
-    provider = LoaderSymbol("__glXMesaProvider");
-    if (provider == NULL)
-      return NULL;
-  }
-
-  return provider->screenProbe(pScreen);
-}
-
-static __GLXprovider __glXMesaProxyProvider = {
-    __glXMesaProxyScreenProbe,
-    "MESA-PROXY",
-    NULL
-};
-
-
 static pointer
 glxSetup(pointer module, pointer opts, int *errmaj, int *errmin)
 {
@@ -129,8 +92,7 @@ glxSetup(pointer module, pointer opts, i
 
     setupDone = TRUE;
 
-    glxModule = module;
-    GlxPushProvider(&__glXMesaProxyProvider);
+    GlxPushProvider(&__glXSoftGLProvider);
 
     xf86Msg(xf86Info.aiglxFrom, "AIGLX %s\n", 
 	    xf86Info.aiglx ? "enabled" : "disabled");
Index: hw/xfree86/dri/dri.c
===================================================================
RCS file: /cvs/xorg/xserver/xorg/hw/xfree86/dri/dri.c,v
retrieving revision 1.20
diff -u -p -r1.20 dri.c
--- hw/xfree86/dri/dri.c	12 Mar 2006 00:11:34 -0000	1.20
+++ hw/xfree86/dri/dri.c	16 Mar 2006 17:24:37 -0000
@@ -41,6 +41,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
 #include "xf86.h"
 #include <sys/time.h>
 #include <unistd.h>
+#include <string.h>
+#include <stdio.h>
 
 #define NEED_REPLIES
 #define NEED_EVENTS
Index: hw/xfree86/dri/dri.h
===================================================================
RCS file: /cvs/xorg/xserver/xorg/hw/xfree86/dri/dri.h,v
retrieving revision 1.8
diff -u -p -r1.8 dri.h
--- hw/xfree86/dri/dri.h	24 Sep 2005 18:45:45 -0000	1.8
+++ hw/xfree86/dri/dri.h	16 Mar 2006 17:24:37 -0000
@@ -37,7 +37,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
 #ifndef _DRI_H_
 
 #include "scrnintstr.h"
-#include "xf86dri.h"
 
 typedef int DRISyncType;
 
Index: include/dix-config.h.in
===================================================================
RCS file: /cvs/xorg/xserver/xorg/include/dix-config.h.in,v
retrieving revision 1.24
diff -u -p -r1.24 dix-config.h.in
--- include/dix-config.h.in	12 Mar 2006 00:11:34 -0000	1.24
+++ include/dix-config.h.in	16 Mar 2006 17:24:38 -0000
@@ -18,6 +18,9 @@
 /* Default font path */
 #undef COMPILEDDEFAULTFONTPATH
 
+/* Path to loadable modules. */
+#undef DEFAULT_MODULE_PATH
+
 /* Support Composite Extension */
 #undef COMPOSITE
 
Index: include/xorg-config.h.in
===================================================================
RCS file: /cvs/xorg/xserver/xorg/include/xorg-config.h.in,v
retrieving revision 1.13
diff -u -p -r1.13 xorg-config.h.in
--- include/xorg-config.h.in	26 Jan 2006 00:23:44 -0000	1.13
+++ include/xorg-config.h.in	16 Mar 2006 17:24:38 -0000
@@ -48,9 +48,6 @@
 /* Path to configuration file. */
 #undef __XCONFIGFILE__
 
-/* Path to loadable modules. */
-#undef DEFAULT_MODULE_PATH
-
 /* Path to server log file. */
 #undef DEFAULT_LOGPREFIX
 
--- /dev/null	2006-03-16 10:08:51.842272750 -0500
+++ GL/glx/glxsoftgl.c	2006-03-16 12:09:23.000000000 -0500
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2006 Red Hat, Inc
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of Red Hat,
+ * Inc not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission.  Red Hat, Inc makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL RED HAT, INC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <dlfcn.h>
+
+#include "glxserver.h"
+#include "glxutil.h"
+#include "glcontextmodes.h"
+
+/* We do a little proxy dance here, so we can avoid loading GLcore
+ * unless we really need to.*/
+
+static __GLXscreen *
+__glXSoftGLScreenProbe(ScreenPtr pScreen)
+{
+  static __GLXprovider *provider;
+  void *softgl;
+
+  if (provider == NULL) {
+      softgl = dlopen(DEFAULT_MODULE_PATH "/softgl.so",
+		      RTLD_LAZY | RTLD_LOCAL);
+      if (softgl == NULL)
+	  return NULL;
+
+      provider = dlsym(softgl, "__glXSoftGLProvider");
+      if (provider == NULL)
+	  return NULL;
+  }
+
+  return provider->screenProbe(pScreen);
+}
+
+__GLXprovider __glXSoftGLProvider = {
+    __glXSoftGLScreenProbe,
+    "SoftGL",
+    NULL
+};

Reply via email to