Module Name:    xsrc
Committed By:   mrg
Date:           Tue Aug  2 07:13:20 UTC 2011

Modified Files:
        xsrc/external/mit/xorg-server/dist/glx: glxcmds.c glxdrawable.h
            glxext.c

Log Message:
revert the change below, to help merge 1.10.3.  there's a new version of
this coming up shortly:

        http://mail-index.netbsd.org/source-changes/2011/03/18/msg020067.html

        Log Message:
        Pull up fix from https://bugs.freedesktop.org/show_bug.cgi?id=28181 to
        prevent random segfaults of the X server when using composite with the
        ati driver.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xorg-server/dist/glx/glxcmds.c
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h \
    xsrc/external/mit/xorg-server/dist/glx/glxext.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server/dist/glx/glxcmds.c
diff -u xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.3 xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.4
--- xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.3	Sun Jul 24 01:33:36 2011
+++ xsrc/external/mit/xorg-server/dist/glx/glxcmds.c	Tue Aug  2 07:13:20 2011
@@ -530,7 +530,6 @@
 	*error = BadAlloc;
 	return NULL;
     }
-    pGlxDraw->refcnt++;
 
     return pGlxDraw;
 }
@@ -1101,10 +1100,8 @@
     drawable->pDraw = pDraw;
     drawable->type = type;
     drawable->drawId = drawId;
-    drawable->otherId = 0;
     drawable->config = config;
     drawable->eventMask = 0;
-    drawable->refcnt = 0;
 
     return GL_TRUE;
 }
@@ -1134,18 +1131,14 @@
 	pGlxDraw->destroy (pGlxDraw);
 	return BadAlloc;
     }
-    pGlxDraw->refcnt++;
 
-    if (drawableId != glxDrawableId) {
-	/* 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 (!AddResource(drawableId, __glXDrawableRes, pGlxDraw)) {
-	    pGlxDraw->destroy (pGlxDraw);
-	    return BadAlloc;
-	}
-	pGlxDraw->refcnt++;
-	pGlxDraw->otherId = drawableId;
+    /* 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 &&
+	!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
+	pGlxDraw->destroy (pGlxDraw);
+	return BadAlloc;
     }
 
     return Success;

Index: xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h
diff -u xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h:1.2 xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h:1.3
--- xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h:1.2	Fri Mar 18 09:51:00 2011
+++ xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h	Tue Aug  2 07:13:20 2011
@@ -51,11 +51,8 @@
     void      (*waitX)(__GLXdrawable *);
     void      (*waitGL)(__GLXdrawable *);
 
-    int refcnt; /* number of resources handles referencing this */
-
     DrawablePtr pDraw;
     XID drawId;
-    XID otherId; /* for glx1.3 we need to track the original Drawable as well */
 
     /*
     ** Either GLX_DRAWABLE_PIXMAP, GLX_DRAWABLE_WINDOW or
Index: xsrc/external/mit/xorg-server/dist/glx/glxext.c
diff -u xsrc/external/mit/xorg-server/dist/glx/glxext.c:1.2 xsrc/external/mit/xorg-server/dist/glx/glxext.c:1.3
--- xsrc/external/mit/xorg-server/dist/glx/glxext.c:1.2	Fri Mar 18 09:51:00 2011
+++ xsrc/external/mit/xorg-server/dist/glx/glxext.c	Tue Aug  2 07:13:20 2011
@@ -130,18 +130,13 @@
      * 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->otherId) {
-	    XID other = glxPriv->otherId;
-	    glxPriv->otherId = 0;
-	    if (xid == other)
-		    FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
-	    else
-		    FreeResourceByType(other, __glXDrawableRes, TRUE);
+    if (glxPriv->drawId != glxPriv->pDraw->id) {
+	if (xid == glxPriv->drawId)
+	    FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE);
+	else
+	    FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
     }
 
-    if (--glxPriv->refcnt)
-	    return True;
-
     for (c = glxAllContexts; c; c = next) {
 	next = c->next;
 	if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {

Reply via email to