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

mesa: Changes to 'ubuntu-maverick'



 debian/changelog |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

New commits:
commit c399c3d272c9152d614facb27d59ba74c5d32615
Author: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Date:   Thu Sep 16 16:07:57 2010 +0200

    Revert 0ubuntu2.  This is a clutter bug, fixed in clutter 1.2.12-0ubuntu12

diff --git a/debian/changelog b/debian/changelog
index d35bd03..f77f0e2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+mesa (7.9~git20100909-0ubuntu3) maverick; urgency=low
+
+  * Drop the changes from previous upload.  The Unity white screen problem
+    is clutter bug #632352, fixed in clutter-1.0 1.2.12-0ubuntu12.
+
+ -- Christopher James Halse Rogers <raof@ubuntu.com>  Thu, 16 Sep 2010 16:04:28 +0200
+
 mesa (7.9~git20100909-0ubuntu2) maverick; urgency=low
 
   * 105_old_gc_ignore_destroyed_drawable_events.patch (revert),
diff --git a/debian/patches/105_old_gc_ignore_destroyed_drawable_events.patch b/debian/patches/105_old_gc_ignore_destroyed_drawable_events.patch
deleted file mode 100644
index cf51117..0000000
--- a/debian/patches/105_old_gc_ignore_destroyed_drawable_events.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-commit f24ec6367b1cf6c6822fa998df8a877288711427
-Author: Kristian Høgsberg <krh@bitplanet.net>
-Date:   Wed Sep 8 18:54:30 2010 -0400
-
-    glx: Ignore DRI2 event for drawables we've destroyed
-    
-    Since we now actually destroy GLX drawables, we get into situations where
-    we get events for drawables that no longer exist.  Just ignore the
-    event in that case.
-
-diff --git a/src/glx/dri2.c b/src/glx/dri2.c
-index d410898..30999c8 100644
---- a/src/glx/dri2.c
-+++ b/src/glx/dri2.c
-@@ -103,7 +103,7 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
- 
-       /* Ignore swap events if we're not looking for them */
-       pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable);
--      if (!(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
-+      if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
- 	 return False;
- 
-       aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
diff --git a/debian/patches/106_old_gc_fix_use_after_free.patch b/debian/patches/106_old_gc_fix_use_after_free.patch
deleted file mode 100644
index 76cfb73..0000000
--- a/debian/patches/106_old_gc_fix_use_after_free.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-commit 659dab6be6bc82f8a0551c30f1133e0010f04ed8
-Author: Kristian Høgsberg <krh@bitplanet.net>
-Date:   Wed Sep 8 14:51:18 2010 -0400
-
-    glx: Fix use after free problem
-
-diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
-index 710985b..0d359f7 100644
---- a/src/glx/glxcurrent.c
-+++ b/src/glx/glxcurrent.c
-@@ -248,12 +248,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
-       oldGC->currentDrawable = None;
-       oldGC->currentReadable = None;
-       oldGC->thread_id = 0;
--      if (oldGC->xid == None && oldGC != gc)
--	 /* We are switching away from a context that was
--	  * previously destroyed, so we need to free the memory
--	  * for the old handle.
--	  */
--	 oldGC->vtable->destroy(oldGC);
-    }
- 
-    if (gc) {
-@@ -267,6 +261,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
-       __glXSetCurrentContextNull();
-    }
- 
-+   if (oldGC != &dummyContext && oldGC->xid == None && oldGC != gc) {
-+      /* We are switching away from a context that was
-+       * previously destroyed, so we need to free the memory
-+       * for the old handle. */
-+      oldGC->vtable->destroy(oldGC);
-+   }
-+
-    if (ret) {
-       __glXGenerateError(dpy, gc, None, ret, X_GLXMakeContextCurrent);
-       return GL_FALSE;
diff --git a/debian/patches/107_old_gc_drop_broken_drawable_garbage_collector.patch b/debian/patches/107_old_gc_drop_broken_drawable_garbage_collector.patch
deleted file mode 100644
index c3139e5..0000000
--- a/debian/patches/107_old_gc_drop_broken_drawable_garbage_collector.patch
+++ /dev/null
@@ -1,252 +0,0 @@
-commit 16887d042a917fa4773e4d853f50051b54e9948c
-Author: Kristian Høgsberg <krh@bitplanet.net>
-Date:   Fri Aug 27 12:40:11 2010 -0400
-
-    glx: Drop broken drawable garbage collection
-    
-    Doesn't work for pixmaps, was looking up the GLX XID and was never thread
-    safe.  Instead, just destroy the client side structures when the
-    drawable is no long current for a context.
-
-diff --git a/src/glx/dri2.c b/src/glx/dri2.c
-index d70ec5a..d410898 100644
---- a/src/glx/dri2.c
-+++ b/src/glx/dri2.c
-@@ -175,6 +175,14 @@ DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code)
- 	err->minorCode == X_DRI2CopyRegion)
- 	return True;
- 
-+    /* If the X drawable was destroyed before the GLX drawable, the
-+     * DRI2 drawble will be gone by the time we call
-+     * DRI2DestroyDrawable.  So just ignore BadDrawable here. */
-+    if (err->majorCode == codes->major_opcode &&
-+	err->errorCode == BadDrawable &&
-+	err->minorCode == X_DRI2DestroyDrawable)
-+	return True;
-+
-     return False;
- }
- 
-diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
-index ff48c79..e38a40c 100644
---- a/src/glx/dri2_glx.c
-+++ b/src/glx/dri2_glx.c
-@@ -124,8 +124,6 @@ dri2_destroy_context(struct glx_context *context)
-    if (context->extensions)
-       XFree((char *) context->extensions);
- 
--   GarbageCollectDRIDrawables(context->psc);
--
-    (*psc->core->destroyContext) (pcp->driContext);
- 
-    Xfree(pcp);
-@@ -159,6 +157,8 @@ dri2_unbind_context(struct glx_context *context, struct glx_context *new)
-    struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc;
- 
-    (*psc->core->unbindContext) (pcp->driContext);
-+
-+   driReleaseDrawables(&pcp->base);
- }
- 
- static struct glx_context *
-diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
-index a7fb4c6..5fb5255 100644
---- a/src/glx/dri_common.c
-+++ b/src/glx/dri_common.c
-@@ -380,4 +380,29 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
-    return pdraw;
- }
- 
-+_X_HIDDEN void
-+driReleaseDrawables(struct glx_context *gc)
-+{
-+   struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
-+   __GLXDRIdrawable *pdraw;
-+
-+   if (priv == NULL)
-+      return;
-+
-+   if (__glxHashLookup(priv->drawHash,
-+		       gc->currentDrawable, (void *) &pdraw) == 0) {
-+      if (pdraw->drawable == pdraw->xDrawable)
-+	 (*pdraw->destroyDrawable)(pdraw);
-+      __glxHashDelete(priv->drawHash, gc->currentDrawable);
-+   }
-+
-+   if (gc->currentDrawable != gc->currentReadable &&
-+       __glxHashLookup(priv->drawHash,
-+		       gc->currentReadable, (void *) &pdraw) == 0) {
-+      if (pdraw->drawable == pdraw->xDrawable)
-+	 (*pdraw->destroyDrawable)(pdraw);
-+      __glxHashDelete(priv->drawHash, gc->currentReadable);
-+   }
-+}
-+
- #endif /* GLX_DIRECT_RENDERING */
-diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h
-index 846a905..13b5ae4 100644
---- a/src/glx/dri_common.h
-+++ b/src/glx/dri_common.h
-@@ -55,6 +55,9 @@ extern void driDestroyConfigs(const __DRIconfig **configs);
- extern __GLXDRIdrawable *
- driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable);
- 
-+extern void
-+driReleaseDrawables(struct glx_context *gc);
-+
- extern const __DRIsystemTimeExtension systemTimeExtension;
- 
- extern void InfoMessageF(const char *f, ...);
-diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
-index 43a2aa4..42b263c 100644
---- a/src/glx/dri_glx.c
-+++ b/src/glx/dri_glx.c
-@@ -509,8 +509,6 @@ dri_destroy_context(struct glx_context * context)
-    if (context->extensions)
-       XFree((char *) context->extensions);
- 
--   GarbageCollectDRIDrawables(context->psc);
--
-    (*psc->core->destroyContext) (pcp->driContext);
- 
-    XF86DRIDestroyContext(psc->base.dpy, psc->base.scr, pcp->hwContextID);
-@@ -545,6 +543,8 @@ dri_unbind_context(struct glx_context *context, struct glx_context *new)
-    struct dri_screen *psc = (struct dri_screen *) pcp->base.psc;
- 
-    (*psc->core->unbindContext) (pcp->driContext);
-+
-+   driReleaseDrawables(&pcp->base);
- }
- 
- static const struct glx_context_vtable dri_context_vtable = {
-diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
-index c5b1791..237ce17 100644
---- a/src/glx/drisw_glx.c
-+++ b/src/glx/drisw_glx.c
-@@ -250,8 +250,6 @@ drisw_destroy_context(struct glx_context *context)
-    if (context->extensions)
-       XFree((char *) context->extensions);
- 
--   GarbageCollectDRIDrawables(context->psc);
--
-    (*psc->core->destroyContext) (pcp->driContext);
- 
-    Xfree(pcp);
-@@ -285,6 +283,8 @@ drisw_unbind_context(struct glx_context *context, struct glx_context *new)
-    struct drisw_screen *psc = (struct drisw_screen *) pcp->base.psc;
- 
-    (*psc->core->unbindContext) (pcp->driContext);
-+
-+   driReleaseDrawables(&pcp->base);
- }
- 
- static const struct glx_context_vtable drisw_context_vtable = {
-diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
-index 9575156..4f7e84e 100644
---- a/src/glx/glxcmds.c
-+++ b/src/glx/glxcmds.c
-@@ -63,56 +63,6 @@ static const char __glXGLXClientVersion[] = "1.4";
- 
- #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
- 
--static Bool windowExistsFlag;
--static int
--windowExistsErrorHandler(Display * dpy, XErrorEvent * xerr)
--{
--   (void) dpy;
--
--   if (xerr->error_code == BadWindow) {
--      windowExistsFlag = GL_FALSE;
--   }
--   return 0;
--}
--
--/**
-- * Find drawables in the local hash that have been destroyed on the
-- * server.
-- *
-- * \param dpy    Display to destroy drawables for
-- * \param screen Screen number to destroy drawables for
-- */
--_X_HIDDEN void
--GarbageCollectDRIDrawables(struct glx_screen * sc)
--{
--   XID draw;
--   __GLXDRIdrawable *pdraw;
--   struct glx_display *priv = sc->display;
--   XWindowAttributes xwa;
--   int (*oldXErrorHandler) (Display *, XErrorEvent *);
--
--   /* Set no-op error handler so Xlib doesn't bail out if the windows
--    * has alreay been destroyed on the server. */
--   XSync(priv->dpy, GL_FALSE);
--   oldXErrorHandler = XSetErrorHandler(windowExistsErrorHandler);
--
--   if (__glxHashFirst(priv->drawHash, &draw, (void *) &pdraw) == 1) {
--      do {
--         windowExistsFlag = GL_TRUE;
--         XGetWindowAttributes(priv->dpy, draw, &xwa); /* dummy request */
--         if (!windowExistsFlag) {
--            /* Destroy the local drawable data, if the drawable no
--               longer exists in the Xserver */
--            (*pdraw->destroyDrawable) (pdraw);
--            __glxHashDelete(priv->drawHash, draw);
--         }
--      } while (__glxHashNext(priv->drawHash, &draw, (void *) &pdraw) == 1);
--   }
--
--   XSync(priv->dpy, GL_FALSE);
--   XSetErrorHandler(oldXErrorHandler);
--}
--
- /**
-  * Get the __DRIdrawable for the drawable associated with a GLXContext
-  *
-diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
-index 98f66c2..710985b 100644
---- a/src/glx/glxcurrent.c
-+++ b/src/glx/glxcurrent.c
-@@ -242,13 +242,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
-       return False;
-    }
- 
--   if (oldGC != &dummyContext && oldGC != gc) {
-+   if (oldGC != &dummyContext) {
-       oldGC->vtable->unbind(oldGC, gc);
-       oldGC->currentDpy = 0;
-       oldGC->currentDrawable = None;
-       oldGC->currentReadable = None;
-       oldGC->thread_id = 0;
--      if (oldGC->xid == None)
-+      if (oldGC->xid == None && oldGC != gc)
- 	 /* We are switching away from a context that was
- 	  * previously destroyed, so we need to free the memory
- 	  * for the old handle.
-@@ -257,12 +257,12 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
-    }
- 
-    if (gc) {
--      ret = gc->vtable->bind(gc, oldGC, draw, read);
-       gc->currentDpy = dpy;
-       gc->currentDrawable = draw;
-       gc->currentReadable = read;
-       gc->thread_id = _glthread_GetID();
-       __glXSetCurrentContext(gc);
-+      ret = gc->vtable->bind(gc, oldGC, draw, read);
-    } else {
-       __glXSetCurrentContextNull();
-    }
-diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
-index 61ceed3..1870ede 100644
---- a/src/glx/indirect_glx.c
-+++ b/src/glx/indirect_glx.c
-@@ -168,6 +168,9 @@ indirect_unbind_context(struct glx_context *gc, struct glx_context *new)
-    int opcode = __glXSetupForCommand(dpy);
-    xGLXMakeCurrentReply reply;
- 
-+   if (gc == new)
-+      return;
-+   
-    /* We are either switching to no context, away from a indirect
-     * context to a direct context or from one dpy to another and have
-     * to send a request to the dpy to unbind the previous context.
diff --git a/debian/patches/series b/debian/patches/series
index 48ff057..c267c2b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,6 +7,3 @@
 101_ubuntu_hidden_glname.patch
 103_savage-expose_fbmodes_with_nonzero_alpha.patch
 104_i915_fragment_shader_disable.patch
-105_old_gc_ignore_destroyed_drawable_events.patch -R
-106_old_gc_fix_use_after_free.patch -R
-107_old_gc_drop_broken_drawable_garbage_collector.patch -R

commit 391df818b0020a9a901f4f1f67456bf2f80a115d
Author: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Date:   Thu Sep 16 15:40:05 2010 +0200

    Merge 0ubuntu2 from outside of git

diff --git a/debian/changelog b/debian/changelog
index d675d81..d35bd03 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+mesa (7.9~git20100909-0ubuntu2) maverick; urgency=low
+
+  * 105_old_gc_ignore_destroyed_drawable_events.patch (revert),
+    106_old_gc_fix_use_after_free.patch (revert),
+    107_old_gc_drop_broken_drawable_garbage_collector.patch (revert):
+    These three related patches introduced a new garbage collector, however
+    this introduces a regression causing clutter/mutter/unity to load with
+    a blank white screen.  Revert these three patches to restore mesa to
+    a working condition for unity.
+    (LP: #638808, #638725)
+
+ -- Bryce Harrington <bryce@ubuntu.com>  Wed, 15 Sep 2010 19:32:52 -0700
+
 mesa (7.9~git20100909-0ubuntu1) maverick; urgency=low
 
   [ Robert Hooker ]
@@ -14,7 +27,8 @@ mesa (7.9~git20100909-0ubuntu1) maverick; urgency=low
     instead.
   * Remove all references to mesa-utils now that its no longer shipped
     with the mesa source.
-  * Disable the experimental ARB_fragment_shader option by default on
+  * Add 104_i915_fragment_shader_disable.patch:
+    - Disable the experimental ARB_fragment_shader option by default on
     i915, it exposes incomplete functionality that breaks KDE compositing
     among other things. It can be enabled via driconf still. (LP: #628930)
 
diff --git a/debian/patches/105_old_gc_ignore_destroyed_drawable_events.patch b/debian/patches/105_old_gc_ignore_destroyed_drawable_events.patch
new file mode 100644
index 0000000..cf51117
--- /dev/null
+++ b/debian/patches/105_old_gc_ignore_destroyed_drawable_events.patch
@@ -0,0 +1,23 @@
+commit f24ec6367b1cf6c6822fa998df8a877288711427
+Author: Kristian Høgsberg <krh@bitplanet.net>
+Date:   Wed Sep 8 18:54:30 2010 -0400
+
+    glx: Ignore DRI2 event for drawables we've destroyed
+    
+    Since we now actually destroy GLX drawables, we get into situations where
+    we get events for drawables that no longer exist.  Just ignore the
+    event in that case.
+
+diff --git a/src/glx/dri2.c b/src/glx/dri2.c
+index d410898..30999c8 100644
+--- a/src/glx/dri2.c
++++ b/src/glx/dri2.c
+@@ -103,7 +103,7 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
+ 
+       /* Ignore swap events if we're not looking for them */
+       pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable);
+-      if (!(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
++      if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
+ 	 return False;
+ 
+       aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
diff --git a/debian/patches/106_old_gc_fix_use_after_free.patch b/debian/patches/106_old_gc_fix_use_after_free.patch
new file mode 100644
index 0000000..76cfb73
--- /dev/null
+++ b/debian/patches/106_old_gc_fix_use_after_free.patch
@@ -0,0 +1,37 @@
+commit 659dab6be6bc82f8a0551c30f1133e0010f04ed8
+Author: Kristian Høgsberg <krh@bitplanet.net>
+Date:   Wed Sep 8 14:51:18 2010 -0400
+
+    glx: Fix use after free problem
+
+diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
+index 710985b..0d359f7 100644
+--- a/src/glx/glxcurrent.c
++++ b/src/glx/glxcurrent.c
+@@ -248,12 +248,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
+       oldGC->currentDrawable = None;
+       oldGC->currentReadable = None;
+       oldGC->thread_id = 0;
+-      if (oldGC->xid == None && oldGC != gc)
+-	 /* We are switching away from a context that was
+-	  * previously destroyed, so we need to free the memory
+-	  * for the old handle.
+-	  */
+-	 oldGC->vtable->destroy(oldGC);
+    }
+ 
+    if (gc) {
+@@ -267,6 +261,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
+       __glXSetCurrentContextNull();
+    }
+ 
++   if (oldGC != &dummyContext && oldGC->xid == None && oldGC != gc) {
++      /* We are switching away from a context that was
++       * previously destroyed, so we need to free the memory
++       * for the old handle. */
++      oldGC->vtable->destroy(oldGC);
++   }
++
+    if (ret) {
+       __glXGenerateError(dpy, gc, None, ret, X_GLXMakeContextCurrent);
+       return GL_FALSE;
diff --git a/debian/patches/107_old_gc_drop_broken_drawable_garbage_collector.patch b/debian/patches/107_old_gc_drop_broken_drawable_garbage_collector.patch
new file mode 100644
index 0000000..c3139e5
--- /dev/null
+++ b/debian/patches/107_old_gc_drop_broken_drawable_garbage_collector.patch
@@ -0,0 +1,252 @@
+commit 16887d042a917fa4773e4d853f50051b54e9948c
+Author: Kristian Høgsberg <krh@bitplanet.net>
+Date:   Fri Aug 27 12:40:11 2010 -0400
+
+    glx: Drop broken drawable garbage collection
+    
+    Doesn't work for pixmaps, was looking up the GLX XID and was never thread
+    safe.  Instead, just destroy the client side structures when the
+    drawable is no long current for a context.
+
+diff --git a/src/glx/dri2.c b/src/glx/dri2.c
+index d70ec5a..d410898 100644
+--- a/src/glx/dri2.c
++++ b/src/glx/dri2.c
+@@ -175,6 +175,14 @@ DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code)
+ 	err->minorCode == X_DRI2CopyRegion)
+ 	return True;
+ 
++    /* If the X drawable was destroyed before the GLX drawable, the
++     * DRI2 drawble will be gone by the time we call
++     * DRI2DestroyDrawable.  So just ignore BadDrawable here. */
++    if (err->majorCode == codes->major_opcode &&
++	err->errorCode == BadDrawable &&
++	err->minorCode == X_DRI2DestroyDrawable)
++	return True;
++
+     return False;
+ }
+ 
+diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
+index ff48c79..e38a40c 100644
+--- a/src/glx/dri2_glx.c
++++ b/src/glx/dri2_glx.c
+@@ -124,8 +124,6 @@ dri2_destroy_context(struct glx_context *context)
+    if (context->extensions)
+       XFree((char *) context->extensions);
+ 
+-   GarbageCollectDRIDrawables(context->psc);
+-
+    (*psc->core->destroyContext) (pcp->driContext);
+ 
+    Xfree(pcp);
+@@ -159,6 +157,8 @@ dri2_unbind_context(struct glx_context *context, struct glx_context *new)
+    struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc;
+ 
+    (*psc->core->unbindContext) (pcp->driContext);
++
++   driReleaseDrawables(&pcp->base);
+ }
+ 
+ static struct glx_context *
+diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
+index a7fb4c6..5fb5255 100644
+--- a/src/glx/dri_common.c
++++ b/src/glx/dri_common.c
+@@ -380,4 +380,29 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
+    return pdraw;
+ }
+ 
++_X_HIDDEN void
++driReleaseDrawables(struct glx_context *gc)
++{
++   struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
++   __GLXDRIdrawable *pdraw;
++
++   if (priv == NULL)
++      return;
++
++   if (__glxHashLookup(priv->drawHash,
++		       gc->currentDrawable, (void *) &pdraw) == 0) {
++      if (pdraw->drawable == pdraw->xDrawable)
++	 (*pdraw->destroyDrawable)(pdraw);
++      __glxHashDelete(priv->drawHash, gc->currentDrawable);
++   }
++
++   if (gc->currentDrawable != gc->currentReadable &&
++       __glxHashLookup(priv->drawHash,
++		       gc->currentReadable, (void *) &pdraw) == 0) {
++      if (pdraw->drawable == pdraw->xDrawable)
++	 (*pdraw->destroyDrawable)(pdraw);
++      __glxHashDelete(priv->drawHash, gc->currentReadable);
++   }
++}
++
+ #endif /* GLX_DIRECT_RENDERING */
+diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h
+index 846a905..13b5ae4 100644
+--- a/src/glx/dri_common.h
++++ b/src/glx/dri_common.h
+@@ -55,6 +55,9 @@ extern void driDestroyConfigs(const __DRIconfig **configs);
+ extern __GLXDRIdrawable *
+ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable);
+ 
++extern void
++driReleaseDrawables(struct glx_context *gc);
++
+ extern const __DRIsystemTimeExtension systemTimeExtension;
+ 
+ extern void InfoMessageF(const char *f, ...);
+diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
+index 43a2aa4..42b263c 100644
+--- a/src/glx/dri_glx.c
++++ b/src/glx/dri_glx.c
+@@ -509,8 +509,6 @@ dri_destroy_context(struct glx_context * context)
+    if (context->extensions)
+       XFree((char *) context->extensions);
+ 
+-   GarbageCollectDRIDrawables(context->psc);
+-
+    (*psc->core->destroyContext) (pcp->driContext);
+ 
+    XF86DRIDestroyContext(psc->base.dpy, psc->base.scr, pcp->hwContextID);
+@@ -545,6 +543,8 @@ dri_unbind_context(struct glx_context *context, struct glx_context *new)
+    struct dri_screen *psc = (struct dri_screen *) pcp->base.psc;
+ 
+    (*psc->core->unbindContext) (pcp->driContext);
++
++   driReleaseDrawables(&pcp->base);
+ }
+ 
+ static const struct glx_context_vtable dri_context_vtable = {
+diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
+index c5b1791..237ce17 100644
+--- a/src/glx/drisw_glx.c
++++ b/src/glx/drisw_glx.c
+@@ -250,8 +250,6 @@ drisw_destroy_context(struct glx_context *context)
+    if (context->extensions)
+       XFree((char *) context->extensions);
+ 
+-   GarbageCollectDRIDrawables(context->psc);
+-
+    (*psc->core->destroyContext) (pcp->driContext);
+ 
+    Xfree(pcp);
+@@ -285,6 +283,8 @@ drisw_unbind_context(struct glx_context *context, struct glx_context *new)
+    struct drisw_screen *psc = (struct drisw_screen *) pcp->base.psc;
+ 
+    (*psc->core->unbindContext) (pcp->driContext);
++
++   driReleaseDrawables(&pcp->base);
+ }
+ 
+ static const struct glx_context_vtable drisw_context_vtable = {
+diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
+index 9575156..4f7e84e 100644
+--- a/src/glx/glxcmds.c
++++ b/src/glx/glxcmds.c
+@@ -63,56 +63,6 @@ static const char __glXGLXClientVersion[] = "1.4";
+ 
+ #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+ 
+-static Bool windowExistsFlag;
+-static int
+-windowExistsErrorHandler(Display * dpy, XErrorEvent * xerr)
+-{
+-   (void) dpy;
+-
+-   if (xerr->error_code == BadWindow) {
+-      windowExistsFlag = GL_FALSE;
+-   }
+-   return 0;
+-}
+-
+-/**
+- * Find drawables in the local hash that have been destroyed on the
+- * server.
+- *
+- * \param dpy    Display to destroy drawables for
+- * \param screen Screen number to destroy drawables for
+- */
+-_X_HIDDEN void
+-GarbageCollectDRIDrawables(struct glx_screen * sc)
+-{
+-   XID draw;
+-   __GLXDRIdrawable *pdraw;
+-   struct glx_display *priv = sc->display;
+-   XWindowAttributes xwa;
+-   int (*oldXErrorHandler) (Display *, XErrorEvent *);
+-
+-   /* Set no-op error handler so Xlib doesn't bail out if the windows
+-    * has alreay been destroyed on the server. */
+-   XSync(priv->dpy, GL_FALSE);
+-   oldXErrorHandler = XSetErrorHandler(windowExistsErrorHandler);
+-
+-   if (__glxHashFirst(priv->drawHash, &draw, (void *) &pdraw) == 1) {
+-      do {
+-         windowExistsFlag = GL_TRUE;
+-         XGetWindowAttributes(priv->dpy, draw, &xwa); /* dummy request */
+-         if (!windowExistsFlag) {
+-            /* Destroy the local drawable data, if the drawable no
+-               longer exists in the Xserver */
+-            (*pdraw->destroyDrawable) (pdraw);
+-            __glxHashDelete(priv->drawHash, draw);
+-         }
+-      } while (__glxHashNext(priv->drawHash, &draw, (void *) &pdraw) == 1);
+-   }
+-
+-   XSync(priv->dpy, GL_FALSE);
+-   XSetErrorHandler(oldXErrorHandler);
+-}
+-
+ /**
+  * Get the __DRIdrawable for the drawable associated with a GLXContext
+  *
+diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
+index 98f66c2..710985b 100644
+--- a/src/glx/glxcurrent.c
++++ b/src/glx/glxcurrent.c
+@@ -242,13 +242,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
+       return False;
+    }
+ 
+-   if (oldGC != &dummyContext && oldGC != gc) {
++   if (oldGC != &dummyContext) {
+       oldGC->vtable->unbind(oldGC, gc);
+       oldGC->currentDpy = 0;
+       oldGC->currentDrawable = None;
+       oldGC->currentReadable = None;
+       oldGC->thread_id = 0;
+-      if (oldGC->xid == None)
++      if (oldGC->xid == None && oldGC != gc)
+ 	 /* We are switching away from a context that was
+ 	  * previously destroyed, so we need to free the memory
+ 	  * for the old handle.
+@@ -257,12 +257,12 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
+    }
+ 
+    if (gc) {
+-      ret = gc->vtable->bind(gc, oldGC, draw, read);
+       gc->currentDpy = dpy;
+       gc->currentDrawable = draw;
+       gc->currentReadable = read;
+       gc->thread_id = _glthread_GetID();
+       __glXSetCurrentContext(gc);
++      ret = gc->vtable->bind(gc, oldGC, draw, read);
+    } else {
+       __glXSetCurrentContextNull();
+    }
+diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
+index 61ceed3..1870ede 100644
+--- a/src/glx/indirect_glx.c
++++ b/src/glx/indirect_glx.c
+@@ -168,6 +168,9 @@ indirect_unbind_context(struct glx_context *gc, struct glx_context *new)
+    int opcode = __glXSetupForCommand(dpy);
+    xGLXMakeCurrentReply reply;
+ 
++   if (gc == new)
++      return;
++   
+    /* We are either switching to no context, away from a indirect
+     * context to a direct context or from one dpy to another and have
+     * to send a request to the dpy to unbind the previous context.
diff --git a/debian/patches/series b/debian/patches/series
index c267c2b..48ff057 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,6 @@
 101_ubuntu_hidden_glname.patch
 103_savage-expose_fbmodes_with_nonzero_alpha.patch
 104_i915_fragment_shader_disable.patch
+105_old_gc_ignore_destroyed_drawable_events.patch -R
+106_old_gc_fix_use_after_free.patch -R
+107_old_gc_drop_broken_drawable_garbage_collector.patch -R


Reply to: