Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework
This commit is contained in:
commit
fd49a0dcc1
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS = glx mesa include
|
||||
SUBDIRS = glx mesa
|
||||
|
||||
# someone could get really crazy someday and add support for the SI...
|
||||
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -47,7 +47,7 @@ __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE] = {
|
|||
__glXMakeCurrent,
|
||||
__glXIsDirect,
|
||||
__glXQueryVersion,
|
||||
__glXWaitGL,
|
||||
__glXWaitGL, /* 0x08 */
|
||||
__glXWaitX,
|
||||
__glXCopyContext,
|
||||
__glXSwapBuffers,
|
||||
|
@ -55,23 +55,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 +448,7 @@ __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE] = {
|
|||
__glXSwapMakeCurrent,
|
||||
__glXSwapIsDirect,
|
||||
__glXSwapQueryVersion,
|
||||
__glXSwapWaitGL,
|
||||
__glXSwapWaitGL, /* 0x08 */
|
||||
__glXSwapWaitX,
|
||||
__glXSwapCopyContext,
|
||||
__glXSwapSwapBuffers,
|
||||
|
@ -456,23 +456,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,
|
||||
|
|
|
@ -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*);
|
||||
|
@ -88,8 +97,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
|
||||
|
|
|
@ -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];
|
||||
|
477
GL/glx/glxcmds.c
477
GL/glx/glxcmds.c
|
@ -188,7 +188,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 +301,7 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
|
|||
return Success;
|
||||
} else {
|
||||
client->errorValue = gcId;
|
||||
return __glXBadContext;
|
||||
return __glXError(GLXBadContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,61 +445,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 +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;
|
||||
|
@ -542,12 +574,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 +594,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,36 +604,18 @@ 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;
|
||||
}
|
||||
|
@ -609,8 +623,8 @@ int DoMakeCurrent( __GLXclientState *cl,
|
|||
} else {
|
||||
/* Switching to no context. Ignore new drawable. */
|
||||
glxc = 0;
|
||||
pDraw = 0;
|
||||
pRead = 0;
|
||||
drawPriv = 0;
|
||||
readPriv = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -631,7 +645,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 +661,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 +670,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 +764,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 +858,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 +888,7 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
|
|||
__GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
|
||||
|
||||
if (!tagcx) {
|
||||
return __glXBadContextTag;
|
||||
return __glXError(GLXBadContextTag);
|
||||
}
|
||||
if (tagcx != src) {
|
||||
/*
|
||||
|
@ -1187,81 +1201,82 @@ 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;
|
||||
|
@ -1299,28 +1314,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;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -1331,50 +1432,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,
|
||||
|
@ -1393,47 +1462,31 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
}
|
||||
|
||||
if (pDraw) {
|
||||
__GLXdrawable *glxPriv;
|
||||
error = GetDrawableOrPixmap(glxc, drawId, &pGlxDraw, &pPixmap, client);
|
||||
if (error != Success)
|
||||
return error;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -1445,7 +1498,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;
|
||||
|
@ -1466,6 +1519,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)
|
||||
{
|
||||
|
@ -1483,7 +1549,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)
|
||||
|
@ -1492,11 +1558,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,
|
||||
|
@ -1525,11 +1591,11 @@ 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,
|
||||
|
@ -1551,7 +1617,7 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
|
|||
glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
|
||||
if (!glxPixmap) {
|
||||
client->errorValue = drawId;
|
||||
return __glXBadPixmap;
|
||||
return __glXError(GLXBadPixmap);
|
||||
}
|
||||
|
||||
numAttribs = 2;
|
||||
|
@ -1589,6 +1655,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);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -1655,13 +1728,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 */
|
||||
|
@ -1747,7 +1820,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
|
|||
*/
|
||||
if (req->requestNumber != 1) {
|
||||
client->errorValue = req->requestNumber;
|
||||
return __glXBadLargeRequest;
|
||||
return __glXError(GLXBadLargeRequest);
|
||||
}
|
||||
|
||||
hdr = (__GLXrenderLargeHeader *) pc;
|
||||
|
@ -1768,13 +1841,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) {
|
||||
/*
|
||||
|
@ -1831,12 +1904,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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1845,7 +1918,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;
|
||||
|
@ -1869,7 +1942,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;
|
||||
|
@ -1888,7 +1961,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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1938,7 +2011,7 @@ static int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
}
|
||||
client->errorValue = drawable;
|
||||
return __glXBadDrawable;
|
||||
return __glXError(GLXBadDrawable);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2179,7 +2252,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)
|
||||
|
@ -2239,7 +2312,7 @@ int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
|
||||
cl->client->errorValue = vendorcode;
|
||||
return __glXUnsupportedPrivateRequest;
|
||||
return __glXError(GLXUnsupportedPrivateRequest);
|
||||
}
|
||||
|
||||
int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
|
||||
|
|
|
@ -315,6 +315,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;
|
||||
|
@ -444,7 +506,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 +674,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 +772,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 +793,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 +855,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 +869,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 +893,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 +916,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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -910,7 +984,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 +1037,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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
/*
|
||||
|
|
|
@ -177,48 +177,6 @@ __glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
|
|||
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 *baseScreen,
|
|||
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 *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;
|
||||
|
||||
#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. */
|
||||
|
|
|
@ -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
|
|
@ -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(__GLXclientState *cl, GLXContextTag tag,
|
|||
cx = (__GLXcontext *) __glXLookupContextByTag(cl, tag);
|
||||
if (!cx) {
|
||||
cl->client->errorValue = tag;
|
||||
*error = __glXBadContextTag;
|
||||
*error = __glXError(GLXBadContextTag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -358,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;
|
||||
}
|
||||
}
|
||||
|
@ -373,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;
|
||||
}
|
||||
}
|
||||
|
@ -469,7 +493,7 @@ static int __glXDispatch(ClientPtr client)
|
|||
*/
|
||||
if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) {
|
||||
client->errorValue = stuff->glxCode;
|
||||
return __glXBadLargeRequest;
|
||||
return __glXError(GLXBadLargeRequest);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -85,8 +85,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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 *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.
|
||||
|
|
|
@ -140,12 +140,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 +155,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;
|
||||
}
|
||||
|
|
|
@ -58,11 +58,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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
EXTRA_DIST = glx_ansic.h xf86glx.h
|
|
@ -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_ */
|
||||
|
|
@ -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@precisioninsight.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "miscstruct.h"
|
|
@ -1 +0,0 @@
|
|||
SUBDIRS = GL
|
|
@ -54,7 +54,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <glxutil.h>
|
||||
#include "context.h"
|
||||
#include "xmesaP.h"
|
||||
#include <GL/xf86glx.h>
|
||||
#include "context.h"
|
||||
|
||||
#include "glcontextmodes.h"
|
||||
|
@ -140,12 +139,12 @@ __glXMesaDrawableSwapBuffers(__GLXdrawable *base)
|
|||
|
||||
|
||||
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 +153,19 @@ __glXMesaContextCreateDrawable(__GLXcontext *context,
|
|||
|
||||
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 +185,7 @@ __glXMesaContextDestroy(__GLXcontext *baseContext)
|
|||
__GLXMESAcontext *context = (__GLXMESAcontext *) baseContext;
|
||||
|
||||
XMesaDestroyContext(context->xmesa);
|
||||
__glXContextDestroy(context);
|
||||
__glXContextDestroy(&context->base);
|
||||
xfree(context);
|
||||
}
|
||||
|
||||
|
@ -268,7 +256,6 @@ __glXMesaScreenCreateContext(__GLXscreen *screen,
|
|||
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 +404,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;
|
||||
|
||||
/*
|
||||
|
|
|
@ -42,7 +42,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "pixmapstr.h"
|
||||
#include "xf86glx_util.h"
|
||||
#include <X11/Xmd.h>
|
||||
#include "GL/xf86glx.h"
|
||||
|
||||
#ifdef ROUNDUP
|
||||
#undef ROUNDUP
|
||||
|
|
|
@ -1602,8 +1602,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
|
||||
|
|
Loading…
Reference in New Issue
Block a user