xserver: Branch 'pci-rework' - 43 commits

Ian Romanick idr at kemper.freedesktop.org
Thu Jul 6 23:00:21 EEST 2006


 .gitignore                                   |    3 
 GL/Makefile.am                               |    2 
 GL/glx/Makefile.am                           |    2 
 GL/glx/g_disptab.c                           |   44 +-
 GL/glx/g_disptab.h                           |   23 +
 GL/glx/global.c                              |   77 ----
 GL/glx/glxcmds.c                             |  478 +++++++++++++++------------
 GL/glx/glxcmdsswap.c                         |  100 ++++-
 GL/glx/glxcontext.h                          |    6 
 GL/glx/glxdrawable.h                         |    4 
 GL/glx/glxdri.c                              |  233 ++++++++-----
 GL/glx/glxerror.h                            |   58 ---
 GL/glx/glxext.c                              |   62 ++-
 GL/glx/glxext.h                              |    5 
 GL/glx/glxscreens.h                          |   13 
 GL/glx/glxserver.h                           |    3 
 GL/glx/glxutil.c                             |   36 --
 GL/glx/glxutil.h                             |   12 
 GL/glx/indirect_util.c                       |    4 
 GL/glx/xfont.c                               |    2 
 GL/include/GL/Makefile.am                    |    1 
 GL/include/GL/glx_ansic.h                    |  112 ------
 GL/include/GL/xf86glx.h                      |   39 --
 GL/include/Makefile.am                       |    1 
 GL/mesa/X/xf86glx.c                          |   40 --
 GL/mesa/X/xf86glx_util.c                     |    1 
 configure.ac                                 |    8 
 exa/exa.c                                    |    7 
 exa/exa.h                                    |    9 
 exa/exa_priv.h                               |    8 
 exa/exa_render.c                             |   13 
 fb/fbcompose.c                               |    8 
 fb/fbmmx.c                                   |    2 
 hw/dmx/dmxcmap.c                             |    2 
 hw/xfree86/common/xf86Config.c               |   10 
 hw/xfree86/common/xf86Events.c               |    6 
 hw/xfree86/dri/xf86dri.c                     |   37 +-
 hw/xfree86/exa/Makefile.am                   |   12 
 hw/xfree86/exa/exa.man.pre                   |   40 ++
 hw/xfree86/loader/os.c                       |    6 
 hw/xfree86/os-support/linux/lnx_agp.c        |    6 
 hw/xfree86/os-support/shared/libc_wrapper.c  |    4 
 hw/xfree86/os-support/solaris/apSolaris.shar |  378 +++++++++++----------
 hw/xfree86/parser/write.c                    |    2 
 hw/xfree86/xaa/xaaPict.c                     |    8 
 hw/xfree86/xaa/xaaWideLine.c                 |   19 -
 hw/xnest/XNCursor.h                          |    1 
 os/xdmcp.c                                   |    4 
 render/filter.c                              |   32 +
 render/picture.c                             |   17 
 render/picture.h                             |    4 
 render/picturestr.h                          |   10 
 52 files changed, 1052 insertions(+), 962 deletions(-)

New commits:
diff-tree fd49a0dcc13280cf195bd6c7ee0f23d0840cb665 (from parents)
Merge: e66e7b48e15543f3753951a19376f0446759963a 28b95fd9d1c2f078aaaac75c310a27b17c74a6fc
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Thu Jul 6 09:52:15 2006 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework

diff-tree 28b95fd9d1c2f078aaaac75c310a27b17c74a6fc (from fc1a55671dceae0e2a701e044ff8203fae5eb1ba)
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Thu Jul 6 03:25:38 2006 -0400

    Drop unused GL/include subtree.
    
    Woo, less Makefile's to generate.

diff --git a/GL/Makefile.am b/GL/Makefile.am
index e8e080d..b9337ba 100644
--- a/GL/Makefile.am
+++ b/GL/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = glx mesa include
+SUBDIRS = glx mesa
 
 # someone could get really crazy someday and add support for the SI...
 
