xserver: Branch 'master' - 2 commits

Donnie Berkholz dberkholz at kemper.freedesktop.org
Fri Mar 14 18:43:49 PDT 2008


 hw/kdrive/ephyr/Makefile.am |    1 +
 hw/kdrive/ephyr/XF86dri.c   |   37 +++++++++++++++++++++++++++++--------
 2 files changed, 30 insertions(+), 8 deletions(-)

New commits:
commit aa231f28d56402d7daea6cbd3002fbf760f79497
Author: Donnie Berkholz <dberkholz at gentoo.org>
Date:   Fri Mar 14 18:41:25 2008 -0700

    Xephyr: Build fix: Port across XF86dri.c changes from Mesa.

diff --git a/hw/kdrive/ephyr/XF86dri.c b/hw/kdrive/ephyr/XF86dri.c
index 506d7be..e656ff5 100644
--- a/hw/kdrive/ephyr/XF86dri.c
+++ b/hw/kdrive/ephyr/XF86dri.c
@@ -385,9 +385,8 @@ Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
 					   context, hHWContext );
 }
 
-GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context)
+GLboolean XF86DRIDestroyContext( Display *dpy, int screen, XID context)
 {
-    Display * const dpy = (Display *) ndpy;
     XExtDisplayInfo *info = find_display (dpy);
     xXF86DRIDestroyContextReq *req;
 
@@ -407,10 +406,9 @@ GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid
 }
 
 GLboolean
-XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
-                       __DRIid drawable, drm_drawable_t * hHWDrawable)
+XF86DRICreateDrawable (Display *dpy, int screen,
+                       XID drawable, drm_drawable_t * hHWDrawable)
 {
-    Display * const dpy = (Display *) ndpy;
     XExtDisplayInfo *info = find_display (dpy);
     xXF86DRICreateDrawableReply rep;
     xXF86DRICreateDrawableReq *req;
@@ -437,16 +435,36 @@ XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
     return True;
 }
 
-GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
-    __DRIid drawable )
+static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
+{
+    return 0;
+}
+
+GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
+    XID drawable )
 {
-    Display * const dpy = (Display *) ndpy;
     XExtDisplayInfo *info = find_display (dpy);
     xXF86DRIDestroyDrawableReq *req;
+    int (*oldXErrorHandler)(Display *, XErrorEvent *);
 
     TRACE("DestroyDrawable...");
     XF86DRICheckExtension (dpy, info, False);
 
+    /* This is called from the DRI driver, which used call it like this
+     *
+     *   if (windowExists(drawable))
+     *     destroyDrawable(drawable);
+     *
+     * which is a textbook race condition - the window may disappear
+     * from the server between checking for its existance and
+     * destroying it.  Instead we change the semantics of
+     * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
+     * the windows is gone, by wrapping the destroy call in an error
+     * handler. */
+
+    XSync(dpy, GL_FALSE);
+    oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
+
     LockDisplay(dpy);
     GetReq(XF86DRIDestroyDrawable, req);
     req->reqType = info->codes->major_opcode;
@@ -455,6 +473,9 @@ GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
     req->drawable = drawable;
     UnlockDisplay(dpy);
     SyncHandle();
+
+    XSetErrorHandler(oldXErrorHandler);
+
     TRACE("DestroyDrawable... return True");
     return True;
 }
commit a955c3b587b22b8bf20cb6bedbbec4ad5fcb32ac
Author: Donnie Berkholz <dberkholz at gentoo.org>
Date:   Fri Mar 14 18:41:07 2008 -0700

    Xephyr: Distribute ephyrdriext.h in tarballs.

diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index d025c20..81d3d69 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -35,6 +35,7 @@ if XEPHYR_HAS_DRI
 
 libxephyr_hostdri_a_SOURCES= \
 ephyrdriext.c	\
+ephyrdriext.h	\
 ephyrdri.c	\
 ephyrdri.h	\
 XF86dri.c	\


More information about the xorg-commit mailing list