diff --git a/Makefile b/Makefile index 4171a97..7a5db48 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,13 @@ install: linux-directfb-install: cd src/mesa/drivers/directfb && $(MAKE) install +# Xserver GLcore module +glcore: + cd src/mesa/drivers/x11/glcore ; $(MAKE) + +glcore-install: + cd src/mesa/drivers/x11/glcore ; $(MAKE) install + # If there's no current configuration file $(TOP)/configs/current: @echo diff --git a/configs/freebsd-dri b/configs/freebsd-dri index 1492e4a..ce52a14 100644 --- a/configs/freebsd-dri +++ b/configs/freebsd-dri @@ -30,6 +30,7 @@ LIBDRM_LIB = `pkg-config --libs libdrm` DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat $(LIBDRM_LIB) GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ -lm -lpthread $(LIBDRM_LIB) +GLCORE_LIB_DEPS = -lm -lpthread GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lX11 diff --git a/configs/linux-dri b/configs/linux-dri index 94a3d35..827431d 100644 --- a/configs/linux-dri +++ b/configs/linux-dri @@ -44,8 +44,8 @@ LIBDRM_CFLAGS = `pkg-config --cflags libdrm` LIBDRM_LIB = `pkg-config --libs libdrm` DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ - -lm -lpthread -ldl \ - $(LIBDRM_LIB) + -lm -lpthread -ldl $(LIBDRM_LIB) +GLCORE_LIB_DEPS = -lm -lpthread -ldl # This is now 0 by default since it seems to confuse the hell out of people diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 0ab4fc5..1a827cb 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -107,9 +107,12 @@ OSMESA16_OBJECTS = \ $(OSMESA_DRIVER_OBJECTS) -stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) +stand-alone: depend subdirs libmesa.a \ + $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) \ + $(TOP)/$(LIB_DIR)/$(OSMESA_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/glcore/Makefile b/src/mesa/drivers/x11/glcore/Makefile new file mode 100644 index 0000000..87ccd6f --- /dev/null +++ b/src/mesa/drivers/x11/glcore/Makefile @@ -0,0 +1,86 @@ +# src/mesa/drivers/x11/glcore/Makefile + +TOP = ../../../../.. +include $(TOP)/configs/current + +LIBNAME = libGLcore.so + +SYMLINKS = \ + xm_api.c \ + xm_buffer.c \ + xm_dd.c \ + xm_image.c \ + xm_line.c \ + xm_span.c \ + xm_tri.c + +C_SOURCES = \ + $(SYMLINKS) + +######################################## + +MESA_MODULES = $(TOP)/src/mesa/libmesa.a + +C_SOURCES += ../../common/driverfuncs.c +ifeq ("${DRIVER_DIRS}", "dri") +C_SOURCES += ../../dri/common/utils.c +endif + +OBJECTS = $(C_SOURCES:.c=.o) + +### Include directories +INCLUDES = \ + -I. \ + -I.. \ + -I$(TOP)/src/mesa/drivers/dri/common \ + -I$(TOP)/include \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/main \ + -I$(TOP)/src/mesa/glapi \ + -I$(TOP)/src/mesa/shader \ + `pkg-config --cflags libdrm` \ + `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) $(TOP)/$(LIB_DIR)/$(LIBNAME) + + +$(LIBNAME): $(OBJECTS) $(MESA_MODULES) Makefile + $(TOP)/bin/mklib -noprefix -o $@ \ + $(OBJECTS) $(MESA_MODULES) $(GLCORE_LIB_DEPS) + + +$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME) + $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR) + + +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 ../$@ ./ + +symlinks: $(SYMLINKS) + +include depend diff --git a/src/mesa/drivers/x11/glxheader.h b/src/mesa/drivers/x11/glxheader.h index a402191..15e8390 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/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 6439d13..2e971f5 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1285,6 +1285,64 @@ xmesa_convert_from_x_visual_type( int visualType ) /**********************************************************************/ +#ifdef IN_DRI_DRIVER +#define need_GL_VERSION_1_3 +#define need_GL_VERSION_1_4 +#define need_GL_VERSION_1_5 +#define need_GL_VERSION_2_0 + +/* sw extensions not associated with some GL version */ +#define need_GL_ARB_shader_objects +#define need_GL_ARB_vertex_program +#define need_GL_APPLE_vertex_array_object +#define need_GL_ATI_fragment_shader +#define need_GL_EXT_blend_color +#define need_GL_EXT_blend_minmax +#define need_GL_EXT_convolution +#define need_GL_EXT_depth_bounds_test +#define need_GL_EXT_framebuffer_object +#define need_GL_EXT_framebuffer_blit +#define need_GL_EXT_histogram +#define need_GL_EXT_paletted_texture +#define need_GL_IBM_multimode_draw_arrays +#define need_GL_MESA_resize_buffers +#define need_GL_NV_vertex_program +#define need_GL_NV_fragment_program +#define need_GL_SGI_color_table +#define need_GL_EXT_gpu_program_parameters + +#include "extension_helper.h" +#include "utils.h" + +const struct dri_extension card_extensions[] = +{ + { "GL_VERSION_1_3", GL_VERSION_1_3_functions }, + { "GL_VERSION_1_4", GL_VERSION_1_4_functions }, + { "GL_VERSION_1_5", GL_VERSION_1_5_functions }, + { "GL_VERSION_2_0", GL_VERSION_2_0_functions }, + + { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, + { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, + { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, + { "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions }, + { "GL_EXT_blend_color", GL_EXT_blend_color_functions }, + { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, + { "GL_EXT_convolution", GL_EXT_convolution_functions }, + { "GL_EXT_depth_bounds_test", GL_EXT_depth_bounds_test_functions }, + { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, + { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, + { "GL_EXT_histogram", GL_EXT_histogram_functions }, + { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, + { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, + { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, + { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, + { "GL_NV_fragment_program", GL_NV_fragment_program_functions }, + { "GL_SGI_color_table", GL_SGI_color_table_functions }, + { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, + { NULL, NULL } +}; +#endif + /* * Create a new X/Mesa visual. * Input: display - X11 display @@ -1330,6 +1388,21 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, XMesaVisual v; GLint red_bits, green_bits, blue_bits, alpha_bits; +#ifdef IN_DRI_DRIVER + /* + * DRI drivers call this in driCreateNewScreen(), which is after + * xxxFillInModes() and before filter_modes(). + * + * The equivalent for XMesa is in __glXMesaScreenProbe() before + * init_screen_visuals(), which is the same as at the beginning + * of XMesaCreateVisual(). + * + * There is no need to call driInitExtensions() when the context is + * created since XMesa enables mesa sw extensions on its own. + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); +#endif + #ifndef XFree86Server /* For debugging only */ if (_mesa_getenv("MESA_XSYNC")) { @@ -1506,7 +1579,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) _mesa_enable_1_5_extensions(mesaCtx); _mesa_enable_2_0_extensions(mesaCtx); #if ENABLE_EXT_texure_compression_s3tc - if (c->Mesa_DXTn) { + if (mesaCtx->Mesa_DXTn) { _mesa_enable_extension(mesaCtx, "GL_EXT_texture_compression_s3tc"); _mesa_enable_extension(mesaCtx, "GL_S3_s3tc"); } diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 5815dbf..8b82b60 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 4513853..92f2e5b 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 5abea13..e6426e4 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) diff --git a/src/mesa/sources b/src/mesa/sources index 73fd581..278a22d 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -339,4 +339,6 @@ INCLUDE_DIRS = \ -I$(TOP)/src/mesa/shader/grammar \ -I$(TOP)/src/mesa/shader/slang \ -I$(TOP)/src/mesa/swrast \ - -I$(TOP)/src/mesa/swrast_setup + -I$(TOP)/src/mesa/swrast_setup \ + -I$(TOP)/src/mesa/drivers/dri/common \ + $(LIBDRM_CFLAGS)