Index: configs/linux =================================================================== RCS file: /cvs/mesa/Mesa/configs/linux,v retrieving revision 1.6 diff -u -r1.6 linux --- configs/linux 28 Oct 2005 13:11:00 -0000 1.6 +++ configs/linux 19 Mar 2006 14:57:29 -0000 @@ -16,8 +16,11 @@ ARCH_FLAGS ?= -DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ - -D_BSD_SOURCE -DPTHREADS -DUSE_XSHM +LINUX_SOURCE = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE + +DEFINES = $(LINUX_SOURCE) \ + -DPTHREADS -DUSE_XSHM X11_INCLUDES = -I/usr/X11R6/include Index: configs/linux-dri =================================================================== RCS file: /cvs/mesa/Mesa/configs/linux-dri,v retrieving revision 1.38 diff -u -r1.38 linux-dri --- configs/linux-dri 26 Jan 2006 08:53:32 -0000 1.38 +++ configs/linux-dri 19 Mar 2006 14:57:29 -0000 @@ -19,8 +19,10 @@ # Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. ARCH_FLAGS ?= -DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ - -D_BSD_SOURCE -D_GNU_SOURCE \ +LINUX_SOURCE = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE + +DEFINES = $(LINUX_SOURCE) \ -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \ -DGLX_DIRECT_RENDERING -DHAVE_ALIAS Index: configs/linux-dri-xcb =================================================================== RCS file: /cvs/mesa/Mesa/configs/linux-dri-xcb,v retrieving revision 1.1 diff -u -r1.1 linux-dri-xcb --- configs/linux-dri-xcb 19 Feb 2006 22:31:26 -0000 1.1 +++ configs/linux-dri-xcb 19 Mar 2006 14:57:29 -0000 @@ -19,8 +19,10 @@ # Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. ARCH_FLAGS ?= -DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ - -D_BSD_SOURCE -D_GNU_SOURCE \ +LINUX_SOURCE = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE + +DEFINES = $(LINUX_SOURCE) \ -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \ -DGLX_DIRECT_RENDERING -DHAVE_ALIAS -DUSE_XCB Index: configs/linux-indirect =================================================================== RCS file: /cvs/mesa/Mesa/configs/linux-indirect,v retrieving revision 1.5 diff -u -r1.5 linux-indirect --- configs/linux-indirect 18 Jan 2006 20:57:02 -0000 1.5 +++ configs/linux-indirect 19 Mar 2006 14:57:29 -0000 @@ -21,8 +21,10 @@ # Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. ARCH_FLAGS ?= -DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ - -D_BSD_SOURCE -D_GNU_SOURCE \ +LINUX_SOURCE = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE + +DEFINES = $(LINUX_SOURCE) \ -DPTHREADS -DHAVE_ALIAS X11_INCLUDES = -I/usr/X11R6/include Index: configs/linux-solo =================================================================== RCS file: /cvs/mesa/Mesa/configs/linux-solo,v retrieving revision 1.23 diff -u -r1.23 linux-solo --- configs/linux-solo 26 Jan 2006 08:53:32 -0000 1.23 +++ configs/linux-solo 19 Mar 2006 14:57:29 -0000 @@ -15,8 +15,10 @@ # Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. ARCH_FLAGS ?= -DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ - -D_BSD_SOURCE -D_GNU_SOURCE \ +LINUX_SOURCE = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE + +DEFINES = $(LINUX_SOURCE) \ -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC -DIN_DRI_DRIVER CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ Index: include/GL/xmesa_xf86.h =================================================================== RCS file: /cvs/mesa/Mesa/include/GL/xmesa_xf86.h,v retrieving revision 1.8 diff -u -r1.8 xmesa_xf86.h --- include/GL/xmesa_xf86.h 4 Mar 2004 16:20:38 -0000 1.8 +++ include/GL/xmesa_xf86.h 19 Mar 2006 14:57:29 -0000 @@ -41,6 +41,7 @@ #include "scrnintstr.h" #include "pixmapstr.h" +#include "gcstruct.h" typedef struct _XMesaImageRec XMesaImage; Index: include/GL/internal/glcore.h =================================================================== RCS file: /cvs/mesa/Mesa/include/GL/internal/glcore.h,v retrieving revision 1.8 diff -u -r1.8 glcore.h --- include/GL/internal/glcore.h 6 Jun 2004 02:20:20 -0000 1.8 +++ include/GL/internal/glcore.h 19 Mar 2006 14:57:30 -0000 @@ -168,259 +168,8 @@ /************************************************************************/ -/* -** Structure used for allocating and freeing drawable private memory. -** (like software buffers, for example). -** -** The memory allocation routines are provided by the surrounding -** "operating system" code, and they are to be used for allocating -** software buffers and things which are associated with the drawable, -** and used by any context which draws to that drawable. There are -** separate memory allocation functions for drawables and contexts -** since drawables and contexts can be created and destroyed independently -** of one another, and the "operating system" may want to use separate -** allocation arenas for each. -** -** The freePrivate function is filled in by the core routines when they -** allocates software buffers, and stick them in "private". The freePrivate -** function will destroy anything allocated to this drawable (to be called -** when the drawable is destroyed). -*/ -typedef struct __GLdrawableRegionRec __GLdrawableRegion; -typedef struct __GLdrawableBufferRec __GLdrawableBuffer; typedef struct __GLdrawablePrivateRec __GLdrawablePrivate; -typedef struct __GLregionRectRec { - /* lower left (inside the rectangle) */ - GLint x0, y0; - /* upper right (outside the rectangle) */ - GLint x1, y1; -} __GLregionRect; - -struct __GLdrawableRegionRec { - GLint numRects; - __GLregionRect *rects; - __GLregionRect boundingRect; -}; - -/************************************************************************/ - -/* masks for the buffers */ -#define __GL_FRONT_BUFFER_MASK 0x00000001 -#define __GL_FRONT_LEFT_BUFFER_MASK 0x00000001 -#define __GL_FRONT_RIGHT_BUFFER_MASK 0x00000002 -#define __GL_BACK_BUFFER_MASK 0x00000004 -#define __GL_BACK_LEFT_BUFFER_MASK 0x00000004 -#define __GL_BACK_RIGHT_BUFFER_MASK 0x00000008 -#define __GL_ACCUM_BUFFER_MASK 0x00000010 -#define __GL_DEPTH_BUFFER_MASK 0x00000020 -#define __GL_STENCIL_BUFFER_MASK 0x00000040 -#define __GL_AUX_BUFFER_MASK(i) (0x0000080 << (i)) - -#define __GL_ALL_BUFFER_MASK 0xffffffff - -/* what Resize routines return if resize resorted to fallback case */ -#define __GL_BUFFER_FALLBACK 0x10 - -typedef void (*__GLbufFallbackInitFn)(__GLdrawableBuffer *buf, - __GLdrawablePrivate *glPriv, GLint bits); -typedef void (*__GLbufMainInitFn)(__GLdrawableBuffer *buf, - __GLdrawablePrivate *glPriv, GLint bits, - __GLbufFallbackInitFn back); - -/* -** A drawable buffer -** -** This data structure describes the context side of a drawable. -** -** According to the spec there could be multiple contexts bound to the same -** drawable at the same time (from different threads). In order to avoid -** multiple-access conflicts, locks are used to serialize access. When a -** thread needs to access (read or write) a member of the drawable, it takes -** a lock first. Some of the entries in the drawable are treated "mostly -** constant", so we take the freedom of allowing access to them without -** taking a lock (for optimization reasons). -** -** For more details regarding locking, see buffers.h in the GL core -*/ -struct __GLdrawableBufferRec { - /* - ** Buffer dimensions - */ - GLint width, height, depth; - - /* - ** Framebuffer base address - */ - void *base; - - /* - ** Framebuffer size (in bytes) - */ - GLuint size; - - /* - ** Size (in bytes) of each element in the framebuffer - */ - GLuint elementSize; - GLuint elementSizeLog2; - - /* - ** Element skip from one scanline to the next. - ** If the buffer is part of another buffer (for example, fullscreen - ** front buffer), outerWidth is the width of that buffer. - */ - GLint outerWidth; - - /* - ** outerWidth * elementSize - */ - GLint byteWidth; - - /* - ** Allocation/deallocation is done based on this handle. A handle - ** is conceptually different from the framebuffer 'base'. - */ - void *handle; - - /* imported */ - GLboolean (*resize)(__GLdrawableBuffer *buf, - GLint x, GLint y, GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, GLuint bufferMask); - void (*lock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); - void (*unlock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); - void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, - GLuint val, GLint x, GLint y, GLint w, GLint h); - void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); - - /* exported */ - void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); -#ifdef __cplusplus - void *privatePtr; -#else - void *private; -#endif - - /* private */ - void *other; /* implementation private data */ - __GLbufMainInitFn mainInit; - __GLbufFallbackInitFn fallbackInit; -}; - -/* -** The context side of the drawable private -*/ -struct __GLdrawablePrivateRec { - /* - ** Drawable Modes - */ - __GLcontextModes *modes; - - /* - ** Drawable size - */ - GLuint width, height; - - /* - ** Origin in screen coordinates of the drawable - */ - GLint xOrigin, yOrigin; -#ifdef __GL_ALIGNED_BUFFERS - /* - ** Drawable offset from screen origin - */ - GLint xOffset, yOffset; - - /* - ** Alignment restriction - */ - GLint xAlignment, yAlignment; -#endif - /* - ** Should we invert the y axis? - */ - GLint yInverted; - - /* - ** Mask specifying which buffers are renderable by the hw - */ - GLuint accelBufferMask; - - /* - ** the buffers themselves - */ - __GLdrawableBuffer frontBuffer; - __GLdrawableBuffer backBuffer; - __GLdrawableBuffer accumBuffer; - __GLdrawableBuffer depthBuffer; - __GLdrawableBuffer stencilBuffer; -#if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0) - __GLdrawableBuffer *auxBuffer; -#endif - - __GLdrawableRegion ownershipRegion; - - /* - ** Lock for the drawable private structure - */ - void *lock; -#ifdef DEBUG - /* lock debugging info */ - int lockRefCount; - int lockLine[10]; - char *lockFile[10]; -#endif - - /* imported */ - void *(*malloc)(size_t size); - void *(*calloc)(size_t numElem, size_t elemSize); - void *(*realloc)(void *oldAddr, size_t newSize); - void (*free)(void *addr); - - GLboolean (*addSwapRect)(__GLdrawablePrivate *glPriv, - GLint x, GLint y, GLsizei width, GLsizei height); - void (*setClipRect)(__GLdrawablePrivate *glPriv, - GLint x, GLint y, GLsizei width, GLsizei height); - void (*updateClipRegion)(__GLdrawablePrivate *glPriv); - GLboolean (*resize)(__GLdrawablePrivate *glPriv); - void (*getDrawableSize)(__GLdrawablePrivate *glPriv, - GLint *x, GLint *y, GLuint *width, GLuint *height); - - void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc); - void (*unlockDP)(__GLdrawablePrivate *glPriv); - - /* exported */ -#ifdef __cplusplus - void *privatePtr; -#else - void *private; -#endif - void (*freePrivate)(__GLdrawablePrivate *); - - /* client data */ - void *other; -}; - -/* -** Macros to lock/unlock the drawable private -*/ -#if defined(DEBUG) -#define __GL_LOCK_DP(glPriv,gc) \ - (*(glPriv)->lockDP)(glPriv,gc); \ - (glPriv)->lockLine[(glPriv)->lockRefCount] = __LINE__; \ - (glPriv)->lockFile[(glPriv)->lockRefCount] = __FILE__; \ - (glPriv)->lockRefCount++ -#define __GL_UNLOCK_DP(glPriv) \ - (glPriv)->lockRefCount--; \ - (glPriv)->lockLine[(glPriv)->lockRefCount] = 0; \ - (glPriv)->lockFile[(glPriv)->lockRefCount] = NULL; \ - (*(glPriv)->unlockDP)(glPriv) -#else /* DEBUG */ -#define __GL_LOCK_DP(glPriv,gc) (*(glPriv)->lockDP)(glPriv,gc) -#define __GL_UNLOCK_DP(glPriv) (*(glPriv)->unlockDP)(glPriv) -#endif /* DEBUG */ - - /* ** Procedures which are imported by the GL from the surrounding ** "operating system". Math functions are not considered part of the @@ -495,4 +244,72 @@ extern __GLcontext *__glCoreCreateContext(__GLimports *, __GLcontextModes *); extern void __glCoreNopDispatch(void); +/************************************************************************/ + +#ifdef _NEED_GLCORE_IF +/* + * The GLcore interface (a subset of the XMesa interface) + */ +typedef struct __GLcoreModuleRec { + /* + * XMesaVisual + */ + XMesaVisual (*XMesaCreateVisual)( XMesaDisplay *display, + XMesaVisualInfo 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 ); + + /* + * XMesaContext + */ + XMesaContext (*XMesaCreateContext)( XMesaVisual v, + XMesaContext share_list ); + + void (*XMesaDestroyContext)( XMesaContext c ); + + GLboolean (*XMesaCopyContext)( XMesaContext src, + XMesaContext dst, + GLuint mask ); + + GLboolean (*XMesaForceCurrent)( XMesaContext c ); + + GLboolean (*XMesaLoseCurrent)( XMesaContext c ); + + /* + * XMesaBuffer + */ + XMesaBuffer (*XMesaCreateWindowBuffer)( XMesaVisual v, + WindowPtr w ); + + XMesaBuffer (*XMesaCreatePixmapBuffer)( XMesaVisual v, + PixmapPtr p, + ColormapPtr cmap ); + + void (*XMesaDestroyBuffer)( XMesaBuffer b ); + + GLboolean (*XMesaMakeCurrent2)( XMesaContext c, + XMesaBuffer drawBuffer, + XMesaBuffer readBuffer ); + + void (*XMesaSwapBuffers)( XMesaBuffer b ); + + void (*XMesaResizeBuffers)( XMesaBuffer b ); + +} __GLcoreModule; +#endif /* _NEED_GLCORE_IF */ + #endif /* __gl_core_h_ */ Index: src/mesa/Makefile =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/Makefile,v retrieving revision 1.34 diff -u -r1.34 Makefile --- src/mesa/Makefile 14 Sep 2005 02:18:43 -0000 1.34 +++ src/mesa/Makefile 19 Mar 2006 14:57:31 -0000 @@ -27,12 +27,15 @@ default: @if [ "${DRIVER_DIRS}" = "dri" ] ; then \ $(MAKE) linux-solo ; \ + $(MAKE) softgl ; \ elif [ "${DRIVER_DIRS}" = "osmesa" ] ; then \ $(MAKE) osmesa-only ; \ elif [ "$(DRIVER_DIRS)" = "beos" ]; then \ $(MAKE) beos ; \ elif [ "$(DRIVER_DIRS)" = "directfb" ]; then \ $(MAKE) directfb; \ + elif [ "${DRIVER_DIRS}" = "x11" ] ; then \ + $(MAKE) softgl ; \ else \ $(MAKE) stand-alone ; \ fi @@ -61,6 +64,13 @@ ##################################################################### +# Xorg softgl module + +softgl: depend subdirs libmesa.a + cd drivers/x11 ; $(MAKE) + + +##################################################################### # Stand-alone Mesa libGL, no built-in drivers (DirectFB) libgl-core: $(CORE_OBJECTS) @@ -132,7 +142,6 @@ $(SOLO_SOURCES) \ $(X86_SOURCES) \ $(COMMON_DRIVER_SOURCES)\ - $(X11_DRIVER_SOURCES) \ $(OSMESA_DRIVER_SOURCES) Index: src/mesa/drivers/dri/Makefile.template =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/Makefile.template,v retrieving revision 1.30 diff -u -r1.30 Makefile.template --- src/mesa/drivers/dri/Makefile.template 18 Oct 2005 13:29:59 -0000 1.30 +++ src/mesa/drivers/dri/Makefile.template 19 Mar 2006 14:57:31 -0000 @@ -12,22 +12,14 @@ ../common/drirenderbuffer.c ifeq ($(WINDOW_SYSTEM),dri) -WINOBJ= -WINLIB= -INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) \ - `pkg-config --cflags libdrm` +INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) OBJECTS = $(C_SOURCES:.c=.o) \ $(ASM_SOURCES:.S=.o) else -WINOBJ= -WINLIB=-L$(MESA)/src/glx/mini MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini -INCLUDES = $(MINIGLX_INCLUDES) \ - -I$(DRM_SOURCE_PATH)/shared-core \ - -I$(DRM_SOURCE_PATH)/libdrm \ - $(SHARED_INCLUDES) +INCLUDES = $(MINIGLX_INCLUDES) $(SHARED_INCLUDES) OBJECTS = $(C_SOURCES:.c=.o) \ $(MINIGLX_SOURCES:.c=.o) \ @@ -36,21 +28,19 @@ ### Include directories +DRM_CFLAGS = $(shell pkg-config --cflags libdrm) + SHARED_INCLUDES = \ -I. \ -I$(TOP)/src/mesa/drivers/dri/common \ -Iserver \ - -I$(DRM_SOURCE_PATH)/shared-core \ + $(DRM_CFLAGS) \ -I$(TOP)/include \ -I$(TOP)/include/GL/internal \ -I$(TOP)/src/mesa \ -I$(TOP)/src/mesa/main \ -I$(TOP)/src/mesa/glapi \ - -I$(TOP)/src/mesa/math \ - -I$(TOP)/src/mesa/transform \ -I$(TOP)/src/mesa/shader \ - -I$(TOP)/src/mesa/swrast \ - -I$(TOP)/src/mesa/swrast_setup \ -I$(TOP)/src/egl/main \ -I$(TOP)/src/egl/drivers/dri @@ -68,14 +58,9 @@ default: depend symlinks $(LIBNAME) $(LIB_DIR)/$(LIBNAME) -#$(LIB_DIR)/$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile -# @echo BUILDING FOR: $(WINDOW_SYSTEM) -# $(TOP)/bin/mklib -o $(LIBNAME) -noprefix -install $(LIB_DIR) \ -# $(WINLIB) $(LIB_DEPS) $(WINOBJ) $(MESA_MODULES) $(OBJECTS) - -$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template +$(LIBNAME): $(OBJECTS) $(MESA_MODULES) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template $(TOP)/bin/mklib -noprefix -o $@ \ - $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS) + $(OBJECTS) $(MESA_MODULES) $(DRI_LIB_DEPS) $(LIB_DIR)/$(LIBNAME): $(LIBNAME) Index: src/mesa/drivers/dri/common/dri_util.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/common/dri_util.c,v retrieving revision 1.29 diff -u -r1.29 dri_util.c --- src/mesa/drivers/dri/common/dri_util.c 29 Nov 2005 23:01:43 -0000 1.29 +++ src/mesa/drivers/dri/common/dri_util.c 19 Mar 2006 14:57:32 -0000 @@ -65,29 +65,6 @@ static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate); -/** - * Print message to \c stderr if the \c LIBGL_DEBUG environment variable - * is set. - * - * Is called from the drivers. - * - * \param f \c printf like format string. - */ -void -__driUtilMessage(const char *f, ...) -{ - va_list args; - - if (getenv("LIBGL_DEBUG")) { - fprintf(stderr, "libGL error: \n"); - va_start(args, f); - vfprintf(stderr, f, args); - va_end(args); - fprintf(stderr, "\n"); - } -} - - /*****************************************************************/ /** \name Drawable list management */ /*****************************************************************/ Index: src/mesa/drivers/dri/common/dri_util.h =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/common/dri_util.h,v retrieving revision 1.21 diff -u -r1.21 dri_util.h --- src/mesa/drivers/dri/common/dri_util.h 29 Nov 2005 23:01:43 -0000 1.21 +++ src/mesa/drivers/dri/common/dri_util.h 19 Mar 2006 14:57:32 -0000 @@ -522,10 +522,6 @@ extern void -__driUtilMessage(const char *f, ...); - - -extern void __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp); Index: src/mesa/drivers/dri/common/utils.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/common/utils.c,v retrieving revision 1.20 diff -u -r1.20 utils.c --- src/mesa/drivers/dri/common/utils.c 10 Aug 2005 23:39:42 -0000 1.20 +++ src/mesa/drivers/dri/common/utils.c 19 Mar 2006 14:57:32 -0000 @@ -693,3 +693,26 @@ *ptr_to_modes = modes; return GL_TRUE; } + + +/** + * Print message to \c stderr if the \c LIBGL_DEBUG environment variable + * is set. + * + * Is called from the drivers. + * + * \param f \c printf like format string. + */ +void +__driUtilMessage(const char *f, ...) +{ + va_list args; + + if (getenv("LIBGL_DEBUG")) { + fprintf(stderr, "libGL error: \n"); + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + fprintf(stderr, "\n"); + } +} Index: src/mesa/drivers/dri/common/utils.h =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/common/utils.h,v retrieving revision 1.10 diff -u -r1.10 utils.h --- src/mesa/drivers/dri/common/utils.h 28 Jul 2005 00:29:51 -0000 1.10 +++ src/mesa/drivers/dri/common/utils.h 19 Mar 2006 14:57:32 -0000 @@ -116,4 +116,7 @@ unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes, int visType ); +extern void +__driUtilMessage(const char *f, ...); + #endif /* DRI_DEBUG_H */ Index: src/mesa/drivers/dri/common/xmlconfig.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/common/xmlconfig.c,v retrieving revision 1.9 diff -u -r1.9 xmlconfig.c --- src/mesa/drivers/dri/common/xmlconfig.c 2 Dec 2004 13:29:40 -0000 1.9 +++ src/mesa/drivers/dri/common/xmlconfig.c 19 Mar 2006 14:57:33 -0000 @@ -36,7 +36,7 @@ #include #include #include "imports.h" -#include "dri_util.h" +#include "utils.h" #include "xmlconfig.h" /* Index: src/mesa/drivers/x11/fakeglx.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/x11/fakeglx.c,v retrieving revision 1.115 diff -u -r1.115 fakeglx.c --- src/mesa/drivers/x11/fakeglx.c 1 Mar 2006 15:32:38 -0000 1.115 +++ src/mesa/drivers/x11/fakeglx.c 19 Mar 2006 14:57:35 -0000 @@ -43,7 +43,6 @@ #include "glxheader.h" #include "glxapi.h" #include "GL/xmesa.h" -#include "context.h" #include "config.h" #include "macros.h" #include "imports.h" @@ -1500,7 +1499,7 @@ if (MakeCurrent_PrevContext == src) { _mesa_Flush(); } - _mesa_copy_context( &(xm_src->mesa), &(xm_dst->mesa), (GLuint) mask ); + XMesaCopyContext( xm_src, xm_dst, (GLuint) mask ); } 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 -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 19 Mar 2006 14:57:36 -0000 @@ -37,9 +37,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/xfonts.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/x11/xfonts.c,v retrieving revision 1.17 diff -u -r1.17 xfonts.c --- src/mesa/drivers/x11/xfonts.c 7 Jan 2004 15:18:17 -0000 1.17 +++ src/mesa/drivers/x11/xfonts.c 19 Mar 2006 14:57:36 -0000 @@ -33,7 +33,6 @@ #endif #include "glxheader.h" -#include "context.h" #include "imports.h" #include "xfonts.h" Index: src/mesa/drivers/x11/xm_api.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/x11/xm_api.c,v retrieving revision 1.99 diff -u -r1.99 xm_api.c --- src/mesa/drivers/x11/xm_api.c 16 Mar 2006 18:05:25 -0000 1.99 +++ src/mesa/drivers/x11/xm_api.c 19 Mar 2006 14:57:37 -0000 @@ -83,10 +83,6 @@ #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" -#ifdef XFree86Server -#include -#endif - /* * Global X driver lock */ @@ -177,7 +173,7 @@ /* * Error handling. */ -#ifndef XFree86Server +#if defined(USE_XSHM) && !defined(XFree86Server) static volatile int mesaXErrorFlag = 0; static int mesaHandleXError( XMesaDisplay *dpy, XErrorEvent *event ) @@ -198,9 +194,7 @@ */ static int check_for_xshm( XMesaDisplay *display ) { -#if defined(XFree86Server) - return 0; -#elif defined(USE_XSHM) +#if defined(USE_XSHM) && !defined(XFree86Server) int major, minor, ignore; Bool pixmaps; @@ -1203,9 +1197,6 @@ XMesaColormap cmap ) { struct xmesa_renderbuffer *front_xrb, *back_xrb; -#ifndef XFree86Server - XGCValues gcvalues; -#endif if (b) { assert(b->xm_visual == v); @@ -1321,9 +1312,12 @@ dixChangeGC(NullClient, b->swapgc, GCGraphicsExposures, v, NULL); } #else + { + XGCValues gcvalues; gcvalues.graphics_exposures = False; b->swapgc = XCreateGC( v->display, window, GCGraphicsExposures, &gcvalues); + } #endif XMesaSetFunction( v->display, b->swapgc, GXcopy ); /* @@ -1460,6 +1454,10 @@ /***** Public Functions *****/ /**********************************************************************/ +#ifdef IN_DRI_DRIVER +#include "utils.h" +extern const struct dri_extension card_extensions[]; +#endif /* * Create a new X/Mesa visual. @@ -1505,6 +1503,18 @@ XMesaVisual v; GLint red_bits, green_bits, blue_bits, alpha_bits; + /* + * 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(). + */ +#ifdef IN_DRI_DRIVER + driInitExtensions( NULL, card_extensions, GL_FALSE ); +#endif + /* For debugging only */ if (_mesa_getenv("MESA_XSYNC")) { /* This makes debugging X easier. @@ -1525,8 +1535,7 @@ /* * In the X server, NULL is passed in for the display. It will have - * to be set before using this visual. See XMesaSetVisualDisplay() - * below. + * to be set before using this visual. */ v->display = display; @@ -1633,12 +1642,6 @@ } -void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v ) -{ - v->display = dpy; -} - - void XMesaDestroyVisual( XMesaVisual v ) { #ifndef XFree86Server @@ -1649,6 +1652,15 @@ +#ifdef IN_DRI_DRIVER +#include "extension_helper.h" + +const struct dri_extension card_extensions[] = +{ + { NULL, NULL } +}; +#endif + /** * Create a new XMesaContext. * \param v the XMesaVisual @@ -1686,6 +1698,10 @@ return NULL; } +#ifdef IN_DRI_DRIVER + driInitExtensions( mesaCtx, card_extensions, GL_TRUE ); +#endif + _mesa_enable_sw_extensions(mesaCtx); _mesa_enable_1_3_extensions(mesaCtx); _mesa_enable_1_4_extensions(mesaCtx); @@ -1751,6 +1767,14 @@ +GLboolean XMesaCopyContext( XMesaContext xm_src, XMesaContext xm_dst, GLuint mask ) +{ + _mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask); + return GL_TRUE; +} + + + /* * XXX this isn't a public function! It's a hack for the 3Dfx driver. * Create a new XMesaBuffer from an X window. @@ -2152,6 +2176,9 @@ GLboolean XMesaForceCurrent(XMesaContext c) { + /* GlxSetRenderTables() for XGL */ + _glapi_set_dispatch(c->mesa.CurrentDispatch); + if (c) { if (&(c->mesa) != _mesa_get_current_context()) { _mesa_make_current(&c->mesa, c->mesa.DrawBuffer, c->mesa.ReadBuffer); @@ -2579,15 +2606,6 @@ } -void XMesaReset( void ) -{ - while (XMesaBufferList) - XMesaDestroyBuffer(XMesaBufferList); - - XMesaBufferList = NULL; -} - - unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) Index: src/mesa/drivers/x11/xm_dd.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/x11/xm_dd.c,v retrieving revision 1.88 diff -u -r1.88 xm_dd.c --- src/mesa/drivers/x11/xm_dd.c 24 Feb 2006 17:58:48 -0000 1.88 +++ src/mesa/drivers/x11/xm_dd.c 19 Mar 2006 14:57:38 -0000 @@ -49,10 +49,6 @@ #include "tnl/tnl.h" #include "tnl/t_context.h" -#ifdef XFree86Server -#include -#endif - /* 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 -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 19 Mar 2006 14:57:39 -0000 @@ -27,12 +27,6 @@ #define XMESAP_H -#ifdef XFree86Server -# include "GL/xf86glx.h" -# include "xf86glx_util.h" -#elif defined(USE_XSHM) -# include -#endif #include "GL/xmesa.h" #include "mtypes.h" #if defined(FX) @@ -541,10 +535,11 @@ * These are the extra routines required for integration with XFree86. * None of these routines should be user visible. -KEM */ -extern void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v ); extern GLboolean XMesaForceCurrent(XMesaContext c); extern GLboolean XMesaLoseCurrent(XMesaContext c); -extern void XMesaReset( void ); +extern GLboolean XMesaCopyContext( XMesaContext src, + XMesaContext dst, + GLuint mask ); #define ENABLE_EXT_texure_compression_s3tc 0 /* SW texture compression */ Index: src/mesa/main/context.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/main/context.c,v retrieving revision 1.271 diff -u -r1.271 context.c --- src/mesa/main/context.c 16 Mar 2006 18:05:25 -0000 1.271 +++ src/mesa/main/context.c 19 Mar 2006 14:57:40 -0000 @@ -291,13 +291,7 @@ GLboolean _mesa_notifyResize(__GLcontext *gc) { - GLint x, y; - GLuint width, height; - __GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc); - if (!d || !d->getDrawableSize) - return GL_FALSE; - d->getDrawableSize( d, &x, &y, &width, &height ); - /* update viewport, resize software buffers, etc. */ + (void) gc; return GL_TRUE; }