[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-experimental'



 Xi/exevents.c                         |   11 
 Xi/extinit.c                          |    2 
 Xi/xipassivegrab.c                    |   16 
 configure.ac                          |    6 
 dix/devices.c                         |   47 
 dix/ptrveloc.c                        |    2 
 glx/Makefile.am                       |    6 
 glx/glapi.c                           |  558 --
 glx/glapi.h                           |   28 
 glx/glapitemp.h                       | 6655 ----------------------------------
 glx/glxcmds.c                         |  109 
 glx/glxdri2.c                         |    1 
 glx/glxdriswrast.c                    |    8 
 glx/glxext.c                          |   53 
 glx/glxserver.h                       |    7 
 hw/xquartz/GL/indirect.c              |    9 
 hw/xquartz/X11Application.m           |    2 
 hw/xquartz/applewmExt.h               |   13 
 hw/xquartz/darwinEvents.c             |   28 
 hw/xquartz/mach-startup/bundle-main.c |   23 
 hw/xquartz/pbproxy/x-selection.m      |   11 
 hw/xquartz/xpr/xprAppleWM.c           |    4 
 include/input.h                       |    5 
 include/inputstr.h                    |    2 
 miext/rootless/rootlessScreen.c       |    2 
 test/input.c                          |   24 
 26 files changed, 230 insertions(+), 7402 deletions(-)

New commits:
commit 164ef01bd55a1d2c31620e9868f4cc3d032223a6
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Fri May 6 15:43:04 2011 -0700

    configure.ac: Version bumped to 1.10.1.901
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/configure.ac b/configure.ac
index 949db90..5f85383 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.10.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2011-04-15"
+AC_INIT([xorg-server], 1.10.1.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2011-05-06"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

commit c52a93c5398e439e6e1d9e8ee20c6c1cf28dd5de
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Fri Apr 29 11:06:18 2011 -0700

    XQuartz: Fix incorrect typedefs with XPLUGIN_VERSION < 4
    
    Ok, this time for sure... how many brown bags can I fit over my face?
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    (cherry picked from commit 0fc7ec6dd504aa03e1a1b18c60942c0c8c8b701b)

diff --git a/hw/xquartz/applewmExt.h b/hw/xquartz/applewmExt.h
index 35c8f8f..c46a7bd 100644
--- a/hw/xquartz/applewmExt.h
+++ b/hw/xquartz/applewmExt.h
@@ -35,9 +35,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <Xplugin.h>
 
 #if XPLUGIN_VERSION < 4
-typedef xp_frame_attr int;
-typedef xp_frame_class int;
-typedef xp_frame_rect int;
+typedef int xp_frame_attr;
+typedef int xp_frame_class;
+typedef int xp_frame_rect;
 #endif
 
 typedef int (*DisableUpdateProc)(void);

commit 7688d6d317f809028394ea6c5ffa31424e853796
Author: Adam Jackson <ajax@redhat.com>
Date:   Fri Apr 15 13:01:37 2011 -0400

    glx: Make --disable-dri not disable AIGLX
    
    Either the DRI1 or DRI2 loaders are sufficient.
    
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit 001b6b8b70734db1fa2f68e45c1db8337ba9f662)

diff --git a/configure.ac b/configure.ac
index 756733e..949db90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1009,7 +1009,7 @@ else
 fi
 AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
 
-if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then
+if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a \( "x$DRI" = xyes -o "x$DRI2" = xyes \); then
 	AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
 else
 	AIGLX=no
diff --git a/glx/Makefile.am b/glx/Makefile.am
index 8c7f7a5..091c18b 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -49,10 +49,13 @@ glapi_sources =					\
 	glthread.h
 
 libglxdri_la_SOURCES = \
-        glxdri.c \
         extension_string.c \
         extension_string.h
 
+if DRI
+libglxdri_la_SOURCES += glxdri.c
+endif
+
 if DRI2_AIGLX
 libglxdri_la_SOURCES += glxdri2.c
 endif

commit e67afcdb9a6a634d6903da3f272aed7dab0e91b3
Author: Adam Jackson <ajax@redhat.com>
Date:   Fri Apr 15 12:57:05 2011 -0400

    glx: Use 0 rather than garbage for unknown INTEL_swap_event types
    
    Otherwise the garbage you return could well be numerically identical to
    one of the swap type tokens, and apps which rely on us to tell the truth
    would be in trouble.
    
    Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit f8540b9dcc1fba886be5c4ce7ea0d74952cb48c4)

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 8d21c93..c4b7ba4 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -184,6 +184,7 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
 	break;
     default:
 	/* unknown swap completion type */
