xserver: Branch 'master' - 3 commits

Keith Packard keithp at kemper.freedesktop.org
Wed Jan 27 14:48:26 PST 2010


 hw/xfree86/dri2/dri2.c |   42 +++++++++++++++++++++++++++---------------
 test/input.c           |    4 +++-
 2 files changed, 30 insertions(+), 16 deletions(-)

New commits:
commit b4baab90c0d98bef98d485682d4a69a327a380d6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jan 8 15:18:41 2010 +1000

    dix: EventToCore needs to copy the root window too.
    
    This value isn't actually set for normal events but it saves us some work
    for the record extension support.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index e25f3ee..878dba5 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -119,6 +119,7 @@ EventToCore(InternalEvent *event, xEvent *core)
                 core->u.keyButtonPointer.rootX = e->root_x;
                 core->u.keyButtonPointer.rootY = e->root_y;
                 core->u.keyButtonPointer.state = e->corestate;
+                core->u.keyButtonPointer.root = e->root;
                 EventSetKeyRepeatFlag(core, (e->type == ET_KeyPress && e->key_repeat));
             }
             break;
diff --git a/test/input.c b/test/input.c
index 2de55bc..63d1a18 100644
--- a/test/input.c
+++ b/test/input.c
@@ -153,6 +153,7 @@ static void dix_event_to_core(int type)
     int rc;
     int state;
     int detail;
+    const int ROOT_WINDOW_ID = 0x100;
 
     /* EventToCore memsets the event to 0 */
 #define test_event() \
@@ -165,7 +166,7 @@ static void dix_event_to_core(int type)
     g_assert(core.u.keyButtonPointer.state == state); \
     g_assert(core.u.keyButtonPointer.eventX == 0); \
     g_assert(core.u.keyButtonPointer.eventY == 0); \
-    g_assert(core.u.keyButtonPointer.root == 0); \
+    g_assert(core.u.keyButtonPointer.root == ROOT_WINDOW_ID); \
     g_assert(core.u.keyButtonPointer.event == 0); \
     g_assert(core.u.keyButtonPointer.child == 0); \
     g_assert(core.u.keyButtonPointer.sameScreen == FALSE);
@@ -181,6 +182,7 @@ static void dix_event_to_core(int type)
     ev.time     = time;
     ev.root_y   = x;
     ev.root_x   = y;
+    ev.root     = ROOT_WINDOW_ID;
     ev.corestate = state;
     ev.detail.key = detail;
 
commit 27fc98ecfed99fefd5c14388b4c6242f87281895
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Jan 27 14:37:32 2010 -0800

    Revert "dix: EventToCore needs to copy the root window too."
    
    This reverts commit 0f2d297dedeff8bd227df4c498cc668b0e902344.
    
    Peter provided an updated patch which fixes the tests.

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 878dba5..e25f3ee 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -119,7 +119,6 @@ EventToCore(InternalEvent *event, xEvent *core)
                 core->u.keyButtonPointer.rootX = e->root_x;
                 core->u.keyButtonPointer.rootY = e->root_y;
                 core->u.keyButtonPointer.state = e->corestate;
-                core->u.keyButtonPointer.root = e->root;
                 EventSetKeyRepeatFlag(core, (e->type == ET_KeyPress && e->key_repeat));
             }
             break;
commit 711e26466ae04ae93ff4c48d377d83d68a6320e9
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Mon Jan 25 09:21:51 2010 -0800

    DRI2: handle drawable destruction properly at DRI2SwapComplete time
    
    Simon reported an issue with kwin that turned out to be a general problem.  If
    a drawable goes away before its swap completes, we'll try to free it up.
    However, we free it improperly, which causes a server crash in
    DRI2DestroyDrawable.  Fix that up by splitting the free code out and calling
    it from DRI2SwapComplete.
    
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
    Reviewed-by: Michel Dänzer <michel at daenzer.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 3d0fa75..587a928 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -158,6 +158,31 @@ DRI2CreateDrawable(DrawablePtr pDraw)
     return Success;
 }
 
+static void
+DRI2FreeDrawable(DrawablePtr pDraw)
+{
+    DRI2DrawablePtr pPriv;
+    WindowPtr  	    pWin;
+    PixmapPtr	    pPixmap;
+
+    pPriv = DRI2GetDrawable(pDraw);
+    if (pPriv == NULL)
+	return;
+
+    xfree(pPriv);
+
+    if (pDraw->type == DRAWABLE_WINDOW)
+    {
+	pWin = (WindowPtr) pDraw;
+	dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
+    }
+    else
+    {
+	pPixmap = (PixmapPtr) pDraw;
+	dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
+    }
+}
+
 static int
 find_attachment(DRI2DrawablePtr pPriv, unsigned attachment)
 {
@@ -508,7 +533,7 @@ DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame,
     if (pPriv->refCount == 0) {
         xf86DrvMsg(pScreen->myNum, X_ERROR,
 		   "[DRI2] %s: bad drawable refcount\n", __func__);
-	xfree(pPriv);
+	DRI2FreeDrawable(pDraw);
 	return;
     }
 
@@ -729,8 +754,6 @@ DRI2DestroyDrawable(DrawablePtr pDraw)
 {
     DRI2ScreenPtr   ds = DRI2GetScreen(pDraw->pScreen);
     DRI2DrawablePtr pPriv;
-    WindowPtr  	    pWin;
-    PixmapPtr	    pPixmap;
 
     pPriv = DRI2GetDrawable(pDraw);
     if (pPriv == NULL)
@@ -753,18 +776,7 @@ DRI2DestroyDrawable(DrawablePtr pDraw)
      * actually free the priv yet.  We'll need it in the DRI2SwapComplete()
      * callback and we'll free it there once we're done. */
     if (!pPriv->swapsPending)
-	xfree(pPriv);
-
-    if (pDraw->type == DRAWABLE_WINDOW)
-    {
-	pWin = (WindowPtr) pDraw;
-	dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
-    }
-    else
-    {
-	pPixmap = (PixmapPtr) pDraw;
-	dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
-    }
+	DRI2FreeDrawable(pDraw);
 }
 
 Bool


More information about the xorg-commit mailing list