glcore: build from mesa
authorGeorge Sapountzis <gsap7@yahoo.gr>
Fri, 18 Apr 2008 14:34:24 +0000 (17:34 +0300)
committerGeorge Sapountzis <gsap7@yahoo.gr>
Wed, 23 Apr 2008 08:12:30 +0000 (11:12 +0300)
12 files changed:
Makefile
configs/autoconf.in
configure.ac
include/GL/internal/glcore.h
src/mesa/Makefile
src/mesa/drivers/x11/glxheader.h
src/mesa/drivers/xorg/.gitignore [new file with mode: 0644]
src/mesa/drivers/xorg/Makefile [new file with mode: 0644]
src/mesa/drivers/xorg/glcore.c [new file with mode: 0644]
src/mesa/glapi/glapi.c
src/mesa/glapi/glthread.c
src/mesa/main/glheader.h

index df8e6a8ab88e3244d47d5f75909d530e5a86f49e..50e8a6e1c924d5d8e70e18b8c21a90bbaed71897 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,13 @@ install:
 linux-directfb-install:
        cd src/mesa/drivers/directfb && $(MAKE) install
 
+# Xserver GLcore module
+glcore:
+       cd src/mesa/drivers/xorg ; $(MAKE)
+
+glcore-install:
+       cd src/mesa/drivers/xorg ; $(MAKE) install
+
 # If there's no current configuration file
 $(TOP)/configs/current:
        @echo
index e5f2fb72c00ec934880746a2d6bee1743df2d082..1bf655ff36314cfafea93ae55992aefd7a478fe4 100644 (file)
@@ -83,6 +83,9 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \
        $(EXTRA_LIB_PATH) @GLW_LIB_DEPS@
 APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
 
+# GLcore dependencies
+GLCORE_LIB_DEPS = $(EXTRA_LIB_PATH) @GLCORE_LIB_DEPS@
+
 # DRI dependencies
 DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
 LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
index 8566384e0c8fce0a3d9ba3f060058d84f197ebba..8f5f0a7cef355424767b5bc09abb2749a0e91202 100644 (file)
@@ -387,6 +387,7 @@ xlib)
         GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
     fi
     GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
+    GLCORE_LIB_DEPS=""
 
     # if static, move the external libraries to the programs
     # and empty the libraries for libGL
@@ -418,13 +419,16 @@ dri)
 
     # need DRM libs, -lpthread, etc.
     GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
+    GLCORE_LIB_DEPS="-lm -lpthread $DLOPEN_LIBS"
     ;;
 osmesa)
     # No libGL for osmesa
     GL_LIB_DEPS=""
+    GLCORE_LIB_DEPS=""
     ;;
 esac
 AC_SUBST(GL_LIB_DEPS)
+AC_SUBST(GLCORE_LIB_DEPS)
 
 dnl
 dnl More X11 setup
