Check for glproto when building GLX and make sure we have at least 1.4.6.
Drop glx_ansic.h wrapper and call xalloc, xrealloc, xfree and str-funcs
    directly.
			
			
This commit is contained in:
		
							parent
							
								
									2c11cde336
								
							
						
					
					
						commit
						2d2d38d17c
					
				
							
								
								
									
										10
									
								
								ChangeLog
								
								
								
								
							
							
						
						
									
										10
									
								
								ChangeLog
								
								
								
								
							|  | @ -1,3 +1,13 @@ | |||
| 2006-03-16  Kristian Høgsberg  <krh@redhat.com> | ||||
| 
 | ||||
| 	* configure.ac: Check for glproto when building GLX and make sure | ||||
| 	we have at least 1.4.6. | ||||
| 
 | ||||
| 	* GL/glx/*.c: Drop glx_ansic.h wrapper and call xalloc, xrealloc, | ||||
| 	xfree and str-funcs directly. | ||||
| 	 | ||||
| 	* GL/glx/glxcmds.c (GlxSetRenderTables): Really add this. | ||||
| 
 | ||||
| 2006-03-16  Kristian Høgsberg  <krh@redhat.com> | ||||
| 
 | ||||
| 	More patches from David Reveman: | ||||
|  |  | |||
|  | @ -22,7 +22,6 @@ AM_CFLAGS = \ | |||
| #sdk_HEADERS =
 | ||||
| 
 | ||||
| INCLUDES = \
 | ||||
| 	-I$(top_srcdir)/GL/include \
 | ||||
| 	-I$(top_srcdir)/hw/xfree86/os-support \
 | ||||
| 	-I$(top_srcdir)/hw/xfree86/os-support/bus \
 | ||||
| 	-I$(top_srcdir)/hw/xfree86/common \
 | ||||
|  |  | |||
|  | @ -41,6 +41,7 @@ | |||
| #endif | ||||
| 
 | ||||
| #include <string.h> | ||||
| #include <assert.h> | ||||
| 
 | ||||
| #include "glxserver.h" | ||||
| #include <GL/glxtokens.h> | ||||
|  | @ -51,7 +52,6 @@ | |||
| #include "g_disptab_EXT.h" | ||||
| #include "glxutil.h" | ||||
| #include "glxext.h" | ||||
| #include "GL/glx_ansic.h" | ||||
| #include "glcontextmodes.h" | ||||
| #include "glapitable.h" | ||||
| #include "glapi.h" | ||||
|  | @ -99,7 +99,7 @@ __glXContextDestroy(__GLXcontext *context) | |||
| static void __glXdirectContextDestroy(__GLXcontext *context) | ||||
| { | ||||
|     __glXContextDestroy(context); | ||||
|     __glXFree(context); | ||||
|     xfree(context); | ||||
| } | ||||
| 
 | ||||
| static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen, | ||||
|  | @ -108,7 +108,7 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen, | |||
| { | ||||
|     __GLXcontext *context; | ||||
| 
 | ||||
|     context = __glXMalloc (sizeof (__GLXcontext)); | ||||
|     context = xalloc (sizeof (__GLXcontext)); | ||||
|     if (context == NULL) | ||||
| 	return NULL; | ||||
| 
 | ||||
|  | @ -344,9 +344,9 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc) | |||
|     ** Didn't find a free slot, so we'll have to grow the table. | ||||
|     */ | ||||
|     if (!num) { | ||||
| 	table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *)); | ||||
| 	table = (__GLXcontext **) xalloc(sizeof(__GLXcontext *)); | ||||
|     } else { | ||||
| 	table = (__GLXcontext **) __glXRealloc(table, | ||||
| 	table = (__GLXcontext **) xrealloc(table, | ||||
| 					   (num+1)*sizeof(__GLXcontext *)); | ||||
|     } | ||||
|     table[num] = glxc; | ||||
|  | @ -688,7 +688,7 @@ int DoMakeCurrent( __GLXclientState *cl, | |||
| 		    ** refcount of the X pixmap and free only if it's zero. | ||||
| 		    */ | ||||
| 		    (*prevglxc->readPixmap->pScreen->DestroyPixmap)(pPixmap); | ||||
| 		    __glXFree(prevglxc->readPixmap); | ||||
| 		    xfree(prevglxc->readPixmap); | ||||
| 		} | ||||
| 	    } | ||||
| 
 | ||||
|  | @ -704,7 +704,7 @@ int DoMakeCurrent( __GLXclientState *cl, | |||
| 		** refcount of the X pixmap and free only if it's zero. | ||||
| 		*/ | ||||
| 		(*prevglxc->drawPixmap->pScreen->DestroyPixmap)(pPixmap); | ||||
| 		__glXFree(prevglxc->drawPixmap); | ||||
| 		xfree(prevglxc->drawPixmap); | ||||
| 	    } | ||||
| 
 | ||||
| 	    prevglxc->drawPixmap = NULL; | ||||
|  | @ -1257,7 +1257,7 @@ int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, | |||
| 	return BadValue; | ||||
|     } | ||||
| 
 | ||||
|     pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap)); | ||||
|     pGlxPixmap = (__GLXpixmap *) xalloc(sizeof(__GLXpixmap)); | ||||
|     if (!pGlxPixmap) { | ||||
| 	return BadAlloc; | ||||
|     } | ||||
|  | @ -1447,7 +1447,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) | |||
|     reply.n = nProps; | ||||
| 
 | ||||
|     nReplyBytes = reply.length << 2; | ||||
|     sendBuf = (int *)__glXMalloc((size_t)nReplyBytes); | ||||
|     sendBuf = (int *)xalloc((size_t)nReplyBytes); | ||||
|     if (sendBuf == NULL) { | ||||
| 	return __glXBadContext;	/* XXX: Is this correct? */ | ||||
|     } | ||||
|  | @ -1465,7 +1465,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) | |||
| 	WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply); | ||||
| 	WriteToClient(client, nReplyBytes, (char *)sendBuf); | ||||
|     } | ||||
|     __glXFree((char *)sendBuf); | ||||
|     xfree((char *)sendBuf); | ||||
| 
 | ||||
|     return Success; | ||||
| } | ||||
|  | @ -1805,9 +1805,9 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) | |||
| 	*/ | ||||
| 	if (cl->largeCmdBufSize < cmdlen) { | ||||
| 	    if (!cl->largeCmdBuf) { | ||||
| 		cl->largeCmdBuf = (GLbyte *) __glXMalloc((size_t)cmdlen); | ||||
| 		cl->largeCmdBuf = (GLbyte *) xalloc((size_t)cmdlen); | ||||
| 	    } else { | ||||
| 		cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf,  | ||||
| 		cl->largeCmdBuf = (GLbyte *) xrealloc(cl->largeCmdBuf,  | ||||
| 						      (size_t)cmdlen); | ||||
| 	    } | ||||
| 	    if (!cl->largeCmdBuf) { | ||||
|  | @ -1815,7 +1815,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) | |||
| 	    } | ||||
| 	    cl->largeCmdBufSize = cmdlen; | ||||
| 	} | ||||
| 	__glXMemcpy(cl->largeCmdBuf, pc, dataBytes); | ||||
| 	memcpy(cl->largeCmdBuf, pc, dataBytes); | ||||
| 
 | ||||
| 	cl->largeCmdBytesSoFar = dataBytes; | ||||
| 	cl->largeCmdBytesTotal = cmdlen; | ||||
|  | @ -1851,7 +1851,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) | |||
| 	    __glXResetLargeCommandStatus(cl); | ||||
| 	    return __glXBadLargeRequest; | ||||
| 	} | ||||
| 	__glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); | ||||
| 	memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); | ||||
| 	cl->largeCmdBytesSoFar += dataBytes; | ||||
| 	cl->largeCmdRequestsSoFar++; | ||||
| 
 | ||||
|  | @ -2267,17 +2267,18 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) | |||
| 
 | ||||
|     ptr = __glXActiveScreens[screen]->GLXextensions; | ||||
| 
 | ||||
|     n = __glXStrlen(ptr) + 1; | ||||
|     n = strlen(ptr) + 1; | ||||
|     length = __GLX_PAD(n) >> 2; | ||||
|     reply.type = X_Reply; | ||||
|     reply.sequenceNumber = client->sequence; | ||||
|     reply.length = length; | ||||
|     reply.n = n; | ||||
| 
 | ||||
|     if ((buf = (char *) __glXMalloc(length << 2)) == NULL) { | ||||
|     /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/ | ||||
|     buf = (char *) xalloc(length << 2); | ||||
|     if (buf == NULL) | ||||
|         return BadAlloc; | ||||
|     } | ||||
|     __glXStrncpy(buf, ptr, n); | ||||
|     memcpy(buf, ptr, n); | ||||
| 
 | ||||
|     if (client->swapped) { | ||||
|         glxSwapQueryExtensionsStringReply(client, &reply, buf); | ||||
|  | @ -2286,7 +2287,7 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) | |||
|         WriteToClient(client, (int)(length << 2), (char *)buf); | ||||
|     } | ||||
| 
 | ||||
|     __glXFree(buf); | ||||
|     xfree(buf); | ||||
|     return Success; | ||||
| } | ||||
| 
 | ||||
|  | @ -2324,17 +2325,18 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc) | |||
| 	    return BadValue;  | ||||
|     } | ||||
| 
 | ||||
|     n = __glXStrlen(ptr) + 1; | ||||
|     n = strlen(ptr) + 1; | ||||
|     length = __GLX_PAD(n) >> 2; | ||||
|     reply.type = X_Reply; | ||||
|     reply.sequenceNumber = client->sequence; | ||||
|     reply.length = length; | ||||
|     reply.n = n; | ||||
| 
 | ||||
|     if ((buf = (char *) Xalloc(length << 2)) == NULL) { | ||||
|     buf = (char *) xalloc(length << 2); | ||||
|     if (buf == NULL) { | ||||
|         return BadAlloc; | ||||
|     } | ||||
|     __glXStrncpy(buf, ptr, n); | ||||
|     memcpy(buf, ptr, n); | ||||
| 
 | ||||
|     if (client->swapped) { | ||||
|         glxSwapQueryServerStringReply(client, &reply, buf); | ||||
|  | @ -2343,7 +2345,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc) | |||
|         WriteToClient(client, (int)(length << 2), buf); | ||||
|     } | ||||
| 
 | ||||
|     __glXFree(buf); | ||||
|     xfree(buf); | ||||
|     return Success; | ||||
| } | ||||
| 
 | ||||
|  | @ -2354,9 +2356,10 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc) | |||
|     | ||||
|     cl->GLClientmajorVersion = req->major; | ||||
|     cl->GLClientminorVersion = req->minor; | ||||
|     if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); | ||||
|     if (cl->GLClientextensions) | ||||
| 	xfree(cl->GLClientextensions); | ||||
|     buf = (const char *)(req+1); | ||||
|     cl->GLClientextensions = __glXStrdup(buf); | ||||
|     cl->GLClientextensions = xstrdup(buf); | ||||
| 
 | ||||
|     return Success; | ||||
| } | ||||
|  |  | |||
|  | @ -50,7 +50,6 @@ | |||
| #include <pixmapstr.h> | ||||
| #include <windowstr.h> | ||||
| #include "glxext.h" | ||||
| #include "GL/glx_ansic.h" | ||||
| #include "glapitable.h" | ||||
| #include "glapi.h" | ||||
| #include "glthread.h" | ||||
|  | @ -752,16 +751,16 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) | |||
| 	*/ | ||||
| 	if (cl->largeCmdBufSize < cmdlen) { | ||||
| 	    if (!cl->largeCmdBuf) { | ||||
| 		cl->largeCmdBuf = (GLbyte *) __glXMalloc(cmdlen); | ||||
| 		cl->largeCmdBuf = (GLbyte *) xalloc(cmdlen); | ||||
| 	    } else { | ||||
| 		cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, cmdlen); | ||||
| 		cl->largeCmdBuf = (GLbyte *) xrealloc(cl->largeCmdBuf, cmdlen); | ||||
| 	    } | ||||
| 	    if (!cl->largeCmdBuf) { | ||||
| 		return BadAlloc; | ||||
| 	    } | ||||
| 	    cl->largeCmdBufSize = cmdlen; | ||||
| 	} | ||||
| 	__glXMemcpy(cl->largeCmdBuf, pc, dataBytes); | ||||
| 	memcpy(cl->largeCmdBuf, pc, dataBytes); | ||||
| 
 | ||||
| 	cl->largeCmdBytesSoFar = dataBytes; | ||||
| 	cl->largeCmdBytesTotal = cmdlen; | ||||
|  | @ -797,7 +796,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) | |||
| 	    __glXResetLargeCommandStatus(cl); | ||||
| 	    return __glXBadLargeRequest; | ||||
| 	} | ||||
| 	__glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); | ||||
| 	memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); | ||||
| 	cl->largeCmdBytesSoFar += dataBytes; | ||||
| 	cl->largeCmdRequestsSoFar++; | ||||
| 
 | ||||
|  |  | |||
|  | @ -144,7 +144,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *private) | |||
| 					    glxPriv->driDrawable.private); | ||||
| #endif | ||||
| 
 | ||||
|     __glXFree(private); | ||||
|     xfree(private); | ||||
| } | ||||
| 
 | ||||
| static GLboolean | ||||
|  | @ -184,14 +184,14 @@ __glXDRIcontextCreateDrawable(__GLXcontext *context, | |||
| { | ||||
|     __GLXDRIdrawable *private; | ||||
| 
 | ||||
|     private = __glXMalloc(sizeof *private); | ||||
|     private = xalloc(sizeof *private); | ||||
|     if (private == NULL) | ||||
| 	return NULL; | ||||
| 
 | ||||
|     memset(private, 0, sizeof *private); | ||||
| 
 | ||||
|     if (!__glXDrawableInit(&private->base, context, pDraw, drawId)) { | ||||
|         __glXFree(private); | ||||
|         xfree(private); | ||||
| 	return NULL; | ||||
|     } | ||||
| 
 | ||||
|  | @ -228,7 +228,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext) | |||
| 				       context->base.pScreen->myNum, | ||||
| 				       context->driContext.private); | ||||
|     __glXContextDestroy(context); | ||||
|     __glXFree(context); | ||||
|     xfree(context); | ||||
| } | ||||
| 
 | ||||
| static int | ||||
|  | @ -397,7 +397,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen) | |||
| 
 | ||||
|     __glXScreenDestroy(baseScreen); | ||||
| 
 | ||||
|     __glXFree(screen); | ||||
|     xfree(screen); | ||||
| } | ||||
| 
 | ||||
| static __GLXcontext * | ||||
|  | @ -415,7 +415,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, | |||
|     else | ||||
| 	sharePrivate = NULL; | ||||
| 
 | ||||
|     context = __glXMalloc(sizeof *context); | ||||
|     context = xalloc(sizeof *context); | ||||
|     if (context == NULL) | ||||
| 	return NULL; | ||||
| 
 | ||||
|  | @ -639,7 +639,7 @@ getDrawableInfo(__DRInativeDisplay *dpy, int screen, | |||
| 
 | ||||
|     if (*numClipRects > 0) { | ||||
| 	size = sizeof (drm_clip_rect_t) * *numClipRects; | ||||
| 	*ppClipRects = __glXMalloc (size); | ||||
| 	*ppClipRects = xalloc (size); | ||||
| 	if (*ppClipRects != NULL) | ||||
| 	    memcpy (*ppClipRects, pClipRects, size); | ||||
|     } | ||||
|  | @ -649,7 +649,7 @@ getDrawableInfo(__DRInativeDisplay *dpy, int screen, | |||
|        | ||||
|     if (*numBackClipRects > 0) { | ||||
| 	size = sizeof (drm_clip_rect_t) * *numBackClipRects; | ||||
| 	*ppBackClipRects = __glXMalloc (size); | ||||
| 	*ppBackClipRects = xalloc (size); | ||||
| 	if (*ppBackClipRects != NULL) | ||||
| 	    memcpy (*ppBackClipRects, pBackClipRects, size); | ||||
|     } | ||||
|  | @ -732,7 +732,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) | |||
| 	return NULL; | ||||
|     } | ||||
| 
 | ||||
|     screen = __glXMalloc(sizeof *screen); | ||||
|     screen = xalloc(sizeof *screen); | ||||
|     if (screen == NULL) | ||||
|       return NULL; | ||||
|     memset(screen, 0, sizeof *screen); | ||||
|  | @ -833,7 +833,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) | |||
|      * but we can't use _mesa_malloc() here.  In fact, the DRI driver | ||||
|      * shouldn't free data it didn't allocate itself, but what can you | ||||
|      * do... */ | ||||
|     dev_priv = __glXMalloc(framebuffer.dev_priv_size); | ||||
|     dev_priv = xalloc(framebuffer.dev_priv_size); | ||||
|     if (dev_priv == NULL) { | ||||
| 	err_msg = "dev_priv allocation"; | ||||
| 	goto handle_error; | ||||
|  | @ -904,7 +904,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) | |||
| 	drmUnmap((drmAddress)framebuffer.base, framebuffer.size); | ||||
| 
 | ||||
|     if (dev_priv != NULL) | ||||
| 	__glXFree(dev_priv); | ||||
| 	xfree(dev_priv); | ||||
| 
 | ||||
|     if (fd >= 0) | ||||
| 	drmClose(fd); | ||||
|  |  | |||
|  | @ -56,17 +56,18 @@ static void ResetClientState(int clientIndex) | |||
| { | ||||
|     __GLXclientState *cl = __glXClients[clientIndex]; | ||||
| 
 | ||||
|     if (cl->returnBuf) __glXFree(cl->returnBuf); | ||||
|     if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf); | ||||
|     if (cl->currentContexts) __glXFree(cl->currentContexts); | ||||
|     __glXMemset(cl, 0, sizeof(__GLXclientState)); | ||||
|     if (cl->returnBuf) xfree(cl->returnBuf); | ||||
|     if (cl->largeCmdBuf) xfree(cl->largeCmdBuf); | ||||
|     if (cl->currentContexts) xfree(cl->currentContexts); | ||||
|     memset(cl, 0, sizeof(__GLXclientState)); | ||||
|     /*
 | ||||
|     ** By default, assume that the client supports | ||||
|     ** GLX major version 1 minor version 0 protocol. | ||||
|     */ | ||||
|     cl->GLClientmajorVersion = 1; | ||||
|     cl->GLClientminorVersion = 0; | ||||
|     if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); | ||||
|     if (cl->GLClientextensions) | ||||
| 	xfree(cl->GLClientextensions); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
|  | @ -145,7 +146,7 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id) | |||
| 	** only if it's zero. | ||||
| 	*/ | ||||
| 	(*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap); | ||||
| 	__glXFree(pGlxPixmap); | ||||
| 	xfree(pGlxPixmap); | ||||
|     } | ||||
| 
 | ||||
|     return True; | ||||
|  | @ -192,8 +193,8 @@ 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->feedbackBuf) xfree(cx->feedbackBuf); | ||||
|     if (cx->selectBuf) xfree(cx->selectBuf); | ||||
|     if (cx == __glXLastContext) { | ||||
| 	__glXFlushContextCache(); | ||||
|     } | ||||
|  | @ -430,12 +431,12 @@ static int __glXDispatch(ClientPtr client) | |||
|     opcode = stuff->glxCode; | ||||
|     cl = __glXClients[client->index]; | ||||
|     if (!cl) { | ||||
| 	cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState)); | ||||
| 	cl = (__GLXclientState *) xalloc(sizeof(__GLXclientState)); | ||||
| 	 __glXClients[client->index] = cl; | ||||
| 	if (!cl) { | ||||
| 	    return BadAlloc; | ||||
| 	} | ||||
| 	__glXMemset(cl, 0, sizeof(__GLXclientState)); | ||||
| 	memset(cl, 0, sizeof(__GLXclientState)); | ||||
|     } | ||||
|      | ||||
|     if (!cl->inUse) { | ||||
|  |  | |||
|  | @ -262,10 +262,10 @@ void GlxPushProvider(__GLXprovider *provider) | |||
| void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen) | ||||
| { | ||||
|     screen->pScreen       = pScreen; | ||||
|     screen->GLextensions  = __glXStrdup(GLServerExtensions); | ||||
|     screen->GLXvendor     = __glXStrdup(GLXServerVendorName); | ||||
|     screen->GLXversion    = __glXStrdup(GLXServerVersion); | ||||
|     screen->GLXextensions = __glXStrdup(GLXServerExtensions); | ||||
|     screen->GLextensions  = xstrdup(GLServerExtensions); | ||||
|     screen->GLXvendor     = xstrdup(GLXServerVendorName); | ||||
|     screen->GLXversion    = xstrdup(GLXServerVersion); | ||||
|     screen->GLXextensions = xstrdup(GLXServerExtensions); | ||||
| 
 | ||||
|     screen->WrappedPositionWindow = pScreen->PositionWindow; | ||||
|     pScreen->PositionWindow = PositionWindow; | ||||
|  | @ -276,10 +276,10 @@ void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen) | |||
| void | ||||
| __glXScreenDestroy(__GLXscreen *screen) | ||||
| { | ||||
|     __glXFree(screen->GLXvendor); | ||||
|     __glXFree(screen->GLXversion); | ||||
|     __glXFree(screen->GLXextensions); | ||||
|     __glXFree(screen->GLextensions); | ||||
|     xfree(screen->GLXvendor); | ||||
|     xfree(screen->GLXversion); | ||||
|     xfree(screen->GLXextensions); | ||||
|     xfree(screen->GLextensions); | ||||
| } | ||||
| 
 | ||||
| void __glXInitScreens(void) | ||||
|  | @ -293,8 +293,8 @@ void __glXInitScreens(void) | |||
|     ** This alloc has to work or else the server might as well core dump. | ||||
|     */ | ||||
|     size = screenInfo.numScreens * sizeof(__GLXscreen *); | ||||
|     __glXActiveScreens =__glXMalloc(size); | ||||
|     __glXMemset(__glXActiveScreens, 0, size); | ||||
|     __glXActiveScreens = xalloc(size); | ||||
|     memset(__glXActiveScreens, 0, size); | ||||
|      | ||||
|     for (i = 0; i < screenInfo.numScreens; i++) { | ||||
| 	pScreen = screenInfo.screens[i]; | ||||
|  | @ -319,9 +319,9 @@ void __glXResetScreens(void) | |||
|       if (__glXActiveScreens[i]) | ||||
| 	  __glXActiveScreens[i]->destroy(__glXActiveScreens[i]); | ||||
| 
 | ||||
|     __glXFree(__glXActiveScreens); | ||||
|     __glXFree(__glXHyperpipeFuncs); | ||||
|     __glXFree(__glXSwapBarrierFuncs); | ||||
|     xfree(__glXActiveScreens); | ||||
|     xfree(__glXHyperpipeFuncs); | ||||
|     xfree(__glXSwapBarrierFuncs); | ||||
|     __glXNumHyperpipeFuncs = 0; | ||||
|     __glXNumSwapBarrierFuncs = 0; | ||||
|     __glXHyperpipeFuncs = NULL; | ||||
|  |  | |||
|  | @ -51,7 +51,6 @@ | |||
| #include <extnsionst.h> | ||||
| #include <resource.h> | ||||
| #include <scrnintstr.h> | ||||
| #include "GL/glx_ansic.h" | ||||
| 
 | ||||
| /*
 | ||||
| ** The X header misc.h defines these math functions. | ||||
|  |  | |||
|  | @ -48,84 +48,10 @@ | |||
| #include <pixmapstr.h> | ||||
| #include <windowstr.h> | ||||
| #include "glxutil.h" | ||||
| #include "GL/glx_ansic.h" | ||||
| #include "GL/internal/glcore.h" | ||||
| #include "GL/glxint.h" | ||||
| #include "glcontextmodes.h" | ||||
| 
 | ||||
| /************************************************************************/ | ||||
| 
 | ||||
| /* Memory Allocation for GLX */ | ||||
| 
 | ||||
| void * | ||||
| __glXMalloc(size_t size) | ||||
| { | ||||
|     void *addr; | ||||
| 
 | ||||
|     if (size == 0) { | ||||
| 	return NULL; | ||||
|     } | ||||
|     addr = (void *) xalloc(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; | ||||
|     } | ||||
|     size = numElements * elementSize; | ||||
|     addr = (void *) xalloc(size); | ||||
|     if (addr == NULL) { | ||||
| 	/* XXX: handle out of memory error */ | ||||
| 	return NULL; | ||||
|     } | ||||
|     memset(addr, 0, size); | ||||
|     return addr; | ||||
| } | ||||
| 
 | ||||
| void * | ||||
| __glXRealloc(void *addr, size_t newSize) | ||||
| { | ||||
|     void *newAddr; | ||||
| 
 | ||||
|     if (addr) { | ||||
| 	if (newSize == 0) { | ||||
| 	    xfree(addr); | ||||
| 	    return NULL; | ||||
| 	} else { | ||||
| 	    newAddr = xrealloc(addr, newSize); | ||||
| 	} | ||||
|     } else { | ||||
| 	if (newSize == 0) { | ||||
| 	    return NULL; | ||||
| 	} else { | ||||
| 	    newAddr = xalloc(newSize); | ||||
| 	} | ||||
|     } | ||||
|     if (newAddr == NULL) { | ||||
| 	return NULL;	/* XXX: out of memory */ | ||||
|     } | ||||
| 
 | ||||
|     return newAddr; | ||||
| } | ||||
| 
 | ||||
| void | ||||
| __glXFree(void *addr) | ||||
| { | ||||
|     if (addr) { | ||||
| 	xfree(addr); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| /************************************************************************/ | ||||
| /* Context stuff */ | ||||
| 
 | ||||
|  |  | |||
|  | @ -35,6 +35,7 @@ | |||
| #include <dix-config.h> | ||||
| #endif | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <string.h> | ||||
| #include <regionstr.h> | ||||
| #include <resource.h> | ||||
|  | @ -218,15 +219,15 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | |||
| 
 | ||||
|     /* Alloc space for the list of new GLX visuals */ | ||||
|     pNewVisualConfigs = (__GLXvisualConfig *) | ||||
| 	__glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); | ||||
| 	xalloc(numNewConfigs * sizeof(__GLXvisualConfig)); | ||||
|     if (!pNewVisualConfigs) { | ||||
| 	return FALSE; | ||||
|     } | ||||
| 
 | ||||
|     /* Alloc space for the list of new GLX visual privates */ | ||||
|     pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); | ||||
|     pNewVisualPriv = (void **) xalloc(numNewConfigs * sizeof(void *)); | ||||
|     if (!pNewVisualPriv) { | ||||
| 	__glXFree(pNewVisualConfigs); | ||||
| 	xfree(pNewVisualConfigs); | ||||
| 	return FALSE; | ||||
|     } | ||||
| 
 | ||||
|  | @ -270,40 +271,40 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | |||
|     numConfigs = 0; | ||||
| 
 | ||||
|     /* Alloc temp space for the list of orig VisualIDs for each new visual */ | ||||
|     orig_vid = (VisualID *) __glXMalloc(numNewVisuals * sizeof(VisualID)); | ||||
|     orig_vid = (VisualID *) xalloc(numNewVisuals * sizeof(VisualID)); | ||||
|     if (!orig_vid) { | ||||
| 	__glXFree(pNewVisualPriv); | ||||
| 	__glXFree(pNewVisualConfigs); | ||||
| 	xfree(pNewVisualPriv); | ||||
| 	xfree(pNewVisualConfigs); | ||||
| 	return FALSE; | ||||
|     } | ||||
| 
 | ||||
|     /* Alloc space for the list of glXVisuals */ | ||||
|     modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); | ||||
|     if (modes == NULL) { | ||||
| 	__glXFree(orig_vid); | ||||
| 	__glXFree(pNewVisualPriv); | ||||
| 	__glXFree(pNewVisualConfigs); | ||||
| 	xfree(orig_vid); | ||||
| 	xfree(pNewVisualPriv); | ||||
| 	xfree(pNewVisualConfigs); | ||||
| 	return FALSE; | ||||
|     } | ||||
| 
 | ||||
|     /* Alloc space for the list of glXVisualPrivates */ | ||||
|     glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); | ||||
|     glXVisualPriv = (void **)xalloc(numNewVisuals * sizeof(void *)); | ||||
|     if (!glXVisualPriv) { | ||||
| 	_gl_context_modes_destroy( modes ); | ||||
| 	__glXFree(orig_vid); | ||||
| 	__glXFree(pNewVisualPriv); | ||||
| 	__glXFree(pNewVisualConfigs); | ||||
| 	xfree(orig_vid); | ||||
| 	xfree(pNewVisualPriv); | ||||
| 	xfree(pNewVisualConfigs); | ||||
| 	return FALSE; | ||||
|     } | ||||
| 
 | ||||
|     /* Alloc space for the new list of the X server's visuals */ | ||||
|     pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); | ||||
|     pVisualNew = (VisualPtr)xalloc(numNewVisuals * sizeof(VisualRec)); | ||||
|     if (!pVisualNew) { | ||||
| 	__glXFree(glXVisualPriv); | ||||
| 	xfree(glXVisualPriv); | ||||
| 	_gl_context_modes_destroy( modes ); | ||||
| 	__glXFree(orig_vid); | ||||
| 	__glXFree(pNewVisualPriv); | ||||
| 	__glXFree(pNewVisualConfigs); | ||||
| 	xfree(orig_vid); | ||||
| 	xfree(pNewVisualPriv); | ||||
| 	xfree(pNewVisualConfigs); | ||||
| 	return FALSE; | ||||
|     } | ||||
| 
 | ||||
|  | @ -388,7 +389,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | |||
| 		    numVids++; | ||||
| 
 | ||||
| 	/* Allocate a new list of VisualIDs for this depth */ | ||||
| 	pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); | ||||
| 	pVids = (VisualID *)xalloc(numVids * sizeof(VisualID)); | ||||
| 
 | ||||
| 	/* Initialize the new list of VisualIDs for this depth */ | ||||
| 	for (j = 0; j < pdepth[i].numVids; j++) | ||||
|  | @ -397,7 +398,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | |||
| 		    pVids[n++] = pVisualNew[k].vid; | ||||
| 
 | ||||
| 	/* Update this depth's list of VisualIDs */ | ||||
| 	__glXFree(pdepth[i].vids); | ||||
| 	xfree(pdepth[i].vids); | ||||
| 	pdepth[i].vids = pVids; | ||||
| 	pdepth[i].numVids = numVids; | ||||
|     } | ||||
|  | @ -407,16 +408,16 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | |||
|     *visualp = pVisualNew; | ||||
| 
 | ||||
|     /* Free the old list of the X server's visuals */ | ||||
|     __glXFree(pVisual); | ||||
|     xfree(pVisual); | ||||
| 
 | ||||
|     /* Clean up temporary allocations */ | ||||
|     __glXFree(orig_vid); | ||||
|     __glXFree(pNewVisualPriv); | ||||
|     __glXFree(pNewVisualConfigs); | ||||
|     xfree(orig_vid); | ||||
|     xfree(pNewVisualPriv); | ||||
|     xfree(pNewVisualConfigs); | ||||
| 
 | ||||
|     /* Free the private list created by DDX HW driver */ | ||||
|     if (visualPrivates) | ||||
|         __glXFree(visualPrivates); | ||||
|         xfree(visualPrivates); | ||||
|     visualPrivates = NULL; | ||||
| 
 | ||||
|     return TRUE; | ||||
|  |  | |||
|  | @ -48,7 +48,6 @@ | |||
| #include "glxext.h" | ||||
| #include "indirect_dispatch.h" | ||||
| #include "unpack.h" | ||||
| #include "GL/glx_ansic.h" | ||||
| #include "glapitable.h" | ||||
| #include "glapi.h" | ||||
| #include "glthread.h" | ||||
|  | @ -266,24 +265,30 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) | |||
|    ** pull tokens out of shortest string | ||||
|    ** include space in combo_string for final separator and null terminator | ||||
|    */ | ||||
|    if ( (clen = __glXStrlen(cext_string)) > (slen = __glXStrlen(sext_string)) ) { | ||||
| 	combo_string = (char *) __glXMalloc(slen + 2); | ||||
| 	s1 = (char *) __glXMalloc(slen + 2); __glXStrcpy(s1, sext_string); | ||||
|    clen = strlen(cext_string); | ||||
|    slen = strlen(sext_string); | ||||
|    if (clen > slen) { | ||||
| 	combo_string = (char *) xalloc(slen + 2); | ||||
| 	s1 = (char *) xalloc(slen + 2); | ||||
| 	strcpy(s1, sext_string); | ||||
| 	s2 = cext_string; | ||||
|    } else { | ||||
| 	combo_string = (char *) __glXMalloc(clen + 2); | ||||
| 	s1 = (char *) __glXMalloc(clen + 2); __glXStrcpy(s1, cext_string); | ||||
| 	combo_string = (char *) xalloc(clen + 2); | ||||
| 	s1 = (char *) xalloc(clen + 2); | ||||
| 	strcpy(s1, cext_string); | ||||
| 	s2 = sext_string; | ||||
|    } | ||||
|    if (!combo_string || !s1) { | ||||
| 	if (combo_string) __glXFree(combo_string); | ||||
| 	if (s1) __glXFree(s1); | ||||
| 	if (combo_string) | ||||
| 	    xfree(combo_string); | ||||
| 	if (s1) | ||||
| 	    xfree(s1); | ||||
| 	return NULL; | ||||
|    } | ||||
|    combo_string[0] = '\0'; | ||||
| 
 | ||||
|    /* Get first extension token */ | ||||
|    token = __glXStrtok( s1, SEPARATOR); | ||||
|    token = strtok( s1, SEPARATOR); | ||||
|    while ( token != NULL ) { | ||||
| 
 | ||||
| 	/*
 | ||||
|  | @ -291,20 +296,20 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) | |||
| 	** beware of extension names which are prefixes of other extension names | ||||
| 	*/ | ||||
| 	const char *p = s2; | ||||
| 	end = p + __glXStrlen(p); | ||||
| 	end = p + strlen(p); | ||||
| 	while (p < end) { | ||||
| 	    size_t n = __glXStrcspn(p, SEPARATOR); | ||||
| 	    if ((__glXStrlen(token) == n) && (__glXStrncmp(token, p, n) == 0)) { | ||||
| 		combo_string = __glXStrcat( combo_string, token); | ||||
| 		combo_string = __glXStrcat( combo_string, SEPARATOR); | ||||
| 	    size_t n = strcspn(p, SEPARATOR); | ||||
| 	    if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) { | ||||
| 		combo_string = strcat(combo_string, token); | ||||
| 		combo_string = strcat(combo_string, SEPARATOR); | ||||
| 	    } | ||||
| 	    p += (n + 1); | ||||
| 	} | ||||
| 
 | ||||
| 	/* Get next extension token */ | ||||
| 	token = __glXStrtok( NULL, SEPARATOR); | ||||
| 	token = strtok( NULL, SEPARATOR); | ||||
|    } | ||||
|    __glXFree(s1); | ||||
|    xfree(s1); | ||||
|    return combo_string; | ||||
| } | ||||
| 
 | ||||
|  | @ -348,26 +353,24 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) | |||
| 	buf = __glXcombine_strings(buf1, | ||||
| 				      cx->pGlxScreen->GLextensions); | ||||
| 	if (buf1 != NULL) { | ||||
| 	    __glXFree(buf1); | ||||
| 	    xfree(buf1); | ||||
| 	} | ||||
| 	string = buf; | ||||
|     } | ||||
|     else if ( name == GL_VERSION ) { | ||||
| 	if ( atof( string ) > atof( GLServerVersion ) ) { | ||||
| 	    buf = __glXMalloc( __glXStrlen( string )  | ||||
| 			       + __glXStrlen( GLServerVersion ) | ||||
| 			       + 4 ); | ||||
| 	    buf = xalloc( strlen( string ) + strlen( GLServerVersion ) + 4 ); | ||||
| 	    if ( buf == NULL ) { | ||||
| 		string = GLServerVersion; | ||||
| 	    } | ||||
| 	    else { | ||||
| 		__glXSprintf( buf, "%s (%s)", GLServerVersion, string ); | ||||
| 		sprintf( buf, "%s (%s)", GLServerVersion, string ); | ||||
| 		string = buf; | ||||
| 	    } | ||||
| 	} | ||||
|     } | ||||
|     if (string) { | ||||
| 	length = __glXStrlen((const char *) string) + 1; | ||||
| 	length = strlen((const char *) string) + 1; | ||||
|     } | ||||
| 
 | ||||
|     __GLX_BEGIN_REPLY(length); | ||||
|  | @ -380,9 +383,9 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) | |||
| 
 | ||||
|     __GLX_SEND_HEADER(); | ||||
|     WriteToClient(client, length, (char *) string);  | ||||
|     if (buf != NULL) { | ||||
| 	__glXFree(buf); | ||||
|     } | ||||
|     if (buf != NULL) | ||||
| 	xfree(buf); | ||||
| 
 | ||||
|     return Success; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -44,7 +44,6 @@ | |||
| #include "glxext.h" | ||||
| #include "indirect_dispatch.h" | ||||
| #include "unpack.h" | ||||
| #include "GL/glx_ansic.h" | ||||
| #include "glapitable.h" | ||||
| #include "glapi.h" | ||||
| #include "glthread.h" | ||||
|  |  | |||
|  | @ -82,7 +82,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) | |||
| 	p = buf; | ||||
| 	allocbuf = 0; | ||||
|     } else { | ||||
| 	p = (unsigned char *) __glXMalloc(allocBytes); | ||||
| 	p = (unsigned char *) xalloc(allocBytes); | ||||
| 	if (!p) | ||||
| 	    return BadAlloc; | ||||
| 	allocbuf = p; | ||||
|  | @ -106,7 +106,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) | |||
| 				  allocbuf ? allocbuf : buf) ); | ||||
| 
 | ||||
|     if (allocbuf) { | ||||
| 	__glXFree(allocbuf); | ||||
| 	xfree(allocbuf); | ||||
|     } | ||||
|     return Success; | ||||
| #undef __GL_CHAR_BUF_SIZE | ||||
|  |  | |||
|  | @ -400,7 +400,7 @@ static void init_screen_visuals(__GLXMESAscreen *screen) | |||
| 	i++; | ||||
|     } | ||||
| 
 | ||||
|     __glXFree(used); | ||||
|     xfree(used); | ||||
| 
 | ||||
|     screen->xm_vis = pXMesaVisual; | ||||
| } | ||||
|  | @ -440,9 +440,3 @@ GlxGetMesaProvider (void) | |||
| { | ||||
|     return &__glXMesaProvider; | ||||
| } | ||||
| 
 | ||||
| __GLXprovider * | ||||
| GlxGetMesaProvider (void) | ||||
| { | ||||
|     return &__glXMesaProvider; | ||||
| } | ||||
|  |  | |||
|  | @ -554,6 +554,7 @@ fi | |||
| 
 | ||||
| if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then | ||||
| 	PKG_CHECK_MODULES([XLIB], [x11]) | ||||
| 	PKG_CHECK_MODULES([GL], [glproto >= 1.4.6]) | ||||
| 	AC_SUBST(XLIB_CFLAGS) | ||||
| 	AC_DEFINE(GLXEXT, 1, [Build GLX extension]) | ||||
| 	GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la' | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue