summaryrefslogtreecommitdiff
path: root/GL/glx
diff options
context:
space:
mode:
Diffstat (limited to 'GL/glx')
-rw-r--r--GL/glx/Makefile.am6
-rw-r--r--GL/glx/g_disptab.c45
-rw-r--r--GL/glx/g_disptab.h33
-rw-r--r--GL/glx/g_disptab_EXT.c1
-rw-r--r--GL/glx/g_disptab_EXT.h1
-rw-r--r--GL/glx/global.c77
-rw-r--r--GL/glx/glxcmds.c542
-rw-r--r--GL/glx/glxcmdsswap.c130
-rw-r--r--GL/glx/glxcontext.h7
-rw-r--r--GL/glx/glxdrawable.h7
-rw-r--r--GL/glx/glxdri.c271
-rw-r--r--GL/glx/glxerror.h58
-rw-r--r--GL/glx/glxext.c64
-rw-r--r--GL/glx/glxext.h6
-rw-r--r--GL/glx/glxscreens.c2
-rw-r--r--GL/glx/glxscreens.h14
-rw-r--r--GL/glx/glxserver.h4
-rw-r--r--GL/glx/glxutil.c37
-rw-r--r--GL/glx/glxutil.h13
-rw-r--r--GL/glx/indirect_util.c4
-rw-r--r--GL/glx/render2.c1
-rw-r--r--GL/glx/render2swap.c1
-rw-r--r--GL/glx/rensize.c1
-rw-r--r--GL/glx/rensizetab.c1
-rw-r--r--GL/glx/single2.c1
-rw-r--r--GL/glx/single2swap.c1
-rw-r--r--GL/glx/singlepixswap.c1
-rw-r--r--GL/glx/singlesize.c1
-rw-r--r--GL/glx/unpack.h1
-rw-r--r--GL/glx/xfont.c2
30 files changed, 768 insertions, 565 deletions
diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am
index fd8a59bd0..1d4a9865d 100644
--- a/GL/glx/Makefile.am
+++ b/GL/glx/Makefile.am
@@ -13,9 +13,7 @@ AM_CFLAGS = \
@DRIPROTO_CFLAGS@ \
-I@MESA_SOURCE@/src/mesa/glapi \
-I@MESA_SOURCE@/src/mesa/main \
- @SERVER_DEFINES@ \
- @MODULE_DEFINES@ \
- @LOADER_DEFINES@ \
+ -DXFree86Server \
-DNO_LIBCWRAPPER \
@GLX_DEFINES@
@@ -43,13 +41,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/g_disptab.c b/GL/glx/g_disptab.c
index c41c45e9f..8e336268d 100644
--- a/GL/glx/g_disptab.c
+++ b/GL/glx/g_disptab.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.5 2004/01/28 18:11:50 alanh Exp $ */
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
/*
** License Applicability. Except to the extent portions of this file are
@@ -47,7 +46,7 @@ __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE] = {
__glXMakeCurrent,
__glXIsDirect,
__glXQueryVersion,
- __glXWaitGL,
+ __glXWaitGL, /* 0x08 */
__glXWaitX,
__glXCopyContext,
__glXSwapBuffers,
@@ -55,23 +54,23 @@ __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE] = {
__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 +447,7 @@ __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE] = {
__glXSwapMakeCurrent,
__glXSwapIsDirect,
__glXSwapQueryVersion,
- __glXSwapWaitGL,
+ __glXSwapWaitGL, /* 0x08 */
__glXSwapWaitX,
__glXSwapCopyContext,
__glXSwapSwapBuffers,
@@ -456,23 +455,23 @@ __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE] = {
__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 9ae901c1d..4a1c5e975 100644
--- a/GL/glx/g_disptab.h
+++ b/GL/glx/g_disptab.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.4 2003/09/28 20:15:42 alanh Exp $ */
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -48,6 +47,7 @@ extern int __glXCopyContext(__GLXclientState*, GLbyte*);
extern int __glXSwapBuffers(__GLXclientState*, GLbyte*);
extern int __glXBindTexImageEXT(__GLXclientState *cl, GLbyte *pc);
extern int __glXReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc);
+extern int __glXCopySubBufferMESA(__GLXclientState *cl, GLbyte *pc);
extern int __glXGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
extern int __glXUseXFont(__GLXclientState*, GLbyte*);
extern int __glXCreateGLXPixmap(__GLXclientState*, GLbyte*);
@@ -60,8 +60,17 @@ extern int __glXQueryServerString(__GLXclientState*, GLbyte*);
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*);
@@ -76,6 +85,7 @@ extern int __glXSwapCopyContext(__GLXclientState*, GLbyte*);
extern int __glXSwapSwapBuffers(__GLXclientState*, GLbyte*);
extern int __glXSwapBindTexImageEXT(__GLXclientState *cl, GLbyte *pc);
extern int __glXSwapReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc);
extern int __glXSwapGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
extern int __glXSwapUseXFont(__GLXclientState*, GLbyte*);
extern int __glXSwapCreateGLXPixmap(__GLXclientState*, GLbyte*);
@@ -88,8 +98,18 @@ extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*);
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
@@ -105,4 +125,11 @@ extern __GLXdispatchRenderProcPtr __glXRenderTable[__GLX_RENDER_TABLE_SIZE];
extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE];
extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE];
extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE];
+
+/* Copied from mesa src/glx/x11/glxcmds.c
+ *
+ * Apparently there's no standardized opcode for this extension.
+ */
+#define X_GLXvop_CopySubBufferMESA 5154 /* temporary */
+
#endif /* _GLX_g_disptab_h_ */
diff --git a/GL/glx/g_disptab_EXT.c b/GL/glx/g_disptab_EXT.c
index 255f3832c..087fb2472 100644
--- a/GL/glx/g_disptab_EXT.c
+++ b/GL/glx/g_disptab_EXT.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.5 2004/01/28 18:11:50 alanh Exp $ */
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
/*
** License Applicability. Except to the extent portions of this file are
diff --git a/GL/glx/g_disptab_EXT.h b/GL/glx/g_disptab_EXT.h
index b5ecc6995..62a7517c4 100644
--- a/GL/glx/g_disptab_EXT.h
+++ b/GL/glx/g_disptab_EXT.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.5 2004/01/28 18:11:50 alanh Exp $ */
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
diff --git a/GL/glx/global.c b/GL/glx/global.c
deleted file mode 100644
index 28030ec03..000000000
--- 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 3202f75dc..f0a6474c1 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.12 2004/01/28 18:11:50 alanh Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
@@ -188,7 +187,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes);
if (!shareglxc) {
client->errorValue = shareList;
- return __glXBadContext;
+ return __glXError(GLXBadContext);
}
if (shareglxc->isDirect) {
/*
@@ -301,7 +300,7 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
return Success;
} else {
client->errorValue = gcId;
- return __glXBadContext;
+ return __glXError(GLXBadContext);
}
}
@@ -445,61 +444,95 @@ int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
* 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
** is, but it must first be created with glxCreateGLXPixmap).
*/
client->errorValue = drawId;
- return __glXBadDrawable;
+ return __glXError(GLXBadDrawable);
}
} 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.
*/
client->errorValue = drawId;
- return __glXBadDrawable;
+ return __glXError(GLXBadDrawable);
}
}
+ /* 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 +543,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;
@@ -542,12 +573,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 +593,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 */
@@ -572,45 +603,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 __glXBadDrawable;
- }
- }
-
- if (pRead != pDraw) {
- readPriv = __glXGetDrawable(glxc, pRead, readId);
- if (readPriv == NULL) {
- return __glXBadDrawable;
- }
- } else {
readPriv = drawPriv;
}
} else {
/* Switching to no context. Ignore new drawable. */
glxc = 0;
- pDraw = 0;
- pRead = 0;
+ drawPriv = 0;
+ readPriv = 0;
}
@@ -631,7 +644,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 +660,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 +669,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 +763,7 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
if (!glxc) {
client->errorValue = req->context;
- return __glXBadContext;
+ return __glXError(GLXBadContext);
}
reply.isDirect = glxc->isDirect;
@@ -844,12 +857,12 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
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 +887,7 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
__GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
if (!tagcx) {
- return __glXBadContextTag;
+ return __glXError(GLXBadContextTag);
}
if (tagcx != src) {
/*
@@ -1187,82 +1200,84 @@ int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
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;
pGlxPixmap->modes = modes;
@@ -1298,28 +1313,114 @@ int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
}
-/**
- * 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.
*/
if (!LookupIDByType(glxpixmap, __glXPixmapRes)) {
client->errorValue = glxpixmap;
- return __glXBadPixmap;
+ return __glXError(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;
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ __GLXdrawable *glxPriv;
+ __GLXscreen *screen;
+ __GLcontextModes *modes;
+ int retval;
+
+ 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;
+
+ 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;
+
+ /*
+ ** 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 Success;
}
+
/*****************************************************************************/
/*
@@ -1330,50 +1431,18 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
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 __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 __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,
@@ -1392,47 +1461,31 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
}
}
- if (pDraw) {
- __GLXdrawable *glxPriv;
-
- if (glxc) {
- glxPriv = __glXGetDrawable(glxc, pDraw, drawId);
- if (glxPriv == NULL) {
- return __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 __glXBadDrawable;
- }
- }
+ if (pGlxDraw != NULL && pGlxDraw->type == DRAWABLE_WINDOW &&
+ (*pGlxDraw->swapBuffers)(pGlxDraw) == GL_FALSE)
+ return __glXError(GLXBadDrawable);
return Success;
}
-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;
- return __glXBadContext;
+ client->errorValue = gcId;
+ return __glXError(GLXBadContext);
}
nProps = 3;
@@ -1444,7 +1497,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
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;
@@ -1465,6 +1518,19 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
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)
{
@@ -1482,7 +1548,7 @@ int __glXBindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
buffer = *((INT32 *) (pc + 4));
if (buffer != GLX_FRONT_LEFT_EXT)
- return __glXBadPixmap;
+ return __glXError(GLXBadPixmap);
context = __glXForceCurrent (cl, req->contextTag, &error);
if (!context)
@@ -1491,11 +1557,11 @@ int __glXBindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
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,
@@ -1524,17 +1590,76 @@ int __glXReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
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,
pGlxPixmap);
}
+int __glXCopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ GLXContextTag tag = req->contextTag;
+ __GLXcontext *glxc = NULL;
+ __GLXdrawable *pGlxDraw;
+ __GLXpixmap *pPixmap;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId;
+ int error;
+ int x, y, width, height;
+
+ (void) client;
+ (void) req;
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+
+ drawId = *((CARD32 *) (pc));
+ x = *((INT32 *) (pc + 4));
+ y = *((INT32 *) (pc + 8));
+ width = *((INT32 *) (pc + 12));
+ height = *((INT32 *) (pc + 16));
+
+ if (tag) {
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXError(GLXBadContextTag);
+ }
+ /*
+ ** The calling thread is swapping its current drawable. In this case,
+ ** glxSwapBuffers is in both GL and X streams, in terms of
+ ** sequentiality.
+ */
+ if (__glXForceCurrent(cl, tag, &error)) {
+ /*
+ ** Do whatever is needed to make sure that all preceding requests
+ ** in both streams are completed before the swap is executed.
+ */
+ CALL_Finish( GET_DISPATCH(), () );
+ __GLX_NOTE_FLUSHED_CMDS(glxc);
+ } else {
+ return error;
+ }
+ }
+
+ error = GetDrawableOrPixmap(glxc, drawId, &pGlxDraw, &pPixmap, client);
+ if (error != Success)
+ return error;
+
+ if (pGlxDraw == NULL ||
+ pGlxDraw->type != DRAWABLE_WINDOW ||
+ pGlxDraw->copySubBuffer == NULL)
+ return __glXError(GLXBadDrawable);
+
+ (*pGlxDraw->copySubBuffer)(pGlxDraw, x, y, width, height);
+
+ return Success;
+}
+
/*
** Get drawable attributes
*/
@@ -1550,7 +1675,7 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
if (!glxPixmap) {
client->errorValue = drawId;
- return __glXBadPixmap;
+ return __glXError(GLXBadPixmap);
}
numAttribs = 2;
@@ -1588,6 +1713,13 @@ int __glXGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
return DoGetDrawableAttributes(cl, drawable);
}
+int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+
+ return DoGetDrawableAttributes(cl, req->drawable);
+}
+
/************************************************************************/
/*
@@ -1654,13 +1786,13 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc)
#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 */
@@ -1746,7 +1878,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
*/
if (req->requestNumber != 1) {
client->errorValue = req->requestNumber;
- return __glXBadLargeRequest;
+ return __glXError(GLXBadLargeRequest);
}
hdr = (__GLXrenderLargeHeader *) pc;
@@ -1767,13 +1899,13 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
#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) {
/*
@@ -1830,12 +1962,12 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
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);
}
/*
@@ -1844,7 +1976,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
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;
@@ -1868,7 +2000,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
__GLX_PAD(cl->largeCmdBytesTotal)) {
client->errorValue = dataBytes;
__glXResetLargeCommandStatus(cl);
- return __glXBadLargeRequest;
+ return __glXError(GLXBadLargeRequest);
}
hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
opcode = hdr->opcode;
@@ -1887,7 +2019,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
} else {
client->errorValue = opcode;
- return __glXBadLargeRequest;
+ return __glXError(GLXBadLargeRequest);
}
/*
@@ -1937,7 +2069,7 @@ static int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
}
}
client->errorValue = drawable;
- return __glXBadDrawable;
+ return __glXError(GLXBadDrawable);
}
@@ -2164,7 +2296,9 @@ int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
case X_GLXvop_BindTexImageEXT:
return __glXBindTexImageEXT(cl, pc);
case X_GLXvop_ReleaseTexImageEXT:
- return __glXReleaseTexImageEXT(cl, pc);
+ return __glXReleaseTexImageEXT(cl, pc);
+ case X_GLXvop_CopySubBufferMESA:
+ return __glXCopySubBufferMESA(cl, pc);
}
#endif
@@ -2178,7 +2312,7 @@ int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
** 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)
@@ -2238,7 +2372,7 @@ int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
}
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 0f8b67496..bb86243ca 100644
--- a/GL/glx/glxcmdsswap.c
+++ b/GL/glx/glxcmdsswap.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.10 2004/01/28 18:11:50 alanh Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
@@ -315,6 +314,68 @@ int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
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;
@@ -432,6 +493,31 @@ int __glXSwapReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
return __glXReleaseTexImageEXT(cl, (GLbyte *)pc);
}
+int __glXSwapCopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ GLXDrawable *drawId;
+ int *buffer;
+
+ (void) drawId;
+ (void) buffer;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(pc);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+
+ return __glXCopySubBufferMESA(cl, pc);
+
+}
+
int __glXSwapGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc;
@@ -444,7 +530,19 @@ int __glXSwapGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
__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);
}
@@ -600,12 +698,12 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc)
#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 */
@@ -698,7 +796,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
*/
if (req->requestNumber != 1) {
client->errorValue = req->requestNumber;
- return __glXBadLargeRequest;
+ return __glXError(GLXBadLargeRequest);
}
hdr = (__GLXrenderLargeHeader *) pc;
__GLX_SWAP_INT(&hdr->length);
@@ -719,13 +817,13 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
#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) {
/*
@@ -781,12 +879,12 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
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);
}
/*
@@ -795,7 +893,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
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;
@@ -819,7 +917,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
__GLX_PAD(cl->largeCmdBytesTotal)) {
client->errorValue = dataBytes;
__glXResetLargeCommandStatus(cl);
- return __glXBadLargeRequest;
+ return __glXError(GLXBadLargeRequest);
}
hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
/*
@@ -842,7 +940,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
} else {
client->errorValue = opcode;
- return __glXBadLargeRequest;
+ return __glXError(GLXBadLargeRequest);
}
/*
@@ -899,7 +997,9 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc)
case X_GLXvop_BindTexImageEXT:
return __glXSwapBindTexImageEXT(cl, pc);
case X_GLXvop_ReleaseTexImageEXT:
- return __glXSwapReleaseTexImageEXT(cl, pc);
+ return __glXSwapReleaseTexImageEXT(cl, pc);
+ case X_GLXvop_CopySubBufferMESA:
+ return __glXSwapCopySubBufferMESA(cl, pc);
}
#endif
@@ -910,7 +1010,7 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc)
return Success;
}
cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
+ return __glXError(GLXUnsupportedPrivateRequest);
}
int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
@@ -963,5 +1063,5 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
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/glxcontext.h b/GL/glx/glxcontext.h
index d57745a25..a54e323cc 100644
--- a/GL/glx/glxcontext.h
+++ b/GL/glx/glxcontext.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.4 2002/02/22 21:45:07 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -58,7 +57,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 +65,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/glxdrawable.h b/GL/glx/glxdrawable.h
index 2d5d07a79..20e9b437f 100644
--- a/GL/glx/glxdrawable.h
+++ b/GL/glx/glxdrawable.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -41,6 +40,8 @@
**
*/
+#include <damage.h>
+
typedef struct {
DrawablePtr pDraw;
@@ -49,13 +50,15 @@ typedef struct {
ScreenPtr pScreen;
Bool idExists;
int refcnt;
-
+ DamagePtr pDamage;
} __GLXpixmap;
struct __GLXdrawable {
void (*destroy)(__GLXdrawable *private);
GLboolean (*resize)(__GLXdrawable *private);
GLboolean (*swapBuffers)(__GLXdrawable *);
+ void (*copySubBuffer)(__GLXdrawable *drawable,
+ int x, int y, int w, int h);
/*
** list of drawable private structs
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index 4935b0aca..cfa9996df 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -112,28 +112,38 @@ struct __GLXDRIdrawable {
* months ago. :(
* 20050727 - Gut all the old interfaces. This breaks compatability with
* any DRI driver built to any previous version.
+ * 20060314 - Added support for GLX_MESA_copy_sub_buffer.
*/
+
#define INTERNAL_VERSION 20050727
static const char CREATE_NEW_SCREEN_FUNC[] =
"__driCreateNewScreen_" STRINGIFY (INTERNAL_VERSION);
+/* The DRI driver entry point version wasn't bumped when the
+ * copySubBuffer functionality was added to the DRI drivers, but the
+ * functionality is still conditional on the value of the
+ * internal_api_version passed to __driCreateNewScreen. However, the
+ * screen constructor doesn't fail for a DRI driver that's older than
+ * the passed in version number, so there's no way we can know for
+ * sure that we can actually use the copySubBuffer functionality. But
+ * since the earliest (and at this point only) released mesa version
+ * (6.5) that uses the 20050727 entry point does have copySubBuffer,
+ * we'll just settle for that. We still have to pass in a higher to
+ * the screen constructor to enable the functionality.
+ */
+#define COPY_SUB_BUFFER_INTERNAL_VERSION 20060314
+
static void
__glXDRIleaveServer(void)
{
- int i;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- DRIDoBlockHandler(i, NULL, NULL, NULL);
+ DRIBlockHandler(NULL, NULL, NULL);
}
static void
__glXDRIenterServer(void)
{
- int i;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- DRIDoWakeupHandler(i, NULL, 0, NULL);
+ DRIWakeupHandler(NULL, 0, NULL);
}
static void
@@ -177,48 +187,27 @@ __glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
return TRUE;
}
-static __GLXdrawable *
-__glXDRIcontextCreateDrawable(__GLXcontext *context,
- DrawablePtr pDraw,
- XID drawId)
+static void
+__glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
+ int x, int y, int w, int h)
{
- __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.*/
+ __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
+ __GLXDRIscreen *screen;
- /* The last argument is 'attrs', which is used with pbuffers which
- * we currently don't support. */
+ /* FIXME: We're jumping through hoops here to get the DRIdrawable
+ * which the dri driver tries to keep to it self... cf. FIXME in
+ * createDrawable. */
- glxPriv->driDrawable.private =
- (pGlxScreen->driScreen.createNewDrawable)(NULL, modes,
- drawId,
- &glxPriv->driDrawable,
- 0,
- NULL);
-#endif
+ screen = (__GLXDRIscreen *) __glXgetActiveScreen(private->base.pDraw->pScreen->myNum);
+ private->driDrawable = (screen->driScreen.getDrawable)(NULL,
+ private->base.drawId,
+ screen->driScreen.private);
- return &private->base;
+ (*private->driDrawable->copySubBuffer)(NULL,
+ private->driDrawable->private,
+ x, y, w, h);
}
-
static void
__glXDRIcontextDestroy(__GLXcontext *baseContext)
{
@@ -296,24 +285,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 +309,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 +317,103 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
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;
}
@@ -425,7 +472,6 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
context->base.loseCurrent = __glXDRIcontextLoseCurrent;
context->base.copy = __glXDRIcontextCopy;
context->base.forceCurrent = __glXDRIcontextForceCurrent;
- context->base.createDrawable = __glXDRIcontextCreateDrawable;
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
@@ -440,6 +486,50 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
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;
+ private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
+
+#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)
@@ -712,7 +802,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
__DRIframebuffer framebuffer;
int fd = -1;
int status;
- int api_ver = INTERNAL_VERSION;
+ int api_ver = COPY_SUB_BUFFER_INTERNAL_VERSION;
drm_magic_t magic;
drmVersionPtr version;
char *driverName;
@@ -740,8 +830,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/glxerror.h b/GL/glx/glxerror.h
deleted file mode 100644
index 2c6d6d863..000000000
--- 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 c2a165efe..8bbb83f41 100644
--- a/GL/glx/glxext.c
+++ b/GL/glx/glxext.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.9 2003/09/28 20:15:43 alanh Exp $
+/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (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.,
@@ -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;
/*
@@ -141,6 +168,10 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
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.
@@ -261,6 +292,13 @@ GLboolean __glXErrorOccured(void)
return errorOccured;
}
+static int __glXErrorBase;
+
+int __glXError(int error)
+{
+ return __glXErrorBase + error;
+}
+
/************************************************************************/
/*
@@ -270,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.
@@ -292,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.
@@ -343,7 +371,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
cx = (__GLXcontext *) __glXLookupContextByTag(cl, tag);
if (!cx) {
cl->client->errorValue = tag;
- *error = __glXBadContextTag;
+ *error = __glXError(GLXBadContextTag);
return 0;
}
@@ -354,7 +382,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
** 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;
}
}
@@ -369,7 +397,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
if (!(*cx->forceCurrent)(cx)) {
/* Bind failed, and set the error code. Bummer */
cl->client->errorValue = cx->id;
- *error = __glXBadContextState;
+ *error = __glXError(GLXBadContextState);
return 0;
}
}
@@ -465,7 +493,7 @@ static int __glXDispatch(ClientPtr client)
*/
if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) {
client->errorValue = stuff->glxCode;
- return __glXBadLargeRequest;
+ return __glXError(GLXBadLargeRequest);
}
/*
diff --git a/GL/glx/glxext.h b/GL/glx/glxext.h
index 5d569899f..f48f331d4 100644
--- a/GL/glx/glxext.h
+++ b/GL/glx/glxext.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.7 2003/11/17 22:20:26 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -85,8 +84,11 @@ extern int DoGetFBConfigs(__GLXclientState *cl, unsigned screen,
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);
+
+extern int DoQueryContext(__GLXclientState *cl, GLXContextID gcId);
extern void GlxExtensionInit(void);
diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c
index 77654d3ab..e388fceb1 100644
--- a/GL/glx/glxscreens.c
+++ b/GL/glx/glxscreens.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.14 2004/02/09 23:46:31 alanh Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
@@ -139,6 +138,7 @@ static char GLXServerExtensions[] =
"GLX_SGIX_swap_barrier "
#endif
"GLX_SGIX_fbconfig "
+ "GLX_MESA_copy_sub_buffer "
;
__GLXscreen **__glXActiveScreens;
diff --git a/GL/glx/glxscreens.h b/GL/glx/glxscreens.h
index 8a2b2388f..8beec17ec 100644
--- a/GL/glx/glxscreens.h
+++ b/GL/glx/glxscreens.h
@@ -5,7 +5,6 @@
#ifndef _GLX_screens_h_
#define _GLX_screens_h_
-/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.4 2001/03/21 16:29:37 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
@@ -53,11 +52,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/glxserver.h b/GL/glx/glxserver.h
index a41720f54..8ece1e2a6 100644
--- a/GL/glx/glxserver.h
+++ b/GL/glx/glxserver.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.5 2003/09/28 20:15:43 alanh Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -70,7 +69,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 +110,8 @@ void __glXScreenInitVisuals(__GLXscreen *screen);
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/glxutil.c b/GL/glx/glxutil.c
index f1f9c06c5..1f172929f 100644
--- a/GL/glx/glxutil.c
+++ b/GL/glx/glxutil.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.5 2001/03/21 16:29:37 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
@@ -140,12 +139,14 @@ __glXUnrefDrawable(__GLXdrawable *glxPriv)
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 *)
@@ -153,35 +154,3 @@ __glXDrawableInit(__GLXdrawable *drawable,
return GL_TRUE;
}
-
-__GLXdrawable *
-__glXFindDrawable(XID drawId)
-{
- __GLXdrawable *glxPriv;
-
- glxPriv = (__GLXdrawable *)LookupIDByType(drawId, __glXDrawableRes);
-
- return glxPriv;
-}
-
-__GLXdrawable *
-__glXGetDrawable(__GLXcontext *ctx, DrawablePtr pDraw, XID drawId)
-{
- __GLXdrawable *glxPriv;
-
- glxPriv = __glXFindDrawable(drawId);
-
- if (glxPriv == NULL)
- {
- glxPriv = ctx->createDrawable(ctx, pDraw, drawId);
-
- /* since we are creating the drawablePrivate, drawId should be new */
- if (!AddResource(drawId, __glXDrawableRes, glxPriv))
- {
- glxPriv->destroy (glxPriv);
- return NULL;
- }
- }
-
- return glxPriv;
-}
diff --git a/GL/glx/glxutil.h b/GL/glx/glxutil.h
index d5cfa20b5..c30a1f9cd 100644
--- a/GL/glx/glxutil.h
+++ b/GL/glx/glxutil.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -58,11 +57,13 @@ extern GLboolean __glXResizeDrawableBuffers(__GLXdrawable *glxPriv);
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/glx/indirect_util.c b/GL/glx/indirect_util.c
index c9d8600c8..bab0226be 100644
--- a/GL/glx/indirect_util.c
+++ b/GL/glx/indirect_util.c
@@ -185,8 +185,8 @@ __glXSendReplySwap( ClientPtr client, const void * data, size_t elements,
}
__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 --git a/GL/glx/render2.c b/GL/glx/render2.c
index b126638a1..5b3d3e6d0 100644
--- a/GL/glx/render2.c
+++ b/GL/glx/render2.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.8 2004/02/03 23:04:08 alanh Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
diff --git a/GL/glx/render2swap.c b/GL/glx/render2swap.c
index 81de81ff9..23b7ebd37 100644
--- a/GL/glx/render2swap.c
+++ b/GL/glx/render2swap.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.6 2002/01/14 22:47:08 tsi Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
diff --git a/GL/glx/rensize.c b/GL/glx/rensize.c
index d37958207..47d698905 100644
--- a/GL/glx/rensize.c
+++ b/GL/glx/rensize.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.6 2003/09/28 20:15:43 alanh Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
diff --git a/GL/glx/rensizetab.c b/GL/glx/rensizetab.c
index c9bd1a73b..b9768a5b5 100644
--- a/GL/glx/rensizetab.c
+++ b/GL/glx/rensizetab.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.5 2004/01/28 18:11:53 alanh Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
diff --git a/GL/glx/single2.c b/GL/glx/single2.c
index efc7220f3..3387af2a2 100644
--- a/GL/glx/single2.c
+++ b/GL/glx/single2.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.8 2004/02/10 22:54:15 alanh Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
diff --git a/GL/glx/single2swap.c b/GL/glx/single2swap.c
index d1f56c2c2..41a42bb0f 100644
--- a/GL/glx/single2swap.c
+++ b/GL/glx/single2swap.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.7 2002/01/14 22:47:08 tsi Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
diff --git a/GL/glx/singlepixswap.c b/GL/glx/singlepixswap.c
index 91cebff46..59d1a690c 100644
--- a/GL/glx/singlepixswap.c
+++ b/GL/glx/singlepixswap.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.5 2001/03/21 16:29:37 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
diff --git a/GL/glx/singlesize.c b/GL/glx/singlesize.c
index 116c6dc41..b5a74f30d 100644
--- a/GL/glx/singlesize.c
+++ b/GL/glx/singlesize.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.7tsi Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
diff --git a/GL/glx/unpack.h b/GL/glx/unpack.h
index 723fb85f3..70ba1a893 100644
--- a/GL/glx/unpack.h
+++ b/GL/glx/unpack.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.4 2002/01/14 22:47:08 tsi Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
diff --git a/GL/glx/xfont.c b/GL/glx/xfont.c
index 795671534..89ff95b7c 100644
--- a/GL/glx/xfont.c
+++ b/GL/glx/xfont.c
@@ -179,7 +179,7 @@ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
** to try to make a font during another lists construction.
*/
client->errorValue = cx->id;
- return __glXBadContextState;
+ return __glXError(GLXBadContextState);
}
/*