index 1bb63c1aee6d0fdbe3d1c6d4f3035815cef5cea5..ae1955a77dd8c3e83815aa01e4ef01c43a374c61 100644 (file)
@@ -181,4 +181,77 @@ typedef struct __GLcontextModesRec {
 #define GLX_TEXTURE_2D_BIT_EXT             0x00000002
 #define GLX_TEXTURE_RECTANGLE_BIT_EXT      0x00000004
 
+
+/************************************************************************/
+
+#ifdef _NEED_GL_CORE_IF
+
+/**
+ * The GLcore interface (a subset of the XMesa interface)
+ */
+#define __GL_CORE "GL_Core"
+
+typedef struct __GLcoreModuleRec {
+    /*
+     * XMesaVisual
+     */
+    XMesaVisual (*XMesaCreateVisual)( ScreenPtr display,
+                                      VisualPtr visinfo,
+                                      GLboolean rgb_flag,
+                                      GLboolean alpha_flag,
+                                      GLboolean db_flag,
+                                      GLboolean stereo_flag,
+                                      GLboolean ximage_flag,
+                                      GLint depth_size,
+                                      GLint stencil_size,
+                                      GLint accum_red_size,
+                                      GLint accum_green_size,
+                                      GLint accum_blue_size,
+                                      GLint accum_alpha_size,
+                                      GLint num_samples,
+                                      GLint level,
+                                      GLint visualCaveat );
+
+    void (*XMesaDestroyVisual)( XMesaVisual v );
+
+    /*
+     * XMesaBuffer
+     */
+    XMesaBuffer (*XMesaCreateWindowBuffer)( XMesaVisual v,
+                                           WindowPtr w );
+
+    XMesaBuffer (*XMesaCreatePixmapBuffer)( XMesaVisual v,
+                                           PixmapPtr p,
+                                           ColormapPtr cmap );
+
+    void (*XMesaDestroyBuffer)( XMesaBuffer b );
+
+    void (*XMesaSwapBuffers)( XMesaBuffer b );
+
+    void (*XMesaResizeBuffers)( XMesaBuffer b );
+
+    /*
+     * XMesaContext
+     */
+    XMesaContext (*XMesaCreateContext)( XMesaVisual v,
+                                       XMesaContext share_list );
+
+    void (*XMesaDestroyContext)( XMesaContext c );
+
+    GLboolean (*XMesaCopyContext)( XMesaContext src,
+                                  XMesaContext dst,
+                                  GLuint mask );
+
+    GLboolean (*XMesaMakeCurrent2)( XMesaContext c,
+                                   XMesaBuffer drawBuffer,
+                                   XMesaBuffer readBuffer );
+
+    GLboolean (*XMesaForceCurrent)( XMesaContext c );
+
+    GLboolean (*XMesaLoseCurrent)( XMesaContext c );
+
+} __GLcoreModule;
+
+#endif /* _NEED_GL_CORE_IF */
+
 #endif /* __gl_core_h_ */
index 695a4160942a98ec15db3d1005bda89cfd0cfd62..633bfb19a3bc69ecf2c213c08e1c41929c0e196b 100644 (file)
@@ -103,9 +103,11 @@ OSMESA16_OBJECTS = \
        $(OSMESA_DRIVER_OBJECTS)
 
 
-stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
+stand-alone: depend subdirs libmesa.a \
+       $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
 
-osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
+osmesa-only: depend subdirs \
+       $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
 
 # Make the GL library
 $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
index a402191f1310f5744e7a7722816ef9024882a615..15e8390583402489f1bbf3d3d57ecc328c94c452 100644 (file)
@@ -34,6 +34,7 @@
 
 #ifdef XFree86Server
 
+# include "xorg-server.h"
 # include "resource.h"
 # include "windowstr.h"
 
diff --git a/src/mesa/drivers/xorg/.gitignore b/src/mesa/drivers/xorg/.gitignore
new file mode 100644 (file)
index 0000000..18a7779
--- /dev/null
@@ -0,0 +1,3 @@
+glxheader.h
+xmesaP.h
+xm_*
diff --git a/src/mesa/drivers/xorg/Makefile b/src/mesa/drivers/xorg/Makefile
new file mode 100644 (file)
index 0000000..7fd7036
--- /dev/null
@@ -0,0 +1,86 @@
+# src/mesa/drivers/xorg/Makefile
+
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = libGLcore.so
+
+SYMLINKS =             \
+       glxheader.h     \
+       xmesaP.h        \
+       xm_api.c        \
+       xm_buffer.c     \
+       xm_dd.c         \
+       xm_image.c      \
+       xm_image.h      \
+       xm_line.c       \
+       xm_span.c       \
+       xm_tri.c
+
+C_SOURCES =            \
+       xm_api.c        \
+       xm_buffer.c     \
+       xm_dd.c         \
+       xm_image.c      \
+       xm_line.c       \
+       xm_span.c       \
+       xm_tri.c        \
+       glcore.c
+
+########################################
+
+MESA_MODULES = $(TOP)/src/mesa/libmesa.a
+
+C_SOURCES += ../common/driverfuncs.c
+
+OBJECTS = $(C_SOURCES:.c=.o)
+
+### Include directories
+INCLUDES = \
+       -I. \
+       -I.. \
+       -I$(TOP)/include \
+       -I$(TOP)/src/mesa \
+       -I$(TOP)/src/mesa/main \
+       -I$(TOP)/src/mesa/glapi \
+       `pkg-config --cflags xorg-server`
+
+# undef 'USE_XSHM' to make it explicit that 'XFree86Server' takes precedence
+DRIVER_DEFINES = -UUSE_XSHM -DXFree86Server
+
+##### RULES #####
+
+.c.o:
+       $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
+
+
+##### TARGETS #####
+
+default: depend symlinks $(LIBNAME)
+
+
+$(LIBNAME): $(OBJECTS) $(MESA_MODULES) Makefile
+       $(TOP)/bin/mklib -noprefix -o $@ \
+               $(OBJECTS) $(MESA_MODULES) $(GLCORE_LIB_DEPS)
+
+
+depend: $(C_SOURCES) $(SYMLINKS)
+       touch depend
+       $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \
+               > /dev/null
+
+
+clean:
+       -rm -f *.o *.so $(SYMLINKS)
+       -rm -f depend depend.bak
+
+install: $(LIBNAME)
+       $(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR)
+       $(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR)
+
+$(SYMLINKS):
+       @[ -e $@ ] || ln -sf ../x11/$@ ./
+
+symlinks: $(SYMLINKS)
+
+include depend
diff --git a/src/mesa/drivers/xorg/glcore.c b/src/mesa/drivers/xorg/glcore.c
new file mode 100644 (file)
index 0000000..a019911
--- /dev/null
@@ -0,0 +1,24 @@
+
+#define _NEED_GL_CORE_IF
+#include <GL/xmesa.h>
+#include <GL/internal/glcore.h>
+#include "xmesaP.h"
+
+PUBLIC
+__GLcoreModule GL_Core = {
+    XMesaCreateVisual,
+    XMesaDestroyVisual,
+
+    XMesaCreateWindowBuffer,
+    XMesaCreatePixmapBuffer,
+    XMesaDestroyBuffer,
+    XMesaSwapBuffers,
+    XMesaResizeBuffers,
+
+    XMesaCreateContext,
+    XMesaDestroyContext,
+    XMesaCopyContext,
+    XMesaMakeCurrent2,
+    XMesaForceCurrent,
+    XMesaLoseCurrent
+};
index 47c57822732e7f15f8c57500f014a4eaf6ebf632..36b09e68e507d2eb1a3c9228519b868427a61bdb 100644 (file)
 
 
 
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 #include "glheader.h"
 #include "glapi.h"
 #include "glapioffsets.h"
index 4513853f5a2b1f4e68726f1cc33e5bf0ab9f8f8f..92f2e5bf560f371f3bcdc5748ff3730f56ec134e 100644 (file)
  */
 
 
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 #include "glheader.h"
 #include "glthread.h"
 
index bab962ad5e120c0ad25fc06df67d33e30090d977..c6f81fdd7e665e3a1c97a33e33a4e61c66ef160e 100644 (file)
 #ifndef GLHEADER_H
 #define GLHEADER_H
 
-/* This allows Mesa to be integrated into XFree86 */
-#ifdef HAVE_DIX_CONFIG_H
-#include "dix-config.h"
-#endif
-
 #include <assert.h>
 #include <ctype.h>
 #if defined(__alpha__) && defined(CCPML)