diff --git a/GL/include/GL/Makefile.am b/GL/include/GL/Makefile.am
deleted file mode 100644
index f2a9023..0000000
--- a/GL/include/GL/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_DIST = glx_ansic.h xf86glx.h
diff --git a/GL/include/GL/glx_ansic.h b/GL/include/GL/glx_ansic.h
deleted file mode 100644
index 9085a08..0000000
--- a/GL/include/GL/glx_ansic.h
+++ /dev/null
@@ -1,112 +0,0 @@
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _glx_ansic_h_
-#define _glx_ansic_h_
-
-/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.5 2001/03/21 20:49:08 dawes Exp $ */
-/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
-** http://oss.sgi.com/projects/FreeB
-**
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-**
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-**
-** Additional Notice Provisions: The application programming interfaces
-** established by SGI in conjunction with the Original Code are The
-** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
-** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
-** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
-** Window System(R) (Version 1.3), released October 19, 1998. This software
-** was created using the OpenGL(R) version 1.2.1 Sample Implementation
-** published by SGI, but has not been independently verified as being
-** compliant with the OpenGL(R) version 1.2.1 Specification.
-*/
-
-/*
-** this needs to check whether we're using XFree86 at all, and then
-** which version we're using. Use these macros if version is 3.9+, else
-** use normal commands below.
-*/
-
-/*
-** turns out this include file only exists for XFree86 3.9+ 
-** I notice that not having it is not an error and does not stop the build,
-** but having it will allow opengl and glx to be built for 3.9+. We no longer
-** need an explicit define in the Makefile, just point to the correct X source
-** tree and all should be taken care of.
-*/
-
-#ifdef XFree86Server
-
-#ifndef assert
-#define assert(a)
-#endif
-
-#else
-
-#if defined(Lynx) && defined(__assert_h)
-#undef __assert_h
-#endif
-#ifdef assert
-#undef assert
-#endif
-#include <assert.h>
-
-#endif
-
-
-#define GLX_STDOUT			stdout
-#define GLX_STDERR			stderr
-#define __glXPrintf			printf
-#define __glXFprintf			fprintf
-#define __glXSprintf			sprintf
-#define __glXVfprintf			vfprintf
-#define __glXVsprintf			vsprintf
-#define __glXFopen			fopen
-#define __glXFclose			fclose
-#define __glXCos(x)			cos(x)
-#define __glXSin(x)			sin(x)
-#define __glXAtan(x)			atan(x)
-#define __glXAbs(x)			abs(x)
-#define __glXLog(x)			log(x)
-#define __glXCeil(x)			ceil(x)
-#define __glXFloor(x)			floor(x)
-#define __glXSqrt(x)			sqrt(x)
-#define __glXPow(x, y)			pow(x, y)
-#define __glXMemmove(dest, src, n)	memmove(dest, src, n)
-#define __glXMemcpy(dest, src, n)	memcpy(dest, src, n)
-#define __glXMemset(s, c, n)		memset(s, c, n)
-#define __glXStrdup(str)		xstrdup(str)
-#define __glXStrcpy(dest, src)		strcpy(dest, src)
-#define __glXStrncpy(dest, src, n)	strncpy(dest, src, n)
-#define __glXStrcat(dest, src)		strcat(dest, src)
-#define __glXStrncat(dest, src, n)	strncat(dest, src, n)
-#define __glXStrcmp(s1, s2)		strcmp(s1, s2)
-#define __glXStrncmp(s1, s2, n)		strncmp(s1, s2, n)
-#define __glXStrlen(str)		strlen(str)
-#define __glXAbort()			abort()
-#define __glXStrtok(s, delim)		strtok(s, delim)
-#define __glXStrcspn(s, reject)		strcspn(s, reject)
-#define __glXGetenv(a)			getenv(a)
-#define __glXAtoi(a)			atoi(a)
-
-#endif /* _glx_ansic_h_ */
-
diff --git a/GL/include/GL/xf86glx.h b/GL/include/GL/xf86glx.h
deleted file mode 100644
index 5d018d7..0000000
--- a/GL/include/GL/xf86glx.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $XFree86: xc/programs/Xserver/GL/include/GL/xf86glx.h,v 1.3 1999/06/14 07:31:41 dawes Exp $ */
-/**************************************************************************
-
-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 <kevin at precisioninsight.com>
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "miscstruct.h"
diff --git a/GL/include/Makefile.am b/GL/include/Makefile.am
deleted file mode 100644
index 1367fb4..0000000
--- a/GL/include/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = GL
diff --git a/GL/mesa/X/xf86glx.c b/GL/mesa/X/xf86glx.c
index 5085eb9..6015e15 100644
--- a/GL/mesa/X/xf86glx.c
+++ b/GL/mesa/X/xf86glx.c
@@ -54,7 +54,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
 #include <glxutil.h>
 #include "context.h"
 #include "xmesaP.h"
-#include <GL/xf86glx.h>
 #include "context.h"
 
 #include "glcontextmodes.h"
diff --git a/GL/mesa/X/xf86glx_util.c b/GL/mesa/X/xf86glx_util.c
index d8afcbc..4092a26 100644
--- a/GL/mesa/X/xf86glx_util.c
+++ b/GL/mesa/X/xf86glx_util.c
@@ -42,7 +42,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
 #include "pixmapstr.h"
 #include "xf86glx_util.h"
 #include <X11/Xmd.h>
-#include "GL/xf86glx.h"
 
 #ifdef ROUNDUP
 #undef ROUNDUP
diff --git a/configure.ac b/configure.ac
index 9d8dfed..55f002e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1599,8 +1599,6 @@ AC_OUTPUT([
 Makefile
 GL/Makefile
 GL/glx/Makefile
-GL/include/Makefile
-GL/include/GL/Makefile
 GL/mesa/Makefile
 GL/mesa/array_cache/Makefile
 GL/mesa/glapi/Makefile
diff-tree fc1a55671dceae0e2a701e044ff8203fae5eb1ba (from ee012588d28b468bd41da8d216210f8cb2bf8cb5)
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Thu Jun 29 04:35:45 2006 -0400

    Implement glXCreateWindow and glXDestroyWindow.

diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index 82166ac..8033f5d 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -1201,81 +1201,82 @@ int __glXGetFBConfigsSGIX(__GLXclientSta
     return DoGetFBConfigs( cl, req->screen, GL_FALSE );
 }
 
-
-/*
-** Create a GLX Pixmap from an X Pixmap.
-*/
-int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual,
-		      GLuint screenNum, XID pixmapId, XID glxpixmapId)
+static int ValidateCreateDrawable(ClientPtr client,
+				  int screenNum, XID fbconfigId,
+				  XID drawablId, XID glxDrawableId,
+				  int type, __GLcontextModes **modes,
+				  DrawablePtr *ppDraw)
 {
-    ClientPtr client = cl->client;
     DrawablePtr pDraw;
     ScreenPtr pScreen;
     VisualPtr pVisual;
-    __GLXpixmap *pGlxPixmap;
     __GLXscreen *pGlxScreen;
-    __GLcontextModes *modes;
     int i;
 
-    LEGAL_NEW_RESOURCE(glxpixmapId, client);
-    
-    pDraw = (DrawablePtr) LookupDrawable(pixmapId, client);
-    if (!pDraw || pDraw->type != DRAWABLE_PIXMAP) {
-	client->errorValue = pixmapId;
-	return BadPixmap;
+    LEGAL_NEW_RESOURCE(glxDrawableId, client);
+
+    pDraw = (DrawablePtr) LookupDrawable(drawablId, client);
+    if (!pDraw || pDraw->type != type) {
+	client->errorValue = drawablId;
+	return type == DRAWABLE_WINDOW ? BadWindow : BadPixmap;
     }
 
-    /*
-    ** Check if screen of visual matches screen of pixmap.
-    */
+    /* Check if screen of the fbconfig matches screen of drawable. */
     pScreen = pDraw->pScreen;
     if (screenNum != pScreen->myNum) {
 	return BadMatch;
     }
 
-    /*
-    ** Find the VisualRec for this visual.
-    */
+    /* If this fbconfig has a corresponding VisualRec the number of
+     * planes must match the drawable depth. */
     pVisual = pScreen->visuals;
-    for (i=0; i < pScreen->numVisuals; i++, pVisual++) {
-	if (pVisual->vid == visual) {
-	    break;
-	}
-    }
-    if (i == pScreen->numVisuals) {
-	client->errorValue = visual;
-	return BadValue;
-    }
-    /*
-    ** Check if depth of visual matches depth of pixmap.
-    */
-    if (pVisual->nplanes != pDraw->depth) {
-	return BadMatch;
+    for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+	if (pVisual->vid == fbconfigId && pVisual->nplanes != pDraw->depth)
+	    return BadMatch;
     }
 
-    /*
-    ** Get configuration of the visual.
-    */
-    pGlxScreen = __glXActiveScreens[screenNum];
-    modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual );
-    if (modes == NULL) {
-	/*
-	** Visual not support on this screen by this OpenGL implementation.
-	*/
-	client->errorValue = visual;
+    /* Get configuration of the visual. */
+    pGlxScreen = __glXgetActiveScreen(screenNum);
+    *modes = _gl_context_modes_find_visual(pGlxScreen->modes, fbconfigId);
+    if (*modes == NULL) {
+	/* Visual not support on this screen by this OpenGL implementation. */
+	client->errorValue = fbconfigId;
 	return BadValue;
     }
 
+    *ppDraw = pDraw;
+
+    return Success;
+}
+
+/*
+** Create a GLX Pixmap from an X Pixmap.
+*/
+int DoCreateGLXPixmap(__GLXclientState *cl, XID fbconfigId,
+		      GLuint screenNum, XID pixmapId, XID glxPixmapId)
+{
+    ClientPtr client = cl->client;
+    DrawablePtr pDraw;
+    __GLXpixmap *pGlxPixmap;
+    __GLcontextModes *modes;
+    int retval;
+
+    retval = ValidateCreateDrawable (client, screenNum, fbconfigId,
+				     pixmapId, glxPixmapId,
+				     DRAWABLE_PIXMAP, &modes, &pDraw);
+    if (retval != Success)
+	return retval;
+
     pGlxPixmap = (__GLXpixmap *) xalloc(sizeof(__GLXpixmap));
     if (!pGlxPixmap) {
 	return BadAlloc;
     }
-    if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) {
+    if (!(AddResource(glxPixmapId, __glXPixmapRes, pGlxPixmap))) {
 	return BadAlloc;
     }
     pGlxPixmap->pDraw = pDraw;
-    pGlxPixmap->pGlxScreen = pGlxScreen;
-    pGlxPixmap->pScreen = pScreen;
+    pGlxPixmap->pGlxScreen = __glXgetActiveScreen(screenNum);
+    pGlxPixmap->pScreen = pDraw->pScreen;
     pGlxPixmap->idExists = True;
     pGlxPixmap->pDamage = NULL;
     pGlxPixmap->refcnt = 0;
@@ -1374,19 +1375,50 @@ int __glXChangeDrawableAttributes(__GLXc
 int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
 {
     xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+    ClientPtr client = cl->client;
+    DrawablePtr pDraw;
+    __GLXdrawable *glxPriv;
+    __GLXscreen *screen;
+    __GLcontextModes *modes;
+    int retval;
 
-    (void) req;
+    retval = ValidateCreateDrawable (client, req->screen, req->fbconfig,
+				     req->window, req->glxwindow,
+				     DRAWABLE_WINDOW, &modes, &pDraw);
+    if (retval != Success)
+	return retval;
+
+    /* FIXME: We need to check that the window visual is compatible
+     * with the specified fbconfig. */
+
+    screen = __glXgetActiveScreen(req->screen);
+    glxPriv = screen->createDrawable(screen, pDraw, req->glxwindow, modes);
+    if (glxPriv == NULL)
+	return BadAlloc;
 
-    return BadRequest;
+    if (!AddResource(req->glxwindow, __glXDrawableRes, glxPriv)) {
+	glxPriv->destroy (glxPriv);
+	return BadAlloc;
+    }
+
+    return Success;
 }
 
 int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
 {
     xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+    ClientPtr client = cl->client;
 
-    (void) req;
+    /*
+    ** Check if it's a valid GLX window.
+    */
+    if (!LookupIDByType(req->glxwindow, __glXDrawableRes)) {
+	client->errorValue = req->glxwindow;
+	return __glXError(GLXBadWindow);
+    }
+    FreeResource(req->glxwindow, FALSE);
 
-    return BadRequest;
+    return Success;
 }
 
 
diff --git a/GL/glx/glxext.h b/GL/glx/glxext.h
index 34d3612..03a2464 100644
--- a/GL/glx/glxext.h
+++ b/GL/glx/glxext.h
@@ -85,7 +85,7 @@ extern int DoGetFBConfigs(__GLXclientSta
     GLboolean do_swap);
 extern int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
     GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect);
-extern int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual,
+extern int DoCreateGLXPixmap(__GLXclientState *cl, XID fbconfigId,
     GLuint screenNum, XID pixmapId, XID glxpixmapId);
 extern int DoDestroyPixmap(__GLXclientState *cl, XID glxpixmapId);
 
diff-tree ee012588d28b468bd41da8d216210f8cb2bf8cb5 (from 8b5bc6a9ab487fdea754266b120c686d75d9e100)
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Thu Jun 29 04:25:54 2006 -0400

    Move __GLXdrawable lookup and creation into GetDrawableOrPixmap.
    
    Also refactors __glXSwapBuffers to use GetDrawableOrPixmap for
    getting the __GLXdrawable.  This patch paves the way for GLXWindows
    with XIDs different from the X Windows they are created for, a
    prerequisite for glXCreateWindow().

diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index 665159c..82166ac 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -445,29 +445,46 @@ int __glXMakeCurrentReadSGI(__GLXclientS
  *        is added.
  */
 static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
-				DrawablePtr *ppDraw, __GLXpixmap **ppPixmap,
+				__GLXdrawable **ppGlxDraw,
+				__GLXpixmap **ppPixmap,
 				ClientPtr client )
 {
     DrawablePtr pDraw;
+    __GLcontextModes *modes;
+    __GLXdrawable *pGlxDraw;
     __GLXpixmap *drawPixmap = NULL;
 
+    /* This is the GLX 1.3 case - the client passes in a GLXWindow and
+     * we just return the __GLXdrawable.  The first time a GLXPixmap
+     * comes in, it doesn't have a corresponding __GLXdrawable, so it
+     * falls through to the else-case below, but after that it'll have
+     * a __GLXdrawable and we'll handle it here. */
+    pGlxDraw = (__GLXdrawable *) LookupIDByType(drawId, __glXDrawableRes);
+    if (pGlxDraw != NULL) {
+	if (glxc != NULL && pGlxDraw->modes != glxc->modes) {
+	    client->errorValue = drawId;
+	    return BadMatch;
+	}
+
+	*ppGlxDraw = pGlxDraw;
+	*ppPixmap = pGlxDraw->pGlxPixmap;
+	return Success;
+    }
+
+    /* The drawId wasn't a GLXWindow, so presumably it's a regular X
+     * window.  In that case, we create a shadow GLXWindow for it on
+     * demand here for pre GLX 1.3 compatibility and use the X Window
+     * XID as its GLXWindow XID.  The client can't explicitly create a
+     * GLXWindow with the same XID as an X Window, so we wont get any
+     * resource ID clashes.  Effectively, the X Window is now also a
+     * GLXWindow. */
     pDraw = (DrawablePtr) LookupDrawable(drawId, client);
     if (pDraw) {
 	if (pDraw->type == DRAWABLE_WINDOW) {
-	    /*
-	    ** Drawable is an X Window.
-	    */
-	    WindowPtr pWin = (WindowPtr)pDraw;
-	    VisualID vid = wVisual(pWin);
+	    VisualID vid = wVisual((WindowPtr)pDraw);
 
-	    /*
-	    ** Check if window and context are similar.
-	    */
-	    if ((vid != glxc->pVisual->vid) ||
-		(pWin->drawable.pScreen != glxc->pScreen)) {
-		client->errorValue = drawId;
-		return BadMatch;
-	    }
+	    modes = _gl_context_modes_find_visual(glxc->pGlxScreen->modes,
+						  vid);
 	} else {
 	    /*
 	    ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
@@ -479,16 +496,8 @@ static int GetDrawableOrPixmap( __GLXcon
     } else {
 	drawPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes);
 	if (drawPixmap) {
-	    /*
-	    ** Check if pixmap and context are similar.
-	    */
-	    if (drawPixmap->pScreen != glxc->pScreen ||
-		drawPixmap->modes->visualID != glxc->modes->visualID) {
-		client->errorValue = drawId;
-		return BadMatch;
-	    }
 	    pDraw = drawPixmap->pDraw;
-
+	    modes = drawPixmap->modes;
 	} else {
 	    /*
 	    ** Drawable is neither a Window nor a GLXPixmap.
@@ -498,8 +507,33 @@ static int GetDrawableOrPixmap( __GLXcon
 	}
     }
 
+    /* If we're not given a context, don't create the __GLXdrawable */
+    if (glxc == NULL) {
+	*ppPixmap = NULL;
+	*ppGlxDraw = NULL;
+	return Success;
+    }
+
+    /* We're binding an X Window or a GLX Pixmap for the first time
+     * and need to create a GLX drawable for it.  First check that the
+     * drawable screen and fbconfig matches the context ditto. */
+    if (pDraw->pScreen != glxc->pScreen || modes != glxc->modes) {
+	client->errorValue = drawId;
+	return BadMatch;
+    }
+
+    pGlxDraw =
+	glxc->pGlxScreen->createDrawable(glxc->pGlxScreen,
+					 pDraw, drawId, modes);
+
+    /* since we are creating the drawablePrivate, drawId should be new */
+    if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
+	pGlxDraw->destroy (pGlxDraw);
+	return BadAlloc;
+    }
+
     *ppPixmap = drawPixmap;
-    *ppDraw = pDraw;
+    *ppGlxDraw = pGlxDraw;
 
     return 0;
 }
@@ -510,8 +544,6 @@ int DoMakeCurrent( __GLXclientState *cl,
 		   GLXContextID contextId, GLXContextTag tag )
 {
     ClientPtr client = cl->client;
-    DrawablePtr pDraw;
-    DrawablePtr pRead;
     xGLXMakeCurrentReply reply;
     __GLXpixmap *drawPixmap = NULL;
     __GLXpixmap *readPixmap = NULL;
@@ -572,45 +604,27 @@ int DoMakeCurrent( __GLXclientState *cl,
 	assert( drawId != None );
 	assert( readId != None );
 
-	status = GetDrawableOrPixmap( glxc, drawId, & pDraw, & drawPixmap,
-				      client );
+	status = GetDrawableOrPixmap(glxc, drawId, &drawPriv, &drawPixmap,
+				     client);
 	if ( status != 0 ) {
 	    return status;
 	}
 
 	if ( readId != drawId ) {
-	    status = GetDrawableOrPixmap( glxc, readId, & pRead, & readPixmap,
-					  client );
+	    status = GetDrawableOrPixmap(glxc, readId, &readPriv, &readPixmap,
+					 client);
 	    if ( status != 0 ) {
 		return status;
 	    }
 	} else {
-	    pRead = pDraw;
-	}
-
-	/* FIXME: Finish refactoring this. - idr */
-	/* get the drawable private */
-	if (pDraw) {
-	    drawPriv = __glXGetDrawable(glxc, pDraw, drawId);
-	    if (drawPriv == NULL) {
-		return __glXError(GLXBadDrawable);
-	    }
-	}
-
-	if (pRead != pDraw) {
-	    readPriv = __glXGetDrawable(glxc, pRead, readId);
-	    if (readPriv == NULL) {
-		return __glXError(GLXBadDrawable);
-	    }
-	} else {
 	    readPriv = drawPriv;
 	}
 
     } else {
 	/* Switching to no context.  Ignore new drawable. */
 	glxc = 0;
-	pDraw = 0;
-	pRead = 0;
+	drawPriv = 0;
+	readPriv = 0;
     }
 
 
@@ -1386,45 +1400,13 @@ int __glXDestroyWindow(__GLXclientState 
 int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
 {
     ClientPtr client = cl->client;
-    DrawablePtr pDraw;
     xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
     GLXContextTag tag = req->contextTag;
     XID drawId = req->drawable;
-    __GLXpixmap *pGlxPixmap;
     __GLXcontext *glxc = NULL;
+    __GLXdrawable *pGlxDraw;
+    __GLXpixmap *pPixmap;
     int error;
-    
-    /*
-    ** Check that the GLX drawable is valid.
-    */
-    pDraw = (DrawablePtr) LookupDrawable(drawId, client);
-    if (pDraw) {
-	if (pDraw->type == DRAWABLE_WINDOW) {
-	    /*
-	    ** Drawable is an X window.
-	    */
-	} else {
-	    /*
-	    ** Drawable is an X pixmap, which is not allowed.
-	    */
-	    client->errorValue = drawId;
-	    return __glXError(GLXBadDrawable);
-	}
-    } else {
-	pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
-						    __glXPixmapRes);
-	if (pGlxPixmap) {
-	    /*
-	    ** Drawable is a GLX pixmap.
-	    */
-	} else {
-	    /*
-	    ** Drawable is neither a X window nor a GLX pixmap.
-	    */
-	    client->errorValue = drawId;
-	    return __glXError(GLXBadDrawable);
-	}
-    }
 
     if (tag) {
 	glxc = __glXLookupContextByTag(cl, tag);
@@ -1448,27 +1430,13 @@ int __glXSwapBuffers(__GLXclientState *c
 	}
     }
 
-    if (pDraw) {
-	__GLXdrawable *glxPriv;
-
-	if (glxc) {
-	    glxPriv = __glXGetDrawable(glxc, pDraw, drawId);
-	    if (glxPriv == NULL) {
-		return __glXError(GLXBadDrawable);
-	    }
-	}
-	else {
-	    glxPriv = __glXFindDrawable(drawId);
-	    if (glxPriv == NULL) {
-		/* This is a window we've never seen before, do nothing */
-		return Success;
-	    }
-	}
+    error = GetDrawableOrPixmap(glxc, drawId, &pGlxDraw, &pPixmap, client);
+    if (error != Success)
+	return error;
 
-	if ((*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) {
-	    return __glXError(GLXBadDrawable);
-	}
-    }
+    if (pGlxDraw != NULL && pGlxDraw->type == DRAWABLE_WINDOW &&
+	(*pGlxDraw->swapBuffers)(pGlxDraw) == GL_FALSE)
+	return __glXError(GLXBadDrawable);
 
     return Success;
 }
diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c
index ed5bafa..bc9adea 100644
--- a/GL/glx/glxutil.c
+++ b/GL/glx/glxutil.c
@@ -155,53 +155,3 @@ __glXDrawableInit(__GLXdrawable *drawabl
 
     return GL_TRUE;
 }
-
-__GLXdrawable *
-__glXFindDrawable(XID drawId)
-{
-    __GLXdrawable *glxPriv;
-
-    glxPriv = (__GLXdrawable *)LookupIDByType(drawId, __glXDrawableRes);
-
-    return glxPriv;
-}
-
-__GLXdrawable *
-__glXGetDrawable(__GLXcontext *ctx, DrawablePtr pDraw, XID drawId)
-{
-    __GLXscreen *pGlxScreen = ctx->pGlxScreen;
-    __GLXdrawable *glxPriv;
-    __GLcontextModes *modes;
-
-    glxPriv = __glXFindDrawable(drawId);
-
-    if (glxPriv == NULL)
-    {
-	if (pDraw->type == DRAWABLE_WINDOW) {
-	    VisualID vid = wVisual((WindowPtr)pDraw);
-
-	    modes = _gl_context_modes_find_visual(pGlxScreen->modes, vid);
-	} else {
-	    __GLXpixmap *pGlxPixmap =
-		(__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes);
-
-	    /* We never get here without a valid pixmap.
-	     * GetDrawableOrPixmap weeds out X Pixmaps without GLX
-	     * pixmaps for us. */
-
-	    modes = pGlxPixmap->modes;
-	}
-
-	glxPriv =
-	    pGlxScreen->createDrawable(ctx->pGlxScreen, pDraw, drawId, modes);
-
-	/* since we are creating the drawablePrivate, drawId should be new */
-	if (!AddResource(drawId, __glXDrawableRes, glxPriv))
-	{
-	    glxPriv->destroy (glxPriv);
-	    return NULL;
-	}
-    }
-
-    return glxPriv;
-}
diff-tree 8b5bc6a9ab487fdea754266b120c686d75d9e100 (from 7cf3ec7b59223f15314a0629f122ecb796678421)
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Thu Jun 29 00:05:01 2006 -0400

    Drop global GLX error integer variables and use __glXError() instead.
    
    Also drop glxerror.h (__glXError is now declared in glxserver.h)
    and global.c (last remaining globals are in glxext.c now).
    
    With this change we now support all GLX 1.3 error codes.

diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am
index fd8a59b..646f7d1 100644
--- a/GL/glx/Makefile.am
+++ b/GL/glx/Makefile.am
@@ -43,13 +43,11 @@ libglx_la_SOURCES = \
         glapi.c \
         glcontextmodes.c \
         glcontextmodes.h \
-        global.c \
         glthread.c \
         glxcmds.c \
         glxcmdsswap.c \
         glxcontext.h \
         glxdrawable.h \
-        glxerror.h \
         glxext.c \
         glxext.h \
 	glxvisuals.c \
diff --git a/GL/glx/global.c b/GL/glx/global.c
deleted file mode 100644
index 28030ec..0000000
--- a/GL/glx/global.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $XFree86$ */
-/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-** 
-** http://oss.sgi.com/projects/FreeB
-** 
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-** 
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-** 
-** Additional Notice Provisions: The application programming interfaces
-** established by SGI in conjunction with the Original Code are The
-** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
-** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
-** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
-** Window System(R) (Version 1.3), released October 19, 1998. This software
-** was created using the OpenGL(R) version 1.2.1 Sample Implementation
-** published by SGI, but has not been independently verified as being
-** compliant with the OpenGL(R) version 1.2.1 Specification.
-**
-*/
-
-#define NEED_REPLIES
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "glxserver.h"
-
-/*
-** The last context used by the server.  It is the context that is current
-** from the server's perspective.
-*/
-__GLXcontext *__glXLastContext;
-
-/*
-** X resources.
-*/
-RESTYPE __glXContextRes;
-RESTYPE __glXClientRes;
-RESTYPE __glXPixmapRes;
-RESTYPE __glXDrawableRes;
-RESTYPE __glXSwapBarrierRes;
-
-/*
-** Error codes with the extension error base already added in.
-*/
-int __glXBadContext, __glXBadContextState, __glXBadDrawable, __glXBadPixmap;
-int __glXBadContextTag, __glXBadCurrentWindow;
-int __glXBadRenderRequest, __glXBadLargeRequest;
-int __glXUnsupportedPrivateRequest;
-
-/*
-** Reply for most singles.
-*/
-xGLXSingleReply __glXReply;
-
-/*
-** A set of state for each client.  The 0th one is unused because client
-** indices start at 1, not 0.
-*/
-__GLXclientState *__glXClients[MAXCLIENTS+1];
-
diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index e2e157d..665159c 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -188,7 +188,7 @@ int DoCreateContext(__GLXclientState *cl
 	shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes);
 	if (!shareglxc) {
 	    client->errorValue = shareList;
-	    return __glXBadContext;
+	    return __glXError(GLXBadContext);
 	}
 	if (shareglxc->isDirect) {
 	    /*
@@ -301,7 +301,7 @@ int __glXDestroyContext(__GLXclientState
 	return Success;
     } else {
 	client->errorValue = gcId;
-	return __glXBadContext;
+	return __glXError(GLXBadContext);
     }
 }
 
@@ -474,7 +474,7 @@ static int GetDrawableOrPixmap( __GLXcon
 	    ** is, but it must first be created with glxCreateGLXPixmap).
 	    */
 	    client->errorValue = drawId;
-	    return __glXBadDrawable;
+	    return __glXError(GLXBadDrawable);
 	}
     } else {
 	drawPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes);
@@ -494,7 +494,7 @@ static int GetDrawableOrPixmap( __GLXcon
 	    ** Drawable is neither a Window nor a GLXPixmap.
 	    */
 	    client->errorValue = drawId;
-	    return __glXBadDrawable;
+	    return __glXError(GLXBadDrawable);
 	}
     }
 
@@ -542,12 +542,12 @@ int DoMakeCurrent( __GLXclientState *cl,
 	    /*
 	    ** Tag for previous context is invalid.
 	    */
-	    return __glXBadContextTag;
+	    return __glXError(GLXBadContextTag);
 	}
 	if (prevglxc->renderMode != GL_RENDER) {
 	    /* Oops.  Not in render mode render. */
 	    client->errorValue = prevglxc->id;
-	    return __glXBadContextState;
+	    return __glXError(GLXBadContextState);
 	}
     } else {
 	prevglxc = 0;
@@ -562,7 +562,7 @@ int DoMakeCurrent( __GLXclientState *cl,
 	glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes);
 	if (!glxc) {
 	    client->errorValue = contextId;
-	    return __glXBadContext;
+	    return __glXError(GLXBadContext);
 	}
 	if ((glxc != prevglxc) && glxc->isCurrent) {
 	    /* Context is current to somebody else */
@@ -593,14 +593,14 @@ int DoMakeCurrent( __GLXclientState *cl,
 	if (pDraw) {
 	    drawPriv = __glXGetDrawable(glxc, pDraw, drawId);
 	    if (drawPriv == NULL) {
-		return __glXBadDrawable;
+		return __glXError(GLXBadDrawable);
 	    }
 	}
 
 	if (pRead != pDraw) {
 	    readPriv = __glXGetDrawable(glxc, pRead, readId);
 	    if (readPriv == NULL) {
-		return __glXBadDrawable;
+		return __glXError(GLXBadDrawable);
 	    }
 	} else {
 	    readPriv = drawPriv;
@@ -631,7 +631,7 @@ int DoMakeCurrent( __GLXclientState *cl,
 	** Make the previous context not current.
 	*/
 	if (!(*prevglxc->loseCurrent)(prevglxc)) {
-	    return __glXBadContext;
+	    return __glXError(GLXBadContext);
 	}
 	__glXFlushContextCache();
 	__glXDeassociateContext(prevglxc);
@@ -647,7 +647,7 @@ int DoMakeCurrent( __GLXclientState *cl,
 	if (!(*glxc->makeCurrent)(glxc)) {
 	    glxc->drawPriv = NULL;
 	    glxc->readPriv = NULL;
-	    return __glXBadContext;
+	    return __glXError(GLXBadContext);
 	}
 
 	/* resize the buffers */
@@ -656,7 +656,7 @@ int DoMakeCurrent( __GLXclientState *cl,
 	    (*glxc->loseCurrent)(glxc);
 	    glxc->drawPriv = NULL;
 	    glxc->readPriv = NULL;
-	    return __glXBadContext;
+	    return __glXError(GLXBadContext);
 	}
 
 	glxc->isCurrent = GL_TRUE;
@@ -750,7 +750,7 @@ int __glXIsDirect(__GLXclientState *cl, 
     glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
     if (!glxc) {
 	client->errorValue = req->context;
-	return __glXBadContext;
+	return __glXError(GLXBadContext);
     }
 
     reply.isDirect = glxc->isDirect;
@@ -844,12 +844,12 @@ int __glXCopyContext(__GLXclientState *c
     src = (__GLXcontext *) LookupIDByType(source, __glXContextRes);
     if (!src) {
 	client->errorValue = source;
-	return __glXBadContext;
+	return __glXError(GLXBadContext);
     }
     dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes);
     if (!dst) {
 	client->errorValue = dest;
-	return __glXBadContext;
+	return __glXError(GLXBadContext);
     }
 
     /*
@@ -874,7 +874,7 @@ int __glXCopyContext(__GLXclientState *c
 	__GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
 	
 	if (!tagcx) {
-	    return __glXBadContextTag;
+	    return __glXError(GLXBadContextTag);
 	}
 	if (tagcx != src) {
 	    /*
@@ -1308,7 +1308,7 @@ int DoDestroyPixmap(__GLXclientState *cl
     */
     if (!LookupIDByType(glxpixmap, __glXPixmapRes)) {
 	client->errorValue = glxpixmap;
-	return __glXBadPixmap;
+	return __glXError(GLXBadPixmap);
     }
     FreeResource(glxpixmap, FALSE);
 
@@ -1408,7 +1408,7 @@ int __glXSwapBuffers(__GLXclientState *c
 	    ** Drawable is an X pixmap, which is not allowed.
 	    */
 	    client->errorValue = drawId;
-	    return __glXBadDrawable;
+	    return __glXError(GLXBadDrawable);
 	}
     } else {
 	pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
@@ -1422,14 +1422,14 @@ int __glXSwapBuffers(__GLXclientState *c
 	    ** Drawable is neither a X window nor a GLX pixmap.
 	    */
 	    client->errorValue = drawId;
-	    return __glXBadDrawable;
+	    return __glXError(GLXBadDrawable);
 	}
     }
 
     if (tag) {
 	glxc = __glXLookupContextByTag(cl, tag);
 	if (!glxc) {
-	    return __glXBadContextTag;
+	    return __glXError(GLXBadContextTag);
 	}
 	/*
 	** The calling thread is swapping its current drawable.  In this case,
@@ -1454,7 +1454,7 @@ int __glXSwapBuffers(__GLXclientState *c
 	if (glxc) {
 	    glxPriv = __glXGetDrawable(glxc, pDraw, drawId);
 	    if (glxPriv == NULL) {
-		return __glXBadDrawable;
+		return __glXError(GLXBadDrawable);
 	    }
 	}
 	else {
@@ -1466,7 +1466,7 @@ int __glXSwapBuffers(__GLXclientState *c
 	}
 
 	if ((*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) {
-	    return __glXBadDrawable;
+	    return __glXError(GLXBadDrawable);
 	}
     }
 
@@ -1486,7 +1486,7 @@ int DoQueryContext(__GLXclientState *cl,
     ctx = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes);
     if (!ctx) {
 	client->errorValue = gcId;
-	return __glXBadContext;
+	return __glXError(GLXBadContext);
     }
 
     nProps = 3;
@@ -1498,7 +1498,7 @@ int DoQueryContext(__GLXclientState *cl,
     nReplyBytes = reply.length << 2;
     sendBuf = (int *)xalloc((size_t)nReplyBytes);
     if (sendBuf == NULL) {
-	return __glXBadContext;	/* XXX: Is this correct? */
+	return __glXError(GLXBadContext);	/* XXX: Is this correct? */
     }
     pSendBuf = sendBuf;
     *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
@@ -1549,7 +1549,7 @@ int __glXBindTexImageEXT(__GLXclientStat
     buffer = *((INT32 *)  (pc + 4));
 
     if (buffer != GLX_FRONT_LEFT_EXT)
-      return __glXBadPixmap;
+	return __glXError(GLXBadPixmap);
 
     context = __glXForceCurrent (cl, req->contextTag, &error);
     if (!context)
@@ -1558,11 +1558,11 @@ int __glXBindTexImageEXT(__GLXclientStat
     pGlxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
     if (!pGlxPixmap) {
 	client->errorValue = drawId;
-	return __glXBadPixmap;
+	return __glXError(GLXBadPixmap);
     }
 
     if (!context->textureFromPixmap)
-	return __glXUnsupportedPrivateRequest;
+	return __glXError(GLXUnsupportedPrivateRequest);
 
     return context->textureFromPixmap->bindTexImage(context,
 						    buffer,
@@ -1591,11 +1591,11 @@ int __glXReleaseTexImageEXT(__GLXclientS
     pGlxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
     if (!pGlxPixmap) {
 	client->errorValue = drawId;
-	return __glXBadDrawable;
+	return __glXError(GLXBadDrawable);
     }
 
     if (!context->textureFromPixmap)
-	return __glXUnsupportedPrivateRequest;
+	return __glXError(GLXUnsupportedPrivateRequest);
 
     return context->textureFromPixmap->releaseTexImage(context,
 						       buffer,
@@ -1617,7 +1617,7 @@ DoGetDrawableAttributes(__GLXclientState
     glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
     if (!glxPixmap) {
 	client->errorValue = drawId;
-	return __glXBadPixmap;
+	return __glXError(GLXBadPixmap);
     }
 
     numAttribs = 2;
@@ -1728,13 +1728,13 @@ int __glXRender(__GLXclientState *cl, GL
 #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
 	} else {
 	    client->errorValue = commandsDone;
-	    return __glXBadRenderRequest;
+	    return __glXError(GLXBadRenderRequest);
 	}
 
         if (!entry->bytes) {
             /* unused opcode */
             client->errorValue = commandsDone;
-            return __glXBadRenderRequest;
+            return __glXError(GLXBadRenderRequest);
         }
         if (entry->varsize) {
             /* variable size command */
@@ -1820,7 +1820,7 @@ int __glXRenderLarge(__GLXclientState *c
 	*/
 	if (req->requestNumber != 1) {
 	    client->errorValue = req->requestNumber;
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 
 	hdr = (__GLXrenderLargeHeader *) pc;
@@ -1841,13 +1841,13 @@ int __glXRenderLarge(__GLXclientState *c
 #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
 	} else {
 	    client->errorValue = opcode;
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 
         if (!entry->bytes) {
             /* unused opcode */
             client->errorValue = opcode;
-            return __glXBadLargeRequest;
+            return __glXError(GLXBadLargeRequest);
         }
 	if (entry->varsize) {
 	    /*
@@ -1904,12 +1904,12 @@ int __glXRenderLarge(__GLXclientState *c
 	if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
 	    client->errorValue = req->requestNumber;
 	    __glXResetLargeCommandStatus(cl);
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 	if (req->requestTotal != cl->largeCmdRequestsTotal) {
 	    client->errorValue = req->requestTotal;
 	    __glXResetLargeCommandStatus(cl);
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 
 	/*
@@ -1918,7 +1918,7 @@ int __glXRenderLarge(__GLXclientState *c
 	if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
 	    client->errorValue = dataBytes;
 	    __glXResetLargeCommandStatus(cl);
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 	memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
 	cl->largeCmdBytesSoFar += dataBytes;
@@ -1942,7 +1942,7 @@ int __glXRenderLarge(__GLXclientState *c
 		__GLX_PAD(cl->largeCmdBytesTotal)) {
 		client->errorValue = dataBytes;
 		__glXResetLargeCommandStatus(cl);
-		return __glXBadLargeRequest;
+		return __glXError(GLXBadLargeRequest);
 	    }
 	    hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
 	    opcode = hdr->opcode;
@@ -1961,7 +1961,7 @@ int __glXRenderLarge(__GLXclientState *c
 #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
 	    } else {
 		client->errorValue = opcode;
-		return __glXBadLargeRequest;
+		return __glXError(GLXBadLargeRequest);
 	    }
 
 	    /*
@@ -2011,7 +2011,7 @@ static int __glXBindSwapBarrierSGIX(__GL
         }
     }
     client->errorValue = drawable;
-    return __glXBadDrawable;
+    return __glXError(GLXBadDrawable);
 }
 
 
@@ -2252,7 +2252,7 @@ int __glXVendorPrivate(__GLXclientState 
     ** This sample implemention does not support any private requests.
     */
     cl->client->errorValue = req->vendorCode;
-    return __glXUnsupportedPrivateRequest;
+    return __glXError(GLXUnsupportedPrivateRequest);
 }
 
 int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
@@ -2312,7 +2312,7 @@ int __glXVendorPrivateWithReply(__GLXcli
     }
 
     cl->client->errorValue = vendorcode;
-    return __glXUnsupportedPrivateRequest;
+    return __glXError(GLXUnsupportedPrivateRequest);
 }
 
 int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
diff --git a/GL/glx/glxcmdsswap.c b/GL/glx/glxcmdsswap.c
index 3464e13..b8f958b 100644
--- a/GL/glx/glxcmdsswap.c
+++ b/GL/glx/glxcmdsswap.c
@@ -674,12 +674,12 @@ int __glXSwapRender(__GLXclientState *cl
 #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
 	} else {
 	    client->errorValue = commandsDone;
-	    return __glXBadRenderRequest;
+	    return __glXError(GLXBadRenderRequest);
 	}
         if (!entry->bytes) {
             /* unused opcode */
 	    client->errorValue = commandsDone;
-            return __glXBadRenderRequest;
+            return __glXError(GLXBadRenderRequest);
         }
         if (entry->varsize) {
             /* variable size command */
@@ -772,7 +772,7 @@ int __glXSwapRenderLarge(__GLXclientStat
 	*/
 	if (req->requestNumber != 1) {
 	    client->errorValue = req->requestNumber;
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 	hdr = (__GLXrenderLargeHeader *) pc;
 	__GLX_SWAP_INT(&hdr->length);
@@ -793,13 +793,13 @@ int __glXSwapRenderLarge(__GLXclientStat
 #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
 	} else {
 	    client->errorValue = opcode;
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 
         if (!entry->bytes) {
             /* unused opcode */
             client->errorValue = opcode;
-            return __glXBadLargeRequest;
+            return __glXError(GLXBadLargeRequest);
         }
 	if (entry->varsize) {
 	    /*
@@ -855,12 +855,12 @@ int __glXSwapRenderLarge(__GLXclientStat
 	if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
 	    client->errorValue = req->requestNumber;
 	    __glXResetLargeCommandStatus(cl);
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 	if (req->requestTotal != cl->largeCmdRequestsTotal) {
 	    client->errorValue = req->requestTotal;
 	    __glXResetLargeCommandStatus(cl);
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 
 	/*
@@ -869,7 +869,7 @@ int __glXSwapRenderLarge(__GLXclientStat
 	if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
 	    client->errorValue = dataBytes;
 	    __glXResetLargeCommandStatus(cl);
-	    return __glXBadLargeRequest;
+	    return __glXError(GLXBadLargeRequest);
 	}
 	memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
 	cl->largeCmdBytesSoFar += dataBytes;
@@ -893,7 +893,7 @@ int __glXSwapRenderLarge(__GLXclientStat
 		__GLX_PAD(cl->largeCmdBytesTotal)) {
 		client->errorValue = dataBytes;
 		__glXResetLargeCommandStatus(cl);
-		return __glXBadLargeRequest;
+		return __glXError(GLXBadLargeRequest);
 	    }
 	    hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
 	    /*
@@ -916,7 +916,7 @@ int __glXSwapRenderLarge(__GLXclientStat
 #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
 	    } else {
 		client->errorValue = opcode;
-		return __glXBadLargeRequest;
+		return __glXError(GLXBadLargeRequest);
 	    }
 
 	    /*
@@ -984,7 +984,7 @@ int __glXSwapVendorPrivate(__GLXclientSt
 	return Success;
     }
     cl->client->errorValue = req->vendorCode;
-    return __glXUnsupportedPrivateRequest;
+    return __glXError(GLXUnsupportedPrivateRequest);
 }
 
 int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
@@ -1037,5 +1037,5 @@ int __glXSwapVendorPrivateWithReply(__GL
 	return (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req);
     }
     cl->client->errorValue = req->vendorCode;
-    return __glXUnsupportedPrivateRequest;
+    return __glXError(GLXUnsupportedPrivateRequest);
 }
diff --git a/GL/glx/glxerror.h b/GL/glx/glxerror.h
deleted file mode 100644
index 2c6d6d8..0000000
--- a/GL/glx/glxerror.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $XFree86$ */
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _GLX_error_h_
-#define _GLX_error_h_
-
-/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-** 
-** http://oss.sgi.com/projects/FreeB
-** 
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-** 
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-** 
-** Additional Notice Provisions: The application programming interfaces
-** established by SGI in conjunction with the Original Code are The
-** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
-** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
-** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
-** Window System(R) (Version 1.3), released October 19, 1998. This software
-** was created using the OpenGL(R) version 1.2.1 Sample Implementation
-** published by SGI, but has not been independently verified as being
-** compliant with the OpenGL(R) version 1.2.1 Specification.
-**
-*/
-
-/*
-** Error codes.  These have the extension error base added to them
-** when the extension initializes.
-*/
-extern int __glXBadContext;
-extern int __glXBadContextState;
-extern int __glXBadDrawable;
-extern int __glXBadPixmap;
-extern int __glXBadCurrentWindow;
-extern int __glXBadContextTag;
-extern int __glXBadRenderRequest;
-extern int __glXBadLargeRequest;
-extern int __glXUnsupportedPrivateRequest;
-
-#endif
diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c
index cc5dd96..176883d 100644
--- a/GL/glx/glxext.c
+++ b/GL/glx/glxext.c
@@ -33,6 +33,33 @@
 #include "glxutil.h"
 #include "glxext.h"
 
+/*
+** The last context used by the server.  It is the context that is current
+** from the server's perspective.
+*/
+__GLXcontext *__glXLastContext;
+
+/*
+** X resources.
+*/
+RESTYPE __glXContextRes;
+RESTYPE __glXClientRes;
+RESTYPE __glXPixmapRes;
+RESTYPE __glXDrawableRes;
+RESTYPE __glXSwapBarrierRes;
+
+/*
+** Reply for most singles.
+*/
+xGLXSingleReply __glXReply;
+
+/*
+** A set of state for each client.  The 0th one is unused because client
+** indices start at 1, not 0.
+*/
+__GLXclientState *__glXClients[MAXCLIENTS+1];
+
+
 static Bool inDispatch;
 
 /*
@@ -265,6 +292,13 @@ GLboolean __glXErrorOccured(void)
     return errorOccured;
 }
 
+static int __glXErrorBase;
+
+int __glXError(int error)
+{
+    return __glXErrorBase + error;
+}
+
 /************************************************************************/
 
 /*
@@ -274,11 +308,12 @@ void GlxExtensionInit(void)
 {
     ExtensionEntry *extEntry;
     int i;
-    
+
     __glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
     __glXClientRes = CreateNewResourceType((DeleteType)ClientGone);
     __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone);
     __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
+    __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone);
 
     /*
     ** Add extension to server extensions.
@@ -296,18 +331,7 @@ void GlxExtensionInit(void)
 	return;
     }
 
-    __glXBadContext = extEntry->errorBase + GLXBadContext;
-    __glXBadContextState = extEntry->errorBase + GLXBadContextState;
-    __glXBadDrawable = extEntry->errorBase + GLXBadDrawable;
-    __glXBadPixmap = extEntry->errorBase + GLXBadPixmap;
-    __glXBadContextTag = extEntry->errorBase + GLXBadContextTag;
-    __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow;
-    __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest;
-    __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest;
-    __glXUnsupportedPrivateRequest = extEntry->errorBase +
-      			GLXUnsupportedPrivateRequest;
-
-    __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone);
+    __glXErrorBase = extEntry->errorBase;
 
     /*
     ** Initialize table of client state.  There is never a client 0.
@@ -347,7 +371,7 @@ __GLXcontext *__glXForceCurrent(__GLXcli
     cx = (__GLXcontext *) __glXLookupContextByTag(cl, tag);
     if (!cx) {
 	cl->client->errorValue = tag;
-	*error = __glXBadContextTag;
+	*error = __glXError(GLXBadContextTag);
 	return 0;
     }
 
@@ -358,7 +382,7 @@ __GLXcontext *__glXForceCurrent(__GLXcli
 	    ** windows can be destroyed from under us; GLX pixmaps are
 	    ** refcounted and don't go away until no one is using them.
 	    */
-	    *error = __glXBadCurrentWindow;
+	    *error = __glXError(GLXBadCurrentWindow);
 	    return 0;
     	}
     }
@@ -373,7 +397,7 @@ __GLXcontext *__glXForceCurrent(__GLXcli
 	if (!(*cx->forceCurrent)(cx)) {
 	    /* Bind failed, and set the error code.  Bummer */
 	    cl->client->errorValue = cx->id;
-	    *error = __glXBadContextState;
+	    *error = __glXError(GLXBadContextState);
 	    return 0;
     	}
     }
@@ -469,7 +493,7 @@ static int __glXDispatch(ClientPtr clien
     */
     if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) {
 	client->errorValue = stuff->glxCode;
-	return __glXBadLargeRequest;
+	return __glXError(GLXBadLargeRequest);
     }
 
     /*
diff --git a/GL/glx/glxserver.h b/GL/glx/glxserver.h
index a41720f..ddb3ca9 100644
--- a/GL/glx/glxserver.h
+++ b/GL/glx/glxserver.h
@@ -70,7 +70,6 @@ typedef struct __GLXcontext __GLXcontext
 #include "glxscreens.h"
 #include "glxdrawable.h"
 #include "glxcontext.h"
-#include "glxerror.h"
 
 
 #define GLX_SERVER_MAJOR_VERSION 1
@@ -112,6 +111,8 @@ void __glXScreenInitVisuals(__GLXscreen 
 extern __GLXcontext *__glXLastContext;
 extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
 
+int __glXError(int error);
+
 /*
 ** Macros to set, unset, and retrieve the flag that says whether a context
 ** has unflushed commands.
diff --git a/GL/glx/xfont.c b/GL/glx/xfont.c
index 7956715..89ff95b 100644
--- a/GL/glx/xfont.c
+++ b/GL/glx/xfont.c
@@ -179,7 +179,7 @@ int __glXUseXFont(__GLXclientState *cl, 
 	** to try to make a font during another lists construction.
 	*/
 	client->errorValue = cx->id;
-	return __glXBadContextState;
+	return __glXError(GLXBadContextState);
     }
 
     /*
diff-tree 7cf3ec7b59223f15314a0629f122ecb796678421 (from eea8efe4516750b2505b52ebc9f769f5e8a6f94c)
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Wed Jun 28 17:00:23 2006 -0400

    Move createDrawable from __GLXcontext to __GLXscreen.

diff --git a/GL/glx/glxcontext.h b/GL/glx/glxcontext.h
index d57745a..68e2660 100644
--- a/GL/glx/glxcontext.h
+++ b/GL/glx/glxcontext.h
@@ -58,7 +58,7 @@ struct __GLXtextureFromPixmap {
 
 
 struct __GLXcontext {
-    void           (*destroy)       (__GLXcontext *context);    
+    void           (*destroy)       (__GLXcontext *context);
     int            (*makeCurrent)   (__GLXcontext *context);
     int            (*loseCurrent)   (__GLXcontext *context);
     int            (*copy)          (__GLXcontext *dst,
@@ -66,10 +66,6 @@ struct __GLXcontext {
 				     unsigned long mask);
     int            (*forceCurrent)  (__GLXcontext *context);
 
-    __GLXdrawable *(*createDrawable)(__GLXcontext *context,
-				     DrawablePtr pDraw,
-				     XID drawId);
-
     __GLXtextureFromPixmap *textureFromPixmap;
 
     /*
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index c033905..4239229 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -177,48 +177,6 @@ __glXDRIdrawableSwapBuffers(__GLXdrawabl
     return TRUE;
 }
 
-static __GLXdrawable *
-__glXDRIcontextCreateDrawable(__GLXcontext *context,
-			      DrawablePtr pDraw,
-			      XID drawId)
-{
-    __GLXDRIdrawable *private;
-
-    private = xalloc(sizeof *private);
-    if (private == NULL)
-	return NULL;
-
-    memset(private, 0, sizeof *private);
-
-    if (!__glXDrawableInit(&private->base, context, pDraw, drawId)) {
-        xfree(private);
-	return NULL;
-    }
-
-    private->base.destroy     = __glXDRIdrawableDestroy;
-    private->base.resize      = __glXDRIdrawableResize;
-    private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
-    
-#if 0
-    /* FIXME: It would only be natural that we called
-     * driScreen->createNewDrawable here but the DRI drivers manage
-     * them a little oddly. FIXME: describe this better.*/
-
-    /* The last argument is 'attrs', which is used with pbuffers which
-     * we currently don't support. */
-
-    glxPriv->driDrawable.private =
-	(pGlxScreen->driScreen.createNewDrawable)(NULL, modes,
-						  drawId,
-						  &glxPriv->driDrawable,
-						  0,
-						  NULL);
-#endif
-
-    return &private->base;
-}
-
-
 static void
 __glXDRIcontextDestroy(__GLXcontext *baseContext)
 {
@@ -483,7 +441,6 @@ __glXDRIscreenCreateContext(__GLXscreen 
     context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
     context->base.copy              = __glXDRIcontextCopy;
     context->base.forceCurrent      = __glXDRIcontextForceCurrent;
-    context->base.createDrawable    = __glXDRIcontextCreateDrawable;
 
     context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
 
@@ -498,6 +455,49 @@ __glXDRIscreenCreateContext(__GLXscreen 
     return &context->base;
 }
 
+static __GLXdrawable *
+__glXDRIscreenCreateDrawable(__GLXscreen *screen,
+			     DrawablePtr pDraw,
+			     XID drawId,
+			     __GLcontextModes *modes)
+{
+    __GLXDRIdrawable *private;
+
+    private = xalloc(sizeof *private);
+    if (private == NULL)
+	return NULL;
+
+    memset(private, 0, sizeof *private);
+
+    if (!__glXDrawableInit(&private->base, screen, pDraw, drawId, modes)) {
+        xfree(private);
+	return NULL;
+    }
+
+    private->base.destroy     = __glXDRIdrawableDestroy;
+    private->base.resize      = __glXDRIdrawableResize;
+    private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
+    
+#if 0
+    /* FIXME: It would only be natural that we called
+     * driScreen->createNewDrawable here but the DRI drivers manage
+     * them a little oddly. FIXME: describe this better.*/
+
+    /* The last argument is 'attrs', which is used with pbuffers which
+     * we currently don't support. */
+
+    glxPriv->driDrawable.private =
+	(screen->driScreen.createNewDrawable)(NULL, modes,
+					      drawId,
+					      &glxPriv->driDrawable,
+					      0,
+					      NULL);
+#endif
+
+    return &private->base;
+}
+
+
 static unsigned
 filter_modes(__GLcontextModes **server_modes,
 	     const __GLcontextModes *driver_modes)
@@ -798,8 +798,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
       return NULL;
     memset(screen, 0, sizeof *screen);
 
-    screen->base.destroy       = __glXDRIscreenDestroy;
-    screen->base.createContext = __glXDRIscreenCreateContext;
+    screen->base.destroy        = __glXDRIscreenDestroy;
+    screen->base.createContext  = __glXDRIscreenCreateContext;
+    screen->base.createDrawable = __glXDRIscreenCreateDrawable;
     screen->base.pScreen       = pScreen;
 
     /* DRI protocol version. */
diff --git a/GL/glx/glxscreens.h b/GL/glx/glxscreens.h
index 8a2b238..96373db 100644
--- a/GL/glx/glxscreens.h
+++ b/GL/glx/glxscreens.h
@@ -53,11 +53,16 @@
 */
 typedef struct __GLXscreen __GLXscreen;
 struct __GLXscreen {
-    void          (*destroy)(__GLXscreen *screen);
+    void          (*destroy)       (__GLXscreen *screen);
 
-    __GLXcontext *(*createContext)(__GLXscreen *screen,
-				   __GLcontextModes *modes,
-				   __GLXcontext *shareContext);
+    __GLXcontext *(*createContext) (__GLXscreen *screen,
+				    __GLcontextModes *modes,
+				    __GLXcontext *shareContext);
+
+    __GLXdrawable *(*createDrawable)(__GLXscreen *context,
+				     DrawablePtr pDraw,
+				     XID drawId,
+				     __GLcontextModes *modes);
 
     ScreenPtr pScreen;
 
diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c
index f1f9c06..ed5bafa 100644
--- a/GL/glx/glxutil.c
+++ b/GL/glx/glxutil.c
@@ -140,12 +140,14 @@ __glXUnrefDrawable(__GLXdrawable *glxPri
 
 GLboolean
 __glXDrawableInit(__GLXdrawable *drawable,
-		  __GLXcontext *ctx, DrawablePtr pDraw, XID drawId)
+		  __GLXscreen *screen, DrawablePtr pDraw, XID drawId,
+		  __GLcontextModes *modes)
 {
     drawable->type = pDraw->type;
     drawable->pDraw = pDraw;
     drawable->drawId = drawId;
     drawable->refCount = 1;
+    drawable->modes = modes;
 
     /* if not a pixmap, lookup will fail, so pGlxPixmap will be NULL */
     drawable->pGlxPixmap = (__GLXpixmap *) 
@@ -167,13 +169,31 @@ __glXFindDrawable(XID drawId)
 __GLXdrawable *
 __glXGetDrawable(__GLXcontext *ctx, DrawablePtr pDraw, XID drawId)
 {
+    __GLXscreen *pGlxScreen = ctx->pGlxScreen;
     __GLXdrawable *glxPriv;
+    __GLcontextModes *modes;
 
     glxPriv = __glXFindDrawable(drawId);
 
     if (glxPriv == NULL)
     {
-	glxPriv = ctx->createDrawable(ctx, pDraw, drawId);
+	if (pDraw->type == DRAWABLE_WINDOW) {
+	    VisualID vid = wVisual((WindowPtr)pDraw);
+
+	    modes = _gl_context_modes_find_visual(pGlxScreen->modes, vid);
+	} else {
+	    __GLXpixmap *pGlxPixmap =
+		(__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes);
+
+	    /* We never get here without a valid pixmap.
+	     * GetDrawableOrPixmap weeds out X Pixmaps without GLX
+	     * pixmaps for us. */
+
+	    modes = pGlxPixmap->modes;
+	}
+
+	glxPriv =
+	    pGlxScreen->createDrawable(ctx->pGlxScreen, pDraw, drawId, modes);
 
 	/* since we are creating the drawablePrivate, drawId should be new */
 	if (!AddResource(drawId, __glXDrawableRes, glxPriv))
diff --git a/GL/glx/glxutil.h b/GL/glx/glxutil.h
index d5cfa20..7b5494c 100644
--- a/GL/glx/glxutil.h
+++ b/GL/glx/glxutil.h
@@ -58,11 +58,13 @@ extern GLboolean __glXResizeDrawableBuff
 extern void __glXRefDrawable(__GLXdrawable *glxPriv);
 extern void __glXUnrefDrawable(__GLXdrawable *glxPriv);
 
-extern __GLXdrawable *__glXCreateDrawable(__GLXcontext *ctx,
-					  DrawablePtr pDraw, 
-					  XID glxpixmapId);
-extern GLboolean __glXDrawableInit(__GLXdrawable *drawable, __GLXcontext *ctx,
-				   DrawablePtr pDraw, XID drawID);
+extern __GLXdrawable *__glXCreateDrawable(__GLXscreen *screen,
+					  DrawablePtr pDraw, XID drawId,
+					  __GLcontextModes *modes);
+extern GLboolean __glXDrawableInit(__GLXdrawable *drawable,
+				   __GLXscreen *screen,
+				   DrawablePtr pDraw, XID drawID,
+				   __GLcontextModes *modes);
 extern GLboolean __glXDestroyDrawable(__GLXdrawable *glxPriv);
 extern __GLXdrawable *__glXFindDrawable(XID glxpixmapId);
 extern __GLXdrawable *__glXGetDrawable(__GLXcontext *ctx,
diff --git a/GL/mesa/X/xf86glx.c b/GL/mesa/X/xf86glx.c
index b1125a7..5085eb9 100644
--- a/GL/mesa/X/xf86glx.c
+++ b/GL/mesa/X/xf86glx.c
@@ -140,12 +140,12 @@ __glXMesaDrawableSwapBuffers(__GLXdrawab
 
 
 static __GLXdrawable *
-__glXMesaContextCreateDrawable(__GLXcontext *context,
-			       DrawablePtr pDraw,
-			       XID drawId)
+__glXMesaScreenCreateDrawable(__GLXscreen *screen,
+			      DrawablePtr pDraw,
+			      XID drawId,
+			      __GLcontextModes *modes)
 {
     __GLXMESAdrawable *glxPriv;
-    __GLXscreen *pGlxScreen;
     XMesaVisual xm_vis;
 
     glxPriv = xalloc(sizeof *glxPriv);
@@ -154,30 +154,19 @@ __glXMesaContextCreateDrawable(__GLXcont
 
     memset(glxPriv, 0, sizeof *glxPriv);
 
-    if (!__glXDrawableInit(&glxPriv->base, context, pDraw, drawId)) {
+    if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, drawId, modes)) {
         xfree(glxPriv);
 	return NULL;
     }
 
-    glxPriv->base.destroy       = __glXMesaDrawableDestroy;
-    glxPriv->base.resize        = __glXMesaDrawableResize;
-    glxPriv->base.swapBuffers   = __glXMesaDrawableSwapBuffers;
+    glxPriv->base.destroy     = __glXMesaDrawableDestroy;
+    glxPriv->base.resize      = __glXMesaDrawableResize;
+    glxPriv->base.swapBuffers = __glXMesaDrawableSwapBuffers;
 
-    pGlxScreen = __glXActiveScreens[pDraw->pScreen->myNum];
-
-    if (glxPriv->base.type == DRAWABLE_WINDOW) {
-	VisualID vid = wVisual((WindowPtr)pDraw);
-
-	glxPriv->base.modes = _gl_context_modes_find_visual(pGlxScreen->modes,
-							    vid);
-    } else {
-	glxPriv->base.modes = glxPriv->base.pGlxPixmap->modes;
-    }
-
-    xm_vis = find_mesa_visual(pGlxScreen, glxPriv->base.modes->visualID);
+    xm_vis = find_mesa_visual(screen, modes->visualID);
     if (xm_vis == NULL) {
 	ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
-	       glxPriv->base.modes->visualID);
+	       modes->visualID);
 	xfree(glxPriv);
 	return NULL;
     }
@@ -197,7 +186,7 @@ __glXMesaContextDestroy(__GLXcontext *ba
     __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
 
     XMesaDestroyContext(context->xmesa);
-    __glXContextDestroy(context);
+    __glXContextDestroy(&context->base);
     xfree(context);
 }
 
@@ -268,7 +257,6 @@ __glXMesaScreenCreateContext(__GLXscreen
     context->base.loseCurrent    = __glXMesaContextLoseCurrent;
     context->base.copy           = __glXMesaContextCopy;
     context->base.forceCurrent   = __glXMesaContextForceCurrent;
-    context->base.createDrawable = __glXMesaContextCreateDrawable;
 
     xm_vis = find_mesa_visual(screen, modes->visualID);
     if (!xm_vis) {
@@ -417,8 +405,9 @@ __glXMesaScreenProbe(ScreenPtr pScreen)
 
     __glXScreenInit(&screen->base, pScreen);
 
-    screen->base.destroy       = __glXMesaScreenDestroy;
-    screen->base.createContext = __glXMesaScreenCreateContext;
+    screen->base.destroy        = __glXMesaScreenDestroy;
+    screen->base.createContext  = __glXMesaScreenCreateContext;
+    screen->base.createDrawable = __glXMesaScreenCreateDrawable;
     screen->base.pScreen       = pScreen;
 
     /*
diff-tree eea8efe4516750b2505b52ebc9f769f5e8a6f94c (from eb35f812a5b65adcc5f6cbb91b31b69cae5d7f3d)
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Wed Jun 28 15:59:01 2006 -0400

    Add marshalling for GLX 1.3 requests.
    
    Also, hook up glXGetDrawableAttributes and glXQueryContext to existing
    DoGetDrawableAttributes and __glXQueryContextInfoEXT.

diff --git a/GL/glx/g_disptab.c b/GL/glx/g_disptab.c
index c41c45e..e97ace6 100644
--- a/GL/glx/g_disptab.c
+++ b/GL/glx/g_disptab.c
@@ -47,7 +47,7 @@ __GLXdispatchSingleProcPtr __glXSingleTa
 	__glXMakeCurrent,
 	__glXIsDirect,
 	__glXQueryVersion,
-	__glXWaitGL,
+	__glXWaitGL,				/* 0x08 */
 	__glXWaitX,
 	__glXCopyContext,
 	__glXSwapBuffers,
@@ -55,23 +55,23 @@ __GLXdispatchSingleProcPtr __glXSingleTa
 	__glXCreateGLXPixmap,
 	__glXGetVisualConfigs,
 	__glXDestroyGLXPixmap,
-	__glXVendorPrivate,
+	__glXVendorPrivate,			/* 0x10 */
 	__glXVendorPrivateWithReply,
 	__glXQueryExtensionsString,
 	__glXQueryServerString,
 	__glXClientInfo,
 	__glXGetFBConfigs,
 	__glXCreatePixmap,
-	__glXDestroyGLXPixmap, /* glXDestroyPixmap */
-	__glXCreateNewContext,
-	__glXNoSuchSingleOpcode, /* glXQueryContext */
+	__glXDestroyPixmap,
+	__glXCreateNewContext,			/* 0x18 */
+	__glXQueryContext,
 	__glXMakeContextCurrent,
-	__glXNoSuchSingleOpcode, /* glXCreatePbuffer */
-	__glXNoSuchSingleOpcode, /* glXDestroyPbuffer */
-	__glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */
-	__glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */
-	__glXNoSuchSingleOpcode, /* glXCreateWindow */
-	__glXNoSuchSingleOpcode, /* glXDestroyWindow */
+	__glXCreatePbuffer,
+	__glXDestroyPbuffer,
+	__glXGetDrawableAttributes,
+	__glXChangeDrawableAttributes,
+	__glXCreateWindow,
+	__glXDestroyWindow,			/* 0x20 */
 	__glXNoSuchSingleOpcode,
 	__glXNoSuchSingleOpcode,
 	__glXNoSuchSingleOpcode,
@@ -448,7 +448,7 @@ __GLXdispatchSingleProcPtr __glXSwapSing
 	__glXSwapMakeCurrent,
 	__glXSwapIsDirect,
 	__glXSwapQueryVersion,
-	__glXSwapWaitGL,
+	__glXSwapWaitGL,			/* 0x08 */
 	__glXSwapWaitX,
 	__glXSwapCopyContext,
 	__glXSwapSwapBuffers,
@@ -456,23 +456,23 @@ __GLXdispatchSingleProcPtr __glXSwapSing
 	__glXSwapCreateGLXPixmap,
 	__glXSwapGetVisualConfigs,
 	__glXSwapDestroyGLXPixmap,
-	__glXSwapVendorPrivate,
+	__glXSwapVendorPrivate,			/* 0x10 */
 	__glXSwapVendorPrivateWithReply,
 	__glXSwapQueryExtensionsString,
 	__glXSwapQueryServerString,
 	__glXSwapClientInfo,
 	__glXSwapGetFBConfigs,
 	__glXSwapCreatePixmap,
-	__glXSwapDestroyGLXPixmap, /* glXDestroyPixmap */
-	__glXSwapCreateNewContext,
-	__glXNoSuchSingleOpcode, /* glXQueryContext */
+	__glXSwapDestroyPixmap,
+	__glXSwapCreateNewContext,		/* 0x18 */
+	__glXSwapQueryContext,
 	__glXSwapMakeContextCurrent,
-	__glXNoSuchSingleOpcode, /* glXCreatePbuffer */
-	__glXNoSuchSingleOpcode, /* glXDestroyPbuffer */
-	__glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */
-	__glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */
-	__glXNoSuchSingleOpcode, /* glXCreateWindow */
-	__glXNoSuchSingleOpcode, /* glXDestroyWindow */
+	__glXSwapCreatePbuffer,
+	__glXSwapDestroyPbuffer,
+	__glXSwapGetDrawableAttributes,
+	__glXSwapChangeDrawableAttributes,
+	__glXSwapCreateWindow,
+	__glXSwapDestroyWindow,			/* 0x20 */
 	__glXNoSuchSingleOpcode,
 	__glXNoSuchSingleOpcode,
 	__glXNoSuchSingleOpcode,
diff --git a/GL/glx/g_disptab.h b/GL/glx/g_disptab.h
index 9ae901c..9be5bdf 100644
--- a/GL/glx/g_disptab.h
+++ b/GL/glx/g_disptab.h
@@ -60,8 +60,17 @@ extern int __glXQueryServerString(__GLXc
 extern int __glXClientInfo(__GLXclientState*, GLbyte*);
 extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*);
 extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*);
-extern int __glXCreateNewContext(__GLXclientState*, GLbyte*);
 extern int __glXCreatePixmap(__GLXclientState*, GLbyte*);
+extern int __glXDestroyPixmap(__GLXclientState*, GLbyte*);
+extern int __glXCreateNewContext(__GLXclientState*, GLbyte*);
+extern int __glXQueryContext(__GLXclientState*, GLbyte*);
+extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*);
+extern int __glXCreatePbuffer(__GLXclientState*, GLbyte*);
+extern int __glXDestroyPbuffer(__GLXclientState*, GLbyte*);
+extern int __glXGetDrawableAttributes(__GLXclientState*, GLbyte*);
+extern int __glXChangeDrawableAttributes(__GLXclientState*, GLbyte*);
+extern int __glXCreateWindow(__GLXclientState*, GLbyte*);
+extern int __glXDestroyWindow(__GLXclientState*, GLbyte*);
 
 extern int __glXSwapRender(__GLXclientState*, GLbyte*);
 extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*);
@@ -88,8 +97,18 @@ extern int __glXSwapQueryServerString(__
 extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*);
 extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*);
 extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreateNewContext(__GLXclientState*, GLbyte*);
 extern int __glXSwapCreatePixmap(__GLXclientState*, GLbyte*);
+extern int __glXSwapDestroyPixmap(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreateNewContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapQueryContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreatePbuffer(__GLXclientState*, GLbyte*);
+extern int __glXSwapDestroyPbuffer(__GLXclientState*, GLbyte*);
+extern int __glXSwapGetDrawableAttributes(__GLXclientState*, GLbyte*);
+extern int __glXSwapChangeDrawableAttributes(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreateWindow(__GLXclientState*, GLbyte*);
+extern int __glXSwapDestroyWindow(__GLXclientState*, GLbyte*);
+
 
 #define __GLX_MIN_GLXCMD_OPCODE 1
 #define __GLX_MAX_GLXCMD_OPCODE 20
diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index 79fee20..e2e157d 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -1299,16 +1299,9 @@ int __glXCreateGLXPixmapWithConfigSGIX(_
 }
 
 
-/**
- * Destroy a GLX pixmap.  This function is used for both
- * \c glXDestroyGLXPixmap and \c glXDestroyPixmap.
- */
-
-int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int DoDestroyPixmap(__GLXclientState *cl, XID glxpixmap)
 {
     ClientPtr client = cl->client;
-    xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
-    XID glxpixmap = req->glxpixmap;
 
     /*
     ** Check if it's a valid GLX pixmap.
@@ -1318,9 +1311,71 @@ int __glXDestroyGLXPixmap(__GLXclientSta
 	return __glXBadPixmap;
     }
     FreeResource(glxpixmap, FALSE);
+
     return Success;
 }
 
+int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+
+    return DoDestroyPixmap(cl, req->glxpixmap);
+}
+
+int __glXDestroyPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
+
+    return DoDestroyPixmap(cl, req->glxpixmap);
+}
+
+int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
+
+    (void) req;
+
+    return BadRequest;
+}
+
+int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
+
+    (void) req;
+
+    return BadRequest;
+}
+
+int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXChangeDrawableAttributesReq *req =
+	(xGLXChangeDrawableAttributesReq *) pc;
+
+    (void) req;
+
+    return BadRequest;
+}
+
+int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+
+    (void) req;
+
+    return BadRequest;
+}
+
+int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+
+    (void) req;
+
+    return BadRequest;
+}
+
+
 /*****************************************************************************/
 
 /*
@@ -1419,20 +1474,18 @@ int __glXSwapBuffers(__GLXclientState *c
 }
 
 
-int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
+int DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
 {
     ClientPtr client = cl->client;
     __GLXcontext *ctx;
-    xGLXQueryContextInfoEXTReq *req;
     xGLXQueryContextInfoEXTReply reply;
     int nProps;
     int *sendBuf, *pSendBuf;
     int nReplyBytes;
 
-    req = (xGLXQueryContextInfoEXTReq *)pc;
-    ctx = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
+    ctx = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes);
     if (!ctx) {
-	client->errorValue = req->context;
+	client->errorValue = gcId;
 	return __glXBadContext;
     }
 
@@ -1466,6 +1519,19 @@ int __glXQueryContextInfoEXT(__GLXclient
     return Success;
 }
 
+int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
+
+    return DoQueryContext(cl, req->context);
+}
+
+int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
+
+    return DoQueryContext(cl, req->context);
+}
 
 int __glXBindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
 {
@@ -1589,6 +1655,13 @@ int __glXGetDrawableAttributesSGIX(__GLX
     return DoGetDrawableAttributes(cl, drawable);
 }
 
+int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+
+    return DoGetDrawableAttributes(cl, req->drawable);
+}
+
 /************************************************************************/
 
 /*
diff --git a/GL/glx/glxcmdsswap.c b/GL/glx/glxcmdsswap.c
index 0f8b674..3464e13 100644
--- a/GL/glx/glxcmdsswap.c
+++ b/GL/glx/glxcmdsswap.c
@@ -315,6 +315,68 @@ int __glXSwapDestroyGLXPixmap(__GLXclien
     return __glXDestroyGLXPixmap(cl, pc);
 }
 
+int __glXSwapDestroyPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    __GLX_SWAP_SHORT(&req->length);
+    __GLX_SWAP_INT(&req->glxpixmap);
+
+    return __glXDestroyGLXPixmap(cl, pc);
+}
+
+int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;    
+
+    (void) req;
+
+    return BadRequest;    
+}
+
+int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;    
+
+    (void) req;
+
+    return BadRequest;    
+}
+
+int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) req;
+
+    return BadRequest;
+}
+
+int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXChangeDrawableAttributesReq *req =
+	(xGLXChangeDrawableAttributesReq *) req;
+
+    return BadRequest;
+}
+
+int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+
+    (void) req;
+
+    return BadRequest;
+}
+
+int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+
+    (void) req;
+
+    return BadRequest;
+}
+
 int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc)
 {
     xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
@@ -444,7 +506,19 @@ int __glXSwapGetDrawableAttributesSGIX(_
     __GLX_SWAP_INT(&req->contextTag);
     __GLX_SWAP_INT(data);
 
-    return __glXGetDrawableAttributesSGIX(cl, (GLbyte *)pc);
+    return __glXGetDrawableAttributesSGIX(cl, pc);
+}
+
+int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+    
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    __GLX_SWAP_SHORT(&req->length);
+    __GLX_SWAP_INT(&req->drawable);
+
+    return __glXGetDrawableAttributes(cl, pc);
 }
 
 
diff --git a/GL/glx/glxext.h b/GL/glx/glxext.h
index 5d56989..34d3612 100644
--- a/GL/glx/glxext.h
+++ b/GL/glx/glxext.h
@@ -87,6 +87,9 @@ extern int DoCreateContext(__GLXclientSt
     GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect);
 extern int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual,
     GLuint screenNum, XID pixmapId, XID glxpixmapId);
+extern int DoDestroyPixmap(__GLXclientState *cl, XID glxpixmapId);
+
+extern int DoQueryContext(__GLXclientState *cl, GLXContextID gcId);
 
 extern void GlxExtensionInit(void);
 
diff-tree e66e7b48e15543f3753951a19376f0446759963a (from parents)
Merge: a9d4842893b65232d61fe4c63f074d30e81021d2 eb35f812a5b65adcc5f6cbb91b31b69cae5d7f3d
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Wed Jul 5 15:21:36 2006 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework

diff-tree eb35f812a5b65adcc5f6cbb91b31b69cae5d7f3d (from 863f5cc31b747bc9f2fcd6a9e20c613a11733bf4)
Author: Greg Kroah-Hartman <gregkh at suse.de>
Date:   Wed Jul 5 13:27:26 2006 -0700

    add another file to .gitignore

diff --git a/.gitignore b/.gitignore
index 1e79706..4118cd0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -145,6 +145,7 @@ hw/xfree86/doc/man/Xorg.man
 hw/xfree86/doc/man/xorg.conf.5x
 hw/xfree86/doc/man/xorg.conf.man
 hw/xfree86/exa/exa.4
+hw/xfree86/exa/exa.4x
 hw/xfree86/exa/exa.man
 hw/xfree86/fbdevhw/fbdevhw.4x
 hw/xfree86/fbdevhw/fbdevhw.man
diff-tree 863f5cc31b747bc9f2fcd6a9e20c613a11733bf4 (from f059b61ab3af25b03c704669eddb838d3ce4366c)
Author: Greg Kroah-Hartman <gregkh at suse.de>
Date:   Wed Jul 5 13:26:34 2006 -0700

    fix compiler warning in hw/xfree86/common/xf86Config.c

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index d9f1dd9..bcad246 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -75,6 +75,7 @@ extern DeviceAssocRec mouse_assoc;
 #endif
 
 #ifdef XKB
+#undef XKB_IN_SERVER
 #define XKB_IN_SERVER
 #include <X11/extensions/XKBsrv.h>
 #endif
diff-tree f059b61ab3af25b03c704669eddb838d3ce4366c (from cc3e99f747586f9d32622e5a682de39891b1fcba)
Author: Greg Kroah-Hartman <gregkh at suse.de>
Date:   Wed Jul 5 11:47:25 2006 -0700

    fix compiler warning about xnestRecolorCursor() not being defined

diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h
index 8684a5e..6cbccfd 100644
--- a/hw/xnest/XNCursor.h
+++ b/hw/xnest/XNCursor.h
@@ -29,6 +29,7 @@ typedef struct {
 
 Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
 Bool xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+void xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed);
 void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y);
 void xnestMoveCursor (ScreenPtr pScreen, int x, int y);
 
diff-tree cc3e99f747586f9d32622e5a682de39891b1fcba (from 59836c0f2abee3339e1aa30dacadb82e477943d6)
Author: Greg Kroah-Hartman <gregkh at suse.de>
Date:   Wed Jul 5 10:13:19 2006 -0700

    fix some more compiler warnings due to defines being declared differently

diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c
index 1663893..fb1363a 100644
--- a/hw/xfree86/os-support/shared/libc_wrapper.c
+++ b/hw/xfree86/os-support/shared/libc_wrapper.c
@@ -89,8 +89,8 @@ extern int mmapFd;
 #include <stdlib.h>
 #endif
 
-#define NEED_XF86_TYPES
-#define NEED_XF86_PROTOTYPES
+#define NEED_XF86_TYPES 1
+#define NEED_XF86_PROTOTYPES 1
 #define DONT_DEFINE_WRAPPERS
 #include "xf86_ansic.h"
 
diff-tree 59836c0f2abee3339e1aa30dacadb82e477943d6 (from 12563db59dd613ecc926e3bed9534152ebc0a2fb)
Author: Greg Kroah-Hartman <gregkh at suse.de>
Date:   Wed Jul 5 09:30:48 2006 -0700

    fix wrong function pointer type in hw/dmx/dmxcmap.c

diff --git a/hw/dmx/dmxcmap.c b/hw/dmx/dmxcmap.c
index f46dc54..b4279e7 100644
--- a/hw/dmx/dmxcmap.c
+++ b/hw/dmx/dmxcmap.c
@@ -46,7 +46,7 @@
 
 #include "micmap.h"
 
-static int dmxInitColormapPrivateFunc(ColormapPtr pColormap)
+static int dmxInitColormapPrivateFunc(ColormapPtr pColormap, int index)
 {
     return TRUE;
 }
diff-tree 12563db59dd613ecc926e3bed9534152ebc0a2fb (from 002e28c12c74aa63777f65cbfb382c2bfd0d6850)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jul 3 12:52:27 2006 -0700

    Revert "Optimize out computing a gradient pixel if the mask value is 0."
    
    This reverts cf46242e337481cd3b9b39d77dd621d2a63b11f9 commit.  It wasn't meant
    to be pushed to master yet, and doesn't work.

diff --git a/fb/fbcompose.c b/fb/fbcompose.c
index 7e17a01..3a61e97 100644
--- a/fb/fbcompose.c
+++ b/fb/fbcompose.c
@@ -2635,8 +2635,7 @@ FbComposeFunctions composeFunctions = {
 };
 
 
-static void fbFetchSolid(PicturePtr pict, int x, int y, int width,
-			 CARD32 *buffer, CARD32 *mask, CARD32 maskBits)
+static void fbFetchSolid(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
 {
     FbBits *bits;
     FbStride stride;
@@ -2657,8 +2656,7 @@ static void fbFetchSolid(PicturePtr pict
         *buffer++ = color;
 }
 
-static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer,
-		    CARD32 *mask, CARD32 maskBits)
+static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
 {
     FbBits *bits;
     FbStride stride;
@@ -2713,8 +2711,7 @@ static CARD32 gradientPixel(const Source
     return pGradient->linear.colorTable[ipos];
 }
 
-static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width,
-			      CARD32 *buffer, CARD32 *mask, CARD32 maskBits)
+static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
 {
     SourcePictPtr pGradient = pict->pSourcePict;
     CARD32 *end = buffer + width;
@@ -2764,30 +2761,22 @@ static void fbFetchSourcePict(PicturePtr
                 inc = (a * unit.vector[0] + b * unit.vector[1]) >> 16;
             }
             while (buffer < end) {
-		if (mask == NULL || (*mask++ & maskBits) != 0) {
-		    *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
-		} else {
-		    *buffer++ = 0; /* Set it to a value for valgrind */
-		}
+                *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
                 t += inc;
             }
         } else {
             /* projective transformation */
             while (buffer < end) {
-		if (mask == NULL || (*mask++ & maskBits) != 0) {
-		    xFixed_48_16 t;
-		    if (v.vector[2] == 0) {
-			t = 0;
-		    } else {
-			xFixed_48_16 x, y;
-			x = ((xFixed_48_16)v.vector[0] << 16) / v.vector[2];
-			y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2];
-			t = ((a*x + b*y) >> 16) + off;
-		    }
-		    *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
-		} else {
-		    *buffer++ = 0; /* Set it to a value for valgrind */
-		}
+                xFixed_48_16 t;
+                if (v.vector[2] == 0) {
+                    t = 0;
+                } else {
+                    xFixed_48_16 x, y;
+                    x = ((xFixed_48_16)v.vector[0] << 16) / v.vector[2];
+                    y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2];
+                    t = ((a*x + b*y) >> 16) + off;
+                }
+                *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
                 v.vector[0] += unit.vector[0];
                 v.vector[1] += unit.vector[1];
                 v.vector[2] += unit.vector[2];
@@ -2827,45 +2816,37 @@ static void fbFetchSourcePict(PicturePtr
                 ry -= pGradient->radial.fy;
 
                 while (buffer < end) {
-		    if (mask == NULL || (*mask++ & maskBits) != 0) {
-			double b = 2*(rx*pGradient->radial.dx + ry*pGradient->radial.dy);
-			double c = -(rx*rx + ry*ry);
-			double det = (b * b) - (4 * pGradient->radial.a * c);
-			double s = (-b + sqrt(det))/(2. * pGradient->radial.a);
-			*buffer++ = gradientPixel(pGradient,
-				(xFixed_48_16)((s * pGradient->radial.m +
-						pGradient->radial.b) * 65536),
-				pict->repeatType);
-		    } else {
-			*buffer++ = 0;
-		    }
+                    double b = 2*(rx*pGradient->radial.dx + ry*pGradient->radial.dy);
+                    double c = -(rx*rx + ry*ry);
+                    double det = (b * b) - (4 * pGradient->radial.a * c);
+                    double s = (-b + sqrt(det))/(2. * pGradient->radial.a);
+                    *buffer = gradientPixel(pGradient,
+                                            (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
+                                            pict->repeatType);
+                    ++buffer;
                     rx += cx;
                     ry += cy;
                 }
             } else {
                 while (buffer < end) {
-		    if (mask == NULL || (*mask++ & maskBits) != 0) {
-			double x, y;
-			double b, c, det, s;
-			if (rz != 0) {
-			    x = rx/rz;
-			    y = ry/rz;
-			} else {
-			    x = y = 0.;
-			}
-			x -= pGradient->radial.fx;
-			y -= pGradient->radial.fy;
-			b = 2*(x*pGradient->radial.dx + y*pGradient->radial.dy);
-			c = -(x*x + y*y);
-			det = (b * b) - (4 * pGradient->radial.a * c);
-			s = (-b + sqrt(det))/(2. * pGradient->radial.a);
-			*buffer++ = gradientPixel(pGradient,
-			    (xFixed_48_16)((s * pGradient->radial.m +
-					   pGradient->radial.b) * 65536),
-			    pict->repeatType);
-		    } else {
-			*buffer++ = 0;
-		    }
+                    double x, y;
+                    double b, c, det, s;
+                    if (rz != 0) {
+                        x = rx/rz;
+                        y = ry/rz;
+                    } else {
+                        x = y = 0.;
+                    }
+                    x -= pGradient->radial.fx;
+                    y -= pGradient->radial.fy;
+                    b = 2*(x*pGradient->radial.dx + y*pGradient->radial.dy);
+                    c = -(x*x + y*y);
+                    det = (b * b) - (4 * pGradient->radial.a * c);
+                    s = (-b + sqrt(det))/(2. * pGradient->radial.a);
+                    *buffer = gradientPixel(pGradient,
+                                            (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
+                                            pict->repeatType);
+                    ++buffer;
                     rx += cx;
                     ry += cy;
                     rz += cz;
@@ -2878,37 +2859,29 @@ static void fbFetchSourcePict(PicturePtr
                 ry -= pGradient->conical.center.y/65536.;
 
                 while (buffer < end) {
-		    if (mask == NULL || (*mask++ & maskBits) != 0) {
-			double angle = atan2(ry, rx) + a;
-			*buffer++ = gradientPixel(pGradient,
-			    (xFixed_48_16) (angle * (65536. / (2*M_PI))),
-					    pict->repeatType);
-		    } else {
-			*buffer++ = 0;
-		    }
+                    double angle = atan2(ry, rx) + a;
+                    *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
+                                            pict->repeatType);
+                    ++buffer;
                     rx += cx;
                     ry += cy;
                 }
             } else {
 
                 while (buffer < end) {
-		    if (mask == NULL || (*mask++ & maskBits) != 0) {
-			double x, y, angle;
-			if (rz != 0) {
-			    x = rx/rz;
-			    y = ry/rz;
-			} else {
-			    x = y = 0.;
-			}
-			x -= pGradient->conical.center.x/65536.;
-			y -= pGradient->conical.center.y/65536.;
-			angle = atan2(y, x) + a;
-			*buffer++ = gradientPixel(pGradient, (xFixed_48_16)
-						  (angle * (65536. / (2*M_PI))),
-						  pict->repeatType);
-		    } else {
-			*buffer++ = 0;
-		    }
+                    double x, y, angle;
+                    if (rz != 0) {
+                        x = rx/rz;
+                        y = ry/rz;
+                    } else {
+                        x = y = 0.;
+                    }
+                    x -= pGradient->conical.center.x/65536.;
+                    y -= pGradient->conical.center.y/65536.;
+                    angle = atan2(y, x) + a;
+                    *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
+                                            pict->repeatType);
+                    ++buffer;
                     rx += cx;
                     ry += cy;
                     rz += cz;
@@ -2920,8 +2893,7 @@ static void fbFetchSourcePict(PicturePtr
 
 
 
-static void fbFetchTransformed(PicturePtr pict, int x, int y, int width,
-			       CARD32 *buffer, CARD32 *mask, CARD32 maskBits)
+static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
 {
     FbBits     *bits;
     FbStride    stride;
@@ -3385,24 +3357,21 @@ static void fbFetchTransformed(PicturePt
 }
 
 
-static void fbFetchExternalAlpha(PicturePtr pict, int x, int y, int width,
-				 CARD32 *buffer, CARD32 *mask, CARD32 maskBits)
+static void fbFetchExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
 {
     int i;
     CARD32 _alpha_buffer[SCANLINE_BUFFER_LENGTH];
     CARD32 *alpha_buffer = _alpha_buffer;
 
     if (!pict->alphaMap) {
-        fbFetchTransformed(pict, x, y, width, buffer, mask, maskBits);
+        fbFetchTransformed(pict, x, y, width, buffer);
 	return;
     }
     if (width > SCANLINE_BUFFER_LENGTH)
         alpha_buffer = (CARD32 *) malloc(width*sizeof(CARD32));
 
-    fbFetchTransformed(pict, x, y, width, buffer, mask, maskBits);
-    fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x,
-		       y - pict->alphaOrigin.y, width, alpha_buffer,
-		       mask, maskBits);
+    fbFetchTransformed(pict, x, y, width, buffer);
+    fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x, y - pict->alphaOrigin.y, width, alpha_buffer);
     for (i = 0; i < width; ++i) {
         int a = alpha_buffer[i]>>24;
         buffer[i] = (a << 24)
@@ -3472,8 +3441,7 @@ static void fbStoreExternalAlpha(Picture
 }
 
 typedef void (*scanStoreProc)(PicturePtr , int , int , int , CARD32 *);
-typedef void (*scanFetchProc)(PicturePtr , int , int , int , CARD32 *,
-			      CARD32 *, CARD32);
+typedef void (*scanFetchProc)(PicturePtr , int , int , int , CARD32 *);
 
 static void
 fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer)
@@ -3535,16 +3503,12 @@ fbCompositeRect (const FbComposeData *da
         for (i = 0; i < data->height; ++i)
         {
             /* fill first half of scanline with source */
-            fetchMask(data->mask, data->xMask, data->yMask + i, data->width,
-		      mask_buffer, NULL, 0);
-            fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width,
-		     src_buffer, mask_buffer, 0);
+            fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width, src_buffer);
+            fetchMask(data->mask, data->xMask, data->yMask + i, data->width, mask_buffer);
 
             /* fill dest into second half of scanline */
-            if (fetchDest) {
-                fetchDest(data->dest, data->xDest, data->yDest + i, data->width,
-			  dest_buffer, NULL, 0);
-	    }
+            if (fetchDest)
+                fetchDest(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer);
 
             /* blend */
             compose(dest_buffer, src_buffer, mask_buffer, data->width);
@@ -3553,27 +3517,17 @@ fbCompositeRect (const FbComposeData *da
             store(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer);
         }
     } else {
-	CARD32 *mask_buffer;
+
         CombineFuncU compose = composeFunctions.combineU[data->op];
         if (!compose)
             return;
 
-	if (fetchMask)
-	    mask_buffer = dest_buffer + data->width;
-	else
-	    mask_buffer = NULL;
-
         if (fetchSrc == fbFetchSolid && (!fetchMask || fetchMask == fbFetchSolid)) {
+            fetchSrc(data->src, data->xSrc, data->ySrc, data->width, src_buffer);
             if (fetchMask) {
-                fetchMask(data->mask, data->xMask, data->yMask, data->width,
-			  dest_buffer, NULL, 0);
+                fetchMask(data->mask, data->xMask, data->yMask, data->width, dest_buffer);
+                composeFunctions.combineMaskU(src_buffer, dest_buffer, data->width);
             }
-            fetchSrc(data->src, data->xSrc, data->ySrc, data->width,
-		     src_buffer, mask_buffer, 0xff000000);
-	    if (mask_buffer != NULL) {
-		composeFunctions.combineMaskU(src_buffer, dest_buffer,
-					      data->width);
-	    }
             fetchSrc = NULL;
             fetchMask = NULL;
         }
@@ -3582,27 +3536,18 @@ fbCompositeRect (const FbComposeData *da
         {
             /* fill first half of scanline with source */
             if (fetchSrc) {
-		/* Fetch mask before source so that fetching of source can be
-		 * optimized out if possible.
-		 */
-                if (fetchMask) {
-                    fetchMask(data->mask, data->xMask, data->yMask + i,
-			      data->width, dest_buffer, NULL, 0);
-		}
-                fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width,
-			 src_buffer, mask_buffer, 0xff000000);
+                fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width, src_buffer);
 
                 /* add in mask */
-                if (mask_buffer != NULL) {
+                if (fetchMask) {
+                    fetchMask(data->mask, data->xMask, data->yMask + i, data->width, dest_buffer);
                     composeFunctions.combineMaskU(src_buffer, dest_buffer, data->width);
                 }
             }
 
             /* fill dest into second half of scanline */
-            if (fetchDest != NULL) {
-                fetchDest(data->dest, data->xDest, data->yDest + i, data->width,
-			  dest_buffer, NULL, 0);
-	    }
+            if (fetchDest)
+                fetchDest(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer);
 
             /* blend */
             compose(dest_buffer, src_buffer, data->width);
diff-tree 002e28c12c74aa63777f65cbfb382c2bfd0d6850 (from cf46242e337481cd3b9b39d77dd621d2a63b11f9)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jul 3 12:48:12 2006 -0700

    Correct AGP memory deallocation argument on *BSD.
    
    This fixes leaks and eventual crashes with RandR resizing on Intel.

diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c
index 65a5a0e..77773f7 100644
--- a/hw/xfree86/os-support/linux/lnx_agp.c
+++ b/hw/xfree86/os-support/linux/lnx_agp.c
@@ -1,7 +1,7 @@
 /*
  * Abstraction of the AGP GART interface.
  *
- * This version is for both Linux and FreeBSD.
+ * This version is for Linux and Free/Open/NetBSD.
  *
  * Copyright © 2000 VA Linux Systems, Inc.
  * Copyright © 2001 The XFree86 Project, Inc.
@@ -264,7 +264,11 @@ xf86DeallocateGARTMemory(int screenNum, 
 		return FALSE;
 	}
 
+#ifdef __linux__
 	if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)key) != 0) {
+#else
+	if (ioctl(gartFd, AGPIOC_DEALLOCATE, &key) != 0) {
+#endif
 		xf86DrvMsg(screenNum, X_WARNING,"xf86DeAllocateGARTMemory: "
                    "deallocation gart memory with key %d failed\n\t(%s)\n",
                    key, strerror(errno));
diff-tree cf46242e337481cd3b9b39d77dd621d2a63b11f9 (from a838fb70c52a829872680f6a2a2e7dd6d2dc9247)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Wed Jun 28 18:35:59 2006 +0200

    Optimize out computing a gradient pixel if the mask value is 0.
    
    Obtained from:	kdrive CVS (DavidR XGL fb/ megapatch)

diff --git a/fb/fbcompose.c b/fb/fbcompose.c
index 3a61e97..7e17a01 100644
--- a/fb/fbcompose.c
+++ b/fb/fbcompose.c
@@ -2635,7 +2635,8 @@ FbComposeFunctions composeFunctions = {
 };
 
 
-static void fbFetchSolid(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
+static void fbFetchSolid(PicturePtr pict, int x, int y, int width,
+			 CARD32 *buffer, CARD32 *mask, CARD32 maskBits)
 {
     FbBits *bits;
     FbStride stride;
@@ -2656,7 +2657,8 @@ static void fbFetchSolid(PicturePtr pict
         *buffer++ = color;
 }
 
-static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
+static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer,
+		    CARD32 *mask, CARD32 maskBits)
 {
     FbBits *bits;
     FbStride stride;
@@ -2711,7 +2713,8 @@ static CARD32 gradientPixel(const Source
     return pGradient->linear.colorTable[ipos];
 }
 
-static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
+static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width,
+			      CARD32 *buffer, CARD32 *mask, CARD32 maskBits)
 {
     SourcePictPtr pGradient = pict->pSourcePict;
     CARD32 *end = buffer + width;
@@ -2761,22 +2764,30 @@ static void fbFetchSourcePict(PicturePtr
                 inc = (a * unit.vector[0] + b * unit.vector[1]) >> 16;
             }
             while (buffer < end) {
-                *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
+		if (mask == NULL || (*mask++ & maskBits) != 0) {
+		    *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
+		} else {
+		    *buffer++ = 0; /* Set it to a value for valgrind */
+		}
                 t += inc;
             }
         } else {
             /* projective transformation */
             while (buffer < end) {
-                xFixed_48_16 t;
-                if (v.vector[2] == 0) {
-                    t = 0;
-                } else {
-                    xFixed_48_16 x, y;
-                    x = ((xFixed_48_16)v.vector[0] << 16) / v.vector[2];
-                    y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2];
-                    t = ((a*x + b*y) >> 16) + off;
-                }
-                *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
+		if (mask == NULL || (*mask++ & maskBits) != 0) {
+		    xFixed_48_16 t;
+		    if (v.vector[2] == 0) {
+			t = 0;
+		    } else {
+			xFixed_48_16 x, y;
+			x = ((xFixed_48_16)v.vector[0] << 16) / v.vector[2];
+			y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2];
+			t = ((a*x + b*y) >> 16) + off;
+		    }
+		    *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
+		} else {
+		    *buffer++ = 0; /* Set it to a value for valgrind */
+		}
                 v.vector[0] += unit.vector[0];
                 v.vector[1] += unit.vector[1];
                 v.vector[2] += unit.vector[2];
@@ -2816,37 +2827,45 @@ static void fbFetchSourcePict(PicturePtr
                 ry -= pGradient->radial.fy;
 
                 while (buffer < end) {
-                    double b = 2*(rx*pGradient->radial.dx + ry*pGradient->radial.dy);
-                    double c = -(rx*rx + ry*ry);
-                    double det = (b * b) - (4 * pGradient->radial.a * c);
-                    double s = (-b + sqrt(det))/(2. * pGradient->radial.a);
-                    *buffer = gradientPixel(pGradient,
-                                            (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
-                                            pict->repeatType);
-                    ++buffer;
+		    if (mask == NULL || (*mask++ & maskBits) != 0) {
+			double b = 2*(rx*pGradient->radial.dx + ry*pGradient->radial.dy);
+			double c = -(rx*rx + ry*ry);
+			double det = (b * b) - (4 * pGradient->radial.a * c);
+			double s = (-b + sqrt(det))/(2. * pGradient->radial.a);
+			*buffer++ = gradientPixel(pGradient,
+				(xFixed_48_16)((s * pGradient->radial.m +
+						pGradient->radial.b) * 65536),
+				pict->repeatType);
+		    } else {
+			*buffer++ = 0;
+		    }
                     rx += cx;
                     ry += cy;
                 }
             } else {
                 while (buffer < end) {
-                    double x, y;
-                    double b, c, det, s;
-                    if (rz != 0) {
-                        x = rx/rz;
-                        y = ry/rz;
-                    } else {
-                        x = y = 0.;
-                    }
-                    x -= pGradient->radial.fx;
-                    y -= pGradient->radial.fy;
-                    b = 2*(x*pGradient->radial.dx + y*pGradient->radial.dy);
-                    c = -(x*x + y*y);
-                    det = (b * b) - (4 * pGradient->radial.a * c);
-                    s = (-b + sqrt(det))/(2. * pGradient->radial.a);
-                    *buffer = gradientPixel(pGradient,
-                                            (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
-                                            pict->repeatType);
-                    ++buffer;
+		    if (mask == NULL || (*mask++ & maskBits) != 0) {
+			double x, y;
+			double b, c, det, s;
+			if (rz != 0) {
+			    x = rx/rz;
+			    y = ry/rz;
+			} else {
+			    x = y = 0.;
+			}
+			x -= pGradient->radial.fx;
+			y -= pGradient->radial.fy;
+			b = 2*(x*pGradient->radial.dx + y*pGradient->radial.dy);
+			c = -(x*x + y*y);
+			det = (b * b) - (4 * pGradient->radial.a * c);
+			s = (-b + sqrt(det))/(2. * pGradient->radial.a);
+			*buffer++ = gradientPixel(pGradient,
+			    (xFixed_48_16)((s * pGradient->radial.m +
+					   pGradient->radial.b) * 65536),
+			    pict->repeatType);
+		    } else {
+			*buffer++ = 0;
+		    }
                     rx += cx;
                     ry += cy;
                     rz += cz;
@@ -2859,29 +2878,37 @@ static void fbFetchSourcePict(PicturePtr
                 ry -= pGradient->conical.center.y/65536.;
 
                 while (buffer < end) {
-                    double angle = atan2(ry, rx) + a;
-                    *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
-                                            pict->repeatType);
-                    ++buffer;
+		    if (mask == NULL || (*mask++ & maskBits) != 0) {
+			double angle = atan2(ry, rx) + a;
+			*buffer++ = gradientPixel(pGradient,
+			    (xFixed_48_16) (angle * (65536. / (2*M_PI))),
+					    pict->repeatType);
+		    } else {
+			*buffer++ = 0;
+		    }
                     rx += cx;
                     ry += cy;
                 }
             } else {
 
                 while (buffer < end) {
-                    double x, y, angle;
-                    if (rz != 0) {
-                        x = rx/rz;
-                        y = ry/rz;
-                    } else {
-                        x = y = 0.;
-                    }
-                    x -= pGradient->conical.center.x/65536.;
-                    y -= pGradient->conical.center.y/65536.;
-                    angle = atan2(y, x) + a;
-                    *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
-                                            pict->repeatType);
-                    ++buffer;
+		    if (mask == NULL || (*mask++ & maskBits) != 0) {
+			double x, y, angle;
+			if (rz != 0) {
+			    x = rx/rz;
+			    y = ry/rz;
+			} else {
+			    x = y = 0.;
+			}
+			x -= pGradient->conical.center.x/65536.;
+			y -= pGradient->conical.center.y/65536.;
+			angle = atan2(y, x) + a;
+			*buffer++ = gradientPixel(pGradient, (xFixed_48_16)
+						  (angle * (65536. / (2*M_PI))),
+						  pict->repeatType);
+		    } else {
+			*buffer++ = 0;
+		    }
                     rx += cx;
                     ry += cy;
                     rz += cz;
@@ -2893,7 +2920,8 @@ static void fbFetchSourcePict(PicturePtr
 
 
 
-static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
+static void fbFetchTransformed(PicturePtr pict, int x, int y, int width,
+			       CARD32 *buffer, CARD32 *mask, CARD32 maskBits)
 {
     FbBits     *bits;
     FbStride    stride;
@@ -3357,21 +3385,24 @@ static void fbFetchTransformed(PicturePt
 }
 
 
-static void fbFetchExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
+static void fbFetchExternalAlpha(PicturePtr pict, int x, int y, int width,
+				 CARD32 *buffer, CARD32 *mask, CARD32 maskBits)
 {
     int i;
     CARD32 _alpha_buffer[SCANLINE_BUFFER_LENGTH];
     CARD32 *alpha_buffer = _alpha_buffer;
 
     if (!pict->alphaMap) {
-        fbFetchTransformed(pict, x, y, width, buffer);
+        fbFetchTransformed(pict, x, y, width, buffer, mask, maskBits);
 	return;
     }
     if (width > SCANLINE_BUFFER_LENGTH)
         alpha_buffer = (CARD32 *) malloc(width*sizeof(CARD32));
 
-    fbFetchTransformed(pict, x, y, width, buffer);
-    fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x, y - pict->alphaOrigin.y, width, alpha_buffer);
+    fbFetchTransformed(pict, x, y, width, buffer, mask, maskBits);
+    fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x,
+		       y - pict->alphaOrigin.y, width, alpha_buffer,
+		       mask, maskBits);
     for (i = 0; i < width; ++i) {
         int a = alpha_buffer[i]>>24;
         buffer[i] = (a << 24)
@@ -3441,7 +3472,8 @@ static void fbStoreExternalAlpha(Picture
 }
 
 typedef void (*scanStoreProc)(PicturePtr , int , int , int , CARD32 *);
-typedef void (*scanFetchProc)(PicturePtr , int , int , int , CARD32 *);
+typedef void (*scanFetchProc)(PicturePtr , int , int , int , CARD32 *,
+			      CARD32 *, CARD32);
 
 static void
 fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer)
@@ -3503,12 +3535,16 @@ fbCompositeRect (const FbComposeData *da
         for (i = 0; i < data->height; ++i)
         {
             /* fill first half of scanline with source */
-            fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width, src_buffer);
-            fetchMask(data->mask, data->xMask, data->yMask + i, data->width, mask_buffer);
+            fetchMask(data->mask, data->xMask, data->yMask + i, data->width,
+		      mask_buffer, NULL, 0);
+            fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width,
+		     src_buffer, mask_buffer, 0);
 
             /* fill dest into second half of scanline */
-            if (fetchDest)
-                fetchDest(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer);
+            if (fetchDest) {
+                fetchDest(data->dest, data->xDest, data->yDest + i, data->width,
+			  dest_buffer, NULL, 0);
+	    }
 
             /* blend */
             compose(dest_buffer, src_buffer, mask_buffer, data->width);
@@ -3517,17 +3553,27 @@ fbCompositeRect (const FbComposeData *da
             store(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer);
         }
     } else {
-
+	CARD32 *mask_buffer;
         CombineFuncU compose = composeFunctions.combineU[data->op];
         if (!compose)
             return;
 
+	if (fetchMask)
+	    mask_buffer = dest_buffer + data->width;
+	else
+	    mask_buffer = NULL;
+
         if (fetchSrc == fbFetchSolid && (!fetchMask || fetchMask == fbFetchSolid)) {
-            fetchSrc(data->src, data->xSrc, data->ySrc, data->width, src_buffer);
             if (fetchMask) {
-                fetchMask(data->mask, data->xMask, data->yMask, data->width, dest_buffer);
-                composeFunctions.combineMaskU(src_buffer, dest_buffer, data->width);
+                fetchMask(data->mask, data->xMask, data->yMask, data->width,
+			  dest_buffer, NULL, 0);
             }
+            fetchSrc(data->src, data->xSrc, data->ySrc, data->width,
+		     src_buffer, mask_buffer, 0xff000000);
+	    if (mask_buffer != NULL) {
+		composeFunctions.combineMaskU(src_buffer, dest_buffer,
+					      data->width);
+	    }
             fetchSrc = NULL;
             fetchMask = NULL;
         }
@@ -3536,18 +3582,27 @@ fbCompositeRect (const FbComposeData *da
         {
             /* fill first half of scanline with source */
             if (fetchSrc) {
-                fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width, src_buffer);
+		/* Fetch mask before source so that fetching of source can be
+		 * optimized out if possible.
+		 */
+                if (fetchMask) {
+                    fetchMask(data->mask, data->xMask, data->yMask + i,
+			      data->width, dest_buffer, NULL, 0);
+		}
+                fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width,
+			 src_buffer, mask_buffer, 0xff000000);
 
                 /* add in mask */
-                if (fetchMask) {
-                    fetchMask(data->mask, data->xMask, data->yMask + i, data->width, dest_buffer);
+                if (mask_buffer != NULL) {
                     composeFunctions.combineMaskU(src_buffer, dest_buffer, data->width);
                 }
             }
 
             /* fill dest into second half of scanline */
-            if (fetchDest)
-                fetchDest(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer);
+            if (fetchDest != NULL) {
+                fetchDest(data->dest, data->xDest, data->yDest + i, data->width,
+			  dest_buffer, NULL, 0);
+	    }
 
             /* blend */
             compose(dest_buffer, src_buffer, data->width);
diff-tree a838fb70c52a829872680f6a2a2e7dd6d2dc9247 (from 25d871d98462f0481ee419295ddc94b8c79dc881)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jul 3 19:22:36 2006 +0200

    Bump server version to 7.1.99.2 for gradient and repeat fixes.

diff --git a/configure.ac b/configure.ac
index af7d066..9d8dfed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -296,7 +296,7 @@ DEFAULT_VENDOR_NAME_SHORT="X.Org"
 DEFAULT_VERSION_MAJOR=7
 DEFAULT_VERSION_MINOR=1
 DEFAULT_VERSION_PATCH=99
-DEFAULT_VERSION_SNAP=1
+DEFAULT_VERSION_SNAP=2
 DEFAULT_RELEASE_DATE="21 December 2005"
 DEFAULT_VENDOR_WEB="http://wiki.x.org"
 
diff-tree 25d871d98462f0481ee419295ddc94b8c79dc881 (from 7106a77df37c06d2b5568eceeb9297096bff3137)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jul 3 19:22:26 2006 +0200

    Fix source picture filter check for multiple screens.
    
    Now, we only check for filter commonality if we're operating on a source
    picture, and we compare the id (screen-independent index of the filter name)
    rather than the pointer to the filter (per-screen state).

diff --git a/render/filter.c b/render/filter.c
index 61e0400..71375da 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -277,9 +277,17 @@ SetPictureFilter (PicturePtr pPicture, c
 
     pFilter = PictureFindFilter (screenInfo.screens[0], name, len);
 
-    for (s = 0; s < screenInfo.numScreens; s++) {
-	if (PictureFindFilter (screenInfo.screens[s], name, len) != pFilter)
-	    return BadMatch;
+    if (pPicture->pDrawable == NULL) {
+	/* For source pictures, the picture isn't tied to a screen.  So, ensure
+	 * that all screens can handle a filter we set for the picture.
+	 */
+	for (s = 0; s < screenInfo.numScreens; s++) {
+	    if (PictureFindFilter (screenInfo.screens[s], name, len)->id !=
+		pFilter->id)
+	    {
+		return BadMatch;
+	    }
+	}
     }
 
     if (!pFilter)
diff-tree 7106a77df37c06d2b5568eceeb9297096bff3137 (from f5e92542a14f51029347b6476e4e4af69144930b)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Sun Jul 2 12:41:35 2006 +0200

    Fix bugs in support for new repeatTypes in XAA and EXA.
    
    EXA now won't pass pictures with new repeatTypes to drivers.  We can add a flag
    for them to support it at a later time.

diff --git a/exa/exa_render.c b/exa/exa_render.c
index b21c5d7..2187af8 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -535,7 +535,8 @@ exaComposite(CARD8	op,
 	if (op == PictOpSrc)
 	{
 	    if (pSrc->pDrawable->width == 1 &&
-		pSrc->pDrawable->height == 1 && pSrc->repeat)
+		pSrc->pDrawable->height == 1 && pSrc->repeat &&
+		pSrc->repeatType == RepeatNormal)
 	    {
 		ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
 					    width, height);
@@ -575,6 +576,8 @@ exaComposite(CARD8	op,
 	    pMask->repeat = 0;
 
     if (pExaScr->info->PrepareComposite &&
+	(!pSrc->repeat || pSrc->repeat == RepeatNormal) &&
+	(!pMask || !pMask->repeat || pMask->repeat == RepeatNormal) &&
 	!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
     {
 	ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask,
diff --git a/hw/xfree86/xaa/xaaPict.c b/hw/xfree86/xaa/xaaPict.c
index a1ff510..a7acf45 100644
--- a/hw/xfree86/xaa/xaaPict.c
+++ b/hw/xfree86/xaa/xaaPict.c
@@ -218,7 +218,13 @@ XAADoComposite (
 
     if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
 	return FALSE;
-	
+
+    if ((pSrc->repeat && pSrc->repeatType != RepeatNormal) ||
+	(pMask && pMask->repeat && pMask->repeatType != RepeatNormal))
+    {
+	return FALSE;
+    }
+
     xDst += pDst->pDrawable->x;
     yDst += pDst->pDrawable->y;
     xSrc += pSrc->pDrawable->x;
diff-tree f5e92542a14f51029347b6476e4e4af69144930b (from 6ef457913955d4289081c7d07d528963ccf5272c)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Jun 30 12:03:47 2006 +0200

    Bug #7366: Fix crashes when setting filters on source pictures.
    
    Now, filters may only be set on source pictures when the filter is common to
    all screens.  Also, like SetPictureTransform, ChangePictureFilter is now not
    called on source pictures.

diff --git a/render/filter.c b/render/filter.c
index f81cc4a..61e0400 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -271,11 +271,16 @@ PictureResetFilters (ScreenPtr pScreen)
 int
 SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams)
 {
-    ScreenPtr		pScreen = pPicture->pDrawable->pScreen;
-    PictureScreenPtr	ps = GetPictureScreen(pScreen);
-    PictFilterPtr	pFilter = PictureFindFilter (pScreen, name, len);
+    PictFilterPtr	pFilter;
     xFixed		*new_params;
-    int			i, result;
+    int			i, s, result;
+
+    pFilter = PictureFindFilter (screenInfo.screens[0], name, len);
+
+    for (s = 0; s < screenInfo.numScreens; s++) {
+	if (PictureFindFilter (screenInfo.screens[s], name, len) != pFilter)
+	    return BadMatch;
+    }
 
     if (!pFilter)
 	return BadName;
@@ -300,8 +305,13 @@ SetPictureFilter (PicturePtr pPicture, c
 	pPicture->filter_params[i] = params[i];
     pPicture->filter = pFilter->id;
 
-    result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
-					 params, nparams);
-    return result;
+    if (pPicture->pDrawable) {
+	ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+	PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+	result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
+					     params, nparams);
+	return result;
+    }
     return Success;
 }
diff --git a/render/picturestr.h b/render/picturestr.h
index 25969a6..f1617f6 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -355,7 +355,12 @@ typedef struct _PictureScreen {
      */
     ChangePictureTransformProcPtr   ChangePictureTransform;
 
+    /**
+     * Called immediately after a picture's transform is changed through the
+     * SetPictureFilter request.  Not called for source-only pictures.
+     */
     ChangePictureFilterProcPtr	ChangePictureFilter;
+
     DestroyPictureFilterProcPtr	DestroyPictureFilter;
 
     TrapezoidsProcPtr		Trapezoids;
diff-tree 6ef457913955d4289081c7d07d528963ccf5272c (from 50a3e1ad18c815a5adafee22beccdf970bae62d6)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Jun 30 03:01:14 2006 +0200

    Bug #7366: Fix two crashes in operations on source pictures.
    
    A screen's ChangePictureTransform now isn't called when changing the transform,
    as source pictures aren't associated with screens.  Also, attempting to set
    an AlphaMap to a source picture will fail with BadMatch just like a Window
    would, preventing another crash.

diff --git a/render/picture.c b/render/picture.c
index ee385e5..55763fc 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1217,7 +1217,8 @@ ChangePicture (PicturePtr	pPicture,
 			    error = BadPixmap;
 			    break;
 			}
-			if (pAlpha->pDrawable->type != DRAWABLE_PIXMAP)
+			if (pAlpha->pDrawable == NULL ||
+			    pAlpha->pDrawable->type != DRAWABLE_PIXMAP)
 			{
 			    client->errorValue = pid;
 			    error = BadMatch;
@@ -1469,9 +1470,6 @@ SetPictureTransform (PicturePtr	    pPic
 	{ 0x00000, xFixed1, 0x00000 },
 	{ 0x00000, 0x00000, xFixed1 },
     } };
-    ScreenPtr		pScreen = pPicture->pDrawable->pScreen;
-    PictureScreenPtr	ps = GetPictureScreen(pScreen);
-    int			result;
 
     if (transform && memcmp (transform, &identity, sizeof (PictTransform)) == 0)
 	transform = 0;
@@ -1496,9 +1494,16 @@ SetPictureTransform (PicturePtr	    pPic
     }
     pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
 
-    result = (*ps->ChangePictureTransform) (pPicture, transform);
+    if (pPicture->pDrawable != NULL) {
+	int result;
+	PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
 
-    return result;
+	result = (*ps->ChangePictureTransform) (pPicture, transform);
+
+	return result;
+    }
+
+    return Success;
 }
 
 void
diff --git a/render/picturestr.h b/render/picturestr.h
index 1ea9120..25969a6 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -349,7 +349,12 @@ typedef struct _PictureScreen {
     PictFilterAliasPtr		filterAliases;
     int				nfilterAliases;
 
+    /**
+     * Called immediately after a picture's transform is changed through the
+     * SetPictureTransform request.  Not called for source-only pictures.
+     */
     ChangePictureTransformProcPtr   ChangePictureTransform;
+
     ChangePictureFilterProcPtr	ChangePictureFilter;
     DestroyPictureFilterProcPtr	DestroyPictureFilter;
 
diff-tree 50a3e1ad18c815a5adafee22beccdf970bae62d6 (from 124a81eb389dfa510ac07ca93ee17c4c9d6e56ea)
Author: Rudo Thomas <rudo at matfyz.cz>
Date:   Sat Jul 1 12:34:36 2006 -0700

    Missing close parenthesis in one of the setuid() fixes.

diff --git a/hw/xfree86/parser/write.c b/hw/xfree86/parser/write.c
index 82baa5a..de3bb8a 100644
--- a/hw/xfree86/parser/write.c
+++ b/hw/xfree86/parser/write.c
@@ -170,7 +170,7 @@ xf86writeConfigFile (const char *filenam
 					strerror(errno));
 			return 0;
 		case 0: /* child */
-			if (setuid(getuid() == -1) 
+			if (setuid(getuid()) == -1) 
 			    FatalError("xf86writeConfigFile(): "
 				"setuid failed(%s)\n", 
 				strerror(errno));
diff-tree 124a81eb389dfa510ac07ca93ee17c4c9d6e56ea (from parents)
Merge: d3d6c5f4d05e0ca5b566e19657e0fe2b3898482a 179737d4a07ed10a734fe017b5680f8e78ffda96
Author: Keith Packard <keithp at neko.keithp.com>
Date:   Sat Jul 1 11:12:50 2006 -0700

    Merge branch 'origin'

diff-tree d3d6c5f4d05e0ca5b566e19657e0fe2b3898482a (from caad8b724b97074e41de447fe77dda189f287a26)
Author: Paul Mackerras <paulus at samba.org>
Date:   Sat Jul 1 11:10:18 2006 -0700

    Bug #7381: Coordinates get wrapped in accelerated line drawing on pixmap
    
    XAAPolylinesWideSolid was adding the drawable origin onto each element in the
    pPts array.  Since the values got stored back into the pPts array, they got
    truncated to 16 bits, causing the overflow I saw.  This patch avoids storing
    the coords back into the pPts array (and actually reduces the size of the
    code too :).  Now the 32-bit sum of coords + origin doesn't get truncated to
    16 bits, and the problem is solved.

diff --git a/hw/xfree86/xaa/xaaWideLine.c b/hw/xfree86/xaa/xaaWideLine.c
index fbec29e..369088e 100644
--- a/hw/xfree86/xaa/xaaWideLine.c
+++ b/hw/xfree86/xaa/xaaWideLine.c
@@ -818,20 +818,6 @@ XAAPolylinesWideSolid (
 	return;
     }
 
-    if (mode == CoordModePrevious) {
-	pPts->x += xorg;
-	pPts->y += yorg;
-    } else if(xorg | yorg) {
-	register int n = npt;
-	register DDXPointPtr pts = pPts;
-
-	while(n--) {
-	   pts->x += xorg;
-	   pts->y += yorg;
-	   pts++;
-	}
-    }
-
     x2 = pPts->x;
     y2 = pPts->y;
     if (npt > 1) {
@@ -869,6 +855,8 @@ XAAPolylinesWideSolid (
               infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);		
     }
 
+    x2 += xorg;
+    y2 += yorg;
     while (--npt) {
 	x1 = x2;
 	y1 = y2;
@@ -878,6 +866,9 @@ XAAPolylinesWideSolid (
 	if (mode == CoordModePrevious) {
 	    x2 += x1;
 	    y2 += y1;
+	} else {
+	    x2 += xorg;
+	    y2 += yorg;
 	}
 	if ((x1 != x2) || (y1 != y2)) {
 	    somethingDrawn = TRUE;
diff-tree 179737d4a07ed10a734fe017b5680f8e78ffda96 (from 6bd4c254396cb0f4e8ae21ff455ebb15cd9f4f10)
Author: Jens Granseuer <jensgr at gmx.net>
Date:   Wed Jun 7 01:46:00 2006 -0700

    Bug 7145: fix build with gcc 2.95 & other c89 compilers
    
    Move variable declarations to start of blocks as required by c89

diff --git a/exa/exa.c b/exa/exa.c
index aa5532a..1022b2e 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -523,6 +523,9 @@ exaDriverInit (ScreenPtr		pScreen,
                ExaDriverPtr	pScreenInfo)
 {
     ExaScreenPrivPtr pExaScr;
+#ifdef RENDER
+    PictureScreenPtr ps;
+#endif
 
     if (pScreenInfo->exa_major != EXA_VERSION_MAJOR ||
 	pScreenInfo->exa_minor > EXA_VERSION_MINOR)
@@ -536,7 +539,7 @@ exaDriverInit (ScreenPtr		pScreen,
     }
 
 #ifdef RENDER
-    PictureScreenPtr	ps = GetPictureScreenIfSet(pScreen);
+    ps = GetPictureScreenIfSet(pScreen);
 #endif
     if (exaGeneration != serverGeneration)
     {
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 36dde30..d9f1dd9 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -617,6 +617,9 @@ static Bool
 configFiles(XF86ConfFilesPtr fileconf)
 {
   MessageType pathFrom = X_DEFAULT;
+  int countDirs;
+  char *temp_path;
+  char *log_buf;
 
   /* FontPath */
 
@@ -676,13 +679,13 @@ configFiles(XF86ConfFilesPtr fileconf)
     FatalError("No valid FontPath could be found.");
 
   /* make fontpath more readable in the logfiles */
-  int countDirs = 1;
-  char *temp_path = defaultFontPath;
+  countDirs = 1;
+  temp_path = defaultFontPath;
   while((temp_path = index(temp_path, ',')) != NULL) {
     countDirs++;
     temp_path++;
   }
-  char *log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1);
+  log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1);
   if(!log_buf) /* fallback to old method */
     xf86Msg(pathFrom, "FontPath set to \"%s\"\n", defaultFontPath);
   else {
diff-tree a9d4842893b65232d61fe4c63f074d30e81021d2 (from parents)
Merge: 66cac9b17498497d939bfb7a4075bcee5a485e5f 6bd4c254396cb0f4e8ae21ff455ebb15cd9f4f10
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Fri Jun 30 11:49:29 2006 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework

diff-tree 6bd4c254396cb0f4e8ae21ff455ebb15cd9f4f10 (from 54d9acd5113318274e291abab4554b8e678227df)
Author: Martin Bochnig <mb1x at gmx.com>
Date:   Mon Jun 26 01:52:24 2006 +0200

    Updated Solaris aperture driver to build on sun4v & amd64 kernels
    Updated for Solaris 10 changes to DDI

diff --git a/hw/xfree86/os-support/solaris/apSolaris.shar b/hw/xfree86/os-support/solaris/apSolaris.shar
index c8e2cfa..a3548f7 100644
--- a/hw/xfree86/os-support/solaris/apSolaris.shar
+++ b/hw/xfree86/os-support/solaris/apSolaris.shar
@@ -1,40 +1,28 @@
 #!/bin/sh
-# $XFree86$
-# This is a shell archive (produced by GNU sharutils 4.2c).
-# To extract the files from this archive, save it to some FILE, remove
-# everything before the `!/bin/sh' line above, then type `sh FILE'.
 #
-# Made on 2002-10-04 13:41 MDT by <root at abcyxhiz>.
-# Source directory was `/archives'.
+# This is a shell archive.  Save it in a file, remove anything before
+# this line, and then unpack it by entering "sh file".  Note, it may
+# create directories; files and directories will be owned by you and
+# have default permissions.
+# Made on Sun Jun 25 20:24:59 CEST 2006 by Martin Bochnig at martux.org
 #
-# Existing files will *not* be overwritten unless `-c' is specified.
-# This format requires very little intelligence at unshar time.
-# "if test", "echo", "mkdir", and "sed" may be needed.
+# This archive contains:
 #
-# This shar contains:
-# length mode       name
-# ------ ---------- ------------------------------------------
-#   1521 -rw-r--r-- aperture/Makefile
-#   1659 -rw-r--r-- aperture/README
-#   7557 -rw-r--r-- aperture/aperture.c
-#    450 -rw-r--r-- aperture/aperture.conf
-#     87 -rw-r--r-- aperture/devlink.tab
-#   1062 -rw-r--r-- aperture/Makefile.sun4u
+#	./aperture
+#	
+#	./aperture/Makefile
+#	./aperture/Makefile.amd64
+#	./aperture/Makefile.sparcv9
+#	./aperture/README
+#	./aperture/aperture.c
+#	./aperture/aperture.conf
+#	./aperture/devlink.tab
 #
-echo=echo
-shar_tty= shar_n= shar_c='
-'
-mkdir _sh09806 || ( echo 'failed to create locking directory' '_sh09806'; exit 1 )
-# ============= aperture/Makefile ==============
-if test ! -d 'aperture'; then
-  $echo $echo_n 'x -' 'aperture: '$echo_c
-  if mkdir 'aperture'; then $echo 'created'; else $echo 'failed to create'; fi
-fi
-if test -f 'aperture/Makefile' && test "$first_param" != -c; then
-  $echo 'x -' SKIPPING 'aperture/Makefile' '(file already exists)'
-else
-  $echo 'x -' extracting 'aperture/Makefile' '(text)'
-  sed 's/^X//' << 'SHAR_EOF' > 'aperture/Makefile' &&
+echo c - ./aperture
+mkdir -p ./aperture > /dev/null 2>&1
+#
+echo x - ./aperture/Makefile
+sed 's/^X//' >./aperture/Makefile << 'END-of-./aperture/Makefile'
 X#
 X#   File: makefile for aperture Framebuffer Driver
 X# Author: Doug Anson (danson at lgc.com)
@@ -46,14 +34,22 @@ X# Modified: Marc Aurele La France (tsi@
 X#   Date: 2001.06.08
 X#   - SPARC support, cleanup and turf aptest.
 X#
-X# >>NOTE<< Have a look at Makefile.sun4u for sun4u specifics.
+X# >>NOTE<< Have a look at Makefile.sparcv9 for  specifics.
+X#
+X# Modified: Martin Bochnig (martin at martux.org)
+X#   Date: 2006.06.24
+X#   - Slightly modified to also build on Solaris 10 and 11.
+X#   - amd64 64 bit kernel support
+X#   - cosmetical changes to also support sun4v, not only sun4u
+X#
+X# >>NOTE<< Have a look at Makefile.amd64 for amd64 specifics.
 X#
 X# GNU gcc compiler
 XCC=gcc
 XCFLGS=-fno-builtin -Wall -O3
 X
 X#
-X# Proworks compiler
+X# SUNWspro compiler
 X#CC=/opt/SUNWspro/bin/cc
 X#CFLGS=-Xa -xnolib -xO3
 X
@@ -75,26 +71,26 @@ X# Make rules
 Xall: $(DRIVER)
 X
 X$(DRIVER): $(OBJS)
-X	@if [ -f "Makefile.`uname -m`" ]; then \
-X		make -f Makefile.`uname -m` $(DRIVER); \
+X	@if [ -f "Makefile.`isainfo -k`" ]; then \
+X		make -f Makefile.`isainfo -k` $(DRIVER); \
 X	else \
 X		rm -f $(DRIVER); \
 X		ld -r -o $(DRIVER) $(OBJS); \
 X	fi
 X
 Xinstall: $(DRIVER)
-X	@if [ -f "Makefile.`uname -m`" ]; then \
-X		make -f Makefile.`uname -m` install; \
+X	@if [ -f "Makefile.`isainfo -k`" ]; then \
+X		make -f Makefile.`isainfo -k` install; \
 X	else \
 X		cp aperture.conf /kernel/drv; \
 X		cp $(DRIVER) /kernel/drv; \
 X	fi
 X
 Xadd_drv:
-X	@if [ -f "Makefile.`uname -m`" ]; then \
-X		make -f Makefile.`uname -m` add_drv; \
+X	@if [ -f "Makefile.`isainfo -k`" ]; then \
+X		make -f Makefile.`isainfo -k` add_drv; \
 X	else \
-X		add_drv /kernel/drv/aperture; \
+X		add_drv aperture; \
 X	fi
 X
 Xclean:
@@ -106,29 +102,156 @@ X.c.i:
 X	$(CC) -E $(CFLAGS) $*.c > $@
 X
 X.c.o:
-X	@if [ -f "Makefile.`uname -m`" ]; then \
-X		make -f Makefile.`uname -m` $@; \
+X	@if [ -f "Makefile.`isainfo -k`" ]; then \
+X		make -f Makefile.`isainfo -k` $@; \
 X	else \
 X		rm -f $@; \
 X		$(CC) -c $(CFLAGS) $*.c -o $@; \
 X	fi
-SHAR_EOF
-  : || $echo 'restore of' 'aperture/Makefile' 'failed'
-fi
-# ============= aperture/README ==============
-if test -f 'aperture/README' && test "$first_param" != -c; then
-  $echo 'x -' SKIPPING 'aperture/README' '(file already exists)'
-else
-  $echo 'x -' extracting 'aperture/README' '(text)'
-  sed 's/^X//' << 'SHAR_EOF' > 'aperture/README' &&
-XFramebuffer apperture driver.
+END-of-./aperture/Makefile
+echo x - ./aperture/Makefile.amd64
+sed 's/^X//' >./aperture/Makefile.amd64 << 'END-of-./aperture/Makefile.amd64'
+X#
+X#   File: Makefile for aperture Framebuffer Driver
+X# Author: Doug Anson (danson at lgc.com)
+X#   Date: 2/15/94
+X# Modified: David Holland (davidh at use.com)
+X#   Date: 2/23/94
+X#   - Changed name, and debugging structure
+X# Modified: Marc Aurele La France (tsi at xfree86.org)
+X#   Date: 2001.06.08
+X#   - SPARC support, cleanup and turf aptest.
+X# Modified: Martin Bochnig (martin at martux.org)
+X#   - amd64 64 bit kernel support, cosmetics and also
+X#     supporting sun4v (and arbitrary sparcv9) platforms
+X#     as well as SunOS 5.10 or higher now
+X#   - Changed name
+X#
+X
+X#
+X# GNU gcc compiler, version 3.2 or later
+X#
+XCC=gcc
+XCFLGS=-fno-builtin -Wall -O3 -m64 -mcmodel=kernel
+X
+X#
+X# SUNWspro compiler (untested, might not properly work for amd64 here)
+X#CC=/opt/SUNWspro/bin/cc
+X#CFLGS=-Xa -xarch=v9 -xnolib -xO3
+X
+X#
+X# Debug error reporting
+X#DEBUG_FLG=
+X#DEBUG_FLG=-DAPERTURE_DEBUG
+X
+X#
+X# Files and object declarations
+XKERNEL_FLGS=-D_KERNEL -DSUNDDI
+XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
+XCFILES= aperture.c
+XOBJS= aperture.o
+XDRIVER= aperture
+X
+X#
+X# Make rules
+Xall: $(DRIVER)
+X
+X$(DRIVER): $(OBJS)
+X	rm -f $(DRIVER)
+X	ld -r -o $(DRIVER) $(OBJS)
+X
+Xinstall: $(DRIVER)
+X	cp aperture.conf /kernel/drv
+X	cp $(DRIVER) /kernel/drv/amd64
+X
+Xadd_drv:
+X	add_drv aperture
+X
+Xclean:
+X	rm -f *% *.BAK $(OBJS) $(DRIVER) core
+X
+X.SUFFIXES: .i
+X
+X.c.i:
+X	$(CC) -E $(CFLAGS) $*.c > $@
+END-of-./aperture/Makefile.amd64
+echo x - ./aperture/Makefile.sparcv9
+sed 's/^X//' >./aperture/Makefile.sparcv9 << 'END-of-./aperture/Makefile.sparcv9'
+X#
+X#   File: makefile for aperture Framebuffer Driver
+X# Author: Doug Anson (danson at lgc.com)
+X#   Date: 2/15/94
+X# Modified: David Holland (davidh at use.com)
+X#   Date: 2/23/94
+X#   - Changed name, and debugging structure
+X# Modified: Marc Aurele La France (tsi at xfree86.org)
+X#   Date: 2001.06.08
+X#   - SPARC support, cleanup and turf aptest.
+X# Modified: Martin Bochnig (martin at martux.org)
+X#   Date: 2006.06.24
+X#   - Changed name for generic sparcv9 support
+X#   - updated to better work with Solaris 10 and 11
+X#
+X
+X#
+X# GNU gcc compiler, version 3.2 or later
+X#
+XCC=gcc
+XCFLGS=-fno-builtin -Wall -O3 -m64
+X
+X#
+X# SUNWspro compiler
+X#CC=/opt/SUNWspro/bin/cc
+X#CFLGS=-Xa -xarch=v9 -xnolib -xO3
+X
+X#
+X# Debug error reporting
+X#DEBUG_FLG=
+X#DEBUG_FLG=-DAPERTURE_DEBUG
+X
+X#
+X# Files and object declarations
+XKERNEL_FLGS=-D_KERNEL -DSUNDDI
+XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
+XCFILES= aperture.c
+XOBJS= aperture.o
+XDRIVER= aperture
+X
+X#
+X# Make rules
+Xall: $(DRIVER)
+X
+X$(DRIVER): $(OBJS)
+X	rm -f $(DRIVER)
+X	ld -r -o $(DRIVER) $(OBJS)
+X
+Xinstall: $(DRIVER)
+X	cp aperture.conf /kernel/drv
+X	cp $(DRIVER) /kernel/drv/sparcv9
+X
+Xadd_drv:
+X	add_drv aperture
+X
+Xclean:
+X	rm -f *% *.BAK $(OBJS) $(DRIVER) core
+X
+X.SUFFIXES: .i
+X
+X.c.i:
+X	$(CC) -E $(CFLAGS) $*.c > $@
+END-of-./aperture/Makefile.sparcv9
+echo x - ./aperture/README
+sed 's/^X//' >./aperture/README << 'END-of-./aperture/README'
+XFramebuffer aperture driver.
 X
 XThis driver was written to provide a device that, unlike /dev/mem, allows
 Xmmap()'ing of ranges beyond installed memory.
 X
-XThe original x86-based version of this driver was the corroborative work of
+XThe original x86-based version of this driver was the collaborative work of
 XDoug Anson (danson at lgc.com), and David Holland (davidh at use.com).  It has since
-Xbeen rewritten to also work on sun4u machines.
+Xbeen rewritten to also work on sparc machines and - later on - also on sparcv9 
+Xand recently amd64 64 bit kernels.
+XIt flawlessly compiles and installs on Solaris 10 and 11 now.
 X
 X
 XInstallation instructions:
@@ -137,23 +260,23 @@ X1) Check the Makefile, for appropriate 
 X   with APERTURE_DEBUG defined means the driver will generate reams of
 X   debugging output.  You'll probably want to leave this off...
 X
-X2) type 'make'.  The driver and test program should compile with out any
-X   problems.  There also should not be any warning messages.
+X2) Type 'make' (or 'gmake').  Both the driver and test program should compile 
+X   without any problems. No warning messages should be generated.
 X
 X3) Become 'root'.
 X
-X4) type 'make install' and 'make add_drv'.  The screen should look something
+X4) Type 'make install' and 'make add_drv'.  The screen should look something
 X   like this:
 X
 X	# make install
 X	cp aperture aperture.conf /kernel/drv
 X	# make add_drv
-X	add_drv /kernel/drv/aperture
+X	add_drv aperture
 X
-X   On a sun4u machine this will mention the /kernel/drv/sparcv9 directory
-X   instead of /kernel/drv.
+X   On a sparcv9 machine this will mention the /kernel/drv/sparcv9 directory
+X   instead of /kernel/drv. Similarily /kernel/drv/amd64 should be used on amd64.
 X
-X   This installs the driver in the system.
+X   This installs the driver to the system.
 X
 X5) While as root modify the file /etc/devlink.tab, adding these lines:
 X
@@ -163,7 +286,7 @@ X
 X   Add that line exactly as shown. You may also simply add the
 X   contents of the devlink.tab file supplied to /etc/devlink.tab.
 X   It contains the lines as well.  (Yes, that is a tab between
-X   aperture, and fbs, not spaces - very important)
+X   aperture and fbs, not spaces - very important)
 X
 X6) Perform a reconfiguration boot of the system.
 X
@@ -171,15 +294,9 @@ X	# touch /reconfigure
 X	# init 6
 X
 XBug reports, questions, suggestions, etc can be sent to xfree86 at xfree86.org.
-SHAR_EOF
-  : || $echo 'restore of' 'aperture/README' 'failed'
-fi
-# ============= aperture/aperture.c ==============
-if test -f 'aperture/aperture.c' && test "$first_param" != -c; then
-  $echo 'x -' SKIPPING 'aperture/aperture.c' '(file already exists)'
-else
-  $echo 'x -' extracting 'aperture/aperture.c' '(text)'
-  sed 's/^X//' << 'SHAR_EOF' > 'aperture/aperture.c' &&
+END-of-./aperture/README
+echo x - ./aperture/aperture.c
+sed 's/^X//' >./aperture/aperture.c << 'END-of-./aperture/aperture.c'
 X/*
 X * Copyright (C) 2001 The XFree86 Project, Inc.  All Rights Reserved.
 X *
@@ -210,6 +327,13 @@ X/*
 X * Aperture driver for Solaris.
 X */
 X
+X/*
+X * Modified: Martin Bochnig (martin at martux.org)
+X * Log:      Commented out obsolete kernel interfaces DDI_IDENTIFIED and DDI_NOT_IDENTIFIED
+X *           not supported by SunOS 5.10 or higher anymore, 
+X *           see http://docs.sun.com/app/docs/doc/819-2255/6n4ibnffr?a=view
+X */
+X
 X#include <sys/conf.h>
 X#include <sys/ddi.h>
 X#include <sys/modctl.h>
@@ -412,9 +536,9 @@ X
 X#endif
 X
 X	if (strcmp(ddi_get_name(dip), DEV_IDENT))
-X		error = DDI_NOT_IDENTIFIED;
+X	  error = 1 /* DDI_NOT_IDENTIFIED obsolete since SunOS 5.10 */ ;
 X	else
-X		error = DDI_IDENTIFIED;
+X	  error = 2 /* DDI_IDENTIFIED obsolete since SunOS 5.10 */ ;
 X
 X#ifdef APERTURE_DEBUG
 X
@@ -465,7 +589,7 @@ X	else
 X	{
 X		error = ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR,
 X					      (minor_t)ddi_get_instance(dip),
-X					      NULL, NODESPECIFIC_DEV);
+X					      NULL, 0 /* NODESPECIFIC_DEV obsolete since SunOS 5.10 */ );
 X
 X		if (error == DDI_SUCCESS)
 X		{
@@ -653,15 +777,9 @@ X#endif
 X
 X	return error;
 X}
-SHAR_EOF
-  : || $echo 'restore of' 'aperture/aperture.c' 'failed'
-fi
-# ============= aperture/aperture.conf ==============
-if test -f 'aperture/aperture.conf' && test "$first_param" != -c; then
-  $echo 'x -' SKIPPING 'aperture/aperture.conf' '(file already exists)'
-else
-  $echo 'x -' extracting 'aperture/aperture.conf' '(text)'
-  sed 's/^X//' << 'SHAR_EOF' > 'aperture/aperture.conf' &&
+END-of-./aperture/aperture.c
+echo x - ./aperture/aperture.conf
+sed 's/^X//' >./aperture/aperture.conf << 'END-of-./aperture/aperture.conf'
 X#
 X# Copyright 1994 Doug Anson, danson at lgc.com & David Holland, davidh at use.com
 X#
@@ -678,91 +796,11 @@ X#
 X# Purpose:  This conf file is used by the aperture driver.
 X#
 Xname="aperture" parent="pseudo";
-SHAR_EOF
-  : || $echo 'restore of' 'aperture/aperture.conf' 'failed'
-fi
-# ============= aperture/devlink.tab ==============
-if test -f 'aperture/devlink.tab' && test "$first_param" != -c; then
-  $echo 'x -' SKIPPING 'aperture/devlink.tab' '(file already exists)'
-else
-  $echo 'x -' extracting 'aperture/devlink.tab' '(text)'
-  sed 's/^X//' << 'SHAR_EOF' > 'aperture/devlink.tab' &&
+END-of-./aperture/aperture.conf
+echo x - ./aperture/devlink.tab
+sed 's/^X//' >./aperture/devlink.tab << 'END-of-./aperture/devlink.tab'
 X# The following entry is for the aperture driver
 Xtype=ddi_pseudo;name=aperture	fbs/\M0
-SHAR_EOF
-  : || $echo 'restore of' 'aperture/devlink.tab' 'failed'
-fi
-# ============= aperture/Makefile.sun4u ==============
-if test -f 'aperture/Makefile.sun4u' && test "$first_param" != -c; then
-  $echo 'x -' SKIPPING 'aperture/Makefile.sun4u' '(file already exists)'
-else
-  $echo 'x -' extracting 'aperture/Makefile.sun4u' '(text)'
-  sed 's/^X//' << 'SHAR_EOF' > 'aperture/Makefile.sun4u' &&
-X#
-X#   File: makefile for aperture Framebuffer Driver
-X# Author: Doug Anson (danson at lgc.com)
-X#   Date: 2/15/94
-X# Modified: David Holland (davidh at use.com)
-X#   Date: 2/23/94
-X#   - Changed name, and debugging structure
-X# Modified: Marc Aurele La France (tsi at xfree86.org)
-X#   Date: 2001.06.08
-X#   - SPARC support, cleanup and turf aptest.
-X#
-X
-X#
-X# GNU gcc compiler, version 3.2 or later
-X#
-XCC=gcc
-XCFLGS=-fno-builtin -Wall -O3 -m64
-X
-X#
-X# Proworks compiler
-X#CC=/opt/SUNWspro/bin/cc
-X#CFLGS=-Xa -xarch=v9 -xnolib -xO3
-X
-X#
-X# Debug error reporting
-X#DEBUG_FLG=
-X#DEBUG_FLG=-DAPERTURE_DEBUG
-X
-X#
-X# Files and object declarations
-XKERNEL_FLGS=-D_KERNEL -DSUNDDI
-XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
-XCFILES= aperture.c
-XOBJS= aperture.o
-XDRIVER= aperture
-X
-X#
-X# Make rules
-Xall: $(DRIVER)
-X
-X$(DRIVER): $(OBJS)
-X	rm -f $(DRIVER)
-X	ld -r -o $(DRIVER) $(OBJS)
-X
-Xinstall: $(DRIVER)
-X	cp aperture.conf /kernel/drv
-X	cp $(DRIVER) /kernel/drv/sparcv9
-X
-Xadd_drv:
-X	add_drv /kernel/drv/sparcv9/aperture
-X
-Xclean:
-X	rm -f *% *.BAK $(OBJS) $(DRIVER) core
-X
-X.SUFFIXES: .i
-X
-X.c.i:
-X	$(CC) -E $(CFLAGS) $*.c > $@
-SHAR_EOF
-  : || $echo 'restore of' 'aperture/Makefile.sun4u' 'failed'
-fi
-$echo $shar_n 'x -' 'lock directory' "\`_sh09806': " $shar_c
-if rm -fr _sh09806; then
-  $echo 'removed'
-else
-  $echo 'failed to remove'
-fi
-exit 0
+END-of-./aperture/devlink.tab
+exit
+
diff-tree 66cac9b17498497d939bfb7a4075bcee5a485e5f (from parents)
Merge: 7c4e54025345455f420cd2abaa7a40679689d3cb 54d9acd5113318274e291abab4554b8e678227df
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Wed Jun 28 14:11:49 2006 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework

diff-tree 54d9acd5113318274e291abab4554b8e678227df (from adfe8e7437ff739f54d1d074008e8cc0e3bcb4d3)
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Tue Jun 27 19:44:52 2006 -0400

    Add damage tracking to GLX_EXT_tfp implementation.
    
    - Only update when pixmap content actually change;
    - Only update the regions that acutally changed.
    
    This is a worthwhile optimization, but it doesn't completely remove
    the bottleneck, as mesa still uploads then entire texture whenever
    it changes.

diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index 3202f75..79fee20 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -1263,6 +1263,7 @@ int DoCreateGLXPixmap(__GLXclientState *
     pGlxPixmap->pGlxScreen = pGlxScreen;
     pGlxPixmap->pScreen = pScreen;
     pGlxPixmap->idExists = True;
+    pGlxPixmap->pDamage = NULL;
     pGlxPixmap->refcnt = 0;
 
     pGlxPixmap->modes = modes;
diff --git a/GL/glx/glxdrawable.h b/GL/glx/glxdrawable.h
index 2d5d07a..4514e26 100644
--- a/GL/glx/glxdrawable.h
+++ b/GL/glx/glxdrawable.h
@@ -41,6 +41,8 @@
 **
 */
 
+#include <damage.h>
+
 typedef struct {
 
     DrawablePtr pDraw;
@@ -49,7 +51,7 @@ typedef struct {
     ScreenPtr pScreen;
     Bool idExists;
     int refcnt;
-
+    DamagePtr pDamage;
 } __GLXpixmap;
 
 struct __GLXdrawable {
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index 4935b0a..c033905 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -296,24 +296,18 @@ glxCountBits(int word)
 }
 
 static void
-glxFillAlphaChannel (PixmapPtr pixmap)
+glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height)
 {
-    int i, j;
-    CARD32 *pixels = (CARD32 *)pixmap->devPrivate.ptr;
+    int i;
+    CARD32 *p, *end, *pixels = (CARD32 *)pixmap->devPrivate.ptr;
     CARD32 rowstride = pixmap->devKind / 4;
-    CARD32 x, y;
-
-    x = pixmap->drawable.x;
-    y = pixmap->drawable.y;
     
-    for (i = y; i < pixmap->drawable.height + y; ++i)
+    for (i = y; i < y + height; i++)
     {
-        for (j = x; j < pixmap->drawable.width + x; ++j)
-        {
-            int index = i * rowstride + j;
-
-            pixels[index] |= 0xFF000000;
-        }
+	p = &pixels[i * rowstride + x];
+	end = p + width;
+	while (p < end)
+	  *p++ |= 0xFF000000;
     }
 }
 
@@ -326,7 +320,6 @@ glxFillAlphaChannel (PixmapPtr pixmap)
  * - No fbconfig handling for TEXTURE_TARGET
  * - No fbconfig exposure of Y inversion state
  * - No GenerateMipmapEXT support (due to no FBO support)
- * - No damage tracking between binds
  * - No support for anything but 16bpp and 32bpp-sparse pixmaps
  */
 
@@ -335,38 +328,103 @@ __glXDRIbindTexImage(__GLXcontext *baseC
 		     int buffer,
 		     __GLXpixmap *glxPixmap)
 {
+    RegionPtr	pRegion;
     PixmapPtr	pixmap;
     int		bpp;
-    Bool	npot;
+    GLenum	target, format, type;
 
     pixmap = (PixmapPtr) glxPixmap->pDraw;
-    bpp = pixmap->drawable.depth >= 24 ? 4 : 2; /* XXX 24bpp packed, 8, etc */
-    
+    if (!glxPixmap->pDamage) {
+        glxPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
+					  TRUE, glxPixmap->pScreen, NULL);
+	if (!glxPixmap->pDamage)
+            return BadAlloc;
+
+	DamageRegister ((DrawablePtr) pixmap, glxPixmap->pDamage);
+	pRegion = NULL;
+    } else {
+	pRegion = DamageRegion(glxPixmap->pDamage);
+	if (REGION_NIL(pRegion))
+	    return Success;
+    }
+
+    /* XXX 24bpp packed, 8, etc */
+    if (pixmap->drawable.depth >= 24) {
+	bpp = 4;
+	format = GL_BGRA;
+	type = GL_UNSIGNED_BYTE;
+    } else {
+	bpp = 2;
+	format = GL_RGB;
+	type = GL_UNSIGNED_SHORT_5_6_5;
+    }
+
+    if (!(glxCountBits(pixmap->drawable.width) == 1 &&
+	  glxCountBits(pixmap->drawable.height) == 1)
+	/* || strstr(CALL_GetString(GL_EXTENSIONS,
+	             "GL_ARB_texture_non_power_of_two")) */)
+	target = GL_TEXTURE_RECTANGLE_ARB;
+    else
+	target = GL_TEXTURE_2D;
+
     CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
-                                       pixmap->devKind / bpp) );
-    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS,
-                                       pixmap->drawable.y) );
-    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS,
-                                       pixmap->drawable.x) );
-
-    if (pixmap->drawable.depth == 24)
-        glxFillAlphaChannel(pixmap);
-
-    npot = !(glxCountBits(pixmap->drawable.width) == 1 &&
-             glxCountBits(pixmap->drawable.height) == 1) /* ||
-             strstr(CALL_GetString(GL_EXTENSIONS,
-                    "GL_ARB_texture_non_power_of_two")) */ ;
-    
-    CALL_TexImage2D( GET_DISPATCH(),
-		     ( npot ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D,
-		       0,
-		       bpp == 4 ? 4 : 3,
-		       pixmap->drawable.width,
-		       pixmap->drawable.height,
-		       0,
-		       bpp == 4 ? GL_BGRA : GL_RGB,
-		       bpp == 4 ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT_5_6_5,
-		       pixmap->devPrivate.ptr ) );
+				       pixmap->devKind / bpp) );
+    if (pRegion == NULL)
+    {
+	if (pixmap->drawable.depth == 24)
+	    glxFillAlphaChannel(pixmap,
+				pixmap->drawable.x,
+				pixmap->drawable.y,
+				pixmap->drawable.width,
+				pixmap->drawable.height);
+
+        CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS,
+					   pixmap->drawable.x) );
+	CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS,
+					   pixmap->drawable.y) );
+
+	CALL_TexImage2D( GET_DISPATCH(),
+			 (target,
+			  0,
+			  bpp == 4 ? 4 : 3,
+			  pixmap->drawable.width,
+			  pixmap->drawable.height,
+			  0,
+			  format,
+			  type,
+			  pixmap->devPrivate.ptr) );
+    } else {
+        int i, numRects;
+	BoxPtr p;
+
+	numRects = REGION_NUM_RECTS (pRegion);
+	p = REGION_RECTS (pRegion);
+	for (i = 0; i < numRects; i++)
+	{
+	    if (pixmap->drawable.depth == 24)
+		glxFillAlphaChannel(pixmap,
+				    pixmap->drawable.x + p[i].x1,
+				    pixmap->drawable.y + p[i].y1,
+				    p[i].x2 - p[i].x1,
+				    p[i].y2 - p[i].y1);
+
+	    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS,
+					       pixmap->drawable.x + p[i].x1) );
+	    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS,
+					       pixmap->drawable.y + p[i].y1) );
+
+	    CALL_TexSubImage2D( GET_DISPATCH(),
+				(target,
+				 0,
+				 p[i].x1, p[i].y1,
+				 p[i].x2 - p[i].x1, p[i].y2 - p[i].y1,
+				 format,
+				 type,
+				 pixmap->devPrivate.ptr) );
+	}
+    }
+
+    DamageEmpty(glxPixmap->pDamage);
 
     return Success;
 }
diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c
index c2a165e..cc5dd96 100644
--- a/GL/glx/glxext.c
+++ b/GL/glx/glxext.c
@@ -141,6 +141,10 @@ static int PixmapGone(__GLXpixmap *pGlxP
 
     pGlxPixmap->idExists = False;
     if (!pGlxPixmap->refcnt) {
+	if (pGlxPixmap->pDamage) {
+	    DamageUnregister (pGlxPixmap->pDraw, pGlxPixmap->pDamage);
+	    DamageDestroy(pGlxPixmap->pDamage);
+	}
 	/*
 	** The DestroyPixmap routine should decrement the refcount and free
 	** only if it's zero.
diff-tree adfe8e7437ff739f54d1d074008e8cc0e3bcb4d3 (from 63c169e3b1f7d6a7375a414fcd50cce32358a525)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Tue Jun 27 21:49:00 2006 +0200

    Bump server release to 7.1.99.1.
    
    This will be important for a couple of cairo workaround tests.

diff --git a/configure.ac b/configure.ac
index b8d942e..af7d066 100644
--- a/configure.ac
+++ b/configure.ac
@@ -294,9 +294,9 @@ AC_DEFINE_UNQUOTED(OSNAME, "$OSNAME", 
 DEFAULT_VENDOR_NAME="The X.Org Foundation"
 DEFAULT_VENDOR_NAME_SHORT="X.Org"
 DEFAULT_VERSION_MAJOR=7
-DEFAULT_VERSION_MINOR=0
-DEFAULT_VERSION_PATCH=0
-DEFAULT_VERSION_SNAP=0
+DEFAULT_VERSION_MINOR=1
+DEFAULT_VERSION_PATCH=99
+DEFAULT_VERSION_SNAP=1
 DEFAULT_RELEASE_DATE="21 December 2005"
 DEFAULT_VENDOR_WEB="http://wiki.x.org"
 
diff-tree 63c169e3b1f7d6a7375a414fcd50cce32358a525 (from ff6b59a0dbadbe61a53e48c23965d3073d95791b)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Tue Jun 27 04:11:47 2006 +0200

    Fix MMX Saturate implementation.
    
    The code was expanding the source blend factor from the wrong channel.  Fixes
    cairo's clip-operator test.

diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index d058ffa..f74930a 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -591,7 +591,7 @@ mmxCombineSaturateU (CARD32 *dest, const
 
         if (sa > da) {
             __m64 msa = load8888(FbIntDiv(da, sa));
-            msa = expand_alpha(msa);
+            msa = expand_alpha_rev(msa);
             ms = pix_multiply(ms, msa);
         }
         md = pix_add(md, ms);
diff-tree 7c4e54025345455f420cd2abaa7a40679689d3cb (from parents)
Merge: 9d0a15dca56b14821cad474f9db9c332acb3b1e6 ff6b59a0dbadbe61a53e48c23965d3073d95791b
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Mon Jun 26 14:39:44 2006 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework

diff-tree ff6b59a0dbadbe61a53e48c23965d3073d95791b (from parents)
Merge: b3c869304cd85af034aa9debaa874e29d14fcbe6 48c871564d493203d434d5da015903399287f619
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Mon Jun 26 13:02:33 2006 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver

diff-tree b3c869304cd85af034aa9debaa874e29d14fcbe6 (from 91dcac5295486cc55a34ad91704bfa483bd31eeb)
Author: Peter Breitenlohner <peb at mppmu.mpg.de>
Date:   Mon Jun 26 10:48:44 2006 -0700

    Free small, one-time memory leak in xdmcp -from handling
    
    Part of Patch #6046 <https://bugs.freedesktop.org/attachment.cgi?id=6046>

diff --git a/os/xdmcp.c b/os/xdmcp.c
index 3aad4ee..4f87097 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1603,6 +1603,10 @@ get_fromaddr_by_name(
       , &ai, &aifirst
 #endif
 	);
+#if defined(IPv6) && defined(AF_INET6)
+    if (aifirst != NULL)
+	freeaddrinfo(aifirst);
+#endif
     xdm_from = argv[i];
 }
 
diff-tree 48c871564d493203d434d5da015903399287f619 (from afb84c2fca56887b3bfe7aa93f337c49b087acdc)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jun 26 15:57:32 2006 +0200

    Move EXA_PM_IS_SOLID() to the public API, since drivers will want it frequently.

diff --git a/exa/exa.h b/exa/exa.h
index 2cb2008..96465a7 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -36,6 +36,7 @@
 #include "windowstr.h"
 #include "gcstruct.h"
 #include "picturestr.h"
+#include "fb.h"
 
 #define EXA_VERSION_MAJOR   2
 #define EXA_VERSION_MINOR   0
@@ -715,4 +716,12 @@ exaGetPixmapSize(PixmapPtr pPix);
 void
 exaEnableDisableFBAccess (int index, Bool enable);
 
+/**
+ * Returns TRUE if the given planemask covers all the significant bits in the
+ * pixel values for pDrawable.
+ */
+#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
+	(((_pm) & FbFullMask((_pDrawable)->depth)) == \
+	 FbFullMask((_pDrawable)->depth))
+
 #endif /* EXA_H */
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 90af553..03ee0ed 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -137,14 +137,6 @@ extern int exaPixmapPrivateIndex;
 /** Align an offset to a power-of-two alignment */
 #define EXA_ALIGN2(offset, align) (((offset) + (align) - 1) & ~((align) - 1))
 
-/**
- * Returns TRUE if the given planemask covers all the significant bits in the
- * pixel values for pDrawable.
- */
-#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
-	(((_pm) & FbFullMask((_pDrawable)->depth)) == \
-	 FbFullMask((_pDrawable)->depth))
-
 #define EXA_PIXMAP_SCORE_MOVE_IN    10
 #define EXA_PIXMAP_SCORE_MAX	    20
 #define EXA_PIXMAP_SCORE_MOVE_OUT   -10
diff-tree afb84c2fca56887b3bfe7aa93f337c49b087acdc (from 930b9a069a425818d4e9965f53be7df1f4d7d422)
Author: George Fufutos <fufutos610 at hotmail.com>
Date:   Sat Jun 24 15:23:14 2006 +0200

    Bug #6911: Check return value of exaGetPixelFromRGBA().

diff --git a/exa/exa_render.c b/exa/exa_render.c
index 26b29ab..b21c5d7 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -282,8 +282,12 @@ exaTryDriverSolidFill(PicturePtr	pSrc,
 	return -1;
     }
 
-    exaGetPixelFromRGBA(&pixel, red, green, blue, alpha,
-			pDst->format);
+    if (!exaGetPixelFromRGBA(&pixel, red, green, blue, alpha,
+			pDst->format))
+    {
+	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+	return -1;
+    }
 
     if (!(*pExaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel))
     {
diff-tree 930b9a069a425818d4e9965f53be7df1f4d7d422 (from 36756fdb2ddc154b406f664a6af0f38d26e6973d)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sat Jun 24 15:21:17 2006 +0200

    Bug #6818: Avoid infinite loop in exaLog2() with negative arguments.

diff --git a/exa/exa.c b/exa/exa.c
index 4b96af8..aa5532a 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -158,7 +158,7 @@ exaLog2(int val)
 {
     int bits;
 
-    if (!val)
+    if (val <= 0)
 	return 0;
     for (bits = 0; val != 0; bits++)
 	val >>= 1;
diff-tree 36756fdb2ddc154b406f664a6af0f38d26e6973d (from 4426215a6e99f84550aaac23ac9c2018668bfbc1)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sat Jun 24 15:09:24 2006 +0200

    Make sure <execinfo.h> is actually included when needed.
    
    configure only defines HAVE_BACKTRACE, not HAVE_EXECINFO_H.
    
    This could cause problems on platforms where the size of a pointer is greater
    than that of an integer, see
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=363218 .

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 397f75d..831c68a 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -1255,12 +1255,8 @@ xf86InterceptSigIll(void (*sigillhandler
     xf86SigIllHandler = sigillhandler;
 }
 
-#ifdef HAVE_EXECINFO_H
-#define HAVE_BACKTRACE
-#include <execinfo.h>
-#endif
-
 #ifdef HAVE_BACKTRACE
+#include <execinfo.h>
 
 static __inline__ void xorg_backtrace(void)
 {
diff-tree 4426215a6e99f84550aaac23ac9c2018668bfbc1 (from a195a3debca02572d9f7d7a9976b5bf67acc5d08)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sat Jun 24 15:02:56 2006 +0200

    Bug #7213: Fix the XFree86-DRI extension for byte-swapped clients.
    
    These clients are by definition non-local and thus not direct rendering
    capable, but they still need the QueryVersion and QueryDirectRenderingCapable
    requests to find out cleanly.

diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 4b0e354..5e46036 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -81,6 +81,7 @@ static DISPATCH_PROC(ProcXF86DRIDispatch
 static DISPATCH_PROC(ProcXF86DRIAuthConnection);
 
 static DISPATCH_PROC(SProcXF86DRIQueryVersion);
+static DISPATCH_PROC(SProcXF86DRIQueryDirectRenderingCapable);
 static DISPATCH_PROC(SProcXF86DRIDispatch);
 
 static void XF86DRIResetProc(ExtensionEntry* extEntry);
@@ -142,6 +143,9 @@ ProcXF86DRIQueryVersion(
     if (client->swapped) {
     	swaps(&rep.sequenceNumber, n);
     	swapl(&rep.length, n);
+	swaps(&rep.majorVersion, n);
+	swaps(&rep.minorVersion, n);
+	swapl(&rep.patchVersion, n);
     }
     WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *)&rep);
     return (client->noClientException);
@@ -154,6 +158,7 @@ ProcXF86DRIQueryDirectRenderingCapable(
 {
     xXF86DRIQueryDirectRenderingCapableReply	rep;
     Bool isCapable;
+    register int n;
 
     REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
     REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
@@ -172,9 +177,14 @@ ProcXF86DRIQueryDirectRenderingCapable(
     }
     rep.isCapable = isCapable;
 
-    if (!LocalClient(client))
+    if (!LocalClient(client) || client->swapped)
 	rep.isCapable = 0;
 
+    if (client->swapped) {
+    	swaps(&rep.sequenceNumber, n);
+    	swapl(&rep.length, n);
+    }
+
     WriteToClient(client, 
 	sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep);
     return (client->noClientException);
@@ -627,22 +637,35 @@ SProcXF86DRIQueryVersion(
 }
 
 static int
+SProcXF86DRIQueryDirectRenderingCapable(
+    register ClientPtr client
+)
+{
+    register int n;
+    REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
+    swaps(&stuff->length, n);
+    swapl(&stuff->screen, n);
+    return ProcXF86DRIQueryDirectRenderingCapable(client);
+}
+
+static int
 SProcXF86DRIDispatch (
     register ClientPtr	client
 )
 {
     REQUEST(xReq);
 
-    /* It is bound to be non-local when there is byte swapping */
-    if (!LocalClient(client))
-	return DRIErrorBase + XF86DRIClientNotLocal;
-
-    /* only local clients are allowed DRI access */
+    /*
+     * Only local clients are allowed DRI access, but remote clients still need
+     * these requests to find out cleanly.
+     */
     switch (stuff->data)
     {
     case X_XF86DRIQueryVersion:
 	return SProcXF86DRIQueryVersion(client);
+    case X_XF86DRIQueryDirectRenderingCapable:
+	return SProcXF86DRIQueryDirectRenderingCapable(client);
     default:
-	return BadRequest;
+	return DRIErrorBase + XF86DRIClientNotLocal;
     }
 }
diff-tree a195a3debca02572d9f7d7a9976b5bf67acc5d08 (from bc6cfde19887eff7a07dc739ffa29609fb55b83d)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sat Jun 24 14:54:52 2006 +0200

    Fix byte swapping in some GLX requests.

diff --git a/GL/glx/indirect_util.c b/GL/glx/indirect_util.c
index c9d8600..bab0226 100644
--- a/GL/glx/indirect_util.c
+++ b/GL/glx/indirect_util.c
@@ -185,8 +185,8 @@ __glXSendReplySwap( ClientPtr client, co
     }
 
     __glXReply.length =         bswap_32( reply_ints );
-    __glXReply.type =           bswap_32( X_Reply );
-    __glXReply.sequenceNumber = bswap_32( client->sequence );
+    __glXReply.type =           X_Reply;
+    __glXReply.sequenceNumber = bswap_16( client->sequence );
     __glXReply.size =           bswap_32( elements );
     __glXReply.retval =         bswap_32( retval );
 
diff-tree bc6cfde19887eff7a07dc739ffa29609fb55b83d (from c7ac485a59709572307b9a4a9abacc52c7021b65)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Jun 23 20:07:34 2006 -0700

    Use correct OSNAME setting so we can find os-specific modules like libdrm.

diff --git a/hw/xfree86/loader/os.c b/hw/xfree86/loader/os.c
index 42ab0bc..83fd247 100644
--- a/hw/xfree86/loader/os.c
+++ b/hw/xfree86/loader/os.c
@@ -33,10 +33,11 @@
 
 /*
  * OSNAME is a standard form of the OS name that may be used by the
- * loader and by OS-specific modules.
+ * loader and by OS-specific modules.  OSNAME here is different from what's in
+ * dix-config.h
  */
 
-#ifndef OSNAME
+#undef OSNAME
 #if defined(__linux__)
 #define OSNAME "linux"
 #elif defined(__FreeBSD__)
@@ -66,7 +67,6 @@
 #else
 #define OSNAME "unknown"
 #endif
-#endif
 
 /* Return the OS name, and run-time OS version */
 
diff-tree c7ac485a59709572307b9a4a9abacc52c7021b65 (from 2cf1f39ca974c81a2f52d2f7509aa3d098a87176)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Wed Jun 21 09:34:55 2006 -0700

    Remove the default case from fbcompose.c switches which should cover all cases.
    
    Instead, stick the NULL return default case afterwards, so that the compiler can
    warn us when we've got unimplemented cases.  Removes some unimplemented and
    unused 8bpp, depth 4 picture format names.

diff --git a/fb/fbcompose.c b/fb/fbcompose.c
index 03adab4..3a61e97 100644
--- a/fb/fbcompose.c
+++ b/fb/fbcompose.c
@@ -573,9 +573,9 @@ static fetchProc fetchProcForPicture (Pi
         /* 1bpp formats */
     case PICT_a1: return  fbFetch_a1;
     case PICT_g1: return  fbFetch_g1;
-    default:
-        return NULL;
     }
+
+    return NULL;
 }
 
 /*
@@ -1010,9 +1010,9 @@ static fetchPixelProc fetchPixelProcForP
         /* 1bpp formats */
     case PICT_a1: return  fbFetchPixel_a1;
     case PICT_g1: return  fbFetchPixel_g1;
-    default:
-        return NULL;
     }
+
+    return NULL;
 }
 
 
diff --git a/render/picture.h b/render/picture.h
index e7d86ac..8184c02 100644
--- a/render/picture.h
+++ b/render/picture.h
@@ -102,10 +102,6 @@ typedef enum _PictFormatShort {
    PICT_g8 =		PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0),
 
    PICT_x4a4 =		PICT_FORMAT(8,PICT_TYPE_A,4,0,0,0),
-   PICT_x4r1g2b1 =	PICT_FORMAT(8,PICT_TYPE_ARGB,0,1,2,1),
-   PICT_x4b1g2r1 =	PICT_FORMAT(8,PICT_TYPE_ABGR,0,1,2,1),
-   PICT_x4a1r1g1b1 =	PICT_FORMAT(8,PICT_TYPE_ARGB,1,1,1,1),
-   PICT_x4a1b1g1r1 =	PICT_FORMAT(8,PICT_TYPE_ABGR,1,1,1,1),
 				    
    PICT_x4c4 =		PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0),
    PICT_x4g4 =		PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0),
diff-tree 2cf1f39ca974c81a2f52d2f7509aa3d098a87176 (from d67fd106968e371d8be3966ed5ecdd3c69f36e3a)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Wed Jun 21 09:30:59 2006 -0700

    Add a manpage for EXA.

diff --git a/.gitignore b/.gitignore
index 149c1e6..1e79706 100644
--- a/.gitignore
+++ b/.gitignore
@@ -144,6 +144,8 @@ hw/xfree86/doc/man/Xorg.1x
 hw/xfree86/doc/man/Xorg.man
 hw/xfree86/doc/man/xorg.conf.5x
 hw/xfree86/doc/man/xorg.conf.man
+hw/xfree86/exa/exa.4
+hw/xfree86/exa/exa.man
 hw/xfree86/fbdevhw/fbdevhw.4x
 hw/xfree86/fbdevhw/fbdevhw.man
 hw/xfree86/getconfig/cfg.man
diff --git a/hw/xfree86/exa/Makefile.am b/hw/xfree86/exa/Makefile.am
index 8e85e1e..7f0a20e 100644
--- a/hw/xfree86/exa/Makefile.am
+++ b/hw/xfree86/exa/Makefile.am
@@ -14,3 +14,15 @@ libexa_la_SOURCES = \
 
 libexa_la_LIBADD = \
 	../../../exa/libexa.la
+
+include $(top_srcdir)/cpprules.in
+
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_DATA = exa.$(DRIVER_MAN_SUFFIX)
+CLEANFILES = $(driverman_DATA) exa.man
+
+exa.$(DRIVER_MAN_SUFFIX): exa.man
+	-rm -f exa.$(DRIVER_MAN_SUFFIX)
+	$(LN_S) exa.man exa.$(DRIVER_MAN_SUFFIX)
+
+EXTRA_DIST = exa.man.pre README
diff --git a/hw/xfree86/exa/exa.man.pre b/hw/xfree86/exa/exa.man.pre
new file mode 100644
index 0000000..ea41b90
--- /dev/null
+++ b/hw/xfree86/exa/exa.man.pre
@@ -0,0 +1,40 @@
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH EXA __drivermansuffix__ __vendorversion__
+.SH NAME
+exa \- new 2D acceleration architecture for X.Org
+.SH DESCRIPTION
+.B EXA
+provides a simple API for video drivers to implement for 2D acceleration.  It
+is a module loaded by drivers, and is not intended to be loaded on its own.  See
+your driver's manual page for how to enable 
+.B EXA
+.
+.PP
+The
+.B EXA
+architecture is designed to make accelerating the Render extension simple and
+efficient, and results in various performance tradeoffs compared to XAA.  Some
+options are available for debugging performance issues or driver rendering
+problems.  They are not intended for general use.
+.TP
+.BI "Option \*qEXANoComposite\*q \*q" boolean \*q
+Disables acceleration of the Composite operation, which is at the heart of
+the Render extension.  Not related to the Composite extension.  Default: No.
+.TP
+.BI "Option \*qEXANoUploadToScreen\*q \*q" boolean \*q
+Disables acceleration of uploading pixmap data to the freamebuffer. Default: No.
+.TP
+.BI "Option \*qEXANoDownloadFromScreen\*q \*q" boolean \*q
+Disables acceleration of downloading of pixmap data from the framebuffer. 
+.B NOTE:
+Not usable with drivers which rely on DownloadFromScreen succeeding.
+Default: No.
+.TP
+.BI "Option \*qMigrationHeuristic\*q \*q" anystr \*q
+Chooses an alternate pixmap migration heuristic, for debugging purposes.  The
+default is intended to be the best performing one for general use, though others
+may help with specific use cases.  Available options include \*qalways\*q,
+\*qgreedy\*q, and \*qsmart\*q.  Default: smart.
+.SH AUTHORS
+Authors include: Keith Packard, Eric Anholt, Zack Rusin, and Michel Dänzer



More information about the xorg-commit mailing list