From 32a2a095f4d8e3be7fa2807cb436bd09e8eb5a75 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Fri, 18 Apr 2008 17:34:24 +0300 Subject: glcore: build from mesa --- Makefile | 7 ++++ configs/autoconf.in | 3 ++ configure.ac | 4 ++ include/GL/internal/glcore.h | 73 ++++++++++++++++++++++++++++++++++ src/mesa/Makefile | 6 ++- src/mesa/drivers/x11/glxheader.h | 1 + src/mesa/drivers/xorg/.gitignore | 3 ++ src/mesa/drivers/xorg/Makefile | 86 ++++++++++++++++++++++++++++++++++++++++ src/mesa/drivers/xorg/glcore.c | 24 +++++++++++ src/mesa/glapi/glapi.c | 4 ++ src/mesa/glapi/glthread.c | 4 ++ src/mesa/main/glheader.h | 5 --- 12 files changed, 213 insertions(+), 7 deletions(-) create mode 100644 src/mesa/drivers/xorg/.gitignore create mode 100644 src/mesa/drivers/xorg/Makefile create mode 100644 src/mesa/drivers/xorg/glcore.c diff --git a/Makefile b/Makefile index df8e6a8ab88..50e8a6e1c92 100644 --- 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 diff --git a/configs/autoconf.in b/configs/autoconf.in index e5f2fb72c00..1bf655ff363 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -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@ diff --git a/configure.ac b/configure.ac index 8566384e0c8..8f5f0a7cef3 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/include/GL/internal/glcore.h b/include/GL/internal/glcore.h index 1bb63c1aee6..ae1955a77dd 100644 --- a/include/GL/internal/glcore.h +++ b/include/GL/internal/glcore.h @@ -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_ */ diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 695a4160942..633bfb19a3b 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -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) diff --git a/src/mesa/drivers/x11/glxheader.h b/src/mesa/drivers/x11/glxheader.h index a402191f131..15e83905834 100644 --- a/src/mesa/drivers/x11/glxheader.h +++ b/src/mesa/drivers/x11/glxheader.h @@ -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 index 00000000000..18a777939c6 --- /dev/null +++ b/src/mesa/drivers/xorg/.gitignore @@ -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 index 00000000000..7fd7036665b --- /dev/null +++ b/src/mesa/drivers/xorg/Makefile @@ -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 index 00000000000..a0199117c67 --- /dev/null +++ b/src/mesa/drivers/xorg/glcore.c @@ -0,0 +1,24 @@ + +#define _NEED_GL_CORE_IF +#include +#include +#include "xmesaP.h" + +PUBLIC +__GLcoreModule GL_Core = { + XMesaCreateVisual, + XMesaDestroyVisual, + + XMesaCreateWindowBuffer, + XMesaCreatePixmapBuffer, + XMesaDestroyBuffer, + XMesaSwapBuffers, + XMesaResizeBuffers, + + XMesaCreateContext, + XMesaDestroyContext, + XMesaCopyContext, + XMesaMakeCurrent2, + XMesaForceCurrent, + XMesaLoseCurrent +}; diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 47c57822732..36b09e68e50 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -50,6 +50,10 @@ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + #include "glheader.h" #include "glapi.h" #include "glapioffsets.h" diff --git a/src/mesa/glapi/glthread.c b/src/mesa/glapi/glthread.c index 4513853f5a2..92f2e5bf560 100644 --- a/src/mesa/glapi/glthread.c +++ b/src/mesa/glapi/glthread.c @@ -29,6 +29,10 @@ */ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + #include "glheader.h" #include "glthread.h" diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index bab962ad5e1..c6f81fdd7e6 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -46,11 +46,6 @@ #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 #include #if defined(__alpha__) && defined(CCPML) -- cgit v1.2.3