From 3815190d52f8ae453c2458335394eb5b18ab9bf5 Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 14 Sep 2010 13:17:20 +0000 Subject: xserver libX11 pixman git update 14/9/2010 --- xorg-server/hw/dmx/dmxinit.c | 9 - xorg-server/hw/dmx/glxProxy/glxcmds.c | 55 ++--- xorg-server/hw/dmx/glxProxy/glxcmdsswap.c | 4 +- xorg-server/hw/dmx/glxProxy/glxext.c | 76 ++---- xorg-server/hw/dmx/glxProxy/glxext.h | 170 ++++++------- xorg-server/hw/dmx/glxProxy/glxscreens.c | 5 - xorg-server/hw/dmx/glxProxy/glxsingle.c | 5 - xorg-server/hw/dmx/glxProxy/glxutil.c | 75 ------ xorg-server/hw/dmx/glxProxy/glxutil.h | 90 ++++--- xorg-server/hw/dmx/glxProxy/glxvendor.c | 5 - xorg-server/hw/dmx/glxProxy/glxvisuals.c | 388 +----------------------------- xorg-server/hw/dmx/glxProxy/glxvisuals.h | 92 ++++--- 12 files changed, 208 insertions(+), 766 deletions(-) (limited to 'xorg-server/hw/dmx') diff --git a/xorg-server/hw/dmx/dmxinit.c b/xorg-server/hw/dmx/dmxinit.c index 0871ab5f5..e0e5d1228 100644 --- a/xorg-server/hw/dmx/dmxinit.c +++ b/xorg-server/hw/dmx/dmxinit.c @@ -69,12 +69,6 @@ #include "dmx_glxvisuals.h" #include #include - -extern void GlxSetVisualConfigs( - int nconfigs, - __GLXvisualConfig *configs, - void **configprivs -); #endif /* GLXEXT */ /* Global variables available to all Xserver/hw/dmx routines. */ @@ -768,9 +762,6 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[]) } } - /* Hand out the glx configs to glx extension */ - GlxSetVisualConfigs(nconfigs, configs, (void**)configprivs); - XFlush(dmxScreen->beDisplay); } } diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c index d0e3a9b77..f1893656f 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcmds.c +++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c @@ -38,11 +38,6 @@ #include "dmxfont.h" #include "dmxsync.h" -#undef Xmalloc -#undef Xcalloc -#undef Xrealloc -#undef Xfree - #include "glxserver.h" #include #include "g_disptab.h" @@ -144,7 +139,7 @@ static int CreateContext(__GLXclientState *cl, /* ** Allocate memory for the new context */ - glxc = __glXCalloc(1, sizeof(__GLXcontext)); + glxc = calloc(1, sizeof(__GLXcontext)); if (!glxc) { return BadAlloc; } @@ -156,7 +151,7 @@ static int CreateContext(__GLXclientState *cl, glxc->pFBConfig = glxLookupFBConfig( fbconfigId ); if (!glxc->pFBConfig) { client->errorValue = fbconfigId; - __glXFree( glxc ); + free( glxc ); return BadValue; } visual = glxc->pFBConfig->associatedVisualId; @@ -177,7 +172,7 @@ static int CreateContext(__GLXclientState *cl, } if (i == pScreen->numVisuals) { client->errorValue = visual; - __glXFree( glxc ); + free( glxc ); return BadValue; } @@ -192,7 +187,7 @@ static int CreateContext(__GLXclientState *cl, ** Visual not support on this screen by this OpenGL implementation. */ client->errorValue = visual; - __glXFree( glxc ); + free( glxc ); return BadValue; } @@ -203,7 +198,7 @@ static int CreateContext(__GLXclientState *cl, /* * visual does not have an FBConfig ??? client->errorValue = visual; - __glXFree( glxc ); + free( glxc ); return BadValue; */ } @@ -223,11 +218,11 @@ static int CreateContext(__GLXclientState *cl, * allocate memory for back-end servers info */ num_be_screens = to_screen - from_screen + 1; - glxc->real_ids = (XID *)__glXMalloc(sizeof(XID) * num_be_screens); + glxc->real_ids = (XID *)malloc(sizeof(XID) * num_be_screens); if (!glxc->real_ids) { return BadAlloc; } - glxc->real_vids = (XID *)__glXMalloc(sizeof(XID) * num_be_screens); + glxc->real_vids = (XID *)malloc(sizeof(XID) * num_be_screens); if (!glxc->real_vids) { return BadAlloc; } @@ -252,9 +247,9 @@ static int CreateContext(__GLXclientState *cl, if (!be_vid) { /* visual is not supported on the back-end server */ - __glXFree( glxc->real_ids ); - __glXFree( glxc->real_vids ); - __glXFree( glxc ); + free( glxc->real_ids ); + free( glxc->real_vids ); + free( glxc ); return BadValue; } } @@ -346,9 +341,9 @@ static int CreateContext(__GLXclientState *cl, ** Register this context as a resource. */ if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) { - __glXFree( glxc->real_ids ); - __glXFree( glxc->real_vids ); - __glXFree( glxc ); + free( glxc->real_ids ); + free( glxc->real_vids ); + free( glxc ); client->errorValue = gcId; return BadAlloc; } @@ -585,16 +580,16 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, DrawableP ** Didn't find a free slot, so we'll have to grow the table. */ if (!num) { - table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *)); - cl->currentDrawables = (DrawablePtr *) __glXMalloc(sizeof(DrawablePtr)); - cl->be_currentCTag = (GLXContextTag *) __glXMalloc(screenInfo.numScreens *sizeof(GLXContextTag)); + table = (__GLXcontext **) malloc(sizeof(__GLXcontext *)); + cl->currentDrawables = (DrawablePtr *) malloc(sizeof(DrawablePtr)); + cl->be_currentCTag = (GLXContextTag *) malloc(screenInfo.numScreens *sizeof(GLXContextTag)); } else { - table = (__GLXcontext **) __glXRealloc(table, + table = (__GLXcontext **) realloc(table, (num+1)*sizeof(__GLXcontext *)); - cl->currentDrawables = (DrawablePtr *) __glXRealloc( + cl->currentDrawables = (DrawablePtr *) realloc( cl->currentDrawables , (num+1)*sizeof(DrawablePtr)); - cl->be_currentCTag = (GLXContextTag *) __glXRealloc(cl->be_currentCTag, + cl->be_currentCTag = (GLXContextTag *) realloc(cl->be_currentCTag, (num+1)*screenInfo.numScreens*sizeof(GLXContextTag)); } table[num] = glxc; @@ -1721,13 +1716,13 @@ static int CreateGLXPixmap(__GLXclientState *cl, pGlxVisual = NULL; } - pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap)); + pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap)); if (!pGlxPixmap) { return BadAlloc; } - pGlxPixmap->be_xids = (XID *) __glXMalloc(sizeof(XID) * screenInfo.numScreens); + pGlxPixmap->be_xids = (XID *) malloc(sizeof(XID) * screenInfo.numScreens); if (!pGlxPixmap->be_xids) { - __glXFree( pGlxPixmap ); + free( pGlxPixmap ); return BadAlloc; } @@ -1832,7 +1827,7 @@ static int CreateGLXPixmap(__GLXclientState *cl, } else { client->errorValue = ( visual ? visual : fbconfigId ); - __glXFree( pGlxPixmap ); + free( pGlxPixmap ); return BadValue; } @@ -1840,7 +1835,7 @@ static int CreateGLXPixmap(__GLXclientState *cl, } if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) { - __glXFree( pGlxPixmap ); + free( pGlxPixmap ); return BadAlloc; } @@ -2570,7 +2565,7 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc) cl->GLClientmajorVersion = req->major; cl->GLClientminorVersion = req->minor; - if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); + if (cl->GLClientextensions) free(cl->GLClientextensions); buf = (const char *)(req+1); cl->GLClientextensions = strdup(buf); diff --git a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c index 8a2efaa73..da5956952 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c +++ b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c @@ -702,9 +702,9 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) */ if (cl->largeCmdBufSize < hdr->length) { if (!cl->largeCmdBuf) { - cl->largeCmdBuf = (GLbyte *) __glXMalloc(hdr->length); + cl->largeCmdBuf = (GLbyte *) malloc(hdr->length); } else { - cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, hdr->length); + cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, hdr->length); } if (!cl->largeCmdBuf) { cl->largeCmdRequestsTotal = 0; diff --git a/xorg-server/hw/dmx/glxProxy/glxext.c b/xorg-server/hw/dmx/glxProxy/glxext.c index 6589e43bb..01cbd6e08 100644 --- a/xorg-server/hw/dmx/glxProxy/glxext.c +++ b/xorg-server/hw/dmx/glxProxy/glxext.c @@ -77,10 +77,10 @@ static void ResetClientState(int clientIndex) Display **keep_be_displays; int i; - if (cl->returnBuf) __glXFree(cl->returnBuf); - if (cl->currentContexts) __glXFree(cl->currentContexts); - if (cl->currentDrawables) __glXFree(cl->currentDrawables); - if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf); + if (cl->returnBuf) free(cl->returnBuf); + if (cl->currentContexts) free(cl->currentContexts); + if (cl->currentDrawables) free(cl->currentDrawables); + if (cl->largeCmdBuf) free(cl->largeCmdBuf); for (i=0; i< screenInfo.numScreens; i++) { if (cl->be_displays[i]) @@ -97,7 +97,7 @@ static void ResetClientState(int clientIndex) */ cl->GLClientmajorVersion = 1; cl->GLClientminorVersion = 0; - if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); + if (cl->GLClientextensions) free(cl->GLClientextensions); memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *)); } @@ -167,8 +167,8 @@ void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap ) ** only if it's zero. */ (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap); - __glXFree(pGlxPixmap->be_xids); - __glXFree(pGlxPixmap); + free(pGlxPixmap->be_xids); + free(pGlxPixmap); } } @@ -222,10 +222,10 @@ GLboolean __glXFreeContext(__GLXcontext *cx) { if (cx->idExists || cx->isCurrent) return GL_FALSE; - if (cx->feedbackBuf) __glXFree(cx->feedbackBuf); - if (cx->selectBuf) __glXFree(cx->selectBuf); - if (cx->real_ids) __glXFree(cx->real_ids); - if (cx->real_vids) __glXFree(cx->real_vids); + if (cx->feedbackBuf) free(cx->feedbackBuf); + if (cx->selectBuf) free(cx->selectBuf); + if (cx->real_ids) free(cx->real_ids); + if (cx->real_vids) free(cx->real_vids); if (cx->pGlxPixmap) { /* @@ -263,7 +263,7 @@ GLboolean __glXFreeContext(__GLXcontext *cx) cx->pGlxReadWindow = 0; } - __glXFree(cx); + free(cx); if (cx == __glXLastContext) { __glXFlushContextCache(); @@ -367,46 +367,6 @@ Bool __glXCoreType(void) /************************************************************************/ -void GlxSetVisualConfigs(int nconfigs, - __GLXvisualConfig *configs, void **privates) -{ - glxSetVisualConfigs(nconfigs, configs, privates); -} - -static miInitVisualsProcPtr saveInitVisualsProc; - -Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB, - int preferredVis) -{ - Bool ret; - - if (saveInitVisualsProc) { - ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp, - rootDepthp, defaultVisp, sizes, bitsPerRGB, - preferredVis); - if (!ret) - return False; - } - - glxInitVisuals(nvisualp, visualp, defaultVisp, *ndepthp, *depthp,*rootDepthp); - - return True; -} - -void -GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc) -{ - if (dmxGLXProxy) { - saveInitVisualsProc = *initVisProc; - *initVisProc = GlxInitVisuals; - } -} - -/************************************************************************/ - void __glXFlushContextCache(void) { __glXLastContext = 0; @@ -427,15 +387,15 @@ static int __glXDispatch(ClientPtr client) opcode = stuff->glxCode; cl = __glXClients[client->index]; if (!cl) { - cl = __glXCalloc(1, sizeof(__GLXclientState)); + cl = calloc(1, sizeof(__GLXclientState)); __glXClients[client->index] = cl; if (!cl) { return BadAlloc; } - cl->be_displays = __glXCalloc(screenInfo.numScreens, sizeof(Display *)); + cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *)); if (!cl->be_displays) { - __glXFree( cl ); + free( cl ); return BadAlloc; } } @@ -479,15 +439,15 @@ static int __glXSwapDispatch(ClientPtr client) opcode = stuff->glxCode; cl = __glXClients[client->index]; if (!cl) { - cl = __glXCalloc(1, sizeof(__GLXclientState)); + cl = calloc(1, sizeof(__GLXclientState)); __glXClients[client->index] = cl; if (!cl) { return BadAlloc; } - cl->be_displays = __glXCalloc(screenInfo.numScreens, sizeof(Display *)); + cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *)); if (!cl->be_displays) { - __glXFree( cl ); + free( cl ); return BadAlloc; } } diff --git a/xorg-server/hw/dmx/glxProxy/glxext.h b/xorg-server/hw/dmx/glxProxy/glxext.h index b9f75b46b..3e3e5b7f3 100644 --- a/xorg-server/hw/dmx/glxProxy/glxext.h +++ b/xorg-server/hw/dmx/glxProxy/glxext.h @@ -1,92 +1,78 @@ -#ifndef _glxext_h_ -#define _glxext_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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, sublicense, - * 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 including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 NONINFRINGEMENT. IN NO EVENT SHALL - * SILICON GRAPHICS, INC. 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. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -/* - * Added by VA Linux for XFree86 4.0.x - */ -typedef struct { - int type; - void (*resetExtension)(void); - Bool (*initVisuals)( - VisualPtr * visualp, - DepthPtr * depthp, - int * nvisualp, - int * ndepthp, - int * rootDepthp, - VisualID * defaultVisp, - unsigned long sizes, - int bitsPerRGB - ); - void (*setVisualConfigs)( - int nconfigs, - __GLXvisualConfig *configs, - void **privates - ); -} __GLXextensionInfo; - -extern GLboolean __glXFreeContext(__GLXcontext *glxc); -extern void __glXFlushContextCache(void); - -extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow); -extern void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap ); - -extern void __glXNoSuchRenderOpcode(GLbyte*); -extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*); -extern void __glXErrorCallBack(GLenum code); -extern void __glXClearErrorOccured(void); -extern GLboolean __glXErrorOccured(void); -extern void __glXResetLargeCommandStatus(__GLXclientState*); - -extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); -extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc); - -extern void GlxExtensionInit(void); - -extern Bool __glXCoreType(void); - -extern int GlxInitVisuals( -#if NeedFunctionPrototypes - VisualPtr * visualp, - DepthPtr * depthp, - int * nvisualp, - int * ndepthp, - int * rootDepthp, - VisualID * defaultVisp, - unsigned long sizes, - int bitsPerRGB, - int preferredVis -#endif -); - -#endif /* _glxext_h_ */ - +#ifndef _glxext_h_ +#define _glxext_h_ + +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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, sublicense, + * 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * Added by VA Linux for XFree86 4.0.x + */ +typedef struct { + int type; + void (*resetExtension)(void); + Bool (*initVisuals)( + VisualPtr * visualp, + DepthPtr * depthp, + int * nvisualp, + int * ndepthp, + int * rootDepthp, + VisualID * defaultVisp, + unsigned long sizes, + int bitsPerRGB + ); + void (*setVisualConfigs)( + int nconfigs, + __GLXvisualConfig *configs, + void **privates + ); +} __GLXextensionInfo; + +extern GLboolean __glXFreeContext(__GLXcontext *glxc); +extern void __glXFlushContextCache(void); + +extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow); +extern void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap ); + +extern void __glXNoSuchRenderOpcode(GLbyte*); +extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*); +extern void __glXErrorCallBack(GLenum code); +extern void __glXClearErrorOccured(void); +extern GLboolean __glXErrorOccured(void); +extern void __glXResetLargeCommandStatus(__GLXclientState*); + +extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc); + +extern void GlxExtensionInit(void); + +extern Bool __glXCoreType(void); + +#endif /* _glxext_h_ */ + diff --git a/xorg-server/hw/dmx/glxProxy/glxscreens.c b/xorg-server/hw/dmx/glxProxy/glxscreens.c index 6425a2bfe..df49fe50d 100644 --- a/xorg-server/hw/dmx/glxProxy/glxscreens.c +++ b/xorg-server/hw/dmx/glxProxy/glxscreens.c @@ -35,11 +35,6 @@ #include "dmx.h" #include "dmxlog.h" -#undef Xmalloc -#undef Xcalloc -#undef Xrealloc -#undef Xfree - #include "glxserver.h" #include diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.c b/xorg-server/hw/dmx/glxProxy/glxsingle.c index 056c74066..7856f5884 100644 --- a/xorg-server/hw/dmx/glxProxy/glxsingle.c +++ b/xorg-server/hw/dmx/glxProxy/glxsingle.c @@ -39,11 +39,6 @@ #include "dmxfont.h" #include "dmxcb.h" -#undef Xmalloc -#undef Xcalloc -#undef Xrealloc -#undef Xfree - #include "glxserver.h" #include "glxext.h" #include "g_disptab.h" diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.c b/xorg-server/hw/dmx/glxProxy/glxutil.c index ad34eef05..1b9ad6962 100644 --- a/xorg-server/hw/dmx/glxProxy/glxutil.c +++ b/xorg-server/hw/dmx/glxProxy/glxutil.c @@ -29,81 +29,6 @@ */ #include "glxserver.h" -#include -#include -#include #include "glxutil.h" -#include - -/************************************************************************/ void __glXNop(void) {} - -/************************************************************************/ - -/* Memory Allocation for GLX */ - -void * -__glXMalloc(size_t size) -{ - void *addr; - - if (size == 0) { - return NULL; - } - addr = malloc(size); - if (addr == NULL) { - /* XXX: handle out of memory error */ - return NULL; - } - return addr; -} - -void * -__glXCalloc(size_t numElements, size_t elementSize) -{ - void *addr; - size_t size; - - if ((numElements == 0) || (elementSize == 0)) { - return NULL; - } - addr = calloc(numElements, elementSize); - if (addr == NULL) { - /* XXX: handle out of memory error */ - return NULL; - } - return addr; -} - -void * -__glXRealloc(void *addr, size_t newSize) -{ - void *newAddr; - - if (addr) { - if (newSize == 0) { - free(addr); - return NULL; - } else { - newAddr = realloc(addr, newSize); - } - } else { - if (newSize == 0) { - return NULL; - } else { - newAddr = malloc(newSize); - } - } - if (newAddr == NULL) { - return NULL; /* XXX: out of memory */ - } - - return newAddr; -} - -void -__glXFree(void *addr) -{ - free(addr); -} diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.h b/xorg-server/hw/dmx/glxProxy/glxutil.h index 6487ca716..15237b258 100644 --- a/xorg-server/hw/dmx/glxProxy/glxutil.h +++ b/xorg-server/hw/dmx/glxProxy/glxutil.h @@ -1,48 +1,42 @@ -#ifndef _glxcmds_h_ -#define _glxcmds_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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, sublicense, - * 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 including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 NONINFRINGEMENT. IN NO EVENT SHALL - * SILICON GRAPHICS, INC. 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. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -extern void __glXNop(void); - -/* memory management */ -extern void *__glXMalloc(size_t size); -extern void *__glXCalloc(size_t numElements, size_t elementSize); -extern void *__glXRealloc(void *addr, size_t newSize); -extern void __glXFree(void *ptr); - -/* context helper routines */ -extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag); -extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag); - - -#endif /* _glxcmds_h_ */ - +#ifndef _glxcmds_h_ +#define _glxcmds_h_ + +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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, sublicense, + * 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +extern void __glXNop(void); + +/* context helper routines */ +extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag); +extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag); + + +#endif /* _glxcmds_h_ */ + diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.c b/xorg-server/hw/dmx/glxProxy/glxvendor.c index 02c8ad73d..26a9c92fb 100644 --- a/xorg-server/hw/dmx/glxProxy/glxvendor.c +++ b/xorg-server/hw/dmx/glxProxy/glxvendor.c @@ -38,11 +38,6 @@ #include "dmxpixmap.h" #include "dmxfont.h" -#undef Xmalloc -#undef Xcalloc -#undef Xrealloc -#undef Xfree - #include "glxserver.h" #include "glxext.h" #include "g_disptab.h" diff --git a/xorg-server/hw/dmx/glxProxy/glxvisuals.c b/xorg-server/hw/dmx/glxProxy/glxvisuals.c index aaace39b6..ae5e86772 100644 --- a/xorg-server/hw/dmx/glxProxy/glxvisuals.c +++ b/xorg-server/hw/dmx/glxProxy/glxvisuals.c @@ -32,16 +32,8 @@ #include #endif -#include -#include "dmx.h" #include "glxserver.h" -#include "glxutil.h" -#include "dmx_glxvisuals.h" -#include - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; +#include "glxvisuals.h" int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 ) { @@ -158,381 +150,3 @@ VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatch return 0; } - -void glxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -static int count_bits(unsigned int n) -{ - int bits = 0; - - while (n > 0) { - if (n & 1) bits++; - n >>= 1; - } - return bits; -} - -static VisualID FindClosestVisual( VisualPtr pVisual, int rootDepth, - DepthPtr pdepth, int ndepths, - VisualPtr pNewVisual, int numNewVisuals) -{ - int d, v; - VisualPtr vis; - - /* - * find the first visual with the same or deeper depth - * of the same class. - */ - for (d=0; d= rootDepth) { - for (v=0; vvid ) vis++; - - if (vis->class == pVisual->class) { - return pdepth[d].vids[v]; - } - } - } - } - - /* - * did not find any. - * try to look for the same class only. - */ - for (d=0; dvid ) vis++; - - if (vis->class == pVisual->class) { - return pdepth[d].vids[v]; - } - } - } - - /* - * if not found - just take the first visual - */ - return pdepth[0].vids[0]; -} - -Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLXvisualConfig *glXVisualPtr = NULL; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - dmxGlxVisualPrivate **pNewVisualPriv; - int found_default; - int i, j, k; - int numGLXvis = 0; - GLint *isGLXvis; - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - return False; - - MAXSCREENSALLOC(__glXActiveScreens); - if (!__glXActiveScreens) - return False; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (dmxGlxVisualPrivate **) __glXMalloc(numNewConfigs * sizeof(dmxGlxVisualPrivate *)); - if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = (dmxGlxVisualPrivate *)visualPrivates[i]; - } - -#if 1 - /* FIXME: This is a hack to workaround a hang in xtest caused by a - * mismatch between what the front end (i.e., DMX) server calculates - * for the visual configs and what the back-end servers have. - */ - { - int numTCRGBconfigs = 0; - int numDCRGBconfigs = 0; - - numRGBconfigs = 0; - numCIconfigs = 0; - - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) { - if (pNewVisualConfigs[i].class == TrueColor) - numTCRGBconfigs++; - else - numDCRGBconfigs++; - numRGBconfigs++; - } else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - numNewVisuals += - (pVisual[i].class == TrueColor) ? numTCRGBconfigs : - (pVisual[i].class == DirectColor) ? numDCRGBconfigs : - numCIconfigs; - } - } -#else - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - numNewVisuals += - (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs; - } -#endif - - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisuals */ - glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals * - sizeof(__GLXvisualConfig)); - if (!glXVisualPtr) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - __glXFree(glXVisualPtr); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - __glXFree(glXVisualPriv); - __glXFree(glXVisualPtr); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - isGLXvis = (GLint *) __glXMalloc(numNewVisuals * sizeof(GLint)); - if (!isGLXvis) { - __glXFree(glXVisualPriv); - __glXFree(glXVisualPtr); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - __glXFree(pVisualNew); - return FALSE; - } - - /* Initialize the new visuals */ - found_default = FALSE; - for (i = j = 0; i < numVisuals; i++) { - - for (k = 0; k < numNewConfigs; k++) { - - int new_depth; - int depth; - int d,v; - - /* find the depth of the new visual config */ - new_depth = pNewVisualPriv[k]->x_visual_depth; - - /* find the depth of the original visual */ - depth = 0; - d = 0; - while( (depth==0) && (d < ndepth) ) { - v = 0; - while( (depth==0) && (v < pdepth[d].numVids) ) { - if (pdepth[d].vids[v] == pVisual[i].vid) { - depth = pdepth[d].depth; - } - v++; - } - d++; - } - - /* check that the visual has the same class and depth - * as the new config - */ - if ( pVisual[i].class != pNewVisualPriv[k]->x_visual_class || - (depth != new_depth) ) - continue; - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - glXVisualPtr[j] = pNewVisualConfigs[k]; - glXVisualPtr[j].vid = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (glXVisualPtr[j].class == -1) { - glXVisualPtr[j].class = pVisual[i].class; - glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask); - glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask); - glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask); - glXVisualPtr[j].alphaSize = glXVisualPtr[j].alphaSize; - glXVisualPtr[j].redMask = pVisual[i].redMask; - glXVisualPtr[j].greenMask = pVisual[i].greenMask; - glXVisualPtr[j].blueMask = pVisual[i].blueMask; - glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask; - glXVisualPtr[j].bufferSize = rootDepth; - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - - isGLXvis[j] = glxMatchGLXVisualInConfigList( &glXVisualPtr[j], - dmxScreens[screenInfo.numScreens-1].glxVisuals, - dmxScreens[screenInfo.numScreens-1].numGlxVisuals ); - if (isGLXvis[j]) numGLXvis++; - - j++; - } - } - - assert(j <= numNewVisuals); - numNewVisuals = j; /* correct number of new visuals */ - - /* Save the GLX visuals in the screen structure */ - __glXActiveScreens[screenInfo.numScreens-1].numVisuals = numNewVisuals; - __glXActiveScreens[screenInfo.numScreens-1].numGLXVisuals = numGLXvis; - __glXActiveScreens[screenInfo.numScreens-1].isGLXvis = isGLXvis; - __glXActiveScreens[screenInfo.numScreens-1].pGlxVisual = glXVisualPtr; - - - /* Set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; - } - - /* - * if the default visual was rejected - need to choose new - * default visual ! - */ - if ( !found_default ) { - - for (i=0; i