+	wire.event_type = 0;
 	break;
     }
     wire.drawable = drawable->drawId;

commit b5093063b5d76ff31519a2daf85ea32808f1afe6
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Mar 28 12:30:09 2011 -0400

    glx: Fix lifetime tracking for pixmaps
    
    GLX pixmaps take a reference on the underlying pixmap; X and GLX pixmap
    IDs can be destroyed in either order with no error.  Only windows need
    to be tracked under both XIDs.
    
    Fixes piglit/glx-pixmap-life.
    
    Reviewed-by: Michel Dänzer <michel@daenzer.net>
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit 6a433b67ca15fd1ea58334e607f867554f227451)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 6585080..0e3ca66 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1127,10 +1127,11 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen,
 	return BadAlloc;
     }
 
-    /* Add the glx drawable under the XID of the underlying X drawable
-     * too.  That way we'll get a callback in DrawableGone and can
-     * clean up properly when the drawable is destroyed. */
-    if (drawableId != glxDrawableId &&
+    /*
+     * Windows aren't refcounted, so track both the X and the GLX window
+     * so we get called regardless of destruction order.
+     */
+    if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW &&
 	!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
 	pGlxDraw->destroy (pGlxDraw);
 	return BadAlloc;
@@ -1161,6 +1162,8 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
     err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId,
 			      glxDrawableId, GLX_DRAWABLE_PIXMAP);
 
+    ((PixmapPtr)pDraw)->refcnt++;
+
     return err;
 }
 
diff --git a/glx/glxext.c b/glx/glxext.c
index 16315b8..fdabfe9 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -124,15 +124,15 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
 {
     __GLXcontext *c, *next;
 
-    /* If this drawable was created using glx 1.3 drawable
-     * constructors, we added it as a glx drawable resource under both
-     * its glx drawable ID and it X drawable ID.  Remove the other
-     * resource now so we don't a callback for freed memory. */
-    if (glxPriv->drawId != glxPriv->pDraw->id) {
-	if (xid == glxPriv->drawId)
-	    FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE);
-	else
-	    FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
+    if (glxPriv->type == GLX_DRAWABLE_WINDOW) {
+        /* If this was created by glXCreateWindow, free the matching resource */
+        if (glxPriv->drawId != glxPriv->pDraw->id) {
+            if (xid == glxPriv->drawId)
+                FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE);
+            else
+                FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
+        }
+        /* otherwise this window was implicitly created by MakeCurrent */
     }
 
     for (c = glxAllContexts; c; c = next) {
@@ -149,6 +149,10 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
 	    c->readPriv = NULL;
     }
 
+    /* drop our reference to any backing pixmap */
+    if (glxPriv->type == GLX_DRAWABLE_PIXMAP)
+        glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr)glxPriv->pDraw);
+
     glxPriv->destroy(glxPriv);
 
     return True;

commit 618dc75a05faf3bb390c152af3059a311f21e406
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Mar 21 11:59:29 2011 -0400

    glx: Reimplement context tags
    
    This would let you do a constant-time context lookup, but if that's your
    performance problem you have two problems.  Just use the context's XID
    as the tag value instead.
    
    In order to do this, we have to defer destroying a context until it
    actually goes unreferenced, as you're allowed to mention a context tag
    after you've (ostensibly) destroyed the context, as long as it's still
    your current context.  Thus, change DestroyContext to merely mark the
    context as dead if it's a current context, and call down to actual
    resource destruction (and XID reclamation) in StopUsingContext.
    
    Also, stop trying to delete context state from DrawableGone.  This was
    always broken, as GLX does not say that contexts are destroyed when
    their drawables are destroyed.  But with the above change to defer
    context destruction, this would trigger a server crash on client exit as
    we'd free the context state twice.
    
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit a48dadc98a28c969741979b70b7a639f24f4cbbd)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 9b4bc9e..6585080 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -136,9 +136,9 @@ validGlxContext(ClientPtr client, XID id, int access_mode,
 {
     *err = dixLookupResourceByType((pointer *) context, id,
 				   __glXContextRes, client, access_mode);
-    if (*err != Success) {
+    if (*err != Success || (*context)->idExists == GL_FALSE) {
 	client->errorValue = id;
-	if (*err == BadValue)
+	if (*err == BadValue || *err == Success)
 	    *err = __glXError(GLXBadContext);
 	return FALSE;
     }
@@ -369,6 +369,7 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
     return DoCreateContext(cl, req->context, req->shareList,
 			   config, pGlxScreen, req->isDirect);
 }
+
 int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
 {
     ClientPtr client = cl->client;
@@ -382,77 +383,31 @@ int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
 			 &glxc, &err))
 	    return err;
 
-    FreeResourceByType(req->context, __glXContextRes, FALSE);
-    return Success;
-}
-
-/*****************************************************************************/
-
-/*
-** For each client, the server keeps a table of all the contexts that are
-** current for that client (each thread of a client may have its own current
-** context).  These routines add, change, and lookup contexts in the table.
-*/
-
-/*
-** Add a current context, and return the tag that will be used to refer to it.
-*/
-static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc)
-{
-    int i;
-    int num = cl->numCurrentContexts;
-    __GLXcontext **table = cl->currentContexts;
-
-    if (!glxc) return -1;
-    
-    /*
-    ** Try to find an empty slot and use it.
-    */
-    for (i=0; i < num; i++) {
-	if (!table[i]) {
-	    table[i] = glxc;
-	    return i+1;
-	}
-    }
-    /*
-    ** Didn't find a free slot, so we'll have to grow the table.
-    */
-    if (!num) {
-	table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
-    } else {
-	table = (__GLXcontext **) realloc(table,
-					   (num+1)*sizeof(__GLXcontext *));
-    }
-    table[num] = glxc;
-    cl->currentContexts = table;
-    cl->numCurrentContexts++;
-    return num+1;
-}
+    glxc->idExists = GL_FALSE;
+    if (!glxc->isCurrent)
+        FreeResourceByType(req->context, __glXContextRes, FALSE);
 
-/*
-** Given a tag, change the current context for the corresponding entry.
-*/
-static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
-				GLXContextTag tag)
-{
-    __GLXcontext **table = cl->currentContexts;
-    table[tag-1] = glxc;
+    return Success;
 }
 
 /*
-** For this implementation we have chosen to simply use the index of the
-** context's entry in the table as the context tag.  A tag must be greater
-** than 0.
-*/
+ * This will return "deleted" contexts, ie, where idExists is GL_FALSE.
+ * Contrast validGlxContext, which will not.  We're cheating here and
+ * using the XID as the context tag, which is fine as long as we defer
+ * actually destroying the context until it's no longer referenced, and
+ * block clients from trying to MakeCurrent on contexts that are on the
+ * way to destruction.  Notice that DoMakeCurrent calls validGlxContext
+ * for new contexts but __glXLookupContextByTag for previous contexts.
+ */
 __GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
 {
-    int num = cl->numCurrentContexts;
+    __GLXcontext *ret;
 
-    if (tag < 1 || tag > num) {
-	return 0;
-    } else {
-	return cl->currentContexts[tag-1];
-    }
+    if (dixLookupResourceByType((void **)&ret, tag, __glXContextRes,
+                                cl->client, DixUseAccess) == Success)
+        return ret;
+
+    return NULL;
 }
 
 /*****************************************************************************/
@@ -466,7 +421,7 @@ static void StopUsingContext(__GLXcontext *glxc)
 	}
 	glxc->isCurrent = GL_FALSE;
 	if (!glxc->idExists) {
-	    __glXFreeContext(glxc);
+            FreeResourceByType(glxc->id, __glXContextRes, FALSE);
 	}
     }
 }
@@ -669,16 +624,11 @@ DoMakeCurrent(__GLXclientState *cl,
 	glxc->isCurrent = GL_TRUE;
     }
 
-    if (prevglxc) {
-	ChangeCurrentContext(cl, glxc, tag);
-	StopUsingContext(prevglxc);
-    } else {
-	tag = AddCurrentContext(cl, glxc);
-    }
+    StopUsingContext(prevglxc);
 
     if (glxc) {
 	StartUsingContext(cl, glxc);
-	reply.contextTag = tag;
+	reply.contextTag = glxc->id;
     } else {
 	reply.contextTag = 0;
     }
diff --git a/glx/glxext.c b/glx/glxext.c
index 4bd5d6b..16315b8 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -138,34 +138,15 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
     for (c = glxAllContexts; c; c = next) {
 	next = c->next;
 	if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
-	    int i;
-
 	    (*c->loseCurrent)(c);
 	    c->isCurrent = GL_FALSE;
 	    if (c == __glXLastContext)
 		__glXFlushContextCache();
-
-	    for (i = 1; i < currentMaxClients; i++) {
-		if (clients[i]) {
-		    __GLXclientState *cl = glxGetClient(clients[i]);
-
-		    if (cl->inUse) {
-			int j;
-
-			for (j = 0; j < cl->numCurrentContexts; j++) {
-			    if (cl->currentContexts[j] == c)
-				cl->currentContexts[j] = NULL;
-			}
-		    }
-		}
-	    }
 	}
 	if (c->drawPriv == glxPriv)
 	    c->drawPriv = NULL;
 	if (c->readPriv == glxPriv)
 	    c->readPriv = NULL;
-	if (!c->idExists && !c->isCurrent)
-	    __glXFreeContext(c);
     }
 
     glxPriv->destroy(glxPriv);
@@ -283,8 +264,6 @@ glxClientCallback (CallbackListPtr	*list,
     NewClientInfoRec	*clientinfo = (NewClientInfoRec *) data;
     ClientPtr		pClient = clientinfo->client;
     __GLXclientState	*cl = glxGetClient(pClient);
-    __GLXcontext	*cx;
-    int i;
 
     switch (pClient->clientState) {
     case ClientStateRunning:
@@ -298,18 +277,8 @@ glxClientCallback (CallbackListPtr	*list,
 	break;
 
     case ClientStateGone:
-	for (i = 0; i < cl->numCurrentContexts; i++) {
-	    cx = cl->currentContexts[i];
-	    if (cx) {
-		cx->isCurrent = GL_FALSE;
-		if (!cx->idExists)
-		    __glXFreeContext(cx);
-	    }
-	}
-
 	free(cl->returnBuf);
 	free(cl->largeCmdBuf);
-	free(cl->currentContexts);
 	free(cl->GLClientextensions);
 	break;
 
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 1daf977..f10c8fe 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -158,13 +158,6 @@ struct __GLXclientStateRec {
     GLbyte *largeCmdBuf;
     GLint largeCmdBufSize;
 
-    /*
-    ** Keep a list of all the contexts that are current for this client's
-    ** threads.
-    */
-    __GLXcontext **currentContexts;
-    GLint numCurrentContexts;
-
     /* Back pointer to X client record */
     ClientPtr client;
 

commit c7d9a07d52ce8a6259d6693d68290826b9618a86
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Mar 7 14:53:28 2011 -0500

    glx: Fix _glapi_add_dispatch
    
    We never need to generate stubs, because those conditions can't happen
    in the server.  Yank that code out, but keep the bookkeeping for which
    extension functions are registered so the DRI driver doesn't get
    confused.
    
    As a pleasant bonus, we're now friendlier for environments like selinux
    that make runtime code generation difficult, and we're portable to more
    arches since we don't have to port the assembly stubs.
    
    Fixes the following clutter conformance tests (indirect rendering,
    llvmpipe driver):
    
        test-cogl-backface-culling
        test-cogl-materials
        test-cogl-readpixels
        test-cogl-texture-mipmaps
        test-cogl-texture-get-set-data
        test-cogl-viewport
        test-cogl-offscreen
    
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit 30d6947cee714385cf62a40ea6fa6d2e68388c78)

diff --git a/glx/glapi.c b/glx/glapi.c
index 79ff6b1..92395ae 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -77,9 +77,6 @@
 static void init_glapi_relocs(void);
 #endif
 
-static _glapi_proc generate_entrypoint(GLuint functionOffset);
-static void fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset);
-
 /**
  * \name Current dispatch and current context control variables
  *
@@ -140,23 +137,6 @@ PUBLIC void *_glapi_Context = NULL;
 #endif /* defined(GLX_USE_TLS) */
 /*@}*/
 
-
-/**
- * strdup() is actually not a standard ANSI C or POSIX routine.
- * Irix will not define it if ANSI mode is in effect.
- */
-static char *
-str_dup(const char *str)
-{
-   char *copy;
-   copy = (char*) malloc(strlen(str) + 1);
-   if (!copy)
-      return NULL;
-   strcpy(copy, str);
-   return copy;
-}
-
-
 /*
  * xserver's gl is not multithreaded, we promise.
  */
@@ -367,7 +347,6 @@ struct _glapi_function {
     */
    const char * name;
 
-
    /**
     * Text string that describes the types of the parameters passed to the
     * named function.   Parameter types are converted to characters using the
@@ -379,164 +358,17 @@ struct _glapi_function {
     */
    const char * parameter_signature;
 
-
    /**
     * Offset in the dispatch table where the pointer to the real function is
     * located.  If the driver has not requested that the named function be
     * added to the dispatch table, this will have the value ~0.
     */
    unsigned dispatch_offset;
-
-
-   /**
-    * Pointer to the dispatch stub for the named function.
-    * 
-    * \todo
-    * The semantic of this field should be changed slightly.  Currently, it
-    * is always expected to be non-\c NULL.  However, it would be better to
-    * only allocate the entry-point stub when the application requests the
-    * function via \c glXGetProcAddress.  This would save memory for all the
-    * functions that the driver exports but that the application never wants
-    * to call.
-    */
-   _glapi_proc dispatch_stub;
 };
 
-
 static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS];
 static GLuint NumExtEntryPoints = 0;
 
-#ifdef USE_SPARC_ASM
-extern void __glapi_sparc_icache_flush(unsigned int *);
-#endif
-
-/**
- * Generate a dispatch function (entrypoint) which jumps through
- * the given slot number (offset) in the current dispatch table.
- * We need assembly language in order to accomplish this.
- */
-static _glapi_proc
-generate_entrypoint(GLuint functionOffset)
-{
-#if defined(USE_X86_ASM)
-   /* 32 is chosen as something of a magic offset.  For x86, the dispatch
-    * at offset 32 is the first one where the offset in the
-    * "jmp OFFSET*4(%eax)" can't be encoded in a single byte.
-    */
-   const GLubyte * const template_func = gl_dispatch_functions_start 
-     + (DISPATCH_FUNCTION_SIZE * 32);
-   GLubyte * const code = (GLubyte *) malloc(DISPATCH_FUNCTION_SIZE);
-
-
-   if ( code != NULL ) {
-      (void) memcpy(code, template_func, DISPATCH_FUNCTION_SIZE);
-      fill_in_entrypoint_offset( (_glapi_proc) code, functionOffset );
-   }
-
-   return (_glapi_proc) code;
-#elif defined(USE_SPARC_ASM)
-
-#ifdef __arch64__
-   static const unsigned int insn_template[] = {
-	   0x05000000,	/* sethi	%uhi(_glapi_Dispatch), %g2	*/
-	   0x03000000,	/* sethi	%hi(_glapi_Dispatch), %g1	*/
-	   0x8410a000,	/* or		%g2, %ulo(_glapi_Dispatch), %g2	*/
-	   0x82106000,	/* or		%g1, %lo(_glapi_Dispatch), %g1	*/
-	   0x8528b020,	/* sllx		%g2, 32, %g2			*/
-	   0xc2584002,	/* ldx		[%g1 + %g2], %g1		*/
-	   0x05000000,	/* sethi	%hi(8 * glapioffset), %g2	*/
-	   0x8410a000,	/* or		%g2, %lo(8 * glapioffset), %g2	*/
-	   0xc6584002,	/* ldx		[%g1 + %g2], %g3		*/
-	   0x81c0c000,	/* jmpl		%g3, %g0			*/
-	   0x01000000	/*  nop						*/
-   };
-#else
-   static const unsigned int insn_template[] = {
-	   0x03000000,	/* sethi	%hi(_glapi_Dispatch), %g1	  */
-	   0xc2006000,	/* ld		[%g1 + %lo(_glapi_Dispatch)], %g1 */
-	   0xc6006000,	/* ld		[%g1 + %lo(4*glapioffset)], %g3	  */
-	   0x81c0c000,	/* jmpl		%g3, %g0			  */
-	   0x01000000	/*  nop						  */
-   };
-#endif /* __arch64__ */
-   unsigned int *code = (unsigned int *) malloc(sizeof(insn_template));
-   unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch;
-   if (code) {
-      memcpy(code, insn_template, sizeof(insn_template));
-
-#ifdef __arch64__
-      code[0] |= (glapi_addr >> (32 + 10));
-      code[1] |= ((glapi_addr & 0xffffffff) >> 10);
-      __glapi_sparc_icache_flush(&code[0]);
-      code[2] |= ((glapi_addr >> 32) & ((1 << 10) - 1));
-      code[3] |= (glapi_addr & ((1 << 10) - 1));
-      __glapi_sparc_icache_flush(&code[2]);
-      code[6] |= ((functionOffset * 8) >> 10);
-      code[7] |= ((functionOffset * 8) & ((1 << 10) - 1));
-      __glapi_sparc_icache_flush(&code[6]);
-#else
-      code[0] |= (glapi_addr >> 10);
-      code[1] |= (glapi_addr & ((1 << 10) - 1));
-      __glapi_sparc_icache_flush(&code[0]);
-      code[2] |= (functionOffset * 4);
-      __glapi_sparc_icache_flush(&code[2]);
-#endif /* __arch64__ */
-   }
-   return (_glapi_proc) code;
-#else
-   (void) functionOffset;
-   return NULL;
-#endif /* USE_*_ASM */
-}
-
-
-/**
- * This function inserts a new dispatch offset into the assembly language
- * stub that was generated with the preceeding function.
- */
-static void
-fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
-{
-#if defined(USE_X86_ASM)
-   GLubyte * const code = (GLubyte *) entrypoint;
-
-#if DISPATCH_FUNCTION_SIZE == 32
-   *((unsigned int *)(code + 11)) = 4 * offset;
-   *((unsigned int *)(code + 22)) = 4 * offset;
-#elif DISPATCH_FUNCTION_SIZE == 16 && defined( GLX_USE_TLS )
-   *((unsigned int *)(code +  8)) = 4 * offset;
-#elif DISPATCH_FUNCTION_SIZE == 16
-   *((unsigned int *)(code +  7)) = 4 * offset;
-#else
-# error Invalid DISPATCH_FUNCTION_SIZE!
-#endif
-
-#elif defined(USE_SPARC_ASM)
-
-   /* XXX this hasn't been tested! */
-   unsigned int *code = (unsigned int *) entrypoint;
-#ifdef __arch64__
-   code[6] = 0x05000000;  /* sethi	%hi(8 * glapioffset), %g2	*/
-   code[7] = 0x8410a000;  /* or		%g2, %lo(8 * glapioffset), %g2	*/
-   code[6] |= ((offset * 8) >> 10);
-   code[7] |= ((offset * 8) & ((1 << 10) - 1));
-   __glapi_sparc_icache_flush(&code[6]);
-#else /* __arch64__ */
-   code[2] = 0xc6006000;  /* ld		[%g1 + %lo(4*glapioffset)], %g3	  */
-   code[2] |= (offset * 4);
-   __glapi_sparc_icache_flush(&code[2]);
-#endif /* __arch64__ */
-
-#else
-
-   /* an unimplemented architecture */
-   (void) entrypoint;
-   (void) offset;
-
-#endif /* USE_*_ASM */
-}
-
-
 /**
  * Generate new entrypoint
  *
@@ -556,16 +388,12 @@ add_function_name( const char * funcName )
    struct _glapi_function * entry = NULL;
    
    if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) {
-      _glapi_proc entrypoint = generate_entrypoint(~0);
-      if (entrypoint != NULL) {
-	 entry = & ExtEntryTable[NumExtEntryPoints];
-
-	 ExtEntryTable[NumExtEntryPoints].name = str_dup(funcName);
-	 ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL;
-	 ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0;
-	 ExtEntryTable[NumExtEntryPoints].dispatch_stub = entrypoint;
-	 NumExtEntryPoints++;
-      }
+      entry = &ExtEntryTable[NumExtEntryPoints];
+
+      ExtEntryTable[NumExtEntryPoints].name = strdup(funcName);
+      ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL;
+      ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0;
+      NumExtEntryPoints++;
    }
 
    return entry;
@@ -634,14 +462,13 @@ _glapi_add_dispatch( const char * const * function_names,
    int new_offset;
 
 
-   (void) memset( is_static, 0, sizeof( is_static ) );
-   (void) memset( entry, 0, sizeof( entry ) );
+   (void) memset(is_static, 0, sizeof(is_static));
+   (void) memset(entry, 0, sizeof(entry));
 
-   for ( i = 0 ; function_names[i] != NULL ; i++ ) {
-      /* Do some trivial validation on the name of the function.
-       */
+   for (i = 0 ; function_names[i] != NULL ; i++) {
+      /* Do some trivial validation on the name of the function. */
 
-      if (!function_names[i] || function_names[i][0] != 'g' || function_names[i][1] != 'l')
+      if (function_names[i][0] != 'g' || function_names[i][1] != 'l')
 	return GL_FALSE;
    
       /* Determine if the named function already exists.  If the function does
@@ -655,7 +482,7 @@ _glapi_add_dispatch( const char * const * function_names,
 	  * FIXME: the parameter signature for static functions?
 	  */
 
-	 if ( (offset != ~0) && (new_offset != offset) ) {
+	 if ((offset != ~0) && (new_offset != offset)) {
 	    return -1;
 	 }
 
@@ -663,20 +490,17 @@ _glapi_add_dispatch( const char * const * function_names,
 	 offset = new_offset;
       }
    
-   
-      for ( j = 0 ; j < NumExtEntryPoints ; j++ ) {
+      for (j = 0; j < NumExtEntryPoints; j++) {
 	 if (strcmp(ExtEntryTable[j].name, function_names[i]) == 0) {
 	    /* The offset may be ~0 if the function name was added by
 	     * glXGetProcAddress but never filled in by the driver.
 	     */
 
 	    if (ExtEntryTable[j].dispatch_offset != ~0) {
-	       if (strcmp(real_sig, ExtEntryTable[j].parameter_signature) 
-		   != 0) {
+	       if (strcmp(real_sig, ExtEntryTable[j].parameter_signature) != 0)
 		  return -1;
-	       }
 
-	       if ( (offset != ~0) && (ExtEntryTable[j].dispatch_offset != offset) ) {
+	       if ((offset != ~0) && (ExtEntryTable[j].dispatch_offset != offset)) {
 		  return -1;
 	       }
 
@@ -694,19 +518,15 @@ _glapi_add_dispatch( const char * const * function_names,
       next_dynamic_offset++;
    }
 
-   for ( i = 0 ; function_names[i] != NULL ; i++ ) {
-      if (! is_static[i] ) {
+   for (i = 0 ; function_names[i] != NULL ; i++) {
+      if (!is_static[i]) {
 	 if (entry[i] == NULL) {
-	    entry[i] = add_function_name( function_names[i] );
-	    if (entry[i] == NULL) {
-	       /* FIXME: Possible memory leak here.
-		*/
+	    entry[i] = add_function_name(function_names[i]);
+	    if (entry[i] == NULL)
 	       return -1;
-	    }
 	 }
 
-	 entry[i]->parameter_signature = str_dup(real_sig);
-	 fill_in_entrypoint_offset(entry[i]->dispatch_stub, offset);
+	 entry[i]->parameter_signature = strdup(real_sig);
 	 entry[i]->dispatch_offset = offset;
       }
    }

commit 888a29674c51ff8c6ce74f5f78289ba88cda160a
Author: Adam Jackson <ajax@redhat.com>
Date:   Wed Mar 2 13:21:39 2011 -0500

    glx: Lobotomize _glapi_get_proc_address
    
    This isn't a meaningful thing in the indirect glx loader, so just warn
    if it ever happens and move on.
    
    But also, mark it PUBLIC, so if the driver does ever call it we merely
    warn instead of aborting because ld.so can't find the symbol.
    
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit 17d9e374721d6c8ee3f7f9cdc882f80127bdb57f)

diff --git a/glx/glapi.c b/glx/glapi.c
index 1814493..79ff6b1 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -54,6 +54,7 @@
 
 #include <dix-config.h>
 #include <X11/Xfuncproto.h>
+#include <os.h>
 #define PUBLIC _X_EXPORT
 
 #else
@@ -713,43 +714,15 @@ _glapi_add_dispatch( const char * const * function_names,
    return offset;
 }
 
-/**
- * Return pointer to the named function.  If the function name isn't found
- * in the name of static functions, try generating a new API entrypoint on
- * the fly with assembly language.
+/*
+ * glXGetProcAddress doesn't exist in the protocol, the drivers never call
+ * this themselves, and neither does the server.  warn if it happens though.
  */
-_glapi_proc
+PUBLIC _glapi_proc
 _glapi_get_proc_address(const char *funcName)
 {
-   struct _glapi_function * entry;
-   GLuint i;
-
-#ifdef MANGLE
-   if (funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l')
-      return NULL;
-#else
-   if (funcName[0] != 'g' || funcName[1] != 'l')
-      return NULL;
-#endif
-
-   /* search extension functions first */
-   for (i = 0; i < NumExtEntryPoints; i++) {
-      if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
-         return ExtEntryTable[i].dispatch_stub;
-      }
-   }
-
-#if !defined( XFree86Server ) && !defined( XGLServer )
-   /* search static functions */
-   {
-      const _glapi_proc func = get_static_proc_address(funcName);
-      if (func)
-         return func;
-   }
-#endif /* !defined( XFree86Server ) */
-
-   entry = add_function_name(funcName);
-   return (entry == NULL) ? NULL : entry->dispatch_stub;
+    ErrorF("_glapi_get_proc_address called!\n");
+    return NULL;
 }
 
 /**

commit 00d1569918d0dca2cf2a5e2e320da7b427e1f69f
Author: Adam Jackson <ajax@redhat.com>
Date:   Wed Mar 2 12:30:22 2011 -0500

    glx: Remove noop dispatch table
    
    We can never hit this, because the indirect GLX dispatch code always
    forces a current context and checks that it's non-NULL before calling
    into the dispatch table.  If it's _not_ null, then _glapi_set_context
    will call into the driver, which is responsible for calling
    _glapi_set_dispatch to make sure the dispatch table is non-NULL.
    
    Also remove _glapi_set_warning_func and friends, since we can no longer
    call them even from dead code.
    
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit b0c665ac0fe6840dda581e4d0d0b76c703d62a7b)

diff --git a/glx/Makefile.am b/glx/Makefile.am
index d708872..8c7f7a5 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -41,7 +41,6 @@ glapi_sources =					\
 	indirect_table.c			\
 	dispatch.h				\
 	glapitable.h				\
-	glapitemp.h				\
 	glapi.c					\
 	glapi.h					\
 	glapioffsets.h				\
diff --git a/glx/glapi.c b/glx/glapi.c
index 19576a7..1814493 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -72,11 +72,6 @@
 #include "glapioffsets.h"
 #include "glapitable.h"
 
-/***** BEGIN NO-OP DISPATCH *****/
-
-static GLboolean WarnFlag = GL_FALSE;
-static _glapi_warning_func warning_func;
-
 #if defined(PTHREADS) || defined(GLX_USE_TLS)
 static void init_glapi_relocs(void);
 #endif
@@ -84,79 +79,6 @@ static void init_glapi_relocs(void);
 static _glapi_proc generate_entrypoint(GLuint functionOffset);
 static void fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset);
 
-/*
- * Enable/disable printing of warning messages.
- */
-PUBLIC void
-_glapi_noop_enable_warnings(GLboolean enable)
-{
-   WarnFlag = enable;
-}
-
-/*
- * Register a callback function for reporting errors.
- */
-PUBLIC void
-_glapi_set_warning_func( _glapi_warning_func func )
-{
-   warning_func = func;
-}
-
-static GLboolean
-warn(void)
-{
-   if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
-       && warning_func) {
-      return GL_TRUE;
-   }
-   else {


Reply to: