diff --git a/GL-Mesa-6.5.3.diff b/GL-Mesa-6.5.3.diff deleted file mode 100644 index 478c816..0000000 --- a/GL-Mesa-6.5.3.diff +++ /dev/null @@ -1,3325 +0,0 @@ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/Makefile.am GL/Makefile.am -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/apple/Makefile.am GL/apple/Makefile.am -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/apple/indirect.c GL/apple/indirect.c -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/Makefile.am GL/glx/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/Makefile.am 2006-11-16 19:01:22.000000000 +0100 -+++ GL/glx/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -14,7 +14,6 @@ - -I@MESA_SOURCE@/src/mesa/glapi \ - -I@MESA_SOURCE@/src/mesa/main \ - -DXFree86Server \ -- -DNO_LIBCWRAPPER \ - @GLX_DEFINES@ \ - @GLX_ARCH_DEFINES@ - -@@ -47,12 +46,13 @@ - glxdrawable.h \ - glxext.c \ - glxext.h \ -- glxvisuals.c \ -+ glxglcore.c \ - glxscreens.c \ - glxscreens.h \ - glxserver.h \ - glxutil.c \ - glxutil.h \ -+ glxvisuals.c \ - indirect_dispatch.c \ - indirect_dispatch.h \ - indirect_dispatch_swap.c \ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxbyteorder.h GL/glx/glxbyteorder.h ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxbyteorder.h 1970-01-01 01:00:00.000000000 +0100 -+++ GL/glx/glxbyteorder.h 2007-04-21 18:21:24.000000000 +0200 -@@ -0,0 +1,61 @@ -+/* -+ * (C) Copyright IBM Corporation 2006, 2007 -+ * 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 -+ * THE COPYRIGHT HOLDERS, THE AUTHORS, AND/OR THEIR 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. -+ */ -+ -+/** -+ * \file glxbyteorder.h -+ * Platform glue for handling byte-ordering issues in GLX protocol. -+ * -+ * \author Ian Romanick -+ */ -+#if !defined(__GLXBYTEORDER_H__) -+#define __GLXBYTEORDER_H__ -+ -+#ifdef HAVE_DIX_CONFIG_H -+#include -+#endif -+ -+#if HAVE_BYTESWAP_H -+#include -+#elif defined(USE_SYS_ENDIAN_H) -+#include -+#elif defined(__APPLE__) -+#include -+#define bswap_16 OSSwapInt16 -+#define bswap_32 OSSwapInt32 -+#define bswap_64 OSSwapInt64 -+#else -+#define bswap_16(value) \ -+ ((((value) & 0xff) << 8) | ((value) >> 8)) -+ -+#define bswap_32(value) \ -+ (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ -+ (uint32_t)bswap_16((uint16_t)((value) >> 16))) -+ -+#define bswap_64(value) \ -+ (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ -+ << 32) | \ -+ (uint64_t)bswap_32((uint32_t)((value) >> 32))) -+#endif -+ -+#endif /* !defined(__GLXBYTEORDER_H__) */ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxcmds.c GL/glx/glxcmds.c -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxcmdsswap.c GL/glx/glxcmdsswap.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxcmdsswap.c 2006-09-18 08:04:17.000000000 +0200 -+++ GL/glx/glxcmdsswap.c 2007-04-21 18:21:24.000000000 +0200 -@@ -496,11 +496,11 @@ - GLXDrawable *drawId; - int *buffer; - -+ __GLX_DECLARE_SWAP_VARIABLES; -+ - (void) drawId; - (void) buffer; - -- __GLX_DECLARE_SWAP_VARIABLES; -- - pc += __GLX_VENDPRIV_HDR_SIZE; - - __GLX_SWAP_SHORT(&req->length); -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxcontext.h GL/glx/glxcontext.h ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxcontext.h 2006-09-18 08:04:17.000000000 +0200 -+++ GL/glx/glxcontext.h 2007-04-21 18:21:24.000000000 +0200 -@@ -40,9 +40,6 @@ - ** - */ - --/* XXX: should be defined somewhere globally */ --#define CAPI -- - #include "GL/internal/glcore.h" - - typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap; -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxdri.c GL/glx/glxdri.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxdri.c 2007-04-09 21:59:09.000000000 +0200 -+++ GL/glx/glxdri.c 2007-04-21 18:21:24.000000000 +0200 -@@ -289,6 +289,19 @@ - &context->driContext); - } - -+static int -+glxCountBits(int word) -+{ -+ int ret = 0; -+ -+ while (word) { -+ ret += (word & 1); -+ word >>= 1; -+ } -+ -+ return ret; -+} -+ - static void - glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height) - { -@@ -482,6 +495,7 @@ - context->base.loseCurrent = __glXDRIcontextLoseCurrent; - context->base.copy = __glXDRIcontextCopy; - context->base.forceCurrent = __glXDRIcontextForceCurrent; -+ context->base.pScreen = screen->base.pScreen; - - context->base.textureFromPixmap = &__glXDRItextureFromPixmap; - -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxext.c GL/glx/glxext.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxext.c 2006-12-01 02:40:10.000000000 +0100 -+++ GL/glx/glxext.c 2007-04-21 18:21:24.000000000 +0200 -@@ -275,7 +275,7 @@ - /* - ** The GL was will call this routine if an error occurs. - */ --void __glXErrorCallBack(__GLinterface *gc, GLenum code) -+void __glXErrorCallBack(GLenum code) - { - errorOccured = GL_TRUE; - } -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxext.h GL/glx/glxext.h ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxext.h 2006-09-18 08:04:17.000000000 +0200 -+++ GL/glx/glxext.h 2007-04-21 18:21:24.000000000 +0200 -@@ -66,7 +66,7 @@ - extern GLboolean __glXFreeContext(__GLXcontext *glxc); - extern void __glXFlushContextCache(void); - --extern void __glXErrorCallBack(__GLinterface *gc, GLenum code); -+extern void __glXErrorCallBack(GLenum code); - extern void __glXClearErrorOccured(void); - extern GLboolean __glXErrorOccured(void); - extern void __glXResetLargeCommandStatus(__GLXclientState*); -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxglcore.c GL/glx/glxglcore.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxglcore.c 1970-01-01 01:00:00.000000000 +0100 -+++ GL/glx/glxglcore.c 2007-04-21 18:21:24.000000000 +0200 -@@ -0,0 +1,409 @@ -+/************************************************************************** -+ -+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 -+ * Brian E. Paul -+ * -+ */ -+ -+#ifdef HAVE_DIX_CONFIG_H -+#include -+#endif -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "glcontextmodes.h" -+#include "os.h" -+ -+typedef struct __GLXMESAscreen __GLXMESAscreen; -+typedef struct __GLXMESAcontext __GLXMESAcontext; -+typedef struct __GLXMESAdrawable __GLXMESAdrawable; -+ -+struct __GLXMESAscreen { -+ __GLXscreen base; -+ int index; -+ int num_vis; -+ 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 != NULL) -+ 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 * -+__glXMesaScreenCreateDrawable(__GLXscreen *screen, -+ DrawablePtr pDraw, -+ XID drawId, -+ __GLcontextModes *modes) -+{ -+ __GLXMESAdrawable *glxPriv; -+ XMesaVisual xm_vis; -+ -+ glxPriv = xalloc(sizeof *glxPriv); -+ if (glxPriv == NULL) -+ return NULL; -+ -+ memset(glxPriv, 0, sizeof *glxPriv); -+ -+ if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, drawId, modes)) { -+ xfree(glxPriv); -+ return NULL; -+ } -+ -+ glxPriv->base.destroy = __glXMesaDrawableDestroy; -+ glxPriv->base.resize = __glXMesaDrawableResize; -+ glxPriv->base.swapBuffers = __glXMesaDrawableSwapBuffers; -+ -+ xm_vis = find_mesa_visual(screen, modes->visualID); -+ if (xm_vis == NULL) { -+ ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", -+ 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); -+ __glXContextDestroy(&context->base); -+ 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; -+ -+ return XMesaCopyContext(src->xmesa, dst->xmesa, mask); -+} -+ -+static int -+__glXMesaContextForceCurrent(__GLXcontext *baseContext) -+{ -+ __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext; -+ -+ /* GlxSetRenderTables() call for XGL moved in XMesaForceCurrent() */ -+ -+ 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; -+ -+ 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 < mesaScreen->num_vis; 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[j], -+ 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++; -+ } -+ -+ xfree(used); -+ -+ screen->num_vis = pScreen->numVisuals; -+ 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.createDrawable = __glXMesaScreenCreateDrawable; -+ 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 __glXMesaProvider = { -+ __glXMesaScreenProbe, -+ "MESA", -+ NULL -+}; -+ -+__GLXprovider * -+GlxGetMesaProvider (void) -+{ -+ return &__glXMesaProvider; -+} -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxscreens.h GL/glx/glxscreens.h ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxscreens.h 2006-09-18 08:04:17.000000000 +0200 -+++ GL/glx/glxscreens.h 2007-04-21 18:21:24.000000000 +0200 -@@ -40,9 +40,6 @@ - ** - */ - --/* XXX: should be defined somewhere globally */ --#define CAPI -- - #include "GL/internal/glcore.h" - - /* -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxutil.h GL/glx/glxutil.h ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/glxutil.h 2007-01-30 07:03:18.000000000 +0100 -+++ GL/glx/glxutil.h 2007-04-21 18:21:24.000000000 +0200 -@@ -60,6 +60,4 @@ - extern void *__glXglDDXScreenInfo(void); - extern void *__glXglDDXExtensionInfo(void); - --extern int glxCountBits(int); -- - #endif /* _glxcmds_h_ */ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_dispatch.c GL/glx/indirect_dispatch.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_dispatch.c 2006-10-25 02:25:19.000000000 +0200 -+++ GL/glx/indirect_dispatch.c 2007-04-21 18:21:24.000000000 +0200 -@@ -33,6 +33,7 @@ - #include "indirect_size_get.h" - #include "indirect_dispatch.h" - #include "glxserver.h" -+#include "glxbyteorder.h" - #include "indirect_util.h" - #include "singlesize.h" - #include "glapitable.h" -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_dispatch.h GL/glx/indirect_dispatch.h ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_dispatch.h 2007-01-30 07:03:18.000000000 +0100 -+++ GL/glx/indirect_dispatch.h 2007-04-21 18:21:24.000000000 +0200 -@@ -211,6 +211,8 @@ - extern HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc); - extern HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc); -+extern HIDDEN void __glXDisp_Rotatef(GLbyte * pc); -+extern HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc); - extern HIDDEN void __glXDisp_TexParameterf(GLbyte * pc); - extern HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc); - extern HIDDEN void __glXDisp_TexParameteri(GLbyte * pc); -@@ -379,8 +381,6 @@ - extern HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc); - extern HIDDEN void __glXDisp_Rotated(GLbyte * pc); - extern HIDDEN void __glXDispSwap_Rotated(GLbyte * pc); --extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc); --extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc); - extern HIDDEN int __glXDisp_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN void __glXDisp_StencilOp(GLbyte * pc); -@@ -519,8 +519,6 @@ - extern HIDDEN void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc); - extern HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc); - extern HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc); --extern HIDDEN int __glXDisp_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); --extern HIDDEN int __glXDispSwap_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN void __glXDisp_SampleMaskSGIS(GLbyte * pc); - extern HIDDEN void __glXDispSwap_SampleMaskSGIS(GLbyte * pc); - extern HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc); -@@ -621,6 +619,8 @@ - extern HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc); - extern HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc); -+extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc); -+extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc); - extern HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc); - extern HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc); - extern HIDDEN void __glXDisp_VertexAttrib3svARB(GLbyte * pc); -@@ -849,8 +849,10 @@ - extern HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); --extern HIDDEN void __glXDisp_Rotatef(GLbyte * pc); --extern HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc); -+extern HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); -+extern HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); -+extern HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); -+extern HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc); -@@ -875,10 +877,6 @@ - extern HIDDEN void __glXDispSwap_Map2f(GLbyte * pc); - extern HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc); - extern HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc); --extern HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); --extern HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); --extern HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); --extern HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); - extern HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_dispatch_swap.c GL/glx/indirect_dispatch_swap.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_dispatch_swap.c 2007-03-05 19:38:58.000000000 +0100 -+++ GL/glx/indirect_dispatch_swap.c 2007-04-21 18:21:24.000000000 +0200 -@@ -28,24 +28,12 @@ - #include - #include - #include --#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) --#include --#elif defined(__OpenBSD__) --#include --#define bswap_16 __swap16 --#define bswap_32 __swap32 --#define bswap_64 __swap64 --#else --#include --#define bswap_16 bswap16 --#define bswap_32 bswap32 --#define bswap_64 bswap64 --#endif - #include - #include "indirect_size.h" - #include "indirect_size_get.h" - #include "indirect_dispatch.h" - #include "glxserver.h" -+#include "glxbyteorder.h" - #include "indirect_util.h" - #include "singlesize.h" - #include "glapitable.h" -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_program.c GL/glx/indirect_program.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_program.c 2007-03-05 19:38:58.000000000 +0100 -+++ GL/glx/indirect_program.c 2007-04-21 18:21:24.000000000 +0200 -@@ -35,6 +35,7 @@ - #endif - - #include "glxserver.h" -+#include "glxbyteorder.h" - #include "glxext.h" - #include "singlesize.h" - #include "unpack.h" -@@ -46,20 +47,6 @@ - #include "dispatch.h" - #include "glapioffsets.h" - --#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) --#include --#elif defined(__OpenBSD__) --#include --#define bswap_16 __swap16 --#define bswap_32 __swap32 --#define bswap_64 __swap64 --#else --#include --#define bswap_16 bswap16 --#define bswap_32 bswap32 --#define bswap_64 bswap64 --#endif -- - static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, - unsigned get_programiv_offset, unsigned get_program_string_offset, - Bool do_swap); -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_reqsize.c GL/glx/indirect_reqsize.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_reqsize.c 2007-01-30 07:03:18.000000000 +0100 -+++ GL/glx/indirect_reqsize.c 2007-04-21 18:21:24.000000000 +0200 -@@ -28,16 +28,10 @@ - - #include - #include "glxserver.h" -+#include "glxbyteorder.h" - #include "indirect_size.h" - #include "indirect_reqsize.h" - --#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) --# include --# define SWAP_32(v) do { (v) = bswap_32(v); } while(0) --#else --# define SWAP_32(v) do { char tmp; swapl(&v, tmp); } while(0) --#endif -- - #define __GLX_PAD(x) (((x) + 3) & ~3) - - #if defined(__CYGWIN__) || defined(__MINGW32__) -@@ -56,15 +50,15 @@ - - - int --__glXCallListsReqSize( const GLbyte * pc, Bool swap ) -+__glXCallListsReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei n = *(GLsizei *)(pc + 0); -- GLenum type = * (GLenum *)(pc + 4); -+ GLsizei n = *(GLsizei *) (pc + 0); -+ GLenum type = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { -- SWAP_32( n ); -- SWAP_32( type ); -+ n = bswap_32(n); -+ type = bswap_32(type); - } - - compsize = __glCallLists_size(type); -@@ -72,22 +66,22 @@ - } - - int --__glXBitmapReqSize( const GLbyte * pc, Bool swap ) -+__glXBitmapReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLsizei width = *(GLsizei *)(pc + 20); -- GLsizei height = *(GLsizei *)(pc + 24); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( width ); -- SWAP_32( height ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLsizei width = *(GLsizei *) (pc + 20); -+ GLsizei height = *(GLsizei *) (pc + 24); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ width = bswap_32(width); -+ height = bswap_32(height); - } - - return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1, -@@ -96,13 +90,13 @@ - } - - int --__glXFogfvReqSize( const GLbyte * pc, Bool swap ) -+__glXFogfvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 0); -+ GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glFogfv_size(pname); -@@ -110,13 +104,13 @@ - } - - int --__glXLightfvReqSize( const GLbyte * pc, Bool swap ) -+__glXLightfvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 4); -+ GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glLightfv_size(pname); -@@ -124,13 +118,13 @@ - } - - int --__glXLightModelfvReqSize( const GLbyte * pc, Bool swap ) -+__glXLightModelfvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 0); -+ GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glLightModelfv_size(pname); -@@ -138,13 +132,13 @@ - } - - int --__glXMaterialfvReqSize( const GLbyte * pc, Bool swap ) -+__glXMaterialfvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 4); -+ GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glMaterialfv_size(pname); -@@ -152,18 +146,18 @@ - } - - int --__glXPolygonStippleReqSize( const GLbyte * pc, Bool swap ) -+__glXPolygonStippleReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); - - if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); - } - - return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, 32, 32, 1, -@@ -172,13 +166,13 @@ - } - - int --__glXTexParameterfvReqSize( const GLbyte * pc, Bool swap ) -+__glXTexParameterfvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 4); -+ GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glTexParameterfv_size(pname); -@@ -186,26 +180,26 @@ - } - - int --__glXTexImage1DReqSize( const GLbyte * pc, Bool swap ) -+__glXTexImage1DReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLenum target = * (GLenum *)(pc + 20); -- GLsizei width = *(GLsizei *)(pc + 32); -- GLenum format = * (GLenum *)(pc + 44); -- GLenum type = * (GLenum *)(pc + 48); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( width ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLenum target = *(GLenum *) (pc + 20); -+ GLsizei width = *(GLsizei *) (pc + 32); -+ GLenum format = *(GLenum *) (pc + 44); -+ GLenum type = *(GLenum *) (pc + 48); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ width = bswap_32(width); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, -@@ -214,28 +208,28 @@ - } - - int --__glXTexImage2DReqSize( const GLbyte * pc, Bool swap ) -+__glXTexImage2DReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLenum target = * (GLenum *)(pc + 20); -- GLsizei width = *(GLsizei *)(pc + 32); -- GLsizei height = *(GLsizei *)(pc + 36); -- GLenum format = * (GLenum *)(pc + 44); -- GLenum type = * (GLenum *)(pc + 48); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( width ); -- SWAP_32( height ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLenum target = *(GLenum *) (pc + 20); -+ GLsizei width = *(GLsizei *) (pc + 32); -+ GLsizei height = *(GLsizei *) (pc + 36); -+ GLenum format = *(GLenum *) (pc + 44); -+ GLenum type = *(GLenum *) (pc + 48); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ width = bswap_32(width); -+ height = bswap_32(height); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, 1, -@@ -244,13 +238,13 @@ - } - - int --__glXTexEnvfvReqSize( const GLbyte * pc, Bool swap ) -+__glXTexEnvfvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 4); -+ GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glTexEnvfv_size(pname); -@@ -258,13 +252,13 @@ - } - - int --__glXTexGendvReqSize( const GLbyte * pc, Bool swap ) -+__glXTexGendvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 4); -+ GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glTexGendv_size(pname); -@@ -272,13 +266,13 @@ - } - - int --__glXTexGenfvReqSize( const GLbyte * pc, Bool swap ) -+__glXTexGenfvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 4); -+ GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glTexGenfv_size(pname); -@@ -286,50 +280,50 @@ - } - - int --__glXPixelMapfvReqSize( const GLbyte * pc, Bool swap ) -+__glXPixelMapfvReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei mapsize = *(GLsizei *)(pc + 4); -+ GLsizei mapsize = *(GLsizei *) (pc + 4); - - if (swap) { -- SWAP_32( mapsize ); -+ mapsize = bswap_32(mapsize); - } - - return __GLX_PAD((mapsize * 4)); - } - - int --__glXPixelMapusvReqSize( const GLbyte * pc, Bool swap ) -+__glXPixelMapusvReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei mapsize = *(GLsizei *)(pc + 4); -+ GLsizei mapsize = *(GLsizei *) (pc + 4); - - if (swap) { -- SWAP_32( mapsize ); -+ mapsize = bswap_32(mapsize); - } - - return __GLX_PAD((mapsize * 2)); - } - - int --__glXDrawPixelsReqSize( const GLbyte * pc, Bool swap ) -+__glXDrawPixelsReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLsizei width = *(GLsizei *)(pc + 20); -- GLsizei height = *(GLsizei *)(pc + 24); -- GLenum format = * (GLenum *)(pc + 28); -- GLenum type = * (GLenum *)(pc + 32); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( width ); -- SWAP_32( height ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLsizei width = *(GLsizei *) (pc + 20); -+ GLsizei height = *(GLsizei *) (pc + 24); -+ GLenum format = *(GLenum *) (pc + 28); -+ GLenum type = *(GLenum *) (pc + 32); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ width = bswap_32(width); -+ height = bswap_32(height); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, 0, width, height, 1, -@@ -338,38 +332,38 @@ - } - - int --__glXPrioritizeTexturesReqSize( const GLbyte * pc, Bool swap ) -+__glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei n = *(GLsizei *)(pc + 0); -+ GLsizei n = *(GLsizei *) (pc + 0); - - if (swap) { -- SWAP_32( n ); -+ n = bswap_32(n); - } - - return __GLX_PAD((n * 4) + (n * 4)); - } - - int --__glXTexSubImage1DReqSize( const GLbyte * pc, Bool swap ) -+__glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLenum target = * (GLenum *)(pc + 20); -- GLsizei width = *(GLsizei *)(pc + 36); -- GLenum format = * (GLenum *)(pc + 44); -- GLenum type = * (GLenum *)(pc + 48); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( width ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLenum target = *(GLenum *) (pc + 20); -+ GLsizei width = *(GLsizei *) (pc + 36); -+ GLenum format = *(GLenum *) (pc + 44); -+ GLenum type = *(GLenum *) (pc + 48); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ width = bswap_32(width); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, -@@ -378,28 +372,28 @@ - } - - int --__glXTexSubImage2DReqSize( const GLbyte * pc, Bool swap ) -+__glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLenum target = * (GLenum *)(pc + 20); -- GLsizei width = *(GLsizei *)(pc + 36); -- GLsizei height = *(GLsizei *)(pc + 40); -- GLenum format = * (GLenum *)(pc + 44); -- GLenum type = * (GLenum *)(pc + 48); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( width ); -- SWAP_32( height ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLenum target = *(GLenum *) (pc + 20); -+ GLsizei width = *(GLsizei *) (pc + 36); -+ GLsizei height = *(GLsizei *) (pc + 40); -+ GLenum format = *(GLenum *) (pc + 44); -+ GLenum type = *(GLenum *) (pc + 48); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ width = bswap_32(width); -+ height = bswap_32(height); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, 1, -@@ -408,26 +402,26 @@ - } - - int --__glXColorTableReqSize( const GLbyte * pc, Bool swap ) -+__glXColorTableReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLenum target = * (GLenum *)(pc + 20); -- GLsizei width = *(GLsizei *)(pc + 28); -- GLenum format = * (GLenum *)(pc + 32); -- GLenum type = * (GLenum *)(pc + 36); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( width ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLenum target = *(GLenum *) (pc + 20); -+ GLsizei width = *(GLsizei *) (pc + 28); -+ GLenum format = *(GLenum *) (pc + 32); -+ GLenum type = *(GLenum *) (pc + 36); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ width = bswap_32(width); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, -@@ -436,13 +430,13 @@ - } - - int --__glXColorTableParameterfvReqSize( const GLbyte * pc, Bool swap ) -+__glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 4); -+ GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glColorTableParameterfv_size(pname); -@@ -450,26 +444,26 @@ - } - - int --__glXColorSubTableReqSize( const GLbyte * pc, Bool swap ) -+__glXColorSubTableReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLenum target = * (GLenum *)(pc + 20); -- GLsizei count = *(GLsizei *)(pc + 28); -- GLenum format = * (GLenum *)(pc + 32); -- GLenum type = * (GLenum *)(pc + 36); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( count ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLenum target = *(GLenum *) (pc + 20); -+ GLsizei count = *(GLsizei *) (pc + 28); -+ GLenum format = *(GLenum *) (pc + 32); -+ GLenum type = *(GLenum *) (pc + 36); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ count = bswap_32(count); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, count, 1, 1, -@@ -478,26 +472,26 @@ - } - - int --__glXConvolutionFilter1DReqSize( const GLbyte * pc, Bool swap ) -+__glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLenum target = * (GLenum *)(pc + 20); -- GLsizei width = *(GLsizei *)(pc + 28); -- GLenum format = * (GLenum *)(pc + 36); -- GLenum type = * (GLenum *)(pc + 40); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( width ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLenum target = *(GLenum *) (pc + 20); -+ GLsizei width = *(GLsizei *) (pc + 28); -+ GLenum format = *(GLenum *) (pc + 36); -+ GLenum type = *(GLenum *) (pc + 40); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ width = bswap_32(width); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, -@@ -506,28 +500,28 @@ - } - - int --__glXConvolutionFilter2DReqSize( const GLbyte * pc, Bool swap ) -+__glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -+ GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -- GLint skip_images = 0; -- GLint skip_rows = * (GLint *)(pc + 8); -- GLint alignment = * (GLint *)(pc + 16); -- GLenum target = * (GLenum *)(pc + 20); -- GLsizei width = *(GLsizei *)(pc + 28); -- GLsizei height = *(GLsizei *)(pc + 32); -- GLenum format = * (GLenum *)(pc + 36); -- GLenum type = * (GLenum *)(pc + 40); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( skip_rows ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( width ); -- SWAP_32( height ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint skip_images = 0; -+ GLint skip_rows = *(GLint *) (pc + 8); -+ GLint alignment = *(GLint *) (pc + 16); -+ GLenum target = *(GLenum *) (pc + 20); -+ GLsizei width = *(GLsizei *) (pc + 28); -+ GLsizei height = *(GLsizei *) (pc + 32); -+ GLenum format = *(GLenum *) (pc + 36); -+ GLenum type = *(GLenum *) (pc + 40); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ skip_rows = bswap_32(skip_rows); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ width = bswap_32(width); -+ height = bswap_32(height); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, 1, -@@ -536,13 +530,13 @@ - } - - int --__glXConvolutionParameterfvReqSize( const GLbyte * pc, Bool swap ) -+__glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 4); -+ GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { -- SWAP_32( pname ); -+ pname = bswap_32(pname); - } - - compsize = __glConvolutionParameterfv_size(pname); -@@ -550,32 +544,32 @@ - } - - int --__glXTexImage3DReqSize( const GLbyte * pc, Bool swap ) -+__glXTexImage3DReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -- GLint image_height = * (GLint *)(pc + 8); -- GLint skip_rows = * (GLint *)(pc + 16); -- GLint skip_images = * (GLint *)(pc + 20); -- GLint alignment = * (GLint *)(pc + 32); -- GLenum target = * (GLenum *)(pc + 36); -- GLsizei width = *(GLsizei *)(pc + 48); -- GLsizei height = *(GLsizei *)(pc + 52); -- GLsizei depth = *(GLsizei *)(pc + 56); -- GLenum format = * (GLenum *)(pc + 68); -- GLenum type = * (GLenum *)(pc + 72); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( image_height ); -- SWAP_32( skip_rows ); -- SWAP_32( skip_images ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( width ); -- SWAP_32( height ); -- SWAP_32( depth ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint row_length = *(GLint *) (pc + 4); -+ GLint image_height = *(GLint *) (pc + 8); -+ GLint skip_rows = *(GLint *) (pc + 16); -+ GLint skip_images = *(GLint *) (pc + 20); -+ GLint alignment = *(GLint *) (pc + 32); -+ GLenum target = *(GLenum *) (pc + 36); -+ GLsizei width = *(GLsizei *) (pc + 48); -+ GLsizei height = *(GLsizei *) (pc + 52); -+ GLsizei depth = *(GLsizei *) (pc + 56); -+ GLenum format = *(GLenum *) (pc + 68); -+ GLenum type = *(GLenum *) (pc + 72); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ image_height = bswap_32(image_height); -+ skip_rows = bswap_32(skip_rows); -+ skip_images = bswap_32(skip_images); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ width = bswap_32(width); -+ height = bswap_32(height); -+ depth = bswap_32(depth); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, depth, -@@ -584,32 +578,32 @@ - } - - int --__glXTexSubImage3DReqSize( const GLbyte * pc, Bool swap ) -+__glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap) - { -- GLint row_length = * (GLint *)(pc + 4); -- GLint image_height = * (GLint *)(pc + 8); -- GLint skip_rows = * (GLint *)(pc + 16); -- GLint skip_images = * (GLint *)(pc + 20); -- GLint alignment = * (GLint *)(pc + 32); -- GLenum target = * (GLenum *)(pc + 36); -- GLsizei width = *(GLsizei *)(pc + 60); -- GLsizei height = *(GLsizei *)(pc + 64); -- GLsizei depth = *(GLsizei *)(pc + 68); -- GLenum format = * (GLenum *)(pc + 76); -- GLenum type = * (GLenum *)(pc + 80); -- -- if (swap) { -- SWAP_32( row_length ); -- SWAP_32( image_height ); -- SWAP_32( skip_rows ); -- SWAP_32( skip_images ); -- SWAP_32( alignment ); -- SWAP_32( target ); -- SWAP_32( width ); -- SWAP_32( height ); -- SWAP_32( depth ); -- SWAP_32( format ); -- SWAP_32( type ); -+ GLint row_length = *(GLint *) (pc + 4); -+ GLint image_height = *(GLint *) (pc + 8); -+ GLint skip_rows = *(GLint *) (pc + 16); -+ GLint skip_images = *(GLint *) (pc + 20); -+ GLint alignment = *(GLint *) (pc + 32); -+ GLenum target = *(GLenum *) (pc + 36); -+ GLsizei width = *(GLsizei *) (pc + 60); -+ GLsizei height = *(GLsizei *) (pc + 64); -+ GLsizei depth = *(GLsizei *) (pc + 68); -+ GLenum format = *(GLenum *) (pc + 76); -+ GLenum type = *(GLenum *) (pc + 80); -+ -+ if (swap) { -+ row_length = bswap_32(row_length); -+ image_height = bswap_32(image_height); -+ skip_rows = bswap_32(skip_rows); -+ skip_images = bswap_32(skip_images); -+ alignment = bswap_32(alignment); -+ target = bswap_32(target); -+ width = bswap_32(width); -+ height = bswap_32(height); -+ depth = bswap_32(depth); -+ format = bswap_32(format); -+ type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, depth, -@@ -618,221 +612,221 @@ - } - - int --__glXDrawBuffersARBReqSize( const GLbyte * pc, Bool swap ) -+__glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei n = *(GLsizei *)(pc + 0); -+ GLsizei imageSize = *(GLsizei *) (pc + 20); - - if (swap) { -- SWAP_32( n ); -+ imageSize = bswap_32(imageSize); - } - -- return __GLX_PAD((n * 4)); -+ return __GLX_PAD(imageSize); - } - - int --__glXPointParameterfvEXTReqSize( const GLbyte * pc, Bool swap ) -+__glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap) - { -- GLenum pname = * (GLenum *)(pc + 0); -- GLsizei compsize; -+ GLsizei imageSize = *(GLsizei *) (pc + 24); - - if (swap) { -- SWAP_32( pname ); -+ imageSize = bswap_32(imageSize); - } - -- compsize = __glPointParameterfvEXT_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return __GLX_PAD(imageSize); - } - - int --__glXCompressedTexImage3DARBReqSize( const GLbyte * pc, Bool swap ) -+__glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei imageSize = *(GLsizei *)(pc + 28); -+ GLsizei imageSize = *(GLsizei *) (pc + 28); - - if (swap) { -- SWAP_32( imageSize ); -+ imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); - } - - int --__glXCompressedTexImage2DARBReqSize( const GLbyte * pc, Bool swap ) -+__glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei imageSize = *(GLsizei *)(pc + 24); -+ GLsizei imageSize = *(GLsizei *) (pc + 36); - - if (swap) { -- SWAP_32( imageSize ); -+ imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); - } - - int --__glXCompressedTexImage1DARBReqSize( const GLbyte * pc, Bool swap ) -+__glXProgramStringARBReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei imageSize = *(GLsizei *)(pc + 20); -+ GLsizei len = *(GLsizei *) (pc + 8); - - if (swap) { -- SWAP_32( imageSize ); -+ len = bswap_32(len); - } - -- return __GLX_PAD(imageSize); -+ return __GLX_PAD(len); - } - - int --__glXCompressedTexSubImage3DARBReqSize( const GLbyte * pc, Bool swap ) -+__glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei imageSize = *(GLsizei *)(pc + 36); -+ GLsizei n = *(GLsizei *) (pc + 0); - - if (swap) { -- SWAP_32( imageSize ); -+ n = bswap_32(n); - } - -- return __GLX_PAD(imageSize); -+ return __GLX_PAD((n * 4)); - } - - int --__glXLoadProgramNVReqSize( const GLbyte * pc, Bool swap ) -+__glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei len = *(GLsizei *)(pc + 8); -+ GLenum pname = *(GLenum *) (pc + 0); -+ GLsizei compsize; - - if (swap) { -- SWAP_32( len ); -+ pname = bswap_32(pname); - } - -- return __GLX_PAD(len); -+ compsize = __glPointParameterfvEXT_size(pname); -+ return __GLX_PAD((compsize * 4)); - } - - int --__glXProgramParameters4dvNVReqSize( const GLbyte * pc, Bool swap ) -+__glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap) - { -- GLuint num = * (GLuint *)(pc + 8); -+ GLuint num = *(GLuint *) (pc + 8); - - if (swap) { -- SWAP_32( num ); -+ num = bswap_32(num); - } - - return __GLX_PAD((num * 32)); - } - - int --__glXProgramParameters4fvNVReqSize( const GLbyte * pc, Bool swap ) -+__glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap) - { -- GLuint num = * (GLuint *)(pc + 8); -+ GLuint num = *(GLuint *) (pc + 8); - - if (swap) { -- SWAP_32( num ); -+ num = bswap_32(num); - } - - return __GLX_PAD((num * 16)); - } - - int --__glXVertexAttribs1dvNVReqSize( const GLbyte * pc, Bool swap ) -+__glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei n = *(GLsizei *)(pc + 4); -+ GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { -- SWAP_32( n ); -+ n = bswap_32(n); - } - - return __GLX_PAD((n * 8)); - } - - int --__glXVertexAttribs2dvNVReqSize( const GLbyte * pc, Bool swap ) -+__glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei n = *(GLsizei *)(pc + 4); -+ GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { -- SWAP_32( n ); -+ n = bswap_32(n); - } - - return __GLX_PAD((n * 16)); - } - - int --__glXVertexAttribs3dvNVReqSize( const GLbyte * pc, Bool swap ) -+__glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei n = *(GLsizei *)(pc + 4); -+ GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { -- SWAP_32( n ); -+ n = bswap_32(n); - } - - return __GLX_PAD((n * 24)); - } - - int --__glXVertexAttribs3fvNVReqSize( const GLbyte * pc, Bool swap ) -+__glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei n = *(GLsizei *)(pc + 4); -+ GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { -- SWAP_32( n ); -+ n = bswap_32(n); - } - - return __GLX_PAD((n * 12)); - } - - int --__glXVertexAttribs3svNVReqSize( const GLbyte * pc, Bool swap ) -+__glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei n = *(GLsizei *)(pc + 4); -+ GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { -- SWAP_32( n ); -+ n = bswap_32(n); - } - - return __GLX_PAD((n * 6)); - } - - int --__glXVertexAttribs4dvNVReqSize( const GLbyte * pc, Bool swap ) -+__glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei n = *(GLsizei *)(pc + 4); -+ GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { -- SWAP_32( n ); -+ n = bswap_32(n); - } - - return __GLX_PAD((n * 32)); - } - - int --__glXProgramNamedParameter4fvNVReqSize( const GLbyte * pc, Bool swap ) -+__glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap) - { -- GLsizei len = *(GLsizei *)(pc + 4); -+ GLsizei len = *(GLsizei *) (pc + 4); - - if (swap) { -- SWAP_32( len ); -+ len = bswap_32(len); - } - - return __GLX_PAD(len); - } - --ALIAS( Fogiv, Fogfv ) --ALIAS( Lightiv, Lightfv ) --ALIAS( LightModeliv, LightModelfv ) --ALIAS( Materialiv, Materialfv ) --ALIAS( TexParameteriv, TexParameterfv ) --ALIAS( TexEnviv, TexEnvfv ) --ALIAS( TexGeniv, TexGenfv ) --ALIAS( PixelMapuiv, PixelMapfv ) --ALIAS( ColorTableParameteriv, ColorTableParameterfv ) --ALIAS( ConvolutionParameteriv, ConvolutionParameterfv ) --ALIAS( CompressedTexSubImage2DARB, CompressedTexImage3DARB ) --ALIAS( CompressedTexSubImage1DARB, CompressedTexImage1DARB ) --ALIAS( RequestResidentProgramsNV, DrawBuffersARB ) --ALIAS( VertexAttribs1fvNV, PixelMapfv ) --ALIAS( VertexAttribs1svNV, PixelMapusv ) --ALIAS( VertexAttribs2fvNV, VertexAttribs1dvNV ) --ALIAS( VertexAttribs2svNV, PixelMapfv ) --ALIAS( VertexAttribs4fvNV, VertexAttribs2dvNV ) --ALIAS( VertexAttribs4svNV, VertexAttribs1dvNV ) --ALIAS( VertexAttribs4ubvNV, PixelMapfv ) --ALIAS( PointParameterivNV, PointParameterfvEXT ) --ALIAS( ProgramStringARB, LoadProgramNV ) --ALIAS( ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB ) --ALIAS( DeleteRenderbuffersEXT, DrawBuffersARB ) --ALIAS( DeleteFramebuffersEXT, DrawBuffersARB ) -+ALIAS(Fogiv, Fogfv) -+ ALIAS(Lightiv, Lightfv) -+ ALIAS(LightModeliv, LightModelfv) -+ ALIAS(Materialiv, Materialfv) -+ ALIAS(TexParameteriv, TexParameterfv) -+ ALIAS(TexEnviv, TexEnvfv) -+ ALIAS(TexGeniv, TexGenfv) -+ ALIAS(PixelMapuiv, PixelMapfv) -+ ALIAS(ColorTableParameteriv, ColorTableParameterfv) -+ ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) -+ ALIAS(CompressedTexSubImage1DARB, CompressedTexImage1DARB) -+ ALIAS(CompressedTexSubImage2DARB, CompressedTexImage3DARB) -+ ALIAS(LoadProgramNV, ProgramStringARB) -+ ALIAS(RequestResidentProgramsNV, DrawBuffersARB) -+ ALIAS(VertexAttribs1fvNV, PixelMapfv) -+ ALIAS(VertexAttribs1svNV, PixelMapusv) -+ ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV) -+ ALIAS(VertexAttribs2svNV, PixelMapfv) -+ ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV) -+ ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV) -+ ALIAS(VertexAttribs4ubvNV, PixelMapfv) -+ ALIAS(PointParameterivNV, PointParameterfvEXT) -+ ALIAS(ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB) -+ ALIAS(DeleteFramebuffersEXT, DrawBuffersARB) -+ ALIAS(DeleteRenderbuffersEXT, DrawBuffersARB) -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_reqsize.h GL/glx/indirect_reqsize.h ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_reqsize.h 2006-06-06 19:13:51.000000000 +0200 -+++ GL/glx/indirect_reqsize.h 2007-04-21 18:21:24.000000000 +0200 -@@ -83,14 +83,15 @@ - extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap); --extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); --extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); --extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap); --extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap); --extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap); --extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap); -+extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap); -+extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap); -+extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap); -+extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap); -+extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap); -+extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); -+extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap); -@@ -109,11 +110,10 @@ - extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap); --extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap); --extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap); --extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); -+extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap); - extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap); -+extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); - - # undef HIDDEN - # undef PURE -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_size_get.c GL/glx/indirect_size_get.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_size_get.c 2006-10-25 02:25:19.000000000 +0200 -+++ GL/glx/indirect_size_get.c 2007-04-21 18:21:24.000000000 +0200 -@@ -370,6 +370,7 @@ - case GL_PROJECTION_STACK_DEPTH: - case GL_TEXTURE_STACK_DEPTH: - case GL_ATTRIB_STACK_DEPTH: -+ case GL_CLIENT_ATTRIB_STACK_DEPTH: - case GL_ALPHA_TEST: - case GL_ALPHA_TEST_FUNC: - case GL_ALPHA_TEST_REF: -@@ -448,6 +449,7 @@ - case GL_MAX_NAME_STACK_DEPTH: - case GL_MAX_PROJECTION_STACK_DEPTH: - case GL_MAX_TEXTURE_STACK_DEPTH: -+ case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - case GL_SUBPIXEL_BITS: - case GL_INDEX_BITS: - case GL_RED_BITS: -@@ -639,7 +641,7 @@ - case GL_PROGRAM_ERROR_POSITION_ARB: - case GL_DEPTH_CLAMP_NV: - case GL_NUM_COMPRESSED_TEXTURE_FORMATS: --/* case GL_NUM_TEXTURE_COMPRESSED_FORMATS_ARB:*/ -+/* case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:*/ - case GL_MAX_VERTEX_UNITS_ARB: - case GL_ACTIVE_VERTEX_UNITS_ARB: - case GL_WEIGHT_SUM_UNITY_ARB: -@@ -699,6 +701,8 @@ - /* case GL_POINT_SPRITE_NV:*/ - case GL_POINT_SPRITE_R_MODE_NV: - case GL_MAX_VERTEX_ATTRIBS_ARB: -+ case GL_MAX_TEXTURE_COORDS_ARB: -+ case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - case GL_DEPTH_BOUNDS_TEST_EXT: - case GL_STENCIL_TEST_TWO_SIDE_EXT: - case GL_ACTIVE_STENCIL_FACE_EXT: -@@ -1005,8 +1009,6 @@ - case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: -- case GL_MAX_TEXTURE_COORDS_ARB: -- case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - case GL_PROGRAM_FORMAT_ARB: - case GL_PROGRAM_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_INSTRUCTIONS_ARB: -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_table.c GL/glx/indirect_table.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_table.c 2007-01-30 07:03:18.000000000 +0100 -+++ GL/glx/indirect_table.c 2007-04-21 18:21:24.000000000 +0200 -@@ -1231,8 +1231,8 @@ - }; - - /*****************************************************************/ --/* tree depth = 12 */ --static const int_fast16_t VendorPriv_dispatch_tree[152] = { -+/* tree depth = 13 */ -+static const int_fast16_t VendorPriv_dispatch_tree[155] = { - /* [0] -> opcode range [0, 131072], node depth 1 */ - 2, - 5, -@@ -1474,12 +1474,17 @@ - - /* [149] -> opcode range [65536, 65568], node depth 12 */ - 1, -+ 152, -+ EMPTY_LEAF, -+ -+ /* [152] -> opcode range [65536, 65552], node depth 13 */ -+ 1, - LEAF(88), - EMPTY_LEAF, - - }; - --static const void *VendorPriv_function_table[104][2] = { -+static const void *VendorPriv_function_table[96][2] = { - /* [ 0] = 0 */ {NULL, NULL}, - /* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT}, - /* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT}, -@@ -1576,14 +1581,6 @@ - /* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX}, - /* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX}, - /* [ 95] = 65543 */ {NULL, NULL}, -- /* [ 96] = 65544 */ {NULL, NULL}, -- /* [ 97] = 65545 */ {NULL, NULL}, -- /* [ 98] = 65546 */ {__glXDisp_GetDrawableAttributesSGIX, __glXDispSwap_GetDrawableAttributesSGIX}, -- /* [ 99] = 65547 */ {NULL, NULL}, -- /* [ 100] = 65548 */ {NULL, NULL}, -- /* [ 101] = 65549 */ {NULL, NULL}, -- /* [ 102] = 65550 */ {NULL, NULL}, -- /* [ 103] = 65551 */ {NULL, NULL}, - }; - - const struct __glXDispatchInfo VendorPriv_dispatch_info = { -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_texture_compression.c GL/glx/indirect_texture_compression.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_texture_compression.c 2007-03-05 19:38:58.000000000 +0100 -+++ GL/glx/indirect_texture_compression.c 2007-04-21 18:21:24.000000000 +0200 -@@ -29,6 +29,7 @@ - #endif - - #include "glxserver.h" -+#include "glxbyteorder.h" - #include "glxext.h" - #include "singlesize.h" - #include "unpack.h" -@@ -39,20 +40,6 @@ - #include "glthread.h" - #include "dispatch.h" - --#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) --#include --#elif defined(__OpenBSD__) --#include --#define bswap_16 __swap16 --#define bswap_32 __swap32 --#define bswap_64 __swap64 --#else --#include --#define bswap_16 bswap16 --#define bswap_32 bswap32 --#define bswap_64 bswap64 --#endif -- - int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *pc) - { - xGLXSingleReq * const req = (xGLXSingleReq *) pc; -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_util.c GL/glx/indirect_util.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/indirect_util.c 2007-01-30 07:03:18.000000000 +0100 -+++ GL/glx/indirect_util.c 2007-04-21 18:21:24.000000000 +0200 -@@ -23,29 +23,21 @@ - * SOFTWARE. - */ - -+#ifdef HAVE_DIX_CONFIG_H -+#include -+#endif -+ - #include - - #include - #include - #include --#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) --#include --#elif defined(__OpenBSD__) --#include --#define bswap_16 __swap16 --#define bswap_32 __swap32 --#define bswap_64 __swap64 --#else --#include --#define bswap_16 bswap16 --#define bswap_32 bswap32 --#define bswap_64 bswap64 --#endif - #include - #include "indirect_size.h" - #include "indirect_size_get.h" - #include "indirect_dispatch.h" - #include "glxserver.h" -+#include "glxbyteorder.h" - #include "singlesize.h" - #include "glapitable.h" - #include "glapi.h" -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/swap_interval.c GL/glx/swap_interval.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/glx/swap_interval.c 2007-03-05 19:38:58.000000000 +0100 -+++ GL/glx/swap_interval.c 2007-04-21 18:21:24.000000000 +0200 -@@ -39,20 +39,7 @@ - #include "glthread.h" - #include "dispatch.h" - #include "glapioffsets.h" -- --#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) --#include --#elif defined(__OpenBSD__) --#include --#define bswap_16 __swap16 --#define bswap_32 __swap32 --#define bswap_64 __swap64 --#else --#include --#define bswap_16 bswap16 --#define bswap_32 bswap32 --#define bswap_64 bswap64 --#endif -+#include "glxbyteorder.h" - - static int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap); - -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/Makefile.am GL/mesa/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/Makefile.am 2006-06-06 19:13:51.000000000 +0200 -+++ GL/mesa/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -1,15 +1,15 @@ --SUBDIRS = main math array_cache swrast swrast_setup tnl shader X glapi -+SUBDIRS = main math swrast swrast_setup tnl shader X glapi vbo - - noinst_LTLIBRARIES = libGLcore.la - - libGLcore_la_SOURCES = dummy.c - libGLcore_la_LIBADD = main/libmain.la \ - math/libmath.la \ -- array_cache/libac.la \ - swrast/libswrast.la \ - swrast_setup/libss.la \ - tnl/libtnl.la \ - shader/libshader.la \ - shader/grammar/libgrammar.la \ - shader/slang/libslang.la \ -+ vbo/libvbo.la \ - X/libX.la -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/Makefile.am GL/mesa/X/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/X/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -2,7 +2,6 @@ - - INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ -- -I../array_cache \ - -I../glapi \ - -I../main \ - -I../math \ -@@ -21,18 +20,13 @@ - AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ -- @GLX_DEFINES@ \ -- -DXFree86Server -- --libX_la_SOURCES = xf86glx.c \ -- xf86glx_util.c \ -- xf86glx_util.h \ -- xf86glxint.h -+ @GLX_DEFINES@ - - nodist_libX_la_SOURCES = \ - xm_api.c \ - xm_buffer.c \ - xm_dd.c \ -+ xm_image.c \ - xm_line.c \ - xm_span.c \ - xm_tri.c \ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/xf86glx.c GL/mesa/X/xf86glx.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/xf86glx.c 2007-01-30 07:56:27.000000000 +0100 -+++ GL/mesa/X/xf86glx.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,432 +0,0 @@ --/************************************************************************** -- --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 -- * Brian E. Paul -- * -- */ -- --#ifdef HAVE_DIX_CONFIG_H --#include --#endif -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include "context.h" --#include "xmesaP.h" --#include "context.h" -- --#include "glcontextmodes.h" --#include "os.h" -- --/* -- * This define is for the glcore.h header file. -- * If you add it here, then make sure you also add it in -- * ../../../glx/Imakefile. -- */ --#if 0 --#define DEBUG --#include --#undef DEBUG --#else --#include --#endif -- --typedef struct __GLXMESAscreen __GLXMESAscreen; --typedef struct __GLXMESAcontext __GLXMESAcontext; --typedef struct __GLXMESAdrawable __GLXMESAdrawable; -- --struct __GLXMESAscreen { -- __GLXscreen base; -- int index; -- int num_vis; -- 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 != NULL) -- 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 * --__glXMesaScreenCreateDrawable(__GLXscreen *screen, -- DrawablePtr pDraw, -- XID drawId, -- __GLcontextModes *modes) --{ -- __GLXMESAdrawable *glxPriv; -- XMesaVisual xm_vis; -- -- glxPriv = xalloc(sizeof *glxPriv); -- if (glxPriv == NULL) -- return NULL; -- -- memset(glxPriv, 0, sizeof *glxPriv); -- -- if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, drawId, modes)) { -- xfree(glxPriv); -- return NULL; -- } -- -- glxPriv->base.destroy = __glXMesaDrawableDestroy; -- glxPriv->base.resize = __glXMesaDrawableResize; -- glxPriv->base.swapBuffers = __glXMesaDrawableSwapBuffers; -- -- xm_vis = find_mesa_visual(screen, modes->visualID); -- if (xm_vis == NULL) { -- ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", -- 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); -- __glXContextDestroy(&context->base); -- 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; -- -- GlxSetRenderTables (context->xmesa->mesa.CurrentDispatch); -- -- 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; -- -- 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 < mesaScreen->num_vis; 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[j], -- 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++; -- } -- -- xfree(used); -- -- screen->num_vis = pScreen->numVisuals; -- 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.createDrawable = __glXMesaScreenCreateDrawable; -- 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 __glXMesaProvider = { -- __glXMesaScreenProbe, -- "MESA", -- NULL --}; -- --__GLXprovider * --GlxGetMesaProvider (void) --{ -- return &__glXMesaProvider; --} -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/xf86glx_util.c GL/mesa/X/xf86glx_util.c ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/xf86glx_util.c 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/X/xf86glx_util.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,151 +0,0 @@ --/************************************************************************** -- --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 -- * Brian Paul -- */ -- --#ifdef HAVE_DIX_CONFIG_H --#include --#endif -- --#include -- --#include --#include "pixmapstr.h" --#include "xf86glx_util.h" --#include -- --#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); --} -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/xf86glx_util.h GL/mesa/X/xf86glx_util.h ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/xf86glx_util.h 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/X/xf86glx_util.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,105 +0,0 @@ --/************************************************************************** -- --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 -- * Brian Paul -- */ -- --#ifdef HAVE_DIX_CONFIG_H --#include --#endif -- --#ifndef _XF86GLX_UTIL_H_ --#define _XF86GLX_UTIL_H_ -- --#ifdef __CYGWIN__ --#undef WIN32 --#undef _WIN32 --#endif -- --#include --#include --#include --#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_ */ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/xf86glxint.h GL/mesa/X/xf86glxint.h ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/X/xf86glxint.h 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/X/xf86glxint.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,45 +0,0 @@ --/************************************************************************** -- --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 -- * -- */ -- --#ifdef HAVE_DIX_CONFIG_H --#include --#endif -- --#ifndef _XF86GLXINT_H_ --#define _XF86GLXINT_H_ -- --#include --#include --#include -- --#endif /* _XF86GLXINT_H_ */ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/array_cache/Makefile.am GL/mesa/array_cache/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/array_cache/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/array_cache/Makefile.am 1970-01-01 01:00:00.000000000 +0100 -@@ -1,21 +0,0 @@ --noinst_LTLIBRARIES = libac.la -- --AM_CFLAGS = \ -- $(DIX_CFLAGS) \ -- -DXFree86Server \ -- @GLX_DEFINES@ -- --INCLUDES = -I@MESA_SOURCE@/include \ -- -I../X \ -- -I../array_cache \ -- -I../glapi \ -- -I../main \ -- -I../math \ -- -I../shader \ -- -I../swrast \ -- -I../swrast_setup \ -- -I../tnl \ -- -I.. \ -- -I$(top_srcdir)/hw/xfree86/os-support -- --nodist_libac_la_SOURCES = ac_context.c ac_import.c -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/glapi/Makefile.am GL/mesa/glapi/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/glapi/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/glapi/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -7,7 +7,6 @@ - - INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ -- -I../array_cache \ - -I../glapi \ - -I../main \ - -I../math \ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/main/Makefile.am GL/mesa/main/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/main/Makefile.am 2006-11-17 18:47:26.000000000 +0100 -+++ GL/mesa/main/Makefile.am 2007-04-21 21:25:52.000000000 +0200 -@@ -7,7 +7,6 @@ - - INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ -- -I../array_cache \ - -I../glapi \ - -I../main \ - -I../math \ -@@ -62,13 +61,14 @@ - matrix.c \ - mipmap.c \ - mm.c \ -- occlude.c \ - pixel.c \ - points.c \ - polygon.c \ -+ queryobj.c \ - rastpos.c \ - rbadaptors.c \ - renderbuffer.c \ -+ shaders.c \ - state.c \ - stencil.c \ - texcompress.c \ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/math/Makefile.am GL/mesa/math/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/math/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/math/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -7,7 +7,6 @@ - - INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ -- -I../array_cache \ - -I../glapi \ - -I../main \ - -I../math \ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/shader/Makefile.am GL/mesa/shader/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/shader/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/shader/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -9,7 +9,6 @@ - - INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ -- -I../array_cache \ - -I../glapi \ - -I../main \ - -I../math \ -@@ -28,8 +27,13 @@ - atifragshader.c \ - nvfragparse.c \ - nvprogram.c \ -- nvvertexec.c \ -- nvvertparse.c \ -+ nvvertparse.c \ -+ prog_debug.c \ -+ prog_execute.c \ -+ prog_instruction.c \ -+ prog_parameter.c \ -+ prog_print.c \ - program.c \ -- shaderobjects.c \ -- shaderobjects_3dlabs.c -+ programopt.c \ -+ prog_statevars.c \ -+ shader_api.c -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/shader/grammar/Makefile.am GL/mesa/shader/grammar/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/shader/grammar/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/shader/grammar/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -7,7 +7,6 @@ - - INCLUDES = -I@MESA_SOURCE@/include \ - -I../../X \ -- -I../../array_cache \ - -I../../glapi \ - -I../../main \ - -I../../math \ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/shader/slang/Makefile.am GL/mesa/shader/slang/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/shader/slang/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/shader/slang/Makefile.am 2007-04-21 21:25:52.000000000 +0200 -@@ -8,7 +8,6 @@ - INCLUDES = -I@MESA_SOURCE@/include \ - -I../grammar \ - -I../../X \ -- -I../../array_cache \ - -I../../glapi \ - -I../../main \ - -I../../math \ -@@ -19,23 +18,24 @@ - -I../.. \ - -I$(top_srcdir)/hw/xfree86/os-support - --nodist_libslang_la_SOURCES = slang_analyse.c \ -- slang_assemble_assignment.c \ -- slang_assemble.c \ -- slang_assemble_conditional.c \ -- slang_assemble_constructor.c \ -- slang_assemble_typeinfo.c \ -+nodist_libslang_la_SOURCES = slang_builtin.c \ -+ slang_codegen.c \ - slang_compile.c \ - slang_compile_function.c \ - slang_compile_operation.c \ - slang_compile_struct.c \ - slang_compile_variable.c \ -- slang_execute.c \ -- slang_execute_x86.c \ -- slang_export.c \ -- slang_library_texsample.c \ -+ slang_emit.c \ -+ slang_ir.c \ -+ slang_label.c \ - slang_library_noise.c \ - slang_link.c \ -+ slang_log.c \ -+ slang_mem.c \ - slang_preprocess.c \ -+ slang_print.c \ -+ slang_simplify.c \ - slang_storage.c \ -- slang_utility.c -+ slang_typeinfo.c \ -+ slang_utility.c \ -+ slang_vartable.c -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/swrast/Makefile.am GL/mesa/swrast/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/swrast/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/swrast/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -7,7 +7,6 @@ - - INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ -- -I../array_cache \ - -I../glapi \ - -I../main \ - -I../math \ -@@ -24,7 +23,6 @@ - s_aatriangle.c \ - s_accum.c \ - s_alpha.c \ -- s_arbshader.c \ - s_atifragshader.c \ - s_bitmap.c \ - s_blend.c \ -@@ -36,11 +34,11 @@ - s_drawpix.c \ - s_feedback.c \ - s_fog.c \ -+ s_fragprog.c \ - s_imaging.c \ - s_lines.c \ - s_logic.c \ - s_masking.c \ -- s_nvfragprog.c \ - s_points.c \ - s_readpix.c \ - s_span.c \ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/swrast_setup/Makefile.am GL/mesa/swrast_setup/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/swrast_setup/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/swrast_setup/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -7,7 +7,6 @@ - - INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ -- -I../array_cache \ - -I../glapi \ - -I../main \ - -I../math \ -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/tnl/Makefile.am GL/mesa/tnl/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/tnl/Makefile.am 2006-09-18 08:04:17.000000000 +0200 -+++ GL/mesa/tnl/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -7,7 +7,6 @@ - - INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ -- -I../array_cache \ - -I../glapi \ - -I../main \ - -I../math \ -@@ -19,16 +18,9 @@ - -I.. \ - -I$(top_srcdir)/hw/xfree86/os-support - --nodist_libtnl_la_SOURCES = t_array_api.c \ -- t_array_import.c \ -- t_context.c \ -+nodist_libtnl_la_SOURCES = t_context.c \ -+ t_draw.c \ - t_pipeline.c \ -- t_save_api.c \ -- t_save_loopback.c \ -- t_save_playback.c \ -- t_vb_arbprogram.c \ -- t_vb_arbprogram_sse.c \ -- t_vb_arbshader.c \ - t_vb_cull.c \ - t_vb_fog.c \ - t_vb_light.c \ -@@ -42,9 +34,4 @@ - t_vertex.c \ - t_vertex_generic.c \ - t_vertex_sse.c \ -- t_vp_build.c \ -- t_vtx_api.c \ -- t_vtx_eval.c \ -- t_vtx_exec.c \ -- t_vtx_generic.c \ -- t_vtx_x86.c -+ t_vp_build.c -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/vbo/Makefile.am GL/mesa/vbo/Makefile.am ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/mesa/vbo/Makefile.am 1970-01-01 01:00:00.000000000 +0100 -+++ GL/mesa/vbo/Makefile.am 2007-04-21 18:21:24.000000000 +0200 -@@ -0,0 +1,35 @@ -+noinst_LTLIBRARIES = libvbo.la -+ -+AM_CFLAGS = \ -+ $(DIX_CFLAGS) \ -+ -DXFree86Server \ -+ @GLX_DEFINES@ -+ -+INCLUDES = -I@MESA_SOURCE@/include \ -+ -I../X \ -+ -I../glapi \ -+ -I../main \ -+ -I../math \ -+ -I../shader \ -+ -I../shader/slang \ -+ -I../shader/slang \ -+ -I../swrast \ -+ -I../swrast_setup \ -+ -I../tnl \ -+ -I.. \ -+ -I$(top_srcdir)/hw/xfree86/os-support -+ -+nodist_libvbo_la_SOURCES = vbo_context.c \ -+ vbo_exec_api.c \ -+ vbo_exec_array.c \ -+ vbo_exec.c \ -+ vbo_exec_draw.c \ -+ vbo_exec_eval.c \ -+ vbo_rebase.c \ -+ vbo_save_api.c \ -+ vbo_save.c \ -+ vbo_save_draw.c \ -+ vbo_save_loopback.c \ -+ vbo_split.c \ -+ vbo_split_copy.c \ -+ vbo_split_inplace.c -diff -N -x .gitignore -x Makefile.in -u -r /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/symlink-mesa.sh GL/symlink-mesa.sh ---- /suse/sndirsch/pkgs/openSUSE/xorg73/xorg-x11-server/xorg-server-1.3.0.0/GL/symlink-mesa.sh 2006-10-04 23:46:03.000000000 +0200 -+++ GL/symlink-mesa.sh 2007-04-21 18:21:24.000000000 +0200 -@@ -85,15 +85,6 @@ - done - } - --symlink_mesa_ac() { -- src_dir src/mesa/array_cache -- dst_dir mesa/array_cache -- -- for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do -- action `basename $src` -- done --} -- - symlink_mesa_swrast() { - src_dir src/mesa/swrast - dst_dir mesa/swrast -@@ -157,6 +148,15 @@ - done - } - -+symlink_mesa_vbo() { -+ src_dir src/mesa/vbo -+ dst_dir mesa/vbo -+ -+ for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do -+ action `basename $src` -+ done -+} -+ - symlink_mesa_x() { - src_dir src/mesa/drivers/x11 - dst_dir mesa/X -@@ -168,6 +168,8 @@ - action xm_api.c - action xm_buffer.c - action xm_dd.c -+ action xm_image.c -+ action xm_image.h - action xm_line.c - action xm_span.c - action xm_tri.c -@@ -203,7 +205,6 @@ - symlink_mesa() { - symlink_mesa_main - symlink_mesa_math -- symlink_mesa_ac - symlink_mesa_swrast - symlink_mesa_ss - symlink_mesa_tnl -@@ -215,6 +216,7 @@ - symlink_mesa_glapi - symlink_mesa_ppc - symlink_mesa_sparc -+ symlink_mesa_vbo - symlink_mesa_x86 - symlink_mesa_x8664 - } -@@ -225,9 +227,6 @@ - dst_dir glx - - action indirect_size.h -- -- src_dir src/mesa/drivers/dri/common -- - action glcontextmodes.c - action glcontextmodes.h - -@@ -289,9 +288,9 @@ - } - - usage() { -- echo symlink.sh src-dir dst-dir -- echo src-dir: the xc directory of the monolithic source tree -- echo dst-dir: the modular source tree containing proto, app, lib, ... -+ echo symlink-mesa.sh src-dir dst-dir -+ echo src-dir: the Mesa source directory -+ echo dst-dir: the GL subdirectory of the Xserver modular tree - } - - # Check commandline args ---- configure.ac.orig 2007-04-22 12:17:16.000000000 +0200 -+++ configure.ac 2007-04-22 12:17:27.000000000 +0200 -@@ -1707,6 +1707,7 @@ - GL/mesa/swrast/Makefile - GL/mesa/swrast_setup/Makefile - GL/mesa/tnl/Makefile -+GL/mesa/vbo/Makefile - GL/mesa/X/Makefile - include/Makefile - afb/Makefile ---- hw/dmx/glxProxy/glxext.h.orig 2007-04-22 10:49:56.000000000 +0000 -+++ hw/dmx/glxProxy/glxext.h 2007-04-22 10:50:27.000000000 +0000 -@@ -67,7 +67,7 @@ - - extern void __glXNoSuchRenderOpcode(GLbyte*); - extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*); --extern void __glXErrorCallBack(__GLinterface *gc, GLenum code); -+extern void __glXErrorCallBack(GLenum code); - extern void __glXClearErrorOccured(void); - extern GLboolean __glXErrorOccured(void); - extern void __glXResetLargeCommandStatus(__GLXclientState*); diff --git a/Mesa-6.5.2-fix_radeon_cliprect.diff b/Mesa-6.5.2-fix_radeon_cliprect.diff new file mode 100644 index 0000000..760b093 --- /dev/null +++ b/Mesa-6.5.2-fix_radeon_cliprect.diff @@ -0,0 +1,237 @@ +unchanged: +--- a/src/mesa/drivers/dri/radeon/radeon_context.c ++++ b/src/mesa/drivers/dri/radeon/radeon_context.c +@@ -594,12 +594,14 @@ radeonMakeCurrent( __DRIcontextPrivate * + driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags, + &newCtx->vbl_seq ); + } +- +- if ( (newCtx->dri.drawable != driDrawPriv) +- || (newCtx->dri.readable != driReadPriv) ) { ++ ++ newCtx->dri.readable = driReadPriv; ++ ++ if ( (newCtx->dri.drawable != driDrawPriv) || ++ newCtx->lastStamp != driDrawPriv->lastStamp ) { + newCtx->dri.drawable = driDrawPriv; +- newCtx->dri.readable = driReadPriv; + ++ radeonSetCliprects(newCtx); + radeonUpdateWindow( newCtx->glCtx ); + radeonUpdateViewportOffset( newCtx->glCtx ); + } +unchanged: +--- a/src/mesa/drivers/dri/radeon/radeon_lock.c ++++ b/src/mesa/drivers/dri/radeon/radeon_lock.c +@@ -96,7 +96,6 @@ void radeonGetLock( radeonContextPtr rme + radeonSetCliprects( rmesa ); + radeonUpdateViewportOffset( rmesa->glCtx ); + driUpdateFramebufferSize(rmesa->glCtx, drawable); +- rmesa->lastStamp = drawable->lastStamp; + } + + RADEON_STATECHANGE( rmesa, ctx ); +unchanged: +--- a/src/mesa/drivers/dri/radeon/radeon_state.c ++++ b/src/mesa/drivers/dri/radeon/radeon_state.c +@@ -1675,6 +1675,8 @@ void radeonSetCliprects( radeonContextPt + + if (rmesa->state.scissor.enabled) + radeonRecalcScissorRects( rmesa ); ++ ++ rmesa->lastStamp = drawable->lastStamp; + } + + +unchanged: +--- b/src/mesa/drivers/dri/r200/r200_context.c ++++ b/src/mesa/drivers/dri/r200/r200_context.c +@@ -673,11 +673,13 @@ + &newCtx->vbl_seq ); + } + ++ newCtx->dri.readable = driReadPriv; ++ + if ( newCtx->dri.drawable != driDrawPriv || +- newCtx->dri.readable != driReadPriv ) { ++ newCtx->lastStamp != driDrawPriv->lastStamp ) { + newCtx->dri.drawable = driDrawPriv; +- newCtx->dri.readable = driReadPriv; + ++ r200SetCliprects(newCtx); + r200UpdateWindow( newCtx->glCtx ); + r200UpdateViewportOffset( newCtx->glCtx ); + } +unchanged: +--- b/src/mesa/drivers/dri/r200/r200_lock.c ++++ b/src/mesa/drivers/dri/r200/r200_lock.c +@@ -92,13 +92,9 @@ + + if ( rmesa->lastStamp != drawable->lastStamp ) { + r200UpdatePageFlipping( rmesa ); +- if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) +- r200SetCliprects( rmesa, GL_BACK_LEFT ); +- else +- r200SetCliprects( rmesa, GL_FRONT_LEFT ); ++ r200SetCliprects( rmesa ); + r200UpdateViewportOffset( rmesa->glCtx ); + driUpdateFramebufferSize(rmesa->glCtx, drawable); +- rmesa->lastStamp = drawable->lastStamp; + } + + R200_STATECHANGE( rmesa, ctx ); +unchanged: +--- b/src/mesa/drivers/dri/r200/r200_state.c ++++ b/src/mesa/drivers/dri/r200/r200_state.c +@@ -1691,6 +1691,11 @@ + #define SUBPIXEL_X 0.125 + #define SUBPIXEL_Y 0.125 + ++ ++/** ++ * Called when window size or position changes or viewport or depth range ++ * state is changed. We update the hardware viewport state here. ++ */ + void r200UpdateWindow( GLcontext *ctx ) + { + r200ContextPtr rmesa = R200_CONTEXT(ctx); +@@ -1843,19 +1848,18 @@ + } + + +-void r200SetCliprects( r200ContextPtr rmesa, GLenum mode ) ++/* ++ * Set up the cliprects for either front or back-buffer drawing. ++ */ ++void r200SetCliprects( r200ContextPtr rmesa ) + { + __DRIdrawablePrivate *const drawable = rmesa->dri.drawable; + __DRIdrawablePrivate *const readable = rmesa->dri.readable; + GLframebuffer *const draw_fb = (GLframebuffer*) drawable->driverPrivate; + GLframebuffer *const read_fb = (GLframebuffer*) readable->driverPrivate; + +- switch ( mode ) { +- case GL_FRONT_LEFT: +- rmesa->numClipRects = drawable->numClipRects; +- rmesa->pClipRects = drawable->pClipRects; +- break; +- case GL_BACK_LEFT: ++ if (draw_fb->_ColorDrawBufferMask[0] ++ == BUFFER_BIT_BACK_LEFT) { + /* Can't ignore 2d windows if we are page flipping. + */ + if ( drawable->numBackClipRects == 0 || rmesa->doPageFlip ) { +@@ -1866,11 +1870,12 @@ + rmesa->numClipRects = drawable->numBackClipRects; + rmesa->pClipRects = drawable->pBackClipRects; + } +- break; +- default: +- fprintf(stderr, "bad mode in r200SetCliprects\n"); +- return; + } ++ else { ++ /* front buffer (or none, or multiple buffers) */ ++ rmesa->numClipRects = drawable->numClipRects; ++ rmesa->pClipRects = drawable->pClipRects; ++ } + + if ((draw_fb->Width != drawable->w) || (draw_fb->Height != drawable->h)) { + _mesa_resize_framebuffer(rmesa->glCtx, draw_fb, +@@ -1889,6 +1894,8 @@ + + if (rmesa->state.scissor.enabled) + r200RecalcScissorRects( rmesa ); ++ ++ rmesa->lastStamp = drawable->lastStamp; + } + + +@@ -1908,19 +1915,17 @@ + */ + switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) { + case BUFFER_BIT_FRONT_LEFT: +- FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE ); +- r200SetCliprects( rmesa, GL_FRONT_LEFT ); +- break; + case BUFFER_BIT_BACK_LEFT: + FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE ); +- r200SetCliprects( rmesa, GL_BACK_LEFT ); + break; + default: +- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */ ++ /* 0 (GL_NONE) buffers or multiple color drawing buffers */ + FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_TRUE ); + return; + } + ++ r200SetCliprects( rmesa ); ++ + /* We'll set the drawing engine's offset/pitch parameters later + * when we update other state. + */ +unchanged: +--- a/src/mesa/drivers/dri/r200/r200_state.h ++++ b/src/mesa/drivers/dri/r200/r200_state.h +@@ -44,7 +44,7 @@ extern void r200InitTnlFuncs( GLcontext + + extern void r200UpdateMaterial( GLcontext *ctx ); + +-extern void r200SetCliprects( r200ContextPtr rmesa, GLenum mode ); ++extern void r200SetCliprects( r200ContextPtr rmesa ); + extern void r200RecalcScissorRects( r200ContextPtr rmesa ); + extern void r200UpdateViewportOffset( GLcontext *ctx ); + extern void r200UpdateWindow( GLcontext *ctx ); +only in patch2: +unchanged: +--- b/src/mesa/drivers/dri/r300/radeon_context.c ++++ b/src/mesa/drivers/dri/r300/radeon_context.c +@@ -51,6 +51,7 @@ + #include "radeon_macros.h" + #include "radeon_reg.h" + ++#include "radeon_state.h" + #include "r300_state.h" + + #include "utils.h" +@@ -272,11 +273,13 @@ + &radeon->vbl_seq); + } + ++ radeon->dri.readable = driReadPriv; ++ + if (radeon->dri.drawable != driDrawPriv || +- radeon->dri.readable != driReadPriv) { ++ radeon->lastStamp != driDrawPriv->lastStamp) { + radeon->dri.drawable = driDrawPriv; +- radeon->dri.readable = driReadPriv; + ++ radeonSetCliprects(radeon); + r300UpdateWindow(radeon->glCtx); + r300UpdateViewportOffset(radeon->glCtx); + } +only in patch2: +unchanged: +--- a/src/mesa/drivers/dri/r300/radeon_lock.c ++++ b/src/mesa/drivers/dri/r300/radeon_lock.c +@@ -90,7 +90,6 @@ static void r300RegainedLock(radeonConte + #else + radeonUpdateScissor(radeon->glCtx); + #endif +- radeon->lastStamp = drawable->lastStamp; + } + + if (sarea->ctx_owner != radeon->dri.hwContext) { +only in patch2: +unchanged: +--- a/src/mesa/drivers/dri/r300/radeon_state.c ++++ b/src/mesa/drivers/dri/r300/radeon_state.c +@@ -185,6 +185,8 @@ void radeonSetCliprects(radeonContextPtr + + if (radeon->state.scissor.enabled) + radeonRecalcScissorRects(radeon); ++ ++ radeon->lastStamp = drawable->lastStamp; + } + + diff --git a/Mesa-6.5.2.tar.bz2 b/Mesa-6.5.2.tar.bz2 new file mode 100644 index 0000000..2122008 --- /dev/null +++ b/Mesa-6.5.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bd2f940b3461574076fa1b6161430b8ed1d9d451d183411f40edfc6ce4034bd +size 5950038 diff --git a/MesaLib-6.5.3rc4.tar.gz b/MesaLib-6.5.3rc4.tar.gz deleted file mode 100644 index f8180bb..0000000 --- a/MesaLib-6.5.3rc4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:12901ffe8018f87dfb7ac06a0b7b2cf4e5b9b9ff36dc2a91b3ee81470dcf2168 -size 4526210 diff --git a/bug-211314-patch-1.diff b/bug-211314-patch-1.diff new file mode 100644 index 0000000..8afc064 --- /dev/null +++ b/bug-211314-patch-1.diff @@ -0,0 +1,99 @@ +commit f30e8a4bdf8338dc3f8e985a9c91af61a3301990 +Author: Brian +Date: Mon Feb 26 11:37:52 2007 -0700 + + if renderbuffer ptr is null, just return + +diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c +index 27f4736..15dc810 100644 +--- a/src/mesa/swrast/s_readpix.c ++++ b/src/mesa/swrast/s_readpix.c +@@ -1,8 +1,8 @@ + /* + * Mesa 3-D graphics library +- * Version: 6.5.2 ++ * Version: 6.5.3 + * +- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. ++ * Copyright (C) 1999-2007 Brian Paul 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"), +@@ -54,7 +54,8 @@ read_index_pixels( GLcontext *ctx, + struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; + GLint i; + +- ASSERT(rb); ++ if (!rb) ++ return; + + /* width should never be > MAX_WIDTH since we did clipping earlier */ + ASSERT(width <= MAX_WIDTH); +@@ -91,6 +92,9 @@ read_depth_pixels( GLcontext *ctx, + const GLboolean biasOrScale + = ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0; + ++ if (!rb) ++ return; ++ + /* clipping should have been done already */ + ASSERT(x >= 0); + ASSERT(y >= 0); +@@ -99,8 +103,6 @@ read_depth_pixels( GLcontext *ctx, + /* width should never be > MAX_WIDTH since we did clipping earlier */ + ASSERT(width <= MAX_WIDTH); + +- ASSERT(rb); +- + if (type == GL_UNSIGNED_SHORT && fb->Visual.depthBits == 16 + && !biasOrScale && !packing->SwapBytes) { + /* Special case: directly read 16-bit unsigned depth values. */ +@@ -171,7 +173,8 @@ read_stencil_pixels( GLcontext *ctx, + struct gl_renderbuffer *rb = fb->_StencilBuffer; + GLint j; + +- ASSERT(rb); ++ if (!rb) ++ return; + + /* width should never be > MAX_WIDTH since we did clipping earlier */ + ASSERT(width <= MAX_WIDTH); +@@ -195,6 +198,7 @@ read_stencil_pixels( GLcontext *ctx, + /** + * Optimized glReadPixels for particular pixel formats when pixel + * scaling, biasing, mapping, etc. are disabled. ++ * \return GL_TRUE if success, GL_FALSE if unable to do the readpixels + */ + static GLboolean + fast_read_rgba_pixels( GLcontext *ctx, +@@ -207,6 +211,9 @@ fast_read_rgba_pixels( GLcontext *ctx, + { + struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; + ++ if (!rb) ++ return GL_FALSE; ++ + ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB); + + /* clipping should have already been done */ +@@ -316,7 +323,8 @@ read_rgba_pixels( GLcontext *ctx, + struct gl_framebuffer *fb = ctx->ReadBuffer; + struct gl_renderbuffer *rb = fb->_ColorReadBuffer; + +- ASSERT(rb); ++ if (!rb) ++ return; + + if (type == GL_FLOAT && ((ctx->Color.ClampReadColor == GL_TRUE) || + (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB && +@@ -457,8 +465,8 @@ read_depth_stencil_pixels(GLcontext *ctx + depthRb = ctx->ReadBuffer->_DepthBuffer; + stencilRb = ctx->ReadBuffer->_StencilBuffer; + +- ASSERT(depthRb); +- ASSERT(stencilRb); ++ if (!depthRb || !stencilRb) ++ return; + + depthRb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + stencilRb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; diff --git a/bug-211314-patch-10.diff b/bug-211314-patch-10.diff new file mode 100644 index 0000000..ce4b923 --- /dev/null +++ b/bug-211314-patch-10.diff @@ -0,0 +1,19 @@ +commit f04979ae481acc9fdc423da06514c4d557edd7cd +Author: Mathias Hopf +Date: Fri Mar 16 08:28:34 2007 -0600 + + added null xmctx check to XMesaResizeBuffers(), bug 7205 + +diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c +index cbbbd56..ba020fc 100644 +--- a/src/mesa/drivers/x11/xm_api.c ++++ b/src/mesa/drivers/x11/xm_api.c +@@ -2499,6 +2499,8 @@ XMesaResizeBuffers( XMesaBuffer b ) + { + GET_CURRENT_CONTEXT(ctx); + XMesaContext xmctx = XMESA_CONTEXT(ctx); ++ if (!xmctx) ++ return; + xmesa_check_and_update_buffer_size(xmctx, b); + } + diff --git a/bug-211314-patch-11.diff b/bug-211314-patch-11.diff new file mode 100644 index 0000000..d9e31d2 --- /dev/null +++ b/bug-211314-patch-11.diff @@ -0,0 +1,218 @@ +commit e5070bc3ca75dee31034cc543f3d2ee04e5dc032 +Author: Brian +Date: Fri Mar 16 11:00:07 2007 -0600 + + Assorted fixes for dealing with zero-size frame/renderbuffers. + + In xmesa_check_and_update_buffer_size() handle xmctx==NULL correctly: still + call _mesa_resize_framebufer(). If we don't we can wind up in a situation + where the framebuffer size is non-zero but an attached renderbuffer size + is still initialized to zero. This inconsistancy can later cause problems. + Check for zero-size renderbuffers in update_color_draw_buffers() and + update_color_read_buffer(). + See bug 7205. + +diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c +index ba020fc..b513dc8 100644 +--- a/src/mesa/drivers/x11/xm_api.c ++++ b/src/mesa/drivers/x11/xm_api.c +@@ -1842,16 +1842,18 @@ XMesaDestroyBuffer(XMesaBuffer b) + * 1. the first time a buffer is bound to a context. + * 2. from glViewport to poll for window size changes + * 3. from the XMesaResizeBuffers() API function. ++ * Note: it's possible (and legal) for xmctx to be NULL. That can happen ++ * when resizing a buffer when no rendering context is bound. + */ + void + xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer) + { + GLuint width, height; +- xmesa_get_window_size(xmctx->display, drawBuffer, &width, &height); ++ xmesa_get_window_size(drawBuffer->display, drawBuffer, &width, &height); + if (drawBuffer->mesa_buffer.Width != width || + drawBuffer->mesa_buffer.Height != height) { +- _mesa_resize_framebuffer(&(xmctx->mesa), +- &(drawBuffer->mesa_buffer), width, height); ++ GLcontext *ctx = xmctx ? &xmctx->mesa : NULL; ++ _mesa_resize_framebuffer(ctx, &(drawBuffer->mesa_buffer), width, height); + } + drawBuffer->mesa_buffer.Initialized = GL_TRUE; /* XXX TEMPORARY? */ + } +@@ -2175,7 +2177,7 @@ void XMesaSwapBuffers( XMesaBuffer b ) + } + #endif + if (b->backxrb->ximage) { +- /* Copy Ximage from host's memory to server's window */ ++ /* Copy Ximage (back buf) from client memory to server window */ + #if defined(USE_XSHM) && !defined(XFree86Server) + if (b->shm) { + /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ +@@ -2197,8 +2199,8 @@ void XMesaSwapBuffers( XMesaBuffer b ) + /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/ + } + } +- else { +- /* Copy pixmap to window on server */ ++ else if (b->backxrb->pixmap) { ++ /* Copy pixmap (back buf) to window (front buf) on server */ + /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ + XMesaCopyArea( b->xm_visual->display, + b->backxrb->pixmap, /* source drawable */ +diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c +index 73c46b1..c1fa233 100644 +--- a/src/mesa/drivers/x11/xm_buffer.c ++++ b/src/mesa/drivers/x11/xm_buffer.c +@@ -168,9 +168,6 @@ alloc_back_shm_ximage(XMesaBuffer b, GLu + static void + alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height) + { +- if (width == 0 || height == 0) +- return; +- + if (b->db_mode == BACK_XIMAGE) { + /* Deallocate the old backxrb->ximage, if any */ + if (b->backxrb->ximage) { +@@ -186,6 +183,9 @@ alloc_back_buffer(XMesaBuffer b, GLuint + b->backxrb->ximage = NULL; + } + ++ if (width == 0 || height == 0) ++ return; ++ + /* Allocate new back buffer */ + #ifdef XFree86Server + /* Allocate a regular XImage for the back buffer. */ +@@ -218,20 +218,20 @@ alloc_back_buffer(XMesaBuffer b, GLuint + b->backxrb->pixmap = None; + } + else if (b->db_mode == BACK_PIXMAP) { +- if (!width) +- width = 1; +- if (!height) +- height = 1; +- + /* Free the old back pixmap */ + if (b->backxrb->pixmap) { +- XMesaFreePixmap(b->xm_visual->display, b->backxrb->pixmap); ++ XMesaFreePixmap(b->xm_visual->display, b->backxrb->pixmap); ++ b->backxrb->pixmap = 0; + } +- /* Allocate new back pixmap */ +- b->backxrb->pixmap = XMesaCreatePixmap(b->xm_visual->display, +- b->frontxrb->drawable, +- width, height, +- GET_VISUAL_DEPTH(b->xm_visual)); ++ ++ if (width > 0 && height > 0) { ++ /* Allocate new back pixmap */ ++ b->backxrb->pixmap = XMesaCreatePixmap(b->xm_visual->display, ++ b->frontxrb->drawable, ++ width, height, ++ GET_VISUAL_DEPTH(b->xm_visual)); ++ } ++ + b->backxrb->ximage = NULL; + } + } +@@ -250,6 +250,7 @@ xmesa_delete_renderbuffer(struct gl_rend + + /** + * Reallocate renderbuffer storage for front color buffer. ++ * Called via gl_renderbuffer::AllocStorage() + */ + static GLboolean + xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +@@ -260,6 +261,7 @@ xmesa_alloc_front_storage(GLcontext *ctx + /* just clear these to be sure we don't accidentally use them */ + xrb->origin1 = NULL; + xrb->origin2 = NULL; ++ xrb->origin3 = NULL; + xrb->origin4 = NULL; + + /* for the FLIP macro: */ +@@ -275,6 +277,7 @@ xmesa_alloc_front_storage(GLcontext *ctx + + /** + * Reallocate renderbuffer storage for back color buffer. ++ * Called via gl_renderbuffer::AllocStorage() + */ + static GLboolean + xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +@@ -309,8 +312,12 @@ xmesa_alloc_back_storage(GLcontext *ctx, + xrb->origin4 = (GLuint *) xrb->ximage->data + xrb->width4 * (height - 1); + } + else { +- /* this assertion will fail if we happend to run out of memory */ +- /*assert(xrb->pixmap);*/ ++ /* out of memory or buffer size is 0 x 0 */ ++ xrb->width1 = xrb->width2 = xrb->width3 = xrb->width4 = 0; ++ xrb->origin1 = NULL; ++ xrb->origin2 = NULL; ++ xrb->origin3 = NULL; ++ xrb->origin4 = NULL; + } + + return GL_TRUE; +diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c +index 3136a95..cd4f594 100644 +--- a/src/mesa/main/framebuffer.c ++++ b/src/mesa/main/framebuffer.c +@@ -647,7 +647,7 @@ update_color_draw_buffers(GLcontext *ctx + const GLuint bufferBit = 1 << i; + if (bufferBit & bufferMask) { + struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; +- if (rb) { ++ if (rb && rb->Width > 0 && rb->Height > 0) { + fb->_ColorDrawBuffers[output][count] = rb; + count++; + } +@@ -673,7 +673,10 @@ static void + update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb) + { + (void) ctx; +- if (fb->_ColorReadBufferIndex == -1 || fb->DeletePending) { ++ if (fb->_ColorReadBufferIndex == -1 || ++ fb->DeletePending || ++ fb->Width == 0 || ++ fb->Height == 0) { + fb->_ColorReadBuffer = NULL; /* legal! */ + } + else { +diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c +index 1cc95a7..e387c42 100644 +--- a/src/mesa/main/renderbuffer.c ++++ b/src/mesa/main/renderbuffer.c +@@ -1192,18 +1192,22 @@ _mesa_soft_renderbuffer_storage(GLcontex + ASSERT(rb->PutMonoValues); + + /* free old buffer storage */ +- if (rb->Data) ++ if (rb->Data) { + _mesa_free(rb->Data); +- +- /* allocate new buffer storage */ +- rb->Data = _mesa_malloc(width * height * pixelSize); +- if (rb->Data == NULL) { +- rb->Width = 0; +- rb->Height = 0; +- _mesa_error(ctx, GL_OUT_OF_MEMORY, +- "software renderbuffer allocation (%d x %d x %d)", +- width, height, pixelSize); +- return GL_FALSE; ++ rb->Data = NULL; ++ } ++ ++ if (width > 0 && height > 0) { ++ /* allocate new buffer storage */ ++ rb->Data = _mesa_malloc(width * height * pixelSize); ++ if (rb->Data == NULL) { ++ rb->Width = 0; ++ rb->Height = 0; ++ _mesa_error(ctx, GL_OUT_OF_MEMORY, ++ "software renderbuffer allocation (%d x %d x %d)", ++ width, height, pixelSize); ++ return GL_FALSE; ++ } + } + + rb->Width = width; diff --git a/bug-211314-patch-2.diff b/bug-211314-patch-2.diff new file mode 100644 index 0000000..e7aa278 --- /dev/null +++ b/bug-211314-patch-2.diff @@ -0,0 +1,594 @@ +commit a510bc3ee1a696da120c09ee4ec33dc033f671ac +Author: Brian +Date: Tue Mar 6 10:07:59 2007 -0700 + + Fix/improve framebuffer object reference counting. + + Use _mesa_reference_framebuffer() and _mesa_unreference_framebuffer() functions + to be sure reference counting is done correctly. Additional assertions are + done too. Note _mesa_dereference_framebuffer() renamed to "unreference" as + that's more accurate. + +diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c +index 594668a..518211c 100644 +--- a/src/mesa/drivers/allegro/amesa.c ++++ b/src/mesa/drivers/allegro/amesa.c +@@ -338,7 +338,7 @@ void AMesaDestroyBuffer(AMesaBuffer buff + { + if (buffer->Screen) destroy_bitmap(buffer->Screen); + if (buffer->Background) destroy_bitmap(buffer->Background); +- _mesa_destroy_framebuffer(buffer->GLBuffer); ++ _mesa_unreference_framebuffer(&buffer->GLBuffer); + free(buffer); + } + +diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c +index 08b52b4..a6d7590 100644 +--- a/src/mesa/drivers/dri/fb/fb_dri.c ++++ b/src/mesa/drivers/dri/fb/fb_dri.c +@@ -480,11 +480,7 @@ fbCreateBuffer( __DRIscreenPrivate *driS + static void + fbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- struct gl_framebuffer *mesa_framebuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate; +- +- _mesa_free(mesa_framebuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer->Data); +- _mesa_destroy_framebuffer(mesa_framebuffer); +- driDrawPriv->driverPrivate = NULL; ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + +diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c +index 215aaf8..4c5323d 100644 +--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c ++++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c +@@ -392,7 +392,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driS + static void + ffbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + +diff --git a/src/mesa/drivers/dri/gamma/gamma_xmesa.c b/src/mesa/drivers/dri/gamma/gamma_xmesa.c +index e8922b1..f41682c 100644 +--- a/src/mesa/drivers/dri/gamma/gamma_xmesa.c ++++ b/src/mesa/drivers/dri/gamma/gamma_xmesa.c +@@ -97,7 +97,7 @@ gammaCreateBuffer( __DRIscreenPrivate *d + static void + gammaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + static void +diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c +index 1014b8a..4e9e216 100644 +--- a/src/mesa/drivers/dri/mach64/mach64_screen.c ++++ b/src/mesa/drivers/dri/mach64/mach64_screen.c +@@ -435,7 +435,7 @@ mach64CreateBuffer( __DRIscreenPrivate * + static void + mach64DestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + +diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c +index f024f73..67a6f8b 100644 +--- a/src/mesa/drivers/dri/mga/mga_xmesa.c ++++ b/src/mesa/drivers/dri/mga/mga_xmesa.c +@@ -831,7 +831,7 @@ mgaCreateBuffer( __DRIscreenPrivate *dri + static void + mgaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + static void +diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c +index 4f1b20a..880dee8 100644 +--- a/src/mesa/drivers/dri/r128/r128_screen.c ++++ b/src/mesa/drivers/dri/r128/r128_screen.c +@@ -357,7 +357,7 @@ r128CreateBuffer( __DRIscreenPrivate *dr + static void + r128DestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + +diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c +index fc5aa11..abb14fa 100644 +--- a/src/mesa/drivers/dri/radeon/radeon_screen.c ++++ b/src/mesa/drivers/dri/radeon/radeon_screen.c +@@ -901,7 +901,7 @@ radeonCreateBuffer( __DRIscreenPrivate * + static void + radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) +diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c +index c451f74..c66fd6d 100644 +--- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c ++++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c +@@ -131,7 +131,7 @@ s3vCreateBuffer( __DRIscreenPrivate *dri + static void + s3vDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + static void +diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c +index ad79b92..f859217 100644 +--- a/src/mesa/drivers/dri/savage/savage_xmesa.c ++++ b/src/mesa/drivers/dri/savage/savage_xmesa.c +@@ -710,7 +710,7 @@ savageCreateBuffer( __DRIscreenPrivate * + static void + savageDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + #if 0 +diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c +index 8f52cfe..89d734b 100644 +--- a/src/mesa/drivers/dri/sis/sis_screen.c ++++ b/src/mesa/drivers/dri/sis/sis_screen.c +@@ -233,7 +233,7 @@ sisCreateBuffer( __DRIscreenPrivate *dri + static void + sisDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + static void sisCopyBuffer( __DRIdrawablePrivate *dPriv ) +diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c +index 646f512..1f9ff4e 100644 +--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c ++++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c +@@ -233,7 +233,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *dr + static void + tdfxDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + +diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c +index dbbd1ac..8dc7f0d 100644 +--- a/src/mesa/drivers/dri/trident/trident_context.c ++++ b/src/mesa/drivers/dri/trident/trident_context.c +@@ -279,7 +279,7 @@ tridentCreateBuffer( __DRIscreenPrivate + static void + tridentDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + static void +diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c +index 28e1f94..90f76be 100644 +--- a/src/mesa/drivers/dri/unichrome/via_screen.c ++++ b/src/mesa/drivers/dri/unichrome/via_screen.c +@@ -320,7 +320,7 @@ viaCreateBuffer(__DRIscreenPrivate *driS + static void + viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) + { +- _mesa_destroy_framebuffer((GLframebuffer *)(driDrawPriv->driverPrivate)); ++ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + } + + +diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c +index e535e73..00b9d29 100644 +--- a/src/mesa/drivers/glide/fxapi.c ++++ b/src/mesa/drivers/glide/fxapi.c +@@ -728,7 +728,7 @@ errorhandler: + FREE(fxMesa->fogTable); + } + if (fxMesa->glBuffer) { +- _mesa_destroy_framebuffer(fxMesa->glBuffer); ++ _mesa_unreference_framebuffer(&fxMesa->glBuffer); + } + if (fxMesa->glVis) { + _mesa_destroy_visual(fxMesa->glVis); +@@ -828,7 +828,7 @@ fxMesaDestroyContext(fxMesaContext fxMes + fxDDDestroyFxMesaContext(fxMesa); /* must be before _mesa_destroy_context */ + _mesa_destroy_visual(fxMesa->glVis); + _mesa_destroy_context(fxMesa->glCtx); +- _mesa_destroy_framebuffer(fxMesa->glBuffer); ++ _mesa_unreference_framebuffer(&fxMesa->glBuffer); + fxTMClose(fxMesa); /* must be after _mesa_destroy_context */ + + FREE(fxMesa); +diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c +index c4fc882..96b9b5c 100644 +--- a/src/mesa/drivers/osmesa/osmesa.c ++++ b/src/mesa/drivers/osmesa/osmesa.c +@@ -1303,7 +1303,8 @@ OSMesaDestroyContext( OSMesaContext osme + _swrast_DestroyContext( &osmesa->mesa ); + + _mesa_destroy_visual( osmesa->gl_visual ); +- _mesa_destroy_framebuffer( osmesa->gl_buffer ); ++ _mesa_unreference_framebuffer( &osmesa->gl_buffer ); ++ + _mesa_free_context_data( &osmesa->mesa ); + _mesa_free( osmesa ); + } +diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c +index 0dd9a14..d138587 100644 +--- a/src/mesa/drivers/svga/svgamesa.c ++++ b/src/mesa/drivers/svga/svgamesa.c +@@ -433,7 +433,6 @@ void SVGAMesaDestroyContext( SVGAMesaCon + if (ctx) { + _mesa_destroy_visual( ctx->gl_vis ); + _mesa_destroy_context( ctx->gl_ctx ); +- _mesa_destroy_framebuffer( ctx->gl_buffer ); + free( ctx ); + if (ctx==SVGAMesa) { + SVGAMesa = NULL; +diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c +index 2cd7d8a..a42de72 100644 +--- a/src/mesa/drivers/x11/xm_api.c ++++ b/src/mesa/drivers/x11/xm_api.c +@@ -485,8 +485,8 @@ xmesa_free_buffer(XMesaBuffer buffer) + + /* mark as delete pending */ + fb->DeletePending = GL_TRUE; +- /* Dereference. If count = zero we'll really delete the buffer */ +- _mesa_dereference_framebuffer(&fb); ++ /* Unreference. If count = zero we'll really delete the buffer */ ++ _mesa_unreference_framebuffer(&fb); + + return; + } +diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c +index 1245c10..135c814 100644 +--- a/src/mesa/main/context.c ++++ b/src/mesa/main/context.c +@@ -1408,6 +1408,13 @@ _mesa_free_context_data( GLcontext *ctx + if (ctx == _mesa_get_current_context()) { + _mesa_make_current(NULL, NULL, NULL); + } ++ else { ++ /* unreference WinSysDraw/Read buffers */ ++ _mesa_unreference_framebuffer(&ctx->WinSysDrawBuffer); ++ _mesa_unreference_framebuffer(&ctx->WinSysReadBuffer); ++ _mesa_unreference_framebuffer(&ctx->DrawBuffer); ++ _mesa_unreference_framebuffer(&ctx->ReadBuffer); ++ } + + _mesa_free_lighting_data( ctx ); + _mesa_free_eval_data( ctx ); +@@ -1694,12 +1701,8 @@ _mesa_make_current( GLcontext *newCtx, G + ASSERT(_mesa_get_current_context() == newCtx); + + if (oldCtx) { +- if (oldCtx->WinSysDrawBuffer) { +- _mesa_dereference_framebuffer(&oldCtx->WinSysDrawBuffer); +- } +- if (oldCtx->WinSysReadBuffer) { +- _mesa_dereference_framebuffer(&oldCtx->WinSysReadBuffer); +- } ++ _mesa_unreference_framebuffer(&oldCtx->WinSysDrawBuffer); ++ _mesa_unreference_framebuffer(&oldCtx->WinSysReadBuffer); + } + + if (!newCtx) { +@@ -1713,20 +1716,18 @@ _mesa_make_current( GLcontext *newCtx, G + + ASSERT(drawBuffer->Name == 0); + ASSERT(readBuffer->Name == 0); +- newCtx->WinSysDrawBuffer = drawBuffer; +- newCtx->WinSysReadBuffer = readBuffer; +- drawBuffer->RefCount++; +- readBuffer->RefCount++; ++ _mesa_reference_framebuffer(&newCtx->WinSysDrawBuffer, drawBuffer); ++ _mesa_reference_framebuffer(&newCtx->WinSysReadBuffer, readBuffer); + + /* + * Only set the context's Draw/ReadBuffer fields if they're NULL + * or not bound to a user-created FBO. + */ + if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { +- newCtx->DrawBuffer = drawBuffer; ++ _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer); + } + if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) { +- newCtx->ReadBuffer = readBuffer; ++ _mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer); + } + + newCtx->NewState |= _NEW_BUFFERS; +diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c +index a99ff9d..6608eef 100644 +--- a/src/mesa/main/fbobject.c ++++ b/src/mesa/main/fbobject.c +@@ -602,7 +602,7 @@ _mesa_BindRenderbufferEXT(GLenum target, + + oldRb = ctx->CurrentRenderbuffer; + if (oldRb) { +- _mesa_dereference_renderbuffer(&oldRb); ++ _mesa_unreference_renderbuffer(&oldRb); + } + + ASSERT(newRb != &DummyRenderbuffer); +@@ -639,7 +639,7 @@ _mesa_DeleteRenderbuffersEXT(GLsizei n, + /* But the object will not be freed until it's no longer + * bound in any context. + */ +- _mesa_dereference_renderbuffer(&rb); ++ _mesa_unreference_renderbuffer(&rb); + } + } + } +@@ -998,12 +998,6 @@ _mesa_BindFramebufferEXT(GLenum target, + } + _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newFb); + } +- _glthread_LOCK_MUTEX(newFb->Mutex); +- if (bindReadBuf) +- newFb->RefCount++; +- if (bindDrawBuf) +- newFb->RefCount++; +- _glthread_UNLOCK_MUTEX(newFb->Mutex); + } + else { + /* Binding the window system framebuffer (which was originally set +@@ -1020,22 +1014,16 @@ _mesa_BindFramebufferEXT(GLenum target, + */ + + if (bindReadBuf) { +- oldFb = ctx->ReadBuffer; +- if (oldFb && oldFb->Name != 0) { +- _mesa_dereference_framebuffer(&oldFb); +- } +- ctx->ReadBuffer = newFb; ++ _mesa_unreference_framebuffer(&ctx->ReadBuffer); ++ _mesa_reference_framebuffer(&ctx->ReadBuffer, newFb); + } + + if (bindDrawBuf) { +- oldFb = ctx->DrawBuffer; +- if (oldFb && oldFb->Name != 0) { +- /* check if old FB had any texture attachments */ +- check_end_texture_render(ctx, oldFb); +- /* check if time to delete this framebuffer */ +- _mesa_dereference_framebuffer(&oldFb); +- } +- ctx->DrawBuffer = newFb; ++ /* check if old FB had any texture attachments */ ++ check_end_texture_render(ctx, ctx->DrawBuffer); ++ /* check if time to delete this framebuffer */ ++ _mesa_unreference_framebuffer(&ctx->DrawBuffer); ++ _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb); + if (newFb->Name != 0) { + /* check if newly bound framebuffer has any texture attachments */ + check_begin_texture_render(ctx, newFb); +@@ -1083,7 +1071,7 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, c + /* But the object will not be freed until it's no longer + * bound in any context. + */ +- _mesa_dereference_framebuffer(&fb); ++ _mesa_unreference_framebuffer(&fb); + } + } + } +diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c +index dabc96d..c97d2f0 100644 +--- a/src/mesa/main/framebuffer.c ++++ b/src/mesa/main/framebuffer.c +@@ -78,7 +78,7 @@ set_depth_renderbuffer(struct gl_framebu + struct gl_renderbuffer *rb) + { + if (fb->_DepthBuffer) { +- _mesa_dereference_renderbuffer(&fb->_DepthBuffer); ++ _mesa_unreference_renderbuffer(&fb->_DepthBuffer); + } + fb->_DepthBuffer = rb; + if (rb) { +@@ -96,7 +96,7 @@ set_stencil_renderbuffer(struct gl_frame + struct gl_renderbuffer *rb) + { + if (fb->_StencilBuffer) { +- _mesa_dereference_renderbuffer(&fb->_StencilBuffer); ++ _mesa_unreference_renderbuffer(&fb->_StencilBuffer); + } + fb->_StencilBuffer = rb; + if (rb) { +@@ -223,13 +223,7 @@ _mesa_free_framebuffer_data(struct gl_fr + for (i = 0; i < BUFFER_COUNT; i++) { + struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; + if (att->Renderbuffer) { +- struct gl_renderbuffer *rb = att->Renderbuffer; +- /* remove framebuffer's reference to renderbuffer */ +- _mesa_dereference_renderbuffer(&rb); +- if (rb && rb->Name == 0) { +- /* delete window system renderbuffer */ +- _mesa_dereference_renderbuffer(&rb); +- } ++ _mesa_unreference_renderbuffer(&att->Renderbuffer); + } + if (att->Texture) { + /* render to texture */ +@@ -236,6 +236,5 @@ _mesa_free_framebuffer_data(struct gl_fr + } + } + att->Type = GL_NONE; +- att->Renderbuffer = NULL; + } + +@@ -247,25 +246,44 @@ _mesa_free_framebuffer_data(struct gl_fr + + + /** +- * Decrement the reference count on a framebuffer and delete it when ++ * Set *ptr to point to fb, with refcounting and locking. ++ */ ++void ++_mesa_reference_framebuffer(struct gl_framebuffer **ptr, ++ struct gl_framebuffer *fb) ++{ ++ assert(ptr); ++ assert(!*ptr); ++ assert(fb); ++ _glthread_LOCK_MUTEX(fb->Mutex); ++ fb->RefCount++; ++ _glthread_UNLOCK_MUTEX(fb->Mutex); ++ *ptr = fb; ++} ++ ++ ++/** ++ * Undo/remove a reference to a framebuffer object. ++ * Decrement the framebuffer object's reference count and delete it when + * the refcount hits zero. +- * Note: we pass the address of a pointer and set it to NULL if we delete it. ++ * Note: we pass the address of a pointer and set it to NULL. + */ + void +-_mesa_dereference_framebuffer(struct gl_framebuffer **fb) ++_mesa_unreference_framebuffer(struct gl_framebuffer **fb) + { +- GLboolean deleteFlag = GL_FALSE; ++ assert(fb); ++ if (*fb) { ++ GLboolean deleteFlag = GL_FALSE; + +- _glthread_LOCK_MUTEX((*fb)->Mutex); +- { ++ _glthread_LOCK_MUTEX((*fb)->Mutex); + ASSERT((*fb)->RefCount > 0); + (*fb)->RefCount--; + deleteFlag = ((*fb)->RefCount == 0); +- } +- _glthread_UNLOCK_MUTEX((*fb)->Mutex); ++ _glthread_UNLOCK_MUTEX((*fb)->Mutex); ++ ++ if (deleteFlag) ++ (*fb)->Delete(*fb); + +- if (deleteFlag) { +- (*fb)->Delete(*fb); + *fb = NULL; + } + } +diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h +index 7f3254f..4d76f3a 100644 +--- a/src/mesa/main/framebuffer.h ++++ b/src/mesa/main/framebuffer.h +@@ -43,7 +43,11 @@ extern void + _mesa_free_framebuffer_data(struct gl_framebuffer *buffer); + + extern void +-_mesa_dereference_framebuffer(struct gl_framebuffer **fb); ++_mesa_reference_framebuffer(struct gl_framebuffer **ptr, ++ struct gl_framebuffer *fb); ++ ++extern void ++_mesa_unreference_framebuffer(struct gl_framebuffer **fb); + + extern void + _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, +diff --git a/src/mesa/main/rbadaptors.c b/src/mesa/main/rbadaptors.c +index 313c8d4..60f4948 100644 +--- a/src/mesa/main/rbadaptors.c ++++ b/src/mesa/main/rbadaptors.c +@@ -1,8 +1,8 @@ + /* + * Mesa 3-D graphics library +- * Version: 6.5.1 ++ * Version: 6.5.3 + * +- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. ++ * Copyright (C) 1999-2007 Brian Paul 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"), +@@ -45,7 +45,7 @@ Delete_wrapper(struct gl_renderbuffer *r + /* Decrement reference count on the buffer we're wrapping and delete + * it if refcount hits zero. + */ +- _mesa_dereference_renderbuffer(&rb->Wrapped); ++ _mesa_unreference_renderbuffer(&rb->Wrapped); + + /* delete myself */ + _mesa_delete_renderbuffer(rb); +diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c +index 6b18d60..1cc95a7 100644 +--- a/src/mesa/main/renderbuffer.c ++++ b/src/mesa/main/renderbuffer.c +@@ -2089,32 +2089,33 @@ _mesa_remove_renderbuffer(struct gl_fram + if (!rb) + return; + +- _mesa_dereference_renderbuffer(&rb); ++ _mesa_unreference_renderbuffer(&rb); + + fb->Attachment[bufferName].Renderbuffer = NULL; + } + + + /** +- * Decrement the reference count on a renderbuffer and delete it when ++ * Decrement a renderbuffer object's reference count and delete it when + * the refcount hits zero. +- * Note: we pass the address of a pointer and set it to NULL if we delete it. ++ * Note: we pass the address of a pointer. + */ + void +-_mesa_dereference_renderbuffer(struct gl_renderbuffer **rb) ++_mesa_unreference_renderbuffer(struct gl_renderbuffer **rb) + { +- GLboolean deleteFlag = GL_FALSE; ++ assert(rb); ++ if (*rb) { ++ GLboolean deleteFlag = GL_FALSE; + +- _glthread_LOCK_MUTEX((*rb)->Mutex); +- { ++ _glthread_LOCK_MUTEX((*rb)->Mutex); + ASSERT((*rb)->RefCount > 0); + (*rb)->RefCount--; + deleteFlag = ((*rb)->RefCount == 0); +- } +- _glthread_UNLOCK_MUTEX((*rb)->Mutex); ++ _glthread_UNLOCK_MUTEX((*rb)->Mutex); ++ ++ if (deleteFlag) ++ (*rb)->Delete(*rb); + +- if (deleteFlag) { +- (*rb)->Delete(*rb); + *rb = NULL; + } + } +diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h +index 74ca43c..e1a0a55 100644 +--- a/src/mesa/main/renderbuffer.h ++++ b/src/mesa/main/renderbuffer.h +@@ -99,7 +99,7 @@ extern void + _mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName); + + extern void +-_mesa_dereference_renderbuffer(struct gl_renderbuffer **rb); ++_mesa_unreference_renderbuffer(struct gl_renderbuffer **rb); + + extern struct gl_renderbuffer * + _mesa_new_depthstencil_renderbuffer(GLcontext *ctx, GLuint name); diff --git a/bug-211314-patch-3.diff b/bug-211314-patch-3.diff new file mode 100644 index 0000000..2d94bef --- /dev/null +++ b/bug-211314-patch-3.diff @@ -0,0 +1,29 @@ +commit 955906aa647d0d233b422c979e1ee81dc32abb87 +Author: Brian +Date: Tue Mar 6 16:25:07 2007 -0700 + + fix renderbuffer mem leak + +diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c +index a358ec2..747971a 100644 +--- a/src/mesa/drivers/x11/xm_buffer.c ++++ b/src/mesa/drivers/x11/xm_buffer.c +@@ -418,6 +418,18 @@ xmesa_delete_framebuffer(struct gl_frame + XMesaDestroyImage( b->rowimage ); + } + ++ /* Note that XMesaBuffer renderbuffers normally have a refcount of 2 ++ * (creation + binding) so we need to explicitly delete/unbind them here. ++ */ ++ if (b->frontxrb) { ++ _mesa_unreference_renderbuffer((struct gl_renderbuffer **) &b->frontxrb); ++ ASSERT(b->frontxrb == NULL); ++ } ++ if (b->backxrb) { ++ _mesa_unreference_renderbuffer((struct gl_renderbuffer **) &b->backxrb); ++ ASSERT(b->backxrb == NULL); ++ } ++ + _mesa_free_framebuffer_data(fb); + _mesa_free(fb); + } diff --git a/bug-211314-patch-4.diff b/bug-211314-patch-4.diff new file mode 100644 index 0000000..3409320 --- /dev/null +++ b/bug-211314-patch-4.diff @@ -0,0 +1,24 @@ +commit 1a6baf092b4c31d5fd30c934f1a17d69c9689f12 +Author: Brian +Date: Tue Mar 6 16:26:02 2007 -0700 + + unreference old framebuffer, if needed, in _mesa_reference_framebuffer() + +diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c +index c97d2f0..3136a95 100644 +--- a/src/mesa/main/framebuffer.c ++++ b/src/mesa/main/framebuffer.c +@@ -253,6 +253,13 @@ _mesa_reference_framebuffer(struct gl_fr + struct gl_framebuffer *fb) + { + assert(ptr); ++ if (*ptr == fb) { ++ /* no change */ ++ return; ++ } ++ if (*ptr) { ++ _mesa_unreference_framebuffer(ptr); ++ } + assert(!*ptr); + assert(fb); + _glthread_LOCK_MUTEX(fb->Mutex); diff --git a/bug-211314-patch-5.diff b/bug-211314-patch-5.diff new file mode 100644 index 0000000..6a38ae4 --- /dev/null +++ b/bug-211314-patch-5.diff @@ -0,0 +1,26 @@ +commit e69da9d02ecdf47d930276783f8b8df1a3cd99dd +Author: Brian +Date: Tue Mar 6 16:26:22 2007 -0700 + + explicit calls to _mesa_unreference_framebuffer() not always needed now + +diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c +index 6608eef..f7e870b 100644 +--- a/src/mesa/main/fbobject.c ++++ b/src/mesa/main/fbobject.c +@@ -1014,7 +1014,6 @@ _mesa_BindFramebufferEXT(GLenum target, + */ + + if (bindReadBuf) { +- _mesa_unreference_framebuffer(&ctx->ReadBuffer); + _mesa_reference_framebuffer(&ctx->ReadBuffer, newFb); + } + +@@ -1022,7 +1021,6 @@ _mesa_BindFramebufferEXT(GLenum target, + /* check if old FB had any texture attachments */ + check_end_texture_render(ctx, ctx->DrawBuffer); + /* check if time to delete this framebuffer */ +- _mesa_unreference_framebuffer(&ctx->DrawBuffer); + _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb); + if (newFb->Name != 0) { + /* check if newly bound framebuffer has any texture attachments */ diff --git a/bug-211314-patch-6.diff b/bug-211314-patch-6.diff new file mode 100644 index 0000000..bcbbd9a --- /dev/null +++ b/bug-211314-patch-6.diff @@ -0,0 +1,30 @@ +commit 47e0b606a85059ff29fe311dc2f1bcafdefe4cdb +Author: Brian +Date: Wed Mar 14 12:42:30 2007 -0600 + + move CLIENT_ID code in xmesa_delete_framebuffer(), see bug 7205 + +diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c +index 747971a..73c46b1 100644 +--- a/src/mesa/drivers/x11/xm_buffer.c ++++ b/src/mesa/drivers/x11/xm_buffer.c +@@ -362,16 +362,13 @@ xmesa_delete_framebuffer(struct gl_frame + { + XMesaBuffer b = XMESA_BUFFER(fb); + +-#ifdef XFree86Server +- int client = 0; +- if (b->frontxrb->drawable) +- client = CLIENT_ID(b->frontxrb->drawable->id); +-#endif +- + if (b->num_alloced > 0) { + /* If no other buffer uses this X colormap then free the colors. */ + if (!xmesa_find_buffer(b->display, b->cmap, b)) { + #ifdef XFree86Server ++ int client = 0; ++ if (b->frontxrb->drawable) ++ client = CLIENT_ID(b->frontxrb->drawable->id); + (void)FreeColors(b->cmap, client, + b->num_alloced, b->alloced_colors, 0); + #else diff --git a/bug-211314-patch-7.diff b/bug-211314-patch-7.diff new file mode 100644 index 0000000..b83696e --- /dev/null +++ b/bug-211314-patch-7.diff @@ -0,0 +1,23 @@ +commit 3049946fa742b654afa9b24f8bc79f387f01aea9 +Author: Brian +Date: Wed Mar 14 12:52:53 2007 -0600 + + clear the b->frontxrb->drawable field in xmesa_free_buffer(), see bug 7205 + +diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c +index 776928d..cbbbd56 100644 +--- a/src/mesa/drivers/x11/xm_api.c ++++ b/src/mesa/drivers/x11/xm_api.c +@@ -483,6 +483,12 @@ xmesa_free_buffer(XMesaBuffer buffer) + + /* mark as delete pending */ + fb->DeletePending = GL_TRUE; ++ ++ /* Since the X window for the XMesaBuffer is going away, we don't ++ * want to dereference this pointer in the future. ++ */ ++ b->frontxrb->drawable = 0; ++ + /* Unreference. If count = zero we'll really delete the buffer */ + _mesa_unreference_framebuffer(&fb); + diff --git a/bug-211314-patch-8.diff b/bug-211314-patch-8.diff new file mode 100644 index 0000000..d21e413 --- /dev/null +++ b/bug-211314-patch-8.diff @@ -0,0 +1,47 @@ +commit 038e981cacdc6f32588442666cde8a8fc16cfdfc +Author: Brian +Date: Thu Mar 15 11:11:41 2007 -0600 + + add some rb->Data null ptr checks (bug 7205) + +diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c +index 69e9404..f53e7f5 100644 +--- a/src/mesa/swrast/s_accum.c ++++ b/src/mesa/swrast/s_accum.c +@@ -136,7 +136,9 @@ _swrast_clear_accum_buffer( GLcontext *c + return; + } + +- assert(rb); ++ if (!rb || !rb->Data) ++ return; ++ + assert(rb->_BaseFormat == GL_RGBA); + /* add other types in future? */ + assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT); +diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c +index 408174c..dde2b1d 100644 +--- a/src/mesa/swrast/s_depth.c ++++ b/src/mesa/swrast/s_depth.c +@@ -1350,7 +1350,7 @@ _swrast_clear_depth_buffer( GLcontext *c + GLuint clearValue; + GLint x, y, width, height; + +- if (!rb || !ctx->Depth.Mask) { ++ if (!rb || !ctx->Depth.Mask || !rb->Data) { + /* no depth buffer, or writing to it is disabled */ + return; + } +diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c +index a8aa1d4..43475c0 100644 +--- a/src/mesa/swrast/s_stencil.c ++++ b/src/mesa/swrast/s_stencil.c +@@ -1154,7 +1154,7 @@ _swrast_clear_stencil_buffer( GLcontext + const GLuint stencilMax = (1 << stencilBits) - 1; + GLint x, y, width, height; + +- if (!rb || mask == 0) ++ if (!rb || mask == 0 || !rb->Data) + return; + + ASSERT(rb->DataType == GL_UNSIGNED_BYTE || diff --git a/bug-211314-patch-9.diff b/bug-211314-patch-9.diff new file mode 100644 index 0000000..28d4dc2 --- /dev/null +++ b/bug-211314-patch-9.diff @@ -0,0 +1,20 @@ +commit 4d2eb637a20e4fdf5d5f6c0ea4d4627894594661 +Author: Brian +Date: Thu Mar 15 11:16:41 2007 -0600 + + no-op clear if buffer width or height is zero (bug 7205) + +diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c +index 0e3ed15..11bd173 100644 +--- a/src/mesa/main/buffers.c ++++ b/src/mesa/main/buffers.c +@@ -140,6 +140,9 @@ _mesa_Clear( GLbitfield mask ) + return; + } + ++ if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0) ++ return; ++ + if (ctx->RenderMode == GL_RENDER) { + GLbitfield bufferMask; + diff --git a/bug-211314_mesa-destroy_buffers.diff b/bug-211314_mesa-destroy_buffers.diff new file mode 100644 index 0000000..e1c17b3 --- /dev/null +++ b/bug-211314_mesa-destroy_buffers.diff @@ -0,0 +1,317 @@ +commit 928a70e4354d4884e2918ec67ddc6d8baf942c8a +Author: Brian +Date: Mon Feb 26 11:39:17 2007 -0700 + + Rewrite code related to buffer destruction. + + Do proper reference counting so that we don't wind up with dangling + references to deleted windows/framebuffers. Should help with bug 7205. + +diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c +index b0ef422..2cd7d8a 100644 +--- a/src/mesa/drivers/x11/xm_api.c ++++ b/src/mesa/drivers/x11/xm_api.c +@@ -345,7 +345,7 @@ xmesa_get_window_size(XMesaDisplay *dpy, + /***** Linked list of XMesaBuffers *****/ + /**********************************************************************/ + +-static XMesaBuffer XMesaBufferList = NULL; ++XMesaBuffer XMesaBufferList = NULL; + + + /** +@@ -378,6 +378,7 @@ create_xmesa_buffer(XMesaDrawable d, Buf + b->cmap = cmap; + + _mesa_initialize_framebuffer(&b->mesa_buffer, &vis->mesa_visual); ++ b->mesa_buffer.Delete = xmesa_delete_framebuffer; + + /* + * Front renderbuffer +@@ -451,8 +452,8 @@ create_xmesa_buffer(XMesaDrawable d, Buf + * Find an XMesaBuffer by matching X display and colormap but NOT matching + * the notThis buffer. + */ +-static XMesaBuffer +-find_xmesa_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis) ++XMesaBuffer ++xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis) + { + XMesaBuffer b; + for (b=XMesaBufferList; b; b=b->Next) { +@@ -465,38 +466,27 @@ find_xmesa_buffer(XMesaDisplay *dpy, XMe + + + /** +- * Free an XMesaBuffer, remove from linked list, perhaps free X colormap +- * entries. ++ * Remove buffer from linked list, delete if no longer referenced. + */ + static void +-free_xmesa_buffer(int client, XMesaBuffer buffer) ++xmesa_free_buffer(XMesaBuffer buffer) + { + XMesaBuffer prev = NULL, b; +- (void) client; +- for (b=XMesaBufferList; b; b=b->Next) { +- if (b==buffer) { +- /* unlink bufer from list */ ++ ++ for (b = XMesaBufferList; b; b = b->Next) { ++ if (b == buffer) { ++ struct gl_framebuffer *fb = &buffer->mesa_buffer; ++ ++ /* unlink buffer from list */ + if (prev) + prev->Next = buffer->Next; + else + XMesaBufferList = buffer->Next; +- /* Check to free X colors */ +- if (buffer->num_alloced>0) { +- /* If no other buffer uses this X colormap then free the colors. */ +- if (!find_xmesa_buffer(buffer->display, buffer->cmap, buffer)) { +-#ifdef XFree86Server +- (void)FreeColors(buffer->cmap, client, +- buffer->num_alloced, buffer->alloced_colors, +- 0); +-#else +- XFreeColors(buffer->display, buffer->cmap, +- buffer->alloced_colors, buffer->num_alloced, 0); +-#endif +- } +- } + +- _mesa_free_framebuffer_data(&buffer->mesa_buffer); +- _mesa_free(buffer); ++ /* mark as delete pending */ ++ fb->DeletePending = GL_TRUE; ++ /* Dereference. If count = zero we'll really delete the buffer */ ++ _mesa_dereference_framebuffer(&fb); + + return; + } +@@ -504,7 +494,7 @@ free_xmesa_buffer(int client, XMesaBuffe + prev = b; + } + /* buffer not found in XMesaBufferList */ +- _mesa_problem(NULL,"free_xmesa_buffer() - buffer not found\n"); ++ _mesa_problem(NULL,"xmesa_free_buffer() - buffer not found\n"); + } + + +@@ -686,7 +676,7 @@ setup_grayscale(int client, XMesaVisual + return GL_FALSE; + } + +- prevBuffer = find_xmesa_buffer(v->display, cmap, buffer); ++ prevBuffer = xmesa_find_buffer(v->display, cmap, buffer); + if (prevBuffer && + (buffer->xm_visual->mesa_visual.rgbMode == + prevBuffer->xm_visual->mesa_visual.rgbMode)) { +@@ -775,7 +765,7 @@ setup_dithered_color(int client, XMesaVi + return GL_FALSE; + } + +- prevBuffer = find_xmesa_buffer(v->display, cmap, buffer); ++ prevBuffer = xmesa_find_buffer(v->display, cmap, buffer); + if (prevBuffer && + (buffer->xm_visual->mesa_visual.rgbMode == + prevBuffer->xm_visual->mesa_visual.rgbMode)) { +@@ -1666,7 +1656,7 @@ XMesaCreateWindowBuffer2(XMesaVisual v, + + if (!initialize_visual_and_buffer( client, v, b, v->mesa_visual.rgbMode, + (XMesaDrawable) w, cmap )) { +- free_xmesa_buffer(client, b); ++ xmesa_free_buffer(b); + return NULL; + } + +@@ -1787,7 +1777,7 @@ XMesaCreatePixmapBuffer(XMesaVisual v, X + + if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode, + (XMesaDrawable) p, cmap)) { +- free_xmesa_buffer(client, b); ++ xmesa_free_buffer(b); + return NULL; + } + +@@ -1821,7 +1811,7 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaC + + if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode, + drawable, cmap)) { +- free_xmesa_buffer(client, b); ++ xmesa_free_buffer(b); + return NULL; + } + +@@ -1834,48 +1824,10 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaC + /* + * Deallocate an XMesaBuffer structure and all related info. + */ +-void XMesaDestroyBuffer( XMesaBuffer b ) ++void ++XMesaDestroyBuffer(XMesaBuffer b) + { +- int client = 0; +- +-#ifdef XFree86Server +- if (b->frontxrb->drawable) +- client = CLIENT_ID(b->frontxrb->drawable->id); +-#endif +- +- if (b->gc) XMesaFreeGC( b->xm_visual->display, b->gc ); +- if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc ); +- if (b->swapgc) XMesaFreeGC( b->xm_visual->display, b->swapgc ); +- +- if (b->xm_visual->mesa_visual.doubleBufferMode) +- { +- if (b->backxrb->ximage) { +-#if defined(USE_XSHM) && !defined(XFree86Server) +- if (b->shm) { +- XShmDetach( b->xm_visual->display, &b->shminfo ); +- XDestroyImage( b->backxrb->ximage ); +- shmdt( b->shminfo.shmaddr ); +- } +- else +-#endif +- XMesaDestroyImage( b->backxrb->ximage ); +- } +- if (b->backxrb->pixmap) { +- XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap ); +- if (b->xm_visual->hpcr_clear_flag) { +- XMesaFreePixmap( b->xm_visual->display, +- b->xm_visual->hpcr_clear_pixmap ); +- XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage ); +- } +- } +- } +- if (b->rowimage) { +- _mesa_free( b->rowimage->data ); +- b->rowimage->data = NULL; +- XMesaDestroyImage( b->rowimage ); +- } +- +- free_xmesa_buffer(client, b); ++ xmesa_free_buffer(b); + } + + +@@ -2436,7 +2388,7 @@ void xmesa_destroy_buffers_on_display(XM + for (b = XMesaBufferList; b; b = next) { + next = b->Next; + if (b->display == dpy) { +- free_xmesa_buffer(0, b); ++ xmesa_free_buffer(b); + } + } + } +diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c +index 490c479..187ae51 100644 +--- a/src/mesa/drivers/x11/xm_buffer.c ++++ b/src/mesa/drivers/x11/xm_buffer.c +@@ -33,6 +33,7 @@ + #include "GL/xmesa.h" + #include "xmesaP.h" + #include "imports.h" ++#include "framebuffer.h" + #include "renderbuffer.h" + + +@@ -352,5 +353,72 @@ xmesa_new_renderbuffer(GLcontext *ctx, G + } + + ++/** ++ * Called via gl_framebuffer::Delete() method when this buffer ++ * is _really_ being ++ * deleted. ++ */ ++void ++xmesa_delete_framebuffer(struct gl_framebuffer *fb) ++{ ++ XMesaBuffer b = XMESA_BUFFER(fb); + ++#ifdef XFree86Server ++ int client = 0; ++ if (b->frontxrb->drawable) ++ client = CLIENT_ID(b->frontxrb->drawable->id); ++#endif + ++ if (b->num_alloced > 0) { ++ /* If no other buffer uses this X colormap then free the colors. */ ++ if (!xmesa_find_buffer(b->display, b->cmap, b)) { ++#ifdef XFree86Server ++ (void)FreeColors(b->cmap, client, ++ b->num_alloced, b->alloced_colors, 0); ++#else ++ XFreeColors(b->display, b->cmap, ++ b->alloced_colors, b->num_alloced, 0); ++#endif ++ } ++ } ++ ++ if (b->gc) ++ XMesaFreeGC(b->xm_visual->display, b->gc); ++ if (b->cleargc) ++ XMesaFreeGC(b->xm_visual->display, b->cleargc); ++ if (b->swapgc) ++ XMesaFreeGC(b->xm_visual->display, b->swapgc); ++ ++ if (b->xm_visual->mesa_visual.doubleBufferMode) { ++ /* free back ximage/pixmap/shmregion */ ++ if (b->backxrb->ximage) { ++#if defined(USE_XSHM) && !defined(XFree86Server) ++ if (b->shm) { ++ XShmDetach( b->xm_visual->display, &b->shminfo ); ++ XDestroyImage( b->backxrb->ximage ); ++ shmdt( b->shminfo.shmaddr ); ++ } ++ else ++#endif ++ XMesaDestroyImage( b->backxrb->ximage ); ++ b->backxrb->ximage = NULL; ++ } ++ if (b->backxrb->pixmap) { ++ XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap ); ++ if (b->xm_visual->hpcr_clear_flag) { ++ XMesaFreePixmap( b->xm_visual->display, ++ b->xm_visual->hpcr_clear_pixmap ); ++ XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage ); ++ } ++ } ++ } ++ ++ if (b->rowimage) { ++ _mesa_free( b->rowimage->data ); ++ b->rowimage->data = NULL; ++ XMesaDestroyImage( b->rowimage ); ++ } ++ ++ _mesa_free_framebuffer_data(fb); ++ _mesa_free(fb); ++} +diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h +index e332fb5..5516031 100644 +--- a/src/mesa/drivers/x11/xmesaP.h ++++ b/src/mesa/drivers/x11/xmesaP.h +@@ -42,6 +42,7 @@ + + extern _glthread_Mutex _xmesa_lock; + ++extern XMesaBuffer XMesaBufferList; + + /* for PF_8R8G8B24 pixel format */ + typedef struct { +@@ -489,6 +490,12 @@ extern struct xmesa_renderbuffer * + xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, + GLboolean backBuffer); + ++extern void ++xmesa_delete_framebuffer(struct gl_framebuffer *fb); ++ ++extern XMesaBuffer ++xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis); ++ + extern unsigned long + xmesa_color_to_pixel( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a, diff --git a/bug-211314_mesa-framebuffer-counting.diff b/bug-211314_mesa-framebuffer-counting.diff new file mode 100644 index 0000000..ef80c39 --- /dev/null +++ b/bug-211314_mesa-framebuffer-counting.diff @@ -0,0 +1,147 @@ +commit e6a9381f78605072cab52447fce35eaa98c1e75c +Author: Brian +Date: Mon Feb 26 11:37:37 2007 -0700 + + Do proper framebuffer refcounting in _mesa_make_current(). + + Also, added DeletePending field to gl_framebuffer used when a window has been + deleted, but there still may be rendering contexts attached to the + gl_framebuffer object. + +diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c +index 9b3759b..1245c10 100644 +--- a/src/mesa/main/context.c ++++ b/src/mesa/main/context.c +@@ -95,6 +95,7 @@ + #include "fbobject.h" + #include "feedback.h" + #include "fog.h" ++#include "framebuffer.h" + #include "get.h" + #include "glthread.h" + #include "glapioffsets.h" +@@ -1666,6 +1667,8 @@ void + _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ) + { ++ GET_CURRENT_CONTEXT(oldCtx); ++ + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(newCtx, "_mesa_make_current()\n"); + +@@ -1690,6 +1693,15 @@ _mesa_make_current( GLcontext *newCtx, G + _glapi_set_context((void *) newCtx); + ASSERT(_mesa_get_current_context() == newCtx); + ++ if (oldCtx) { ++ if (oldCtx->WinSysDrawBuffer) { ++ _mesa_dereference_framebuffer(&oldCtx->WinSysDrawBuffer); ++ } ++ if (oldCtx->WinSysReadBuffer) { ++ _mesa_dereference_framebuffer(&oldCtx->WinSysReadBuffer); ++ } ++ } ++ + if (!newCtx) { + _glapi_set_dispatch(NULL); /* none current */ + } +@@ -1703,6 +1715,8 @@ _mesa_make_current( GLcontext *newCtx, G + ASSERT(readBuffer->Name == 0); + newCtx->WinSysDrawBuffer = drawBuffer; + newCtx->WinSysReadBuffer = readBuffer; ++ drawBuffer->RefCount++; ++ readBuffer->RefCount++; + + /* + * Only set the context's Draw/ReadBuffer fields if they're NULL +diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c +index 4651974..d061d22 100644 +--- a/src/mesa/main/framebuffer.c ++++ b/src/mesa/main/framebuffer.c +@@ -166,6 +166,8 @@ _mesa_initialize_framebuffer(struct gl_f + + _glthread_INIT_MUTEX(fb->Mutex); + ++ fb->RefCount = 1; ++ + /* save the visual */ + fb->Visual = *visual; + +@@ -198,7 +200,6 @@ void + _mesa_destroy_framebuffer(struct gl_framebuffer *fb) + { + if (fb) { +- _glthread_DESTROY_MUTEX(fb->Mutex); + _mesa_free_framebuffer_data(fb); + _mesa_free(fb); + } +@@ -216,6 +217,8 @@ _mesa_free_framebuffer_data(struct gl_fr + + assert(fb); + ++ _glthread_DESTROY_MUTEX(fb->Mutex); ++ + for (i = 0; i < BUFFER_COUNT; i++) { + struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; + if (att->Renderbuffer) { +@@ -605,21 +608,25 @@ update_color_draw_buffers(GLcontext *ctx + GLbitfield bufferMask = fb->_ColorDrawBufferMask[output]; + GLuint count = 0; + GLuint i; +- /* We need the inner loop here because glDrawBuffer(GL_FRONT_AND_BACK) +- * can specify writing to two or four color buffers (for example). +- */ +- for (i = 0; bufferMask && i < BUFFER_COUNT; i++) { +- const GLuint bufferBit = 1 << i; +- if (bufferBit & bufferMask) { +- struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; +- if (rb) { +- fb->_ColorDrawBuffers[output][count] = rb; +- count++; +- } +- else { +- /*_mesa_warning(ctx, "DrawBuffer names a missing buffer!\n");*/ ++ if (!fb->DeletePending) { ++ /* We need the inner loop here because glDrawBuffer(GL_FRONT_AND_BACK) ++ * can specify writing to two or four color buffers (for example). ++ */ ++ for (i = 0; bufferMask && i < BUFFER_COUNT; i++) { ++ const GLuint bufferBit = 1 << i; ++ if (bufferBit & bufferMask) { ++ struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; ++ if (rb) { ++ fb->_ColorDrawBuffers[output][count] = rb; ++ count++; ++ } ++ else { ++ /* ++ _mesa_warning(ctx, "DrawBuffer names a missing buffer!\n"); ++ */ ++ } ++ bufferMask &= ~bufferBit; + } +- bufferMask &= ~bufferBit; + } + } + fb->_NumColorDrawBuffers[output] = count; +@@ -635,7 +642,7 @@ static void + update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb) + { + (void) ctx; +- if (fb->_ColorReadBufferIndex == -1) { ++ if (fb->_ColorReadBufferIndex == -1 || fb->DeletePending) { + fb->_ColorReadBuffer = NULL; /* legal! */ + } + else { +diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h +index e8f0f45..422d176 100644 +--- a/src/mesa/main/mtypes.h ++++ b/src/mesa/main/mtypes.h +@@ -2243,6 +2243,7 @@ struct gl_framebuffer + _glthread_Mutex Mutex; /**< for thread safety */ + GLuint Name; /* if zero, this is a window system framebuffer */ + GLint RefCount; ++ GLboolean DeletePending; + + GLvisual Visual; /**< The framebuffer's visual. + Immutable if this is a window system buffer. diff --git a/bug-211314_mesa-refcount-memleak-fixes.diff b/bug-211314_mesa-refcount-memleak-fixes.diff new file mode 100644 index 0000000..1c73430 --- /dev/null +++ b/bug-211314_mesa-refcount-memleak-fixes.diff @@ -0,0 +1,316 @@ +commit 42aaa548a1020be5d40b3dce9448d8004b1ef947 +Author: Brian +Date: Sun Mar 25 10:39:36 2007 -0600 + + Fix some renderbuffer reference counting issues. Also fixes a mem leak. + +diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c +index c1fa233..bb8fe31 100644 +--- a/src/mesa/drivers/x11/xm_buffer.c ++++ b/src/mesa/drivers/x11/xm_buffer.c +@@ -422,18 +422,6 @@ xmesa_delete_framebuffer(struct gl_frame + XMesaDestroyImage( b->rowimage ); + } + +- /* Note that XMesaBuffer renderbuffers normally have a refcount of 2 +- * (creation + binding) so we need to explicitly delete/unbind them here. +- */ +- if (b->frontxrb) { +- _mesa_unreference_renderbuffer((struct gl_renderbuffer **) &b->frontxrb); +- ASSERT(b->frontxrb == NULL); +- } +- if (b->backxrb) { +- _mesa_unreference_renderbuffer((struct gl_renderbuffer **) &b->backxrb); +- ASSERT(b->backxrb == NULL); +- } +- + _mesa_free_framebuffer_data(fb); + _mesa_free(fb); + } +diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c +index f7e870b..fefa14e 100644 +--- a/src/mesa/main/fbobject.c ++++ b/src/mesa/main/fbobject.c +@@ -559,7 +559,7 @@ _mesa_IsRenderbufferEXT(GLuint renderbuf + void GLAPIENTRY + _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) + { +- struct gl_renderbuffer *newRb, *oldRb; ++ struct gl_renderbuffer *newRb; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); +@@ -593,21 +593,16 @@ _mesa_BindRenderbufferEXT(GLenum target, + } + ASSERT(newRb->AllocStorage); + _mesa_HashInsert(ctx->Shared->RenderBuffers, renderbuffer, newRb); ++ newRb->RefCount = 1; /* referenced by hash table */ + } +- newRb->RefCount++; + } + else { + newRb = NULL; + } + +- oldRb = ctx->CurrentRenderbuffer; +- if (oldRb) { +- _mesa_unreference_renderbuffer(&oldRb); +- } +- + ASSERT(newRb != &DummyRenderbuffer); + +- ctx->CurrentRenderbuffer = newRb; ++ _mesa_reference_renderbuffer(&ctx->CurrentRenderbuffer, newRb); + } + + +@@ -632,14 +627,15 @@ _mesa_DeleteRenderbuffersEXT(GLsizei n, + _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); + } + +- /* remove from hash table immediately, to free the ID */ ++ /* Remove from hash table immediately, to free the ID. ++ * But the object will not be freed until it's no longer ++ * referenced anywhere else. ++ */ + _mesa_HashRemove(ctx->Shared->RenderBuffers, renderbuffers[i]); + + if (rb != &DummyRenderbuffer) { +- /* But the object will not be freed until it's no longer +- * bound in any context. +- */ +- _mesa_unreference_renderbuffer(&rb); ++ /* no longer referenced by hash table */ ++ _mesa_reference_renderbuffer(&rb, NULL); + } + } + } +diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c +index cd4f594..1fd31a5 100644 +--- a/src/mesa/main/framebuffer.c ++++ b/src/mesa/main/framebuffer.c +@@ -70,42 +70,6 @@ compute_depth_max(struct gl_framebuffer + + + /** +- * Set the framebuffer's _DepthBuffer field, taking care of +- * reference counts, etc. +- */ +-static void +-set_depth_renderbuffer(struct gl_framebuffer *fb, +- struct gl_renderbuffer *rb) +-{ +- if (fb->_DepthBuffer) { +- _mesa_unreference_renderbuffer(&fb->_DepthBuffer); +- } +- fb->_DepthBuffer = rb; +- if (rb) { +- rb->RefCount++; +- } +-} +- +- +-/** +- * Set the framebuffer's _StencilBuffer field, taking care of +- * reference counts, etc. +- */ +-static void +-set_stencil_renderbuffer(struct gl_framebuffer *fb, +- struct gl_renderbuffer *rb) +-{ +- if (fb->_StencilBuffer) { +- _mesa_unreference_renderbuffer(&fb->_StencilBuffer); +- } +- fb->_StencilBuffer = rb; +- if (rb) { +- rb->RefCount++; +- } +-} +- +- +-/** + * Create and initialize a gl_framebuffer object. + * This is intended for creating _window_system_ framebuffers, not generic + * framebuffer objects ala GL_EXT_framebuffer_object. +@@ -223,7 +187,7 @@ _mesa_free_framebuffer_data(struct gl_fr + for (i = 0; i < BUFFER_COUNT; i++) { + struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; + if (att->Renderbuffer) { +- _mesa_unreference_renderbuffer(&att->Renderbuffer); ++ _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); + } + if (att->Texture) { + /* render to texture */ +@@ -239,9 +203,9 @@ _mesa_free_framebuffer_data(struct gl_fr + att->Texture = NULL; + } + +- /* unbind depth/stencil to decr ref counts */ +- set_depth_renderbuffer(fb, NULL); +- set_stencil_renderbuffer(fb, NULL); ++ /* unbind _Depth/_StencilBuffer to decr ref counts */ ++ _mesa_reference_renderbuffer(&fb->_DepthBuffer, NULL); ++ _mesa_reference_renderbuffer(&fb->_StencilBuffer, NULL); + } + + +@@ -569,13 +533,13 @@ _mesa_update_depth_buffer(GLcontext *ctx + /* need to update wrapper */ + struct gl_renderbuffer *wrapper + = _mesa_new_z24_renderbuffer_wrapper(ctx, depthRb); +- set_depth_renderbuffer(fb, wrapper); ++ _mesa_reference_renderbuffer(&fb->_DepthBuffer, wrapper); + ASSERT(fb->_DepthBuffer->Wrapped == depthRb); + } + } + else { + /* depthRb may be null */ +- set_depth_renderbuffer(fb, depthRb); ++ _mesa_reference_renderbuffer(&fb->_DepthBuffer, depthRb); + } + } + +@@ -610,13 +574,13 @@ _mesa_update_stencil_buffer(GLcontext *c + /* need to update wrapper */ + struct gl_renderbuffer *wrapper + = _mesa_new_s8_renderbuffer_wrapper(ctx, stencilRb); +- set_stencil_renderbuffer(fb, wrapper); ++ _mesa_reference_renderbuffer(&fb->_StencilBuffer, wrapper); + ASSERT(fb->_StencilBuffer->Wrapped == stencilRb); + } + } + else { + /* stencilRb may be null */ +- set_stencil_renderbuffer(fb, stencilRb); ++ _mesa_reference_renderbuffer(&fb->_StencilBuffer, stencilRb); + } + } + +diff --git a/src/mesa/main/rbadaptors.c b/src/mesa/main/rbadaptors.c +index 60f4948..c1ac060 100644 +--- a/src/mesa/main/rbadaptors.c ++++ b/src/mesa/main/rbadaptors.c +@@ -45,7 +45,7 @@ Delete_wrapper(struct gl_renderbuffer *r + /* Decrement reference count on the buffer we're wrapping and delete + * it if refcount hits zero. + */ +- _mesa_unreference_renderbuffer(&rb->Wrapped); ++ _mesa_reference_renderbuffer(&rb->Wrapped, NULL); + + /* delete myself */ + _mesa_delete_renderbuffer(rb); +diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c +index ded0063..49706b5 100644 +--- a/src/mesa/main/renderbuffer.c ++++ b/src/mesa/main/renderbuffer.c +@@ -1473,7 +1473,7 @@ _mesa_init_renderbuffer(struct gl_render + + rb->ClassID = 0; + rb->Name = name; +- rb->RefCount = 1; ++ rb->RefCount = 0; + rb->Delete = _mesa_delete_renderbuffer; + + /* The rest of these should be set later by the caller of this function or +@@ -2105,9 +2105,7 @@ _mesa_add_renderbuffer(struct gl_framebu + + fb->Attachment[bufferName].Type = GL_RENDERBUFFER_EXT; + fb->Attachment[bufferName].Complete = GL_TRUE; +- fb->Attachment[bufferName].Renderbuffer = rb; +- +- rb->RefCount++; ++ _mesa_reference_renderbuffer(&fb->Attachment[bufferName].Renderbuffer, rb); + } + + +@@ -2125,38 +2123,55 @@ _mesa_remove_renderbuffer(struct gl_fram + if (!rb) + return; + +- _mesa_unreference_renderbuffer(&rb); ++ _mesa_reference_renderbuffer(&rb, NULL); + + fb->Attachment[bufferName].Renderbuffer = NULL; + } + + + /** +- * Decrement a renderbuffer object's reference count and delete it when +- * the refcount hits zero. +- * Note: we pass the address of a pointer. ++ * Set *ptr to point to rb. If *ptr points to another renderbuffer, ++ * dereference that buffer first. The new renderbuffer's refcount will ++ * be incremented. The old renderbuffer's refcount will be decremented. + */ + void +-_mesa_unreference_renderbuffer(struct gl_renderbuffer **rb) ++_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr, ++ struct gl_renderbuffer *rb) + { +- assert(rb); +- if (*rb) { ++ assert(ptr); ++ if (*ptr == rb) { ++ /* no change */ ++ return; ++ } ++ ++ if (*ptr) { ++ /* Unreference the old renderbuffer */ + GLboolean deleteFlag = GL_FALSE; ++ struct gl_renderbuffer *oldRb = *ptr; + +- _glthread_LOCK_MUTEX((*rb)->Mutex); +- ASSERT((*rb)->RefCount > 0); +- (*rb)->RefCount--; +- deleteFlag = ((*rb)->RefCount == 0); +- _glthread_UNLOCK_MUTEX((*rb)->Mutex); ++ _glthread_LOCK_MUTEX(oldRb->Mutex); ++ ASSERT(oldRb->RefCount > 0); ++ oldRb->RefCount--; ++ /*printf("RB DECR %p to %d\n", (void*) oldRb, oldRb->RefCount);*/ ++ deleteFlag = (oldRb->RefCount == 0); ++ _glthread_UNLOCK_MUTEX(oldRb->Mutex); + + if (deleteFlag) +- (*rb)->Delete(*rb); ++ oldRb->Delete(oldRb); + +- *rb = NULL; ++ *ptr = NULL; + } +-} +- ++ assert(!*ptr); + ++ if (rb) { ++ /* reference new renderbuffer */ ++ _glthread_LOCK_MUTEX(rb->Mutex); ++ rb->RefCount++; ++ /*printf("RB REF %p to %d\n", (void*)rb, rb->RefCount);*/ ++ _glthread_UNLOCK_MUTEX(rb->Mutex); ++ *ptr = rb; ++ } ++} + + + /** +@@ -2180,4 +2195,3 @@ _mesa_new_depthstencil_renderbuffer(GLco + + return dsrb; + } +- +diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h +index e5f1147..c9bf888 100644 +--- a/src/mesa/main/renderbuffer.h ++++ b/src/mesa/main/renderbuffer.h +@@ -102,7 +102,8 @@ extern void + _mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName); + + extern void +-_mesa_unreference_renderbuffer(struct gl_renderbuffer **rb); ++_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr, ++ struct gl_renderbuffer *rb); + + extern struct gl_renderbuffer * + _mesa_new_depthstencil_renderbuffer(GLcontext *ctx, GLuint name); diff --git a/symlink-mesa.sh.diff b/symlink-mesa.sh.diff new file mode 100644 index 0000000..b48e6eb --- /dev/null +++ b/symlink-mesa.sh.diff @@ -0,0 +1,11 @@ +--- /suse/sndirsch/pkgs/openSUSE/xorg7/xorg-x11-server/xorg-server-1.1.99.3/GL/symlink-mesa.sh 2006-07-20 22:27:47.000000000 +0200 ++++ GL/symlink-mesa.sh 2006-08-26 11:40:23.000000000 +0200 +@@ -468,7 +468,7 @@ + action slang_core_gc.h + action slang_fragment_builtin_gc.h + action slang_shader_syn.h +- action slang_version_syn.h ++ action slang_pp_version_syn.h + action slang_vertex_builtin_gc.h + } + diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index 840716a..f5f1e98 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Apr 27 17:00:21 CEST 2007 - sndirsch@suse.de + +- back to Mesa 6.5.2 (Bug #269155/269042) + ------------------------------------------------------------------- Wed Apr 25 19:35:35 CEST 2007 - sndirsch@suse.de diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index be2100a..e31ea26 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -21,7 +21,7 @@ BuildRequires: libjpeg-devel URL: http://xorg.freedesktop.org/ %define EXPERIMENTAL 0 Version: 7.2 -Release: 74 +Release: 76 License: X11/MIT BuildRoot: %{_tmppath}/%{name}-%{version}-build Group: System/X11/Servers/XF86_4 @@ -35,7 +35,7 @@ Provides: xorg-x11-Xnest xorg-x11-Xprt xorg-x11-Xvfb xorg-x11-server-glx Obsoletes: xorg-x11-Xnest xorg-x11-Xprt xorg-x11-Xvfb xorg-x11-server-glx Summary: X.Org Server Source: xorg-server-%{dirsuffix}.tar.bz2 -Source1: MesaLib-6.5.3rc4.tar.gz +Source1: Mesa-6.5.2.tar.bz2 Source3: README.updates Source4: xorgcfg.tar.bz2 %if %suse_version > 1010 @@ -65,6 +65,7 @@ Patch18: p_ia64-console.diff Patch19: disable-aiglx.diff Patch22: disable-root-xorg_conf.diff Patch23: disable-fbblt-opt.diff +Patch24: symlink-mesa.sh.diff Patch25: glx-align.patch Patch26: p_enable-altrix.diff Patch27: mouse.diff @@ -82,8 +83,22 @@ Patch41: loadmod-bug197195.diff Patch42: bug227111-ddc_screensize.diff Patch45: bug-197858_dpms.diff Patch46: x86emu.diff -Patch47: GL-Mesa-6.5.3.diff +Patch47: bug-211314_mesa-destroy_buffers.diff +Patch48: bug-211314_mesa-framebuffer-counting.diff +Patch49: bug-211314-patch-1.diff +Patch50: bug-211314-patch-2.diff +Patch51: bug-211314-patch-3.diff +Patch52: bug-211314-patch-4.diff +Patch53: bug-211314-patch-5.diff +Patch54: bug-211314-patch-6.diff +Patch55: bug-211314-patch-7.diff +Patch56: bug-211314-patch-8.diff +Patch57: bug-211314-patch-9.diff +Patch58: bug-211314-patch-10.diff +Patch59: bug-211314-patch-11.diff +Patch60: bug-211314_mesa-refcount-memleak-fixes.diff Patch61: bug-259290_trapfault.diff +Patch62: Mesa-6.5.2-fix_radeon_cliprect.diff Patch334: p_pci-domain.diff Patch357: p_pci-ce-x.diff @@ -128,8 +143,8 @@ An X Window System server for Virtual Network Computing (VNC). %prep %setup -q -n xorg-server-%{dirsuffix} -b1 -a4 # make legal department happy (Bug #204110) -test -f ../Mesa-6.5.3rc4/src/mesa/drivers/directfb/idirectfbgl_mesa.c && exit 1 -test -f ../Mesa-6.5.3rc4/progs/ggi/asc-view.c && exit 1 +test -f ../Mesa/src/mesa/drivers/directfb/idirectfbgl_mesa.c && exit 1 +test -f ../Mesa/progs/ggi/asc-view.c && exit 1 %patch %patch1 sed 's/LIBDIR/%{_lib}/g' %{PATCH2} | patch -p0 @@ -155,6 +170,7 @@ popd %endif %patch22 %patch23 +#%patch24 %patch25 -p1 %patch26 %patch27 @@ -175,7 +191,23 @@ popd %patch42 -p1 %patch45 -p0 %patch46 -p0 -%patch47 -p0 +pushd ../Mesa +%patch47 -p1 +%patch48 -p1 +%patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 +%patch55 -p1 +%patch56 -p1 +%patch57 -p1 +%patch58 -p1 +%patch59 -p1 +%patch60 -p1 +%patch62 -p1 +popd %patch61 -p1 %build @@ -236,7 +268,7 @@ autoreconf -fi --with-log-dir="/var/log" \ --with-os-name="openSUSE" \ --with-os-vendor="SUSE LINUX" \ - --with-mesa-source=$RPM_BUILD_DIR/Mesa-6.5.3rc4 \ + --with-mesa-source=$RPM_BUILD_DIR/Mesa \ --with-fontdir="/usr/share/fonts" \ --with-xkb-path="/usr/share/X11/xkb" \ --with-xkb-output="/var/lib/xkb/compiled" @@ -507,6 +539,8 @@ exit 0 %endif %changelog +* Fri Apr 27 2007 - sndirsch@suse.de +- back to Mesa 6.5.2 (Bug #269155/269042) * Wed Apr 25 2007 - sndirsch@suse.de - Mesa update: 4th RC ready * This fixes some breakage in RC3.