[Xquartz-changes] xserver: Branch 'server-1.8-apple' - 40 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Wed Mar 10 23:54:18 PST 2010


Rebased ref, commits from common ancestor:
commit 0e97acaf8c8d6affcdd0b3398f3179acb213b975
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jan 15 11:39:36 2010 +1000

    dix: if owner-events is true for passive grabs, add the window mask (#25400)
    
    A client requesting a GrabModeSync button grab, owner-events true, with only
    the ButtonRelease mask set would never receive the press event even if the
    grab window had the ButtonPress mask set.
    
    The protocol requires that if owner-events is true, then the delivery mask
    is the combination of the grab mask + the window event mask.
    
    X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Jim Ramsay <i.am at jimramsay.com>

diff --git a/dix/events.c b/dix/events.c
index 8af8c5a..9abeaec 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3578,6 +3578,8 @@ CheckPassiveGrabsOnWindow(
                 xE = &core;
                 count = 1;
                 mask = grab->eventMask;
+                if (grab->ownerEvents)
+                    mask |= pWin->eventMask;
             } else if (match & XI2_MATCH)
             {
                 rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3599,6 +3601,24 @@ CheckPassiveGrabsOnWindow(
                     mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
                 else if (event->type == XI_Enter || event->type == XI_FocusIn)
                     mask = grab->xi2mask[device->id][event->type/8];
+
+                if (grab->ownerEvents && wOtherInputMasks(grab->window))
+                {
+                    InputClientsPtr icp =
+                        wOtherInputMasks(grab->window)->inputClients;
+
+                    while(icp)
+                    {
+                        if (rClient(icp) == rClient(grab))
+                        {
+                            int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type;
+                            mask |= icp->xi2mask[device->id][evtype/8];
+                            break;
+                        }
+
+                        icp = icp->next;
+                    }
+                }
             } else
             {
                 rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3610,6 +3630,22 @@ CheckPassiveGrabsOnWindow(
                     continue;
                 }
                 mask = grab->eventMask;
+                if (grab->ownerEvents && wOtherInputMasks(grab->window))
+                {
+                    InputClientsPtr icp =
+                        wOtherInputMasks(grab->window)->inputClients;
+
+                    while(icp)
+                    {
+                        if (rClient(icp) == rClient(grab))
+                        {
+                            mask |= icp->mask[device->id];
+                            break;
+                        }
+
+                        icp = icp->next;
+                    }
+                }
             }
 
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
commit 7d94919ccaa7aa91da8c4812c5fb7cf615fce2fb
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 12 19:48:52 2010 -0800

    fb: Revert fb changes that broke XQuartz
    
    http://bugs.freedesktop.org/show_bug.cgi?id=26124
    
    Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
    Revert "fb: Adjust transform or composite coordinates for pixman operations"
    
    http://bugs.freedesktop.org/26124
    
    This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
    This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/fb/fb.h b/fb/fb.h
index 02d6c03..ed21f9e 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2082,11 +2082,8 @@ fbFillRegionSolid (DrawablePtr	pDrawable,
 		   FbBits	xor);
 
 extern _X_EXPORT pixman_image_t *
-image_from_pict (PicturePtr	pict,
-		 Bool		has_clip,
-		 int		*xoff,
-		 int		*yoff);
-
+image_from_pict (PicturePtr pict,
+		 Bool       has_clip);
 extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
 
 #endif /* _FB_H_ */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index dddfce8..07a2286 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -158,24 +158,19 @@ fbComposite (CARD8      op,
 	     CARD16     height)
 {
     pixman_image_t *src, *mask, *dest;
-    int src_xoff, src_yoff;
-    int msk_xoff, msk_yoff;
-    int dst_xoff, dst_yoff;
     
     miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
     if (pMask)
 	miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
     
-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
-    mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
-    dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+    src = image_from_pict (pSrc, TRUE);
+    mask = image_from_pict (pMask, TRUE);
+    dest = image_from_pict (pDst, TRUE);
 
     if (src && dest && !(pMask && !mask))
     {
 	pixman_image_composite (op, src, mask, dest,
-				xSrc + src_xoff, ySrc + src_yoff,
-				xMask + msk_xoff, yMask + msk_yoff,
-				xDst + dst_xoff, yDst + dst_yoff,
+				xSrc, ySrc, xMask, yMask, xDst, yDst,
 				width, height);
     }
 
@@ -275,22 +270,22 @@ create_conical_gradient_image (PictGradient *gradient)
 
 static pixman_image_t *
 create_bits_picture (PicturePtr pict,
-		     Bool       has_clip,
-		     int	*xoff,
-		     int	*yoff)
+		     Bool       has_clip)
 {
-    PixmapPtr pixmap;
     FbBits *bits;
     FbStride stride;
-    int bpp;
+    int bpp, xoff, yoff;
     pixman_image_t *image;
     
-    fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
-    fbGetPixmapBitsData(pixmap, bits, stride, bpp);
+    fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+
+    bits = (FbBits*)((CARD8*)bits +
+		     (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
+		     (pict->pDrawable->x + xoff) * (bpp / 8));
 
     image = pixman_image_create_bits (
 	pict->format,
-	pixmap->drawable.width, pixmap->drawable.height,
+	pict->pDrawable->width, pict->pDrawable->height,
 	(uint32_t *)bits, stride * sizeof (FbStride));
     
     
@@ -316,52 +311,30 @@ create_bits_picture (PicturePtr pict,
 	if (pict->clientClipType != CT_NONE)
 	    pixman_image_set_has_client_clip (image, TRUE);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+	pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
 
 	pixman_image_set_clip_region (image, pict->pCompositeClip);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+	pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
     }
     
     /* Indexed table */
     if (pict->pFormat->index.devPrivate)
 	pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
 
-    /* Add in drawable origin to position within the image */
-    *xoff += pict->pDrawable->x;
-    *yoff += pict->pDrawable->y;
-
     return image;
 }
 
 static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+set_image_properties (pixman_image_t *image, PicturePtr pict)
 {
     pixman_repeat_t repeat;
     pixman_filter_t filter;
     
     if (pict->transform)
     {
-	/* For source images, adjust the transform to account
-	 * for the drawable offset within the pixman image,
-	 * then set the offset to 0 as it will be used
-	 * to compute positions within the transformed image.
-	 */
-	if (!has_clip) {
-	    struct pixman_transform	adjusted;
-
-	    adjusted = *pict->transform;
-	    pixman_transform_translate(&adjusted,
-				       NULL,
-				       pixman_int_to_fixed(*xoff),
-				       pixman_int_to_fixed(*yoff));
-	    pixman_image_set_transform (image, &adjusted);
-	    *xoff = 0;
-	    *yoff = 0;
-	} else
-	    pixman_image_set_transform (image, pict->transform);
+	pixman_image_set_transform (
+	    image, (pixman_transform_t *)pict->transform);
     }
     
     switch (pict->repeatType)
@@ -388,8 +361,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
     
     if (pict->alphaMap)
     {
-	int alpha_xoff, alpha_yoff;
-	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff);
+	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, TRUE);
 	
 	pixman_image_set_alpha_map (
 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -422,7 +394,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
 }
 
 pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict,
+		 Bool has_clip)
 {
     pixman_image_t *image = NULL;
 
@@ -431,7 +404,7 @@ image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
 
     if (pict->pDrawable)
     {
-	image = create_bits_picture (pict, has_clip, xoff, yoff);
+	image = create_bits_picture (pict, has_clip);
     }
     else if (pict->pSourcePict)
     {
@@ -452,11 +425,10 @@ image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
 	    else if (sp->type == SourcePictTypeConical)
 		image = create_conical_gradient_image (gradient);
 	}
-	*xoff = *yoff = 0;
     }
     
     if (image)
-	set_image_properties (image, pict, has_clip, xoff, yoff);
+	set_image_properties (image, pict);
     
     return image;
 }
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 515e2e1..830603a 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -40,8 +40,7 @@ fbAddTraps (PicturePtr	pPicture,
 	    int		ntrap,
 	    xTrap	*traps)
 {
-    int image_xoff, image_yoff;
-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
 
     if (!image)
 	return;
@@ -57,8 +56,7 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
 		      int	    x_off,
 		      int	    y_off)
 {
-    int	mask_xoff, mask_yoff;
-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff);
+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
 
     if (!image)
 	return;
commit 5797072dbfcb773c5df73b9156bc2683d1245475
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Feb 10 15:52:14 2010 -0800

    XQuartz: Use an empty xkb keymap by default
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 3feacdc..066f5a5 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -45,6 +45,7 @@
 #include "site.h"
 #include "globals.h"
 #include "dix.h"
+#include "xkbsrv.h"
 
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
@@ -461,6 +462,11 @@ int DarwinParseModifierList(const char *constmodifiers, int separatelr)
  */
 void InitInput( int argc, char **argv )
 {
+    XkbRMLVOSet rmlvo = { .rules = "base", .model = "empty", .layout = "empty",
+                          .variant = NULL, .options = NULL };
+    /* We need to really have rules... or something... */
+    XkbSetRulesDflts(&rmlvo);
+
     darwinKeyboard = AddInputDevice(serverClient, DarwinKeybdProc, TRUE);
     RegisterKeyboardDevice( darwinKeyboard );
     darwinKeyboard->name = strdup("keyboard");
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 3b4eac3..7e36a9a 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -301,9 +301,6 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
     // for a kIOHIDParamConnectType connection.
     assert(darwinParamConnect = NXOpenEventStatus());
 
-    /* We need to really have rules... or something... */
-    //XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
-
     InitKeyboardDeviceStruct(pDev, NULL, DarwinKeyboardBell, DarwinChangeKeyboardControl);
 
     DarwinKeyboardReloadHandler();
@@ -775,12 +772,9 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
 #endif
         }
 
-        // There seems to be an issue with this in 1.5+, shift-space is not
-        // producing space, it's sending NoSymbol... ?
-        //if (k[3] == k[2]) k[3] = NoSymbol;
-        //if (k[1] == k[0]) k[1] = NoSymbol;
-        //if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
-        //if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] = NoSymbol;
+        if (k[3] == k[2]) k[3] = NoSymbol;
+        if (k[1] == k[0]) k[1] = NoSymbol;
+        if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
     }
 
     /* Fix up some things that are normally missing.. */
@@ -791,7 +785,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
 
             if    (k[0] == NoSymbol && k[1] == NoSymbol
                 && k[2] == NoSymbol && k[3] == NoSymbol)
-	      k[0] = k[1] = k[2] = k[3] = known_keys[i].keysym;
+	      k[0] = known_keys[i].keysym;
         }
     }
 
@@ -804,7 +798,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
             k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
 
             if (k[0] == known_numeric_keys[i].normal)
-                k[0] = k[1] = k[2] = k[3] = known_numeric_keys[i].keypad;
+                k[0] = known_numeric_keys[i].keypad;
         }
     }
 
commit f2eacb4646beb25d055de22868f93e6b24f229b6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Mar 10 09:39:05 2010 +1000

    Revert "dix: Use DeliverGrabbedEvent for implicit passive grabs (#25400)"
    
    Several users have pointed out that this commit introduces regressions, most
    notably perhaps fluxbox which essentially stops working after a few clicks.
    
    This reverts commit cf72b5437d2d620521279077a29c5df6d0fbb576.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index 1611f7d..8af8c5a 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3462,6 +3462,7 @@ CheckPassiveGrabsOnWindow(
     {
 	DeviceIntPtr	gdev;
 	XkbSrvInfoPtr	xkbi = NULL;
+	Mask		mask = 0;
 
 	gdev= grab->modifierDevice;
         if (grab->grabtype == GRABTYPE_CORE)
@@ -3514,6 +3515,10 @@ CheckPassiveGrabsOnWindow(
 	     (grab->confineTo->realized &&
 				BorderSizeNotEmpty(device, grab->confineTo))))
 	{
+            int rc, count = 0;
+            xEvent *xE = NULL;
+            xEvent core;
+
             event->corestate &= 0x1f00;
             event->corestate |= tempGrab.modifiersDetail.exact & (~0x1f00);
             grabinfo = &device->deviceGrab;
@@ -3560,8 +3565,62 @@ CheckPassiveGrabsOnWindow(
             }
 
 
+            if (match & CORE_MATCH)
+            {
+                rc = EventToCore((InternalEvent*)event, &core);
+                if (rc != Success)
+                {
+                    if (rc != BadMatch)
+                        ErrorF("[dix] %s: core conversion failed in CPGFW "
+                                "(%d, %d).\n", device->name, event->type, rc);
+                    continue;
+                }
+                xE = &core;
+                count = 1;
+                mask = grab->eventMask;
+            } else if (match & XI2_MATCH)
+            {
+                rc = EventToXI2((InternalEvent*)event, &xE);
+                if (rc != Success)
+                {
+                    if (rc != BadMatch)
+                        ErrorF("[dix] %s: XI2 conversion failed in CPGFW "
+                                "(%d, %d).\n", device->name, event->type, rc);
+                    continue;
+                }
+                count = 1;
+
+                /* FIXME: EventToXI2 returns NULL for enter events, so
+                 * dereferencing the event is bad. Internal event types are
+                 * aligned with core events, so the else clause is valid.
+                 * long-term we should use internal events for enter/focus
+                 * as well */
+                if (xE)
+                    mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
+                else if (event->type == XI_Enter || event->type == XI_FocusIn)
+                    mask = grab->xi2mask[device->id][event->type/8];
+            } else
+            {
+                rc = EventToXI((InternalEvent*)event, &xE, &count);
+                if (rc != Success)
+                {
+                    if (rc != BadMatch)
+                        ErrorF("[dix] %s: XI conversion failed in CPGFW "
+                                "(%d, %d).\n", device->name, event->type, rc);
+                    continue;
+                }
+                mask = grab->eventMask;
+            }
+
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
-            DeliverGrabbedEvent((InternalEvent*)event, device, FALSE);
+
+            if (xE)
+            {
+                FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
+
+                TryClientEvents(rClient(grab), device, xE, count, mask,
+                                       GetEventFilter(device, xE), grab);
+            }
 
 	    if (grabinfo->sync.state == FROZEN_NO_EVENT)
 	    {
@@ -3571,6 +3630,8 @@ CheckPassiveGrabsOnWindow(
 		grabinfo->sync.state = FROZEN_WITH_EVENT;
             }
 
+            if (match & (XI_MATCH | XI2_MATCH))
+                xfree(xE); /* on core match xE == &core */
 	    return TRUE;
 	}
     }
commit df9f3273041c6c3e0da2d2254e8c156cd582e296
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Mar 10 09:24:32 2010 +1000

    xfree86: fix xf86Config.c build error in --enable-debug mode. (#26971)
    
    xf86Config.c: In function 'configInputDevices':
    xf86Config.c:1514: error: request for member 'lay_identifier' in something
    not a structure or union
    make[5]: *** [xf86Config.lo] Error 1
    
    Introduced with e1165632bdfbd720889ed1adf5f7ab338032c0ee.
    
    X.Org Bug 26971 <http://bugs.freedesktop.org/show_bug.cgi?id=26971>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 65725d2..718a078 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1503,7 +1503,7 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
 	irp = (XF86ConfInputrefPtr)irp->list.next;
     }
     DebugF("Found %d input devices in the layout section %s\n",
-	    count, layout.lay_identifier);
+	    count, layout->lay_identifier);
     indp = xnfcalloc((count + 1), sizeof(IDevPtr));
     indp[count] = NULL;
     irp = layout->lay_input_lst;
commit 116068103282924ef1476231d13d54719a797252
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Mar 9 09:35:23 2010 +1000

    xfree86: don't warn about nonexisting core pointer/keyboard in config.
    
    In the vast majority of cases there is no xorg.conf that specifies a core
    pointer/keyboard. Skip this warning, since we'll get another notification
    about how the server relies on the config backend for input devices anyway.
    
    Leave the warning in for the error case (AEI off).
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Fernando Carrijo <fcarrijo at yahoo.com.br>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 132e8bc..65725d2 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1286,14 +1286,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
 	}
     }
 
-    if (!foundPointer) {
-	if (!xf86Info.allowEmptyInput) {
-	    /* This shouldn't happen. */
-	    xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
-	    return FALSE;
-	} else {
-	    xf86Msg(X_INFO, "Cannot locate a core pointer device.\n");
-	}
+    if (!foundPointer && !xf86Info.allowEmptyInput) {
+	/* This shouldn't happen. */
+	xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
+	return FALSE;
     }
 
     /*
@@ -1430,14 +1426,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
 	}
     }
 
-    if (!foundKeyboard) {
-	if (!xf86Info.allowEmptyInput) {
-		/* This shouldn't happen. */
-		xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
-		return FALSE;
-	} else {
-		xf86Msg(X_INFO, "Cannot locate a core keyboard device.\n");
-	}
+    if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+	/* This shouldn't happen. */
+	xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
+	return FALSE;
     }
 
     if (pointerMsg) {
commit c39c8ece9bd3ce025549f4bac7794f5a62266f4a
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Feb 10 15:06:52 2010 +1000

    os: remove INTERNAL_MALLOC define.
    
    There doesn't seem to be anything that defines it and given that the
    counterpart (the X internal malloc) was removed in
    01cfba75229f4b9bf1e4fe80814931acdacde14c it's unlikely to work anyway.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/utils.c b/os/utils.c
index 21e25e0..5a5a203 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1032,8 +1032,6 @@ set_font_authorizations(char **authorizations, int *authlen, pointer client)
 #endif /* TCPCONN */
 }
 
-#ifndef INTERNAL_MALLOC
-
 void *
 Xalloc(unsigned long amount)
 {
@@ -1149,7 +1147,6 @@ Xfree(pointer ptr)
     if (ptr)
 	free(ptr); 
 }
-#endif /* !INTERNAL_MALLOC */
 
 
 char *
commit 9f462ff9082634719e64d2d8d4dbd09ec7deaf2e
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 26 14:02:09 2010 +1000

    dix: Clip only into axis ranges if we're in absolute mode. (#26543)
    
    An absolute device in relative mode may provide valuators outside of the
    axis range. Clipping back into the range prevents screen crossings in a
    multi-screen (Xinerama) setup as the required screen edge for crossing is
    never met: miPointerSetPosition crosses the screen conditional to the X
    coordinate being equal to the screen width or _less than_ 0. While the
    former can be met when clipping into the coordinate range and scaling, the
    latter cannot, resulting in a mouse pointer that gets stuck on the rightmost
    screen.
    
    This patch only applies axis clipping for valuators in mode Absolute. If
    relative, we allow the values to get above/below the axis ranges. Doesn't
    matter, miPointerSetPosition will reset the values to the allowed range even
    if no screen was crossed.
    This leads to interesting values provided to clients, the valuator range of
    the device resets once a screen is crossed and essentially reflects
    the position of the cursor on the screen - scaled into the valuator range.
    The values themselves are valid given the range though.
    
    In theory, the XI1 specs require that a relative device has a min/max range
    of 0/0. This doesn't really go well with devices that actually can switch
    mode between relative and absolute since they would have to reset their axis
    range when switching. If multiple XI clients are in use, we have no method
    of notifying them about the changes, so other clients may continue to use
    the wrong axis ranges (note: XI1 wasn't really designed to have multiple
    clients use a device). Expecting all relative devices to have this min/max
    of 0 is unrealistic at this point.
    
    So pick what is possibly the lesser of all evils, pass the beer and despair.
    
    X.Org Bug 26543 <http://bugs.freedesktop.org/show_bug.cgi?id=26543>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/getevents.c b/dix/getevents.c
index 82bb77b..197deb4 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -710,7 +710,7 @@ moveRelative(DeviceIntPtr dev, int *x, int *y,
     /* if attached, clip both x and y to the defined limits (usually
      * co-ord space limit). If it is attached, we need x/y to go over the
      * limits to be able to change screens. */
-    if(dev->u.master) {
+    if(dev->u.master && dev->valuator->mode == Absolute) {
         clipAxis(dev, 0, x);
         clipAxis(dev, 1, y);
     }
@@ -720,7 +720,8 @@ moveRelative(DeviceIntPtr dev, int *x, int *y,
     for (; i < num; i++)
     {
         dev->last.valuators[i + first] += valuators[i];
-        clipAxis(dev, i, &dev->last.valuators[i + first]);
+        if (dev->valuator->mode == Absolute)
+            clipAxis(dev, i, &dev->last.valuators[i + first]);
         valuators[i] = dev->last.valuators[i + first];
     }
 }
commit bbae92795c7eab062e6722c42fa7915e0cee5d69
Author: Matt Turner <mattst88 at gmail.com>
Date:   Mon Feb 15 20:08:09 2010 -0500

    Replace assembly with generic unaligned access code
    
    Removes Alpha assembly, and probably works around unaligned accesses on
    other sensitive platforms.
    
    Signed-off-by: Matt Turner <mattst88 at gmail.com>
    Acked-by: Adam Jackson <ajax at redhat.com>
    Compiled-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/x86emu/sys.c b/hw/xfree86/x86emu/sys.c
index e15fb09..602b0bb 100644
--- a/hw/xfree86/x86emu/sys.c
+++ b/hw/xfree86/x86emu/sys.c
@@ -48,168 +48,104 @@
 #ifndef NO_SYS_HEADERS
 #include <string.h>
 #endif                                                                                           
-/*------------------------- Global Variables ------------------------------*/
 
-X86EMU_sysEnv		_X86EMU_env;		/* Global emulator machine state */
-X86EMU_intrFuncs	_X86EMU_intrTab[256];
+# ifndef NO_INLINE
+#  ifdef __GNUC__
 
-/*----------------------------- Implementation ----------------------------*/
-#if defined(__alpha__) || defined(__alpha)
-/* to cope with broken egcs-1.1.2 :-(((( */
-
-#define ALPHA_UALOADS
-/*
- * inline functions to do unaligned accesses
- * from linux/include/asm-alpha/unaligned.h
- */
-
-/*
- * EGCS 1.1 knows about arbitrary unaligned loads.  Define some
- * packed structures to talk about such things with.
- */
-
-#if defined(__GNUC__)
-struct __una_u64 { unsigned long  x __attribute__((packed)); };
-struct __una_u32 { unsigned int   x __attribute__((packed)); };
-struct __una_u16 { unsigned short x __attribute__((packed)); };
-#endif
+/* Define some packed structures to use with unaligned accesses */
+
+struct __una_u64 { u64 x __attribute__((packed)); };
+struct __una_u32 { u32 x __attribute__((packed)); };
+struct __una_u16 { u16 x __attribute__((packed)); };
 
-static __inline__ unsigned long ldq_u(unsigned long * r11)
+/* Elemental unaligned loads */
+
+static __inline__ u64 ldq_u(u64 *p)
 {
-#if defined(__GNUC__)
-	const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+	const struct __una_u64 *ptr = (const struct __una_u64 *) p;
 	return ptr->x;
-#else
-	unsigned long r1,r2;
-	__asm__("ldq_u %0,%3\n\t"
-		"ldq_u %1,%4\n\t"
-		"extql %0,%2,%0\n\t"
-		"extqh %1,%2,%1"
-		:"=&r" (r1), "=&r" (r2)
-		:"r" (r11),
-		 "m" (*r11),
-		 "m" (*(const unsigned long *)(7+(char *) r11)));
-	return r1 | r2;
-#endif
 }
 
-static __inline__ unsigned long ldl_u(unsigned int * r11)
+static __inline__ u32 ldl_u(u32 *p)
 {
-#if defined(__GNUC__)
-	const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+	const struct __una_u32 *ptr = (const struct __una_u32 *) p;
 	return ptr->x;
-#else
-	unsigned long r1,r2;
-	__asm__("ldq_u %0,%3\n\t"
-		"ldq_u %1,%4\n\t"
-		"extll %0,%2,%0\n\t"
-		"extlh %1,%2,%1"
-		:"=&r" (r1), "=&r" (r2)
-		:"r" (r11),
-		 "m" (*r11),
-		 "m" (*(const unsigned long *)(3+(char *) r11)));
-	return r1 | r2;
-#endif
 }
 
-static __inline__ unsigned long ldw_u(unsigned short * r11)
+static __inline__ u16 ldw_u(u16 *p)
 {
-#if defined(__GNUC__)
-	const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+	const struct __una_u16 *ptr = (const struct __una_u16 *) p;
 	return ptr->x;
-#else
-	unsigned long r1,r2;
-	__asm__("ldq_u %0,%3\n\t"
-		"ldq_u %1,%4\n\t"
-		"extwl %0,%2,%0\n\t"
-		"extwh %1,%2,%1"
-		:"=&r" (r1), "=&r" (r2)
-		:"r" (r11),
-		 "m" (*r11),
-		 "m" (*(const unsigned long *)(1+(char *) r11)));
-	return r1 | r2;
-#endif
 }
 
-/*
- * Elemental unaligned stores 
- */
+/* Elemental unaligned stores */
 
-static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
+static __inline__ void stq_u(u64 val, u64 *p)
 {
-#if defined(__GNUC__)
-	struct __una_u64 *ptr = (struct __una_u64 *) r11;
-	ptr->x = r5;
-#else
-	unsigned long r1,r2,r3,r4;
-
-	__asm__("ldq_u %3,%1\n\t"
-		"ldq_u %2,%0\n\t"
-		"insqh %6,%7,%5\n\t"
-		"insql %6,%7,%4\n\t"
-		"mskqh %3,%7,%3\n\t"
-		"mskql %2,%7,%2\n\t"
-		"bis %3,%5,%3\n\t"
-		"bis %2,%4,%2\n\t"
-		"stq_u %3,%1\n\t"
-		"stq_u %2,%0"
-		:"=m" (*r11),
-		 "=m" (*(unsigned long *)(7+(char *) r11)),
-		 "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
-		:"r" (r5), "r" (r11));
-#endif
+	struct __una_u64 *ptr = (struct __una_u64 *) p;
+	ptr->x = val;
 }
 
-static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
+static __inline__ void stl_u(u32 val, u32 *p)
 {
-#if defined(__GNUC__)
-	struct __una_u32 *ptr = (struct __una_u32 *) r11;
-	ptr->x = r5;
-#else
-	unsigned long r1,r2,r3,r4;
-
-	__asm__("ldq_u %3,%1\n\t"
-		"ldq_u %2,%0\n\t"
-		"inslh %6,%7,%5\n\t"
-		"insll %6,%7,%4\n\t"
-		"msklh %3,%7,%3\n\t"
-		"mskll %2,%7,%2\n\t"
-		"bis %3,%5,%3\n\t"
-		"bis %2,%4,%2\n\t"
-		"stq_u %3,%1\n\t"
-		"stq_u %2,%0"
-		:"=m" (*r11),
-		 "=m" (*(unsigned long *)(3+(char *) r11)),
-		 "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
-		:"r" (r5), "r" (r11));
-#endif
+	struct __una_u32 *ptr = (struct __una_u32 *) p;
+	ptr->x = val;
 }
 
-static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
+static __inline__ void stw_u(u16 val, u16 *p)
 {
-#if defined(__GNUC__)
-	struct __una_u16 *ptr = (struct __una_u16 *) r11;
-	ptr->x = r5;
-#else
-	unsigned long r1,r2,r3,r4;
-
-	__asm__("ldq_u %3,%1\n\t"
-		"ldq_u %2,%0\n\t"
-		"inswh %6,%7,%5\n\t"
-		"inswl %6,%7,%4\n\t"
-		"mskwh %3,%7,%3\n\t"
-		"mskwl %2,%7,%2\n\t"
-		"bis %3,%5,%3\n\t"
-		"bis %2,%4,%2\n\t"
-		"stq_u %3,%1\n\t"
-		"stq_u %2,%0"
-		:"=m" (*r11),
-		 "=m" (*(unsigned long *)(1+(char *) r11)),
-		 "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
-		:"r" (r5), "r" (r11));
-#endif
+	struct __una_u16 *ptr = (struct __una_u16 *) p;
+	ptr->x = val;
+}
+#  else /* !__GNUC__ */
+
+static __inline__ u64 ldq_u(u64 *p)
+{
+	u64 ret;
+	memmove(&ret, p, sizeof(*p));
+	return ret;
 }
-#endif
+
+static __inline__ u32 ldl_u(u32 *p)
+{
+	u32 ret;
+	memmove(&ret, p, sizeof(*p));
+	return ret;
+}
+
+static __inline__ u16 ldw_u(u16 *p)
+{
+	u16 ret;
+	memmove(&ret, p, sizeof(*p));
+	return ret;
+}
+
+static __inline__ void stq_u(u64 val, u64 *p)
+{
+	u64 tmp = val;
+	memmove(p, &tmp, sizeof(*p));
+}
+
+static __inline__ void stl_u(u32 val, u32 *p)
+{
+	u32 tmp = val;
+	memmove(p, &tmp, sizeof(*p));
+}
+
+static __inline__ void stw_u(u16 val, u16 *p)
+{
+	u16 tmp = val;
+	memmove(p, &tmp, sizeof(*p));
+}
+
+#  endif /* __GNUC__ */
+# endif /* NO_INLINE */
+/*------------------------- Global Variables ------------------------------*/
+
+X86EMU_sysEnv		_X86EMU_env;		/* Global emulator machine state */
+X86EMU_intrFuncs	_X86EMU_intrTab[256];
+
+/*----------------------------- Implementation ----------------------------*/
 
 /****************************************************************************
 PARAMETERS:
@@ -262,13 +198,7 @@ u16 X86API rdw(
 		}
 	else
 #endif
-#if defined(ALPHA_UALOADS)
 		val = ldw_u((u16*)(M.mem_base + addr));
-#elif  defined(IA64_UALOADS)
-      val = uldw((u16*)(M.mem_base + addr));
-#else
-		val = *(u16*)(M.mem_base + addr);
-#endif
 		DB(	if (DEBUG_MEM_TRACE())
 		printk("%#08x 2 -> %#x\n", addr, val);)
     return val;
@@ -301,13 +231,7 @@ u32 X86API rdl(
 		}
 	else
 #endif
-#if defined(ALPHA_UALOADS)
 		val = ldl_u((u32*)(M.mem_base + addr));
-#elif  defined(IA64_UALOADS)
-        val = uldl((u32*)(M.mem_base + addr));
-#else
-		val = *(u32*)(M.mem_base + addr);
-#endif
 DB(	if (DEBUG_MEM_TRACE())
 		printk("%#08x 4 -> %#x\n", addr, val);)
 	return val;
@@ -359,13 +283,7 @@ DB(	if (DEBUG_MEM_TRACE())
 		}
 	else
 #endif
-#if defined(ALPHA_UALOADS)
 	 stw_u(val,(u16*)(M.mem_base + addr));
-#elif defined(IA64_UALOADS)
-     ustw(val,(u16*)(M.mem_base + addr));
-#else
-	 *(u16*)(M.mem_base + addr) = val;
-#endif
 }
 
 /****************************************************************************
@@ -395,13 +313,7 @@ DB(	if (DEBUG_MEM_TRACE())
 		}
 	else
 #endif
-#if defined(ALPHA_UALOADS)
 	 stl_u(val,(u32*)(M.mem_base + addr));
-#elif defined(IA64_UALOADS)
-     ustl(val,(u32*)(M.mem_base + addr));
-#else
-	 *(u32*)(M.mem_base + addr) = val;
-#endif
 }
 
 /****************************************************************************
commit 1c2abec479cfbac9aeadc121af0825d368317658
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 26 11:44:17 2010 +1000

    configure: move SELINUX_LIBS to XSERVER_SYS_LIBS
    
    All ddxs require linking against selinux if enabled.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 7d6944d..0579551 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1432,7 +1432,7 @@ PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
 #
 XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}"
 XSERVER_LIBS="$DIX_LIB $CONFIG_LIB $MI_LIB $OS_LIB"
-XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
+XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${SELINUX_LIBS}"
 AC_SUBST([XSERVER_LIBS])
 AC_SUBST([XSERVER_SYS_LIBS])
 
@@ -1580,7 +1580,7 @@ if test "x$XORG" = xyes; then
 	AC_CHECK_FUNCS([pci_device_vgaarb_init])
 	LIBS=$SAVE_LIBS
 	CFLAGS=$SAVE_CFLAGS
-	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $SELINUX_LIBS"
+	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS"
 	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
 
 	case $host_os in
commit cab99b947c66a42dbf8a906bdb02e23aa7cab519
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 26 11:41:38 2010 +1000

    configure: move libselinux requirement up to the common section.
    
    Let's have all version-specific requirements in one block.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index b9c7574..7d6944d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -786,6 +786,7 @@ LIBXTST="xtst >= 1.0.99.2"
 LIBPCIACCESS="pciaccess >= 0.8.0"
 LIBGLIB="glib-2.0 >= 2.16"
 LIBUDEV="libudev >= 143"
+LIBSELINUX="libselinux >= 2.0.86"
 
 if test "x$CONFIG_UDEV" = xyes &&
  { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
@@ -1058,7 +1059,7 @@ if test "x$XSELINUX" = xyes; then
 	fi
 	AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
 	AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
-	PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.0.86])
+	PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
 	SELINUX_LIBS="$SELINUX_LIBS -laudit"
 	AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
 fi
commit 9e7b6e565f6e69f20002bf03ed05fe8b63f86924
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 26 10:14:00 2010 +1000

    dmx: fix OsAbort()-related build error in examples/xinput.c
    
    5b9a52be7e975e59e0bbc6b43539ecaff96b2ecd changed the server to use OsAbort()
    instead of abort(). xinput in dmx is a client program though and fails to
    link if it tries to use OsAbort(). Switch it back to using abort().
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Fernando Carrijo <fcarrijo at yahoo.com.br>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/dmx/examples/xinput.c b/hw/dmx/examples/xinput.c
index 7421be3..b12daf2 100644
--- a/hw/dmx/examples/xinput.c
+++ b/hw/dmx/examples/xinput.c
@@ -233,7 +233,7 @@ int main(int argc, char **argv)
         int         total = 0;
 
 #define ADD(type)                                     \
-        if (cnt >= MAX_EVENTS) OsAbort();             \
+        if (cnt >= MAX_EVENTS) abort();             \
         names[cnt] = #type;                           \
         type(dev, event_type[cnt], event_list[cnt]);  \
         if (event_type[cnt]) ++cnt
commit cf72b5437d2d620521279077a29c5df6d0fbb576
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Feb 25 12:49:21 2010 +1000

    dix: Use DeliverGrabbedEvent for implicit passive grabs (#25400)
    
    A client requesting a GrabModeSync button grab, owner-events true, with only
    the ButtonRelease mask set would never receive the press event even if the
    grab window had the ButtonPress mask set.
    
    The protocol requires that if owner-events is true, then the delivery mask
    is the combination of the grab mask + the window event mask.
    
    DeliverGrabbedEvents does this already for us, checking first the delivery
    based on owner_events and then based on the grab mask. AFAICT, the device
    cannot enter the states FREEZE_BOTH_NEXT_EVENT or FREEZE_NEXT_EVENT that
    would be handled by DGE in any possible path here.
    
    Bonus point - CheckPassiveGrabsOnWindows suddenly becomes a lot lesss
    complicated.
    
    X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400>
    
    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/events.c b/dix/events.c
index 8af8c5a..1611f7d 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3462,7 +3462,6 @@ CheckPassiveGrabsOnWindow(
     {
 	DeviceIntPtr	gdev;
 	XkbSrvInfoPtr	xkbi = NULL;
-	Mask		mask = 0;
 
 	gdev= grab->modifierDevice;
         if (grab->grabtype == GRABTYPE_CORE)
@@ -3515,10 +3514,6 @@ CheckPassiveGrabsOnWindow(
 	     (grab->confineTo->realized &&
 				BorderSizeNotEmpty(device, grab->confineTo))))
 	{
-            int rc, count = 0;
-            xEvent *xE = NULL;
-            xEvent core;
-
             event->corestate &= 0x1f00;
             event->corestate |= tempGrab.modifiersDetail.exact & (~0x1f00);
             grabinfo = &device->deviceGrab;
@@ -3565,62 +3560,8 @@ CheckPassiveGrabsOnWindow(
             }
 
 
-            if (match & CORE_MATCH)
-            {
-                rc = EventToCore((InternalEvent*)event, &core);
-                if (rc != Success)
-                {
-                    if (rc != BadMatch)
-                        ErrorF("[dix] %s: core conversion failed in CPGFW "
-                                "(%d, %d).\n", device->name, event->type, rc);
-                    continue;
-                }
-                xE = &core;
-                count = 1;
-                mask = grab->eventMask;
-            } else if (match & XI2_MATCH)
-            {
-                rc = EventToXI2((InternalEvent*)event, &xE);
-                if (rc != Success)
-                {
-                    if (rc != BadMatch)
-                        ErrorF("[dix] %s: XI2 conversion failed in CPGFW "
-                                "(%d, %d).\n", device->name, event->type, rc);
-                    continue;
-                }
-                count = 1;
-
-                /* FIXME: EventToXI2 returns NULL for enter events, so
-                 * dereferencing the event is bad. Internal event types are
-                 * aligned with core events, so the else clause is valid.
-                 * long-term we should use internal events for enter/focus
-                 * as well */
-                if (xE)
-                    mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
-                else if (event->type == XI_Enter || event->type == XI_FocusIn)
-                    mask = grab->xi2mask[device->id][event->type/8];
-            } else
-            {
-                rc = EventToXI((InternalEvent*)event, &xE, &count);
-                if (rc != Success)
-                {
-                    if (rc != BadMatch)
-                        ErrorF("[dix] %s: XI conversion failed in CPGFW "
-                                "(%d, %d).\n", device->name, event->type, rc);
-                    continue;
-                }
-                mask = grab->eventMask;
-            }
-
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
-
-            if (xE)
-            {
-                FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
-
-                TryClientEvents(rClient(grab), device, xE, count, mask,
-                                       GetEventFilter(device, xE), grab);
-            }
+            DeliverGrabbedEvent((InternalEvent*)event, device, FALSE);
 
 	    if (grabinfo->sync.state == FROZEN_NO_EVENT)
 	    {
@@ -3630,8 +3571,6 @@ CheckPassiveGrabsOnWindow(
 		grabinfo->sync.state = FROZEN_WITH_EVENT;
             }
 
-            if (match & (XI_MATCH | XI2_MATCH))
-                xfree(xE); /* on core match xE == &core */
 	    return TRUE;
 	}
     }
commit de86a3a3448f0a55c1cd99aee9ea80070a589877
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Feb 25 11:37:05 2010 -0800

    Allow for missing or disabled compat_output
    
    When the compat output is missing (I don't think this is actually
    possible), or is disabled (and hence has no crtc), we would like to
    avoid dereferencing NULL pointers. This patch creates inline functions
    to extract the current compat output, crtc or associated RandR crtc
    structure, carefully checking for NULL pointers everywhere.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index edd5ae9..f60d96e 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -1001,8 +1001,7 @@ xf86ChangeGammaRamp(
     CMapLinkPtr pLink;
 
     if (xf86_crtc_supports_gamma(pScrn)) {
-	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
-	RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+	RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
 
 	if (crtc) {
 	    if (crtc->gammaSize != size)
@@ -1076,8 +1075,7 @@ xf86GetGammaRampSize(ScreenPtr pScreen)
     CMapScreenPtr pScreenPriv;
 
     if (xf86_crtc_supports_gamma(pScrn)) {
-	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
-	RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+	RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
 
 	if (crtc)
 	    return crtc->gammaSize;
@@ -1106,8 +1104,7 @@ xf86GetGammaRamp(
     int shift, sigbits;
 
     if (xf86_crtc_supports_gamma(pScrn)) {
-	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
-	RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+	RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
 
 	if (crtc) {
 	    if (crtc->gammaSize < size)
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 10ac818..860e520 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2595,8 +2595,8 @@ xf86SetDesiredModes (ScrnInfoPtr scrn)
 	if (!crtc->enabled)
 	    continue;
 
-	if (config->output[config->compat_output]->crtc == crtc)
-	    output = config->output[config->compat_output];
+	if (xf86CompatOutput(scrn) && xf86CompatCrtc(scrn) == crtc)
+	    output = xf86CompatOutput(scrn);
 	else
 	{
 	    for (o = 0; o < config->num_output; o++)
@@ -2716,14 +2716,16 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
 {
     xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(pScrn);
     Bool		ok = TRUE;
-    xf86OutputPtr	compat_output = config->output[config->compat_output];
-    DisplayModePtr	compat_mode;
+    xf86OutputPtr	compat_output;
+    DisplayModePtr	compat_mode = NULL;
     int			c;
 
     /*
      * Let the compat output drive the final mode selection
      */
-    compat_mode = xf86OutputFindClosestMode (compat_output, desired);
+    compat_output = xf86CompatOutput(pScrn);
+    if (compat_output)
+	compat_mode = xf86OutputFindClosestMode (compat_output, desired);
     if (compat_mode)
 	desired = compat_mode;
     
@@ -2947,7 +2949,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
     }
 
     /* Set the DDC properties for the 'compat' output */
-    if (output == config->output[config->compat_output])
+    if (output == xf86CompatOutput(scrn))
         xf86SetDDCproperties(scrn, edid_mon);
 
 #ifdef RANDR_12_INTERFACE
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 9baa956..68a968c 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -689,6 +689,32 @@ extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
 
 #define XF86_CRTC_CONFIG_PTR(p)	((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
 
+static _X_INLINE xf86OutputPtr
+xf86CompatOutput(ScrnInfoPtr pScrn)
+{
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+    return config->output[config->compat_output];
+}
+
+static _X_INLINE xf86CrtcPtr
+xf86CompatCrtc(ScrnInfoPtr pScrn)
+{
+    xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
+    if (!compat_output)
+	return NULL;
+    return compat_output->crtc;
+}
+
+static _X_INLINE RRCrtcPtr
+xf86CompatRRCrtc(ScrnInfoPtr pScrn)
+{
+    xf86CrtcPtr	compat_crtc = xf86CompatCrtc(pScrn);
+    if (!compat_crtc)
+	return NULL;
+    return compat_crtc->randr_crtc;
+}
+
+
 /*
  * Initialize xf86CrtcConfig structure
  */
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 1fc63c4..7ba09b6 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -805,9 +805,10 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
 	}
 	else
 	{
-	    xf86OutputPtr   output = config->output[config->compat_output];
+	    xf86OutputPtr   output = xf86CompatOutput(pScrn);
 
-	    if (output->conf_monitor &&
+	    if (output &&
+		output->conf_monitor &&
 		(output->conf_monitor->mon_width  > 0 &&
 		 output->conf_monitor->mon_height > 0))
 	    {
@@ -1719,10 +1720,13 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
 {
     CARD16 *points, *red, *green, *blue;
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
-    RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
-    int size = max(0, crtc->gammaSize);
+    RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+    int size;
 
+    if (!crtc)
+	return Success;
+
+    size = max(0, crtc->gammaSize);
     if (!size)
 	return Success;
 
commit fbbadca7e88391e81ab0f470290f5eec36aa9ce7
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Feb 25 11:35:03 2010 -0800

    Share enum definition for det_monrec_parameter sync_source
    
    There were two separate enum definitions, one inside
    det_monrec_parameter struct and one for a local variable (which was then
    stored inside the struct). Sharing a single definition makes the
    code more obviously correct while making the compiler happier.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 9b1ff28..10ac818 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1495,12 +1495,16 @@ GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
        mon->vrefresh[0].lo = 58.0;
 }
 
+enum det_monrec_source {
+    sync_config, sync_edid, sync_default
+};
+
 struct det_monrec_parameter {
     MonRec *mon_rec;
     int *max_clock;
     Bool set_hsync;
     Bool set_vrefresh;
-    enum { sync_config, sync_edid, sync_default } *sync_source;
+    enum det_monrec_source *sync_source;
 };
 
 static void handle_detailed_monrec(struct detailed_monitor_section *det_mon,
@@ -1563,7 +1567,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
 	Bool                add_default_modes = TRUE;
 	Bool		    debug_modes = config->debug_modes ||
 					  xf86Initialising;
-	enum { sync_config, sync_edid, sync_default } sync_source = sync_default;
+	enum det_monrec_source sync_source = sync_default;
 	
 	while (output->probed_modes != NULL)
 	    xf86DeleteMode(&output->probed_modes, output->probed_modes);
commit 4b55b2cf8a52c39b53bae11cd1bc7314481d4c86
Author: Robert Bragg <bob at o-hand.com>
Date:   Wed Jan 27 20:38:38 2010 +0000

    DRI2: initialize event->drawable in DRI2SwapEvent
    
    We weren't initialising the drawable in the event structure so the
    client side DRI2WireToEvent used for translating the event into a GLX
    event wouldn't be able to lookup up the corresponding GLXDrawable before
    passing the event on.
    
    Signed-off-by: Robert Bragg <robert at linux.intel.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 3e6b03e..bd92fd3 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -353,10 +353,12 @@ DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc,
 	      CARD64 sbc)
 {
     xDRI2BufferSwapComplete event;
+    DrawablePtr pDrawable = data;
 
     event.type = DRI2EventBase + DRI2_BufferSwapComplete;
     event.sequenceNumber = client->sequence;
     event.event_type = type;
+    event.drawable = pDrawable->id;
     event.ust_hi = (CARD64)ust >> 32;
     event.ust_lo = ust & 0xffffffff;
     event.msc_hi = (CARD64)msc >> 32;
commit 780c95caf9888fa4548dfe4c1c78a7e7ce99a9ed
Merge: 018b177... 758f697...
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Feb 24 09:59:19 2010 -0800

    Merge remote branch 'whot/for-keith'

commit 018b177591c9fade6d065e31858cc6e054d33eff
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Wed Feb 24 10:37:26 2010 -0500

    glx: Compile fix to let server compile with new and old mesa
    
    We broke the __DRI2_FLUSH API since it was never released, but since it's
    taking a little longer than expected to get the X server side of the changes
    ready, fix things up so it compiles.
    
    Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 0f998de..edd29b0 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -217,8 +217,15 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable)
     __GLXDRIscreen *screen = priv->screen;
     CARD64 unused;
 
+#if __DRI2_FLUSH_VERSION >= 3
+    if (screen->flush) {
+	(*screen->flush->flush)(priv->driDrawable);
+	(*screen->flush->invalidate)(priv->driDrawable);
+    }
+#else
     if (screen->flush)
 	(*screen->flush->flushInvalidate)(priv->driDrawable);
+#endif
 
     if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
 			__glXdriSwapEvent, drawable->pDraw) != Success)
commit 758f6971750ed507e64eee817d720a77181439f2
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Feb 15 16:32:16 2010 +1000

    dix: try to ring the bell even if the current device doesn't have one. (#24503)
    
    Evdev devices do not have the bell proc set, but XTEST devices do. By
    exiting early, the bell only rings if the last keyboard used was the XTEST
    keyboard and hence the bell proc is still set on the master but not if an
    evdev keyboard was used last.
    
    The better approach here is to try to ring the bell on all devices attached
    to this master device in case one or more actually do produce an audible
    sound. That's also XKB's behaviour if XkbUseCoreKbd is specified as device
    identifier.
    
    X.Org Bug 24503 <http://bugs.freedesktop.org/show_bug.cgi?id=24503>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/devices.c b/dix/devices.c
index b002150..6119dce 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2020,14 +2020,6 @@ ProcBell(ClientPtr client)
 	return BadValue;
     }
 
-    /* Seems like no keyboard actually has the BellProc set. Returning
-     * BadDevice (previous code) will make apps crash badly. The man pages
-     * doesn't say anything about a BadDevice being returned either.
-     * So just quietly do nothing and pretend everything has worked.
-     */
-    if (!keybd->kbdfeed->BellProc)
-        return Success;
-
     newpercent = (base * stuff->percent) / 100;
     if (stuff->percent < 0)
         newpercent = base + newpercent;
commit c0d941913199ed251fceab62fcf65437f6f9bd31
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Feb 18 16:00:15 2010 +1000

    dix: remove now-erroneous comment about frozen slave devices.
    
    A direct grab on a slave device through XI2 detaches it, regardless of
    whether the grab is sync or async. So this comment doesn't apply to XI2
    anyway.
    
    For XI1, aside from your life being miserable already, it doesn't matter as
    XI1 does not have a concept of attachment. You can freeze a device and if
    you don't freeze _all_ other devices at the same time, the master device can
    still happily send events to the client.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/events.c b/dix/events.c
index c085a75..4eb8afa 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1414,11 +1414,6 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
 	    thisDev->deviceGrab.sync.other = NullGrab;
     }
 
-    /*
-        XXX: Direct slave grab won't freeze the paired master device.
-        The correct thing to do would be to freeze all SDs attached to the
-        paired master device.
-     */
     if (IsMaster(thisDev))
     {
         dev = GetPairedDevice(thisDev);
commit db4f676f25c6d8e58263d5151942be730592d444
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Wed Feb 3 15:40:47 2010 -0500

    xselinux: Bump extension minor version.
    
    Changes introduced in this version:
    	- 3 window-related requests now handle pixmaps also.
    
    Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xselinux.h b/Xext/xselinux.h
index d82d903..5723982 100644
--- a/Xext/xselinux.h
+++ b/Xext/xselinux.h
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 /* Extension info */
 #define SELINUX_EXTENSION_NAME		"SELinux"
 #define SELINUX_MAJOR_VERSION		1
-#define SELINUX_MINOR_VERSION		0
+#define SELINUX_MINOR_VERSION		1
 #define SELinuxNumberEvents		0
 #define SELinuxNumberErrors		0
 
commit a6cbcf6e782e65f3d4d14202ed0b7a8f65b33c9d
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Wed Feb 3 15:38:57 2010 -0500

    xselinux: Rename window-related requests that now support pixmaps.
    
    Renamed requests:
    	SetWindowCreateContext -> SetDrawableCreateContext
    	GetWindowCreateContext -> GetDrawableCreateContext
    	GetWindowContext -> GetDrawableContext
    
    Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xselinux.h b/Xext/xselinux.h
index dcd250e..d82d903 100644
--- a/Xext/xselinux.h
+++ b/Xext/xselinux.h
@@ -33,9 +33,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define X_SELinuxGetDeviceCreateContext		2
 #define X_SELinuxSetDeviceContext		3
 #define X_SELinuxGetDeviceContext		4
-#define X_SELinuxSetWindowCreateContext		5
-#define X_SELinuxGetWindowCreateContext		6
-#define X_SELinuxGetWindowContext		7
+#define X_SELinuxSetDrawableCreateContext	5
+#define X_SELinuxGetDrawableCreateContext	6
+#define X_SELinuxGetDrawableContext		7
 #define X_SELinuxSetPropertyCreateContext	8
 #define X_SELinuxGetPropertyCreateContext	9
 #define X_SELinuxSetPropertyUseContext		10
diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index 1dff32d..aa55734 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -221,7 +221,7 @@ ProcSELinuxGetDeviceContext(ClientPtr client)
 }
 
 static int
-ProcSELinuxGetWindowContext(ClientPtr client)
+ProcSELinuxGetDrawableContext(ClientPtr client)
 {
     DrawablePtr pDraw;
     PrivateRec **privatePtr;
@@ -486,12 +486,12 @@ ProcSELinuxDispatch(ClientPtr client)
 	return ProcSELinuxSetDeviceContext(client);
     case X_SELinuxGetDeviceContext:
 	return ProcSELinuxGetDeviceContext(client);
-    case X_SELinuxSetWindowCreateContext:
+    case X_SELinuxSetDrawableCreateContext:
 	return ProcSELinuxSetCreateContext(client, CTX_WIN);
-    case X_SELinuxGetWindowCreateContext:
+    case X_SELinuxGetDrawableCreateContext:
 	return ProcSELinuxGetCreateContext(client, CTX_WIN);
-    case X_SELinuxGetWindowContext:
-	return ProcSELinuxGetWindowContext(client);
+    case X_SELinuxGetDrawableContext:
+	return ProcSELinuxGetDrawableContext(client);
     case X_SELinuxSetPropertyCreateContext:
 	return ProcSELinuxSetCreateContext(client, CTX_PRP);
     case X_SELinuxGetPropertyCreateContext:
@@ -574,14 +574,14 @@ SProcSELinuxGetDeviceContext(ClientPtr client)
 }
 
 static int
-SProcSELinuxGetWindowContext(ClientPtr client)
+SProcSELinuxGetDrawableContext(ClientPtr client)
 {
     REQUEST(SELinuxGetContextReq);
     int n;
 
     REQUEST_SIZE_MATCH(SELinuxGetContextReq);
     swapl(&stuff->id, n);
-    return ProcSELinuxGetWindowContext(client);
+    return ProcSELinuxGetDrawableContext(client);
 }
 
 static int
@@ -648,12 +648,12 @@ SProcSELinuxDispatch(ClientPtr client)
 	return SProcSELinuxSetDeviceContext(client);
     case X_SELinuxGetDeviceContext:
 	return SProcSELinuxGetDeviceContext(client);
-    case X_SELinuxSetWindowCreateContext:
+    case X_SELinuxSetDrawableCreateContext:
 	return SProcSELinuxSetCreateContext(client, CTX_WIN);
-    case X_SELinuxGetWindowCreateContext:
+    case X_SELinuxGetDrawableCreateContext:
 	return ProcSELinuxGetCreateContext(client, CTX_WIN);
-    case X_SELinuxGetWindowContext:
-	return SProcSELinuxGetWindowContext(client);
+    case X_SELinuxGetDrawableContext:
+	return SProcSELinuxGetDrawableContext(client);
     case X_SELinuxSetPropertyCreateContext:
 	return SProcSELinuxSetCreateContext(client, CTX_PRP);
     case X_SELinuxGetPropertyCreateContext:
commit ab68c707fd02613d9359120ba6402639dd8bd89e
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Wed Feb 3 15:08:40 2010 -0500

    xselinux: Allow GetWindowContext to be used for pixmaps as well.
    
    Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index dc27c92..1dff32d 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -223,18 +223,26 @@ ProcSELinuxGetDeviceContext(ClientPtr client)
 static int
 ProcSELinuxGetWindowContext(ClientPtr client)
 {
-    WindowPtr pWin;
+    DrawablePtr pDraw;
+    PrivateRec **privatePtr;
     SELinuxObjectRec *obj;
     int rc;
 
     REQUEST(SELinuxGetContextReq);
     REQUEST_SIZE_MATCH(SELinuxGetContextReq);
 
-    rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
+    rc = dixLookupDrawable(&pDraw, stuff->id, client,
+			   M_WINDOW | M_DRAWABLE_PIXMAP,
+			   DixGetAttrAccess);
     if (rc != Success)
 	return rc;
 
-    obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
+    if (pDraw->type == M_DRAWABLE_PIXMAP)
+	privatePtr = &((PixmapPtr)pDraw)->devPrivates;
+    else
+	privatePtr = &((WindowPtr)pDraw)->devPrivates;
+
+    obj = dixLookupPrivate(privatePtr, objectKey);
     return SELinuxSendContextReply(client, obj->sid);
 }
 
commit eb9210097efea81065c301e5b6b4da7a566deb4a
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Wed Jan 6 12:52:51 2010 -0500

    xselinux: Remove reference counting calls for SID objects.
    
    Starting with libselinux 2.0.86, SID objects are no longer
    reference counted and the sidput() and sidget() calls are no-ops.
    
    Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index b36fb13..dc27c92 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -132,7 +132,6 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
 
     ptr = dixLookupPrivate(privPtr, subjectKey);
     pSid = (security_id_t *)(ptr + offset);
-    sidput(*pSid);
     *pSid = NULL;
 
     rc = Success;
@@ -193,11 +192,9 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
     }
 
     subj = dixLookupPrivate(&dev->devPrivates, subjectKey);
-    sidput(subj->sid);
     subj->sid = sid;
     obj = dixLookupPrivate(&dev->devPrivates, objectKey);
-    sidput(obj->sid);
-    sidget(obj->sid = sid);
+    obj->sid = sid;
 
     rc = Success;
 out:
diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index 72732e7..6c8c8cd 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -69,9 +69,6 @@ DevPrivateKey dataKey = &dataKeyIndex;
 /* audit file descriptor */
 static int audit_fd;
 
-/* whether AVC is active */
-static int avc_active;
-
 /* atoms for window label properties */
 static Atom atom_ctx;
 static Atom atom_client_ctx;
@@ -125,9 +122,7 @@ SELinuxLabelClient(ClientPtr client)
     security_context_t ctx;
 
     subj = dixLookupPrivate(&client->devPrivates, subjectKey);
-    sidput(subj->sid);
     obj = dixLookupPrivate(&client->devPrivates, objectKey);
-    sidput(obj->sid);
 
     /* Try to get a context from the socket */
     if (fd < 0 || getpeercon_raw(fd, &ctx) < 0) {
@@ -170,7 +165,7 @@ finish:
 	FatalError("SELinux: client %d: context_to_sid_raw(%s) failed\n",
 		   client->index, ctx);
 
-    sidget(obj->sid = subj->sid);
+    obj->sid = subj->sid;
     freecon(ctx);
 }
 
@@ -191,7 +186,6 @@ SELinuxLabelInitial(void)
     subj = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
     obj = dixLookupPrivate(&serverClient->devPrivates, objectKey);
     subj->privileged = 1;
-    sidput(subj->sid);
 
     /* Use the context of the X server process for the serverClient */
     if (getcon_raw(&ctx) < 0)
@@ -201,7 +195,7 @@ SELinuxLabelInitial(void)
     if (avc_context_to_sid_raw(ctx, &subj->sid) < 0)
 	FatalError("SELinux: serverClient: context_to_sid(%s) failed\n", ctx);
 
-    sidget(obj->sid = subj->sid);
+    obj->sid = subj->sid;
     freecon(ctx);
 
     srec.client = serverClient;
@@ -231,7 +225,7 @@ SELinuxLabelResource(XaceResourceAccessRec *rec, SELinuxSubjectRec *subj,
 
     /* Check for a create context */
     if (rec->rtype & RC_DRAWABLE && subj->win_create_sid) {
-	sidget(obj->sid = subj->win_create_sid);
+	obj->sid = subj->win_create_sid;
 	return Success;
     }
 
@@ -359,17 +353,14 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 	SELinuxSubjectRec *dsubj;
 	dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
 
-	sidput(dsubj->sid);
-	sidput(obj->sid);
-
 	if (subj->dev_create_sid) {
 	    /* Label the device with the create context */
-	    sidget(obj->sid = subj->dev_create_sid);
-	    sidget(dsubj->sid = subj->dev_create_sid);
+	    obj->sid = subj->dev_create_sid;
+	    dsubj->sid = subj->dev_create_sid;
 	} else {
 	    /* Label the device directly with the process SID */
-	    sidget(obj->sid = subj->sid);
-	    sidget(dsubj->sid = subj->sid);
+	    obj->sid = subj->sid;
+	    dsubj->sid = subj->sid;
 	}
     }
 
@@ -483,8 +474,6 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 	    return;
 	}
 
-	sidput(obj->sid);
-
 	/* Perform a transition to obtain the final SID */
 	if (avc_compute_create(serv->sid, sid, SECCLASS_X_EXTENSION,
 			       &obj->sid) < 0) {
@@ -520,7 +509,6 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 
     /* If this is a new object that needs labeling, do it now */
     if (access_mode & DixCreateAccess) {
-	sidput(obj->sid);
 	rc = SELinuxSelectionToSID(name, subj, &obj->sid, &obj->poly);
 	if (rc != Success)
 	    obj->sid = unlabeled_sid;
@@ -538,7 +526,6 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 		break;
 	    obj = dixLookupPrivate(&pSel->devPrivates, objectKey);
 	}
-	sidput(tsid);
 
 	if (pSel)
 	    *rec->ppSel = pSel;
@@ -557,11 +544,10 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     /* Label the content (advisory only) */
     if (access_mode & DixSetAttrAccess) {
 	data = dixLookupPrivate(&pSel->devPrivates, dataKey);
-	sidput(data->sid);
 	if (subj->sel_create_sid)
-	    sidget(data->sid = subj->sel_create_sid);
+	    data->sid = subj->sel_create_sid;
 	else
-	    sidget(data->sid = obj->sid);
+	    data->sid = obj->sid;
     }
 }
 
@@ -586,7 +572,6 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 
     /* If this is a new object that needs labeling, do it now */
     if (rec->access_mode & DixCreateAccess) {
-	sidput(obj->sid);
 	rc = SELinuxPropertyToSID(name, subj, &obj->sid, &obj->poly);
 	if (rc != Success) {
 	    rec->status = rc;
@@ -605,7 +590,6 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 		break;
 	    obj = dixLookupPrivate(&pProp->devPrivates, objectKey);
 	}
-	sidput(tsid);
 
 	if (pProp)
 	    *rec->ppProp = pProp;
@@ -624,11 +608,10 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     /* Label the content (advisory only) */
     if (rec->access_mode & DixWriteAccess) {
 	data = dixLookupPrivate(&pProp->devPrivates, dataKey);
-	sidput(data->sid);
 	if (subj->prp_create_sid)
-	    sidget(data->sid = subj->prp_create_sid);
+	    data->sid = subj->prp_create_sid;
 	else
-	    sidget(data->sid = obj->sid);
+	    data->sid = obj->sid;
     }
 }
 
@@ -705,8 +688,6 @@ SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
 
     /* If this is a new object that needs labeling, do it now */
     if (access_mode & DixCreateAccess) {
-	sidput(obj->sid);
-
 	/* Perform a transition to obtain the final SID */
 	if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SCREEN,
 			       &obj->sid) < 0) {
@@ -838,7 +819,6 @@ SELinuxSubjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     PrivateCallbackRec *rec = calldata;
     SELinuxSubjectRec *subj = *rec->value;
 
-    sidget(unlabeled_sid);
     subj->sid = unlabeled_sid;
 
     avc_entry_ref_init(&subj->aeref);
@@ -851,14 +831,6 @@ SELinuxSubjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     SELinuxSubjectRec *subj = *rec->value;
 
     xfree(subj->command);
-
-    if (avc_active) {
-	sidput(subj->sid);
-	sidput(subj->dev_create_sid);
-	sidput(subj->win_create_sid);
-	sidput(subj->sel_create_sid);
-	sidput(subj->prp_create_sid);
-    }
 }
 
 static void
@@ -867,20 +839,9 @@ SELinuxObjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     PrivateCallbackRec *rec = calldata;
     SELinuxObjectRec *obj = *rec->value;
 
-    sidget(unlabeled_sid);
     obj->sid = unlabeled_sid;
 }
 
-static void
-SELinuxObjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
-{
-    PrivateCallbackRec *rec = calldata;
-    SELinuxObjectRec *obj = *rec->value;
-
-    if (avc_active)
-	sidput(obj->sid);
-}
-
 static int netlink_fd;
 
 static void
@@ -923,7 +884,6 @@ SELinuxFlaskReset(void)
     RemoveGeneralSocket(netlink_fd);
 
     avc_destroy();
-    avc_active = 0;
 }
 
 void
@@ -961,7 +921,6 @@ SELinuxFlaskInit(void)
 
     if (avc_open(&avc_option, 1) < 0)
 	FatalError("SELinux: Couldn't initialize SELinux userspace AVC\n");
-    avc_active = 1;
 
     if (security_get_initial_context_raw("unlabeled", &ctx) < 0)
 	FatalError("SELinux: Failed to look up unlabeled context\n");
@@ -997,9 +956,7 @@ SELinuxFlaskInit(void)
     ret &= dixRegisterPrivateInitFunc(subjectKey, SELinuxSubjectInit, NULL);
     ret &= dixRegisterPrivateDeleteFunc(subjectKey, SELinuxSubjectFree, NULL);
     ret &= dixRegisterPrivateInitFunc(objectKey, SELinuxObjectInit, NULL);
-    ret &= dixRegisterPrivateDeleteFunc(objectKey, SELinuxObjectFree, NULL);
     ret &= dixRegisterPrivateInitFunc(dataKey, SELinuxObjectInit, NULL);
-    ret &= dixRegisterPrivateDeleteFunc(dataKey, SELinuxObjectFree, NULL);
 
     ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL);
     ret &= AddCallback(&ResourceStateCallback, SELinuxResourceState, NULL);
diff --git a/Xext/xselinux_label.c b/Xext/xselinux_label.c
index 239536c..9b5023a 100644
--- a/Xext/xselinux_label.c
+++ b/Xext/xselinux_label.c
@@ -177,20 +177,17 @@ SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec *subj,
 
     /* Check for an override context next */
     if (subj->sel_use_sid) {
-	sidget(tsid = subj->sel_use_sid);
+	tsid = subj->sel_use_sid;
 	goto out;
     }
 
-    sidget(tsid = obj->sid);
+    tsid = obj->sid;
 
     /* Polyinstantiate if necessary to obtain the final SID */
-    if (obj->poly) {
-	sidput(tsid);
-	if (avc_compute_member(subj->sid, obj->sid,
-			       SECCLASS_X_SELECTION, &tsid) < 0) {
-	    ErrorF("SELinux: a compute_member call failed!\n");
-	    return BadValue;
-	}
+    if (obj->poly && avc_compute_member(subj->sid, obj->sid,
+					SECCLASS_X_SELECTION, &tsid) < 0) {
+	ErrorF("SELinux: a compute_member call failed!\n");
+	return BadValue;
     }
 out:
     *sid_rtn = tsid;
@@ -217,7 +214,7 @@ SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
 
     /* Check for an override context next */
     if (subj->prp_use_sid) {
-	sidget(tsid = subj->prp_use_sid);
+	tsid = subj->prp_use_sid;
 	goto out;
     }
 
@@ -234,10 +231,8 @@ SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
 	if (avc_compute_member(subj->sid, tsid2,
 			       SECCLASS_X_PROPERTY, &tsid) < 0) {
 	    ErrorF("SELinux: a compute_member call failed!\n");
-	    sidput(tsid2);
 	    return BadValue;
 	}
-	sidput(tsid2);
     }
 out:
     *sid_rtn = tsid;
@@ -273,10 +268,8 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
 	}
 	freecon(ctx);
 	/* Cache the SID value */
-	if (!SELinuxArraySet(&arr_events, type, sid)) {
-	    sidput(sid);
+	if (!SELinuxArraySet(&arr_events, type, sid))
 	    return BadAlloc;
-	}
     }
 
     /* Perform a transition to obtain the final SID */
commit 0c4b75a08922416050bb73d2e279ce938d3823e7
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Wed Oct 21 21:59:01 2009 -0400

    Don't print a failure message when XACE denies an input event delivery.
    
    A denial is normal and the behavior should be to drop the event.
    Having the log message creates excessive log spam.
    
    Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/events.c b/dix/events.c
index aecf726..2e94726 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2485,15 +2485,15 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
             if (mask & XI_MASK)
             {
                 rc = EventToXI(event, &xE, &count);
-                if (rc == Success &&
-                    XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count) == Success)
-                {
-                    filter = GetEventFilter(dev, xE);
-                    FixUpEventFromWindow(dev, xE, pWin, child, FALSE);
-                    deliveries = DeliverEventsToWindow(dev, pWin, xE, count,
-                                                       filter, grab);
-                    if (deliveries > 0)
-                        goto unwind;
+                if (rc == Success) {
+                    if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count) == Success) {
+                        filter = GetEventFilter(dev, xE);
+                        FixUpEventFromWindow(dev, xE, pWin, child, FALSE);
+                        deliveries = DeliverEventsToWindow(dev, pWin, xE, count,
+                                                           filter, grab);
+                        if (deliveries > 0)
+                            goto unwind;
+                    }
                 } else if (rc != BadMatch)
                     ErrorF("[dix] %s: XI conversion failed in DDE (%d, %d). Skipping delivery.\n",
                             dev->name, event->any.type, rc);
@@ -2503,15 +2503,15 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
             if ((mask & CORE_MASK) && IsMaster(dev) && dev->coreEvents)
             {
                 rc = EventToCore(event, &core);
-                if (rc == Success &&
-                    XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, &core, 1) == Success)
-                {
-                    filter = GetEventFilter(dev, &core);
-                    FixUpEventFromWindow(dev, &core, pWin, child, FALSE);
-                    deliveries = DeliverEventsToWindow(dev, pWin, &core, 1,
-                            filter, grab);
-                    if (deliveries > 0)
-                        goto unwind;
+                if (rc == Success) {
+                    if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, &core, 1) == Success) {
+                        filter = GetEventFilter(dev, &core);
+                        FixUpEventFromWindow(dev, &core, pWin, child, FALSE);
+                        deliveries = DeliverEventsToWindow(dev, pWin, &core, 1,
+                                                           filter, grab);
+                        if (deliveries > 0)
+                            goto unwind;
+                    }
                 } else if (rc != BadMatch)
                         ErrorF("[dix] %s: Core conversion failed in DDE (%d, %d).\n",
                                 dev->name, event->any.type, rc);
@@ -3791,13 +3791,13 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
     if (sendCore)
     {
         rc = EventToCore(event, &core);
-        if (rc == Success &&
-            XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, &core, 1) == Success)
-        {
-            FixUpEventFromWindow(keybd, &core, focus, None, FALSE);
-            deliveries = DeliverEventsToWindow(keybd, focus, &core, 1,
-                                               GetEventFilter(keybd, &core),
-                                               NullGrab);
+        if (rc == Success) {
+            if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, &core, 1) == Success) {
+                FixUpEventFromWindow(keybd, &core, focus, None, FALSE);
+                deliveries = DeliverEventsToWindow(keybd, focus, &core, 1,
+                                                   GetEventFilter(keybd, &core),
+                                                   NullGrab);
+            }
         } else if (rc != BadMatch)
             ErrorF("[dix] %s: core conversion failed DFE (%d, %d). Skipping delivery.\n",
                     keybd->name, event->any.type, rc);
commit e687e11b1248494a45b9a4e4c321675526808703
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Wed Oct 21 21:46:50 2009 -0400

    Revert "Remove some debug messages that trigger on XACE event delivery failure."
    
    The log messages still need to be there for non-XACE failures.
    
    This reverts commit 4be354c4c2da5168b302601b91bd80cfaca7e193.
    
    Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/events.c b/dix/events.c
index c085a75..aecf726 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2494,7 +2494,9 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
                                                        filter, grab);
                     if (deliveries > 0)
                         goto unwind;
-                }
+                } else if (rc != BadMatch)
+                    ErrorF("[dix] %s: XI conversion failed in DDE (%d, %d). Skipping delivery.\n",
+                            dev->name, event->any.type, rc);
             }
 
             /* Core event */
@@ -2510,7 +2512,9 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
                             filter, grab);
                     if (deliveries > 0)
                         goto unwind;
-                }
+                } else if (rc != BadMatch)
+                        ErrorF("[dix] %s: Core conversion failed in DDE (%d, %d).\n",
+                                dev->name, event->any.type, rc);
             }
 
             if ((deliveries < 0) || (pWin == stopAt) ||
@@ -3794,7 +3798,9 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
             deliveries = DeliverEventsToWindow(keybd, focus, &core, 1,
                                                GetEventFilter(keybd, &core),
                                                NullGrab);
-        }
+        } else if (rc != BadMatch)
+            ErrorF("[dix] %s: core conversion failed DFE (%d, %d). Skipping delivery.\n",
+                    keybd->name, event->any.type, rc);
     }
 
 unwind:
commit 2ecb9f7d86117f212d7845741a3e155553954a85
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Wed Oct 21 19:28:26 2009 -0400

    libselinux now has a pkgconfig file.  Use it.
    
    Also remove HAVE_NETLINK_AVC_ACQUIRE_FD tests, because we now
    require a version of libselinux that has it.
    
    Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index 6e8c86d..72732e7 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -881,7 +881,6 @@ SELinuxObjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 	sidput(obj->sid);
 }
 
-#ifdef HAVE_AVC_NETLINK_ACQUIRE_FD
 static int netlink_fd;
 
 static void
@@ -895,7 +894,6 @@ SELinuxWakeupHandler(void *data, int err, void *read_mask)
     if (FD_ISSET(netlink_fd, (fd_set *)read_mask))
         avc_netlink_check_nb();
 }
-#endif
 
 void
 SELinuxFlaskReset(void)
@@ -919,12 +917,10 @@ SELinuxFlaskReset(void)
 
     /* Tear down SELinux stuff */
     audit_close(audit_fd);
-#ifdef HAVE_AVC_NETLINK_ACQUIRE_FD
     avc_netlink_release_fd();
     RemoveBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
                                  NULL);
     RemoveGeneralSocket(netlink_fd);
-#endif
 
     avc_destroy();
     avc_active = 0;
@@ -992,12 +988,10 @@ SELinuxFlaskInit(void)
     if (atom_client_ctx == BAD_RESOURCE)
 	FatalError("SELinux: Failed to create atom\n");
 
-#ifdef HAVE_AVC_NETLINK_ACQUIRE_FD
     netlink_fd = avc_netlink_acquire_fd();
     AddGeneralSocket(netlink_fd);
     RegisterBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
                                    NULL);
-#endif
 
     /* Register callbacks */
     ret &= dixRegisterPrivateInitFunc(subjectKey, SELinuxSubjectInit, NULL);
diff --git a/configure.ac b/configure.ac
index de252f3..b9c7574 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1056,16 +1056,11 @@ if test "x$XSELINUX" = xyes; then
 	if test "x$XACE" != xyes; then
 		AC_MSG_ERROR([cannot build SELinux extension without X-ACE])
 	fi
-	AC_CHECK_HEADERS([selinux/selinux.h selinux/avc.h], [], AC_MSG_ERROR([SELinux include files not found]))
-	AC_CHECK_LIB(selinux, avc_init, [], AC_MSG_ERROR([SELinux library not found])) 
 	AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
 	AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
-        AC_CHECK_DECL(avc_netlink_acquire_fd,
-                      [AC_DEFINE(HAVE_AVC_NETLINK_ACQUIRE_FD, 1, "Have avc_netlink_acquire_fd")],
-                      [],
-                      [#include <selinux/avc.h>])
+	PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.0.86])
+	SELINUX_LIBS="$SELINUX_LIBS -laudit"
 	AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
-	SELINUX_LIB="-lselinux -laudit"
 fi
 
 AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
@@ -1584,7 +1579,7 @@ if test "x$XORG" = xyes; then
 	AC_CHECK_FUNCS([pci_device_vgaarb_init])
 	LIBS=$SAVE_LIBS
 	CFLAGS=$SAVE_CFLAGS
-	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $SELINUX_LIB"
+	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $SELINUX_LIBS"
 	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
 
 	case $host_os in
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index e942dac..058c8fd 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -446,6 +446,4 @@
 #include "dix-config-apple-verbatim.h"
 #endif
 
-#undef HAVE_AVC_NETLINK_ACQUIRE_FD
-
 #endif /* _DIX_CONFIG_H_ */
commit 9fc6b59d46382e949526dc10c3f5bfddbe2acb92
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Oct 15 17:32:21 2009 -0400

    xselinux: Allow SetWindowCreateContext to be used for pixmaps as well.
    
    Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index 43683ff..6e8c86d 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -230,7 +230,7 @@ SELinuxLabelResource(XaceResourceAccessRec *rec, SELinuxSubjectRec *subj,
     security_id_t tsid;
 
     /* Check for a create context */
-    if (rec->rtype == RT_WINDOW && subj->win_create_sid) {
+    if (rec->rtype & RC_DRAWABLE && subj->win_create_sid) {
 	sidget(obj->sid = subj->win_create_sid);
 	return Success;
     }
commit 93ff1bc5884cdfca1132af7fbc06c48e06f218c8
Author: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
Date:   Mon Feb 15 14:18:00 2010 +0200

    Always enable outputs that have been forced on in the configuration file
    
    If the user has gone to the effort of manually enabling an output in
    the configuration file assume that they know what they're doing.
    
    X.org Bug 14611 <http://bugs.freedesktop.org/show_bug.cgi?id=14611>
    
    Signed-off-by: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
    Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 573fe96..9b1ff28 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1573,7 +1573,8 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
 	 */
 	output->status = (*output->funcs->detect)(output);
 
-	if (output->status == XF86OutputStatusDisconnected)
+	if (output->status == XF86OutputStatusDisconnected &&
+		!xf86ReturnOptValBool(output->options, OPTION_ENABLE, FALSE))
 	{
 	    xf86OutputSetEDID (output, NULL);
 	    continue;
commit ca9c2472d74c7107ccc117e2c9c723c168d2eccf
Merge: e40ba57... 02d1116...
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Feb 22 13:26:06 2010 -0800

    Merge remote branch 'whot/for-keith'

commit e40ba5798c367bec584f6437b23d2c5f801fd013
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Feb 18 15:49:09 2010 +1000

    Xi: assume BadMode for non-BadMatch errors returned from SetDeviceMode.
    
    The XI protocol spec only allows for two errors on the SetDeviceMode
    requests: BadMatch or BadMode. BadMode however is a dynamically assigned
    extension error and the driver doesn't have access to the actual error
    number. Hence, if a SetDeviceMode driver returns an error other than
    BadMatch, assume BadMode.
    
    The two exceptions are BadAlloc and BadImplementations, pass these on to the
    client (any request is allowed to return either of those).
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/Xi/setmode.c b/Xi/setmode.c
index 51e5767..ce2ad47 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -112,7 +112,17 @@ ProcXSetDeviceMode(ClientPtr client)
     if (rep.status == Success)
 	dev->valuator->mode = stuff->mode;
     else if (rep.status != AlreadyGrabbed)
+    {
+	switch(rep.status) {
+	    case BadMatch:
+	    case BadImplementation:
+	    case BadAlloc:
+		break;
+	    default:
+		rep.status = BadMode;
+	}
 	return rep.status;
+    }
 
     WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
     return Success;
commit 02d1116e7eb84068fa32477f1640d29b0a81b638
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Jan 11 16:35:36 2010 +1000

    Xi: assume BadMode for non-BadMatch errors returned from SetDeviceMode.
    
    The XI protocol spec only allows for two errors on the SetDeviceMode
    requests: BadMatch or BadMode. BadMode however is a dynamically assigned
    extension error and the driver doesn't have access to the actual error
    number. Hence, if a SetDeviceMode driver returns an error other than
    BadMatch, assume BadMode.
    
    The two exceptions are BadAlloc and BadImplementations, pass these on to the
    client (any request is allowed to return either of those).
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/Xi/setmode.c b/Xi/setmode.c
index 51e5767..ce2ad47 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -112,7 +112,17 @@ ProcXSetDeviceMode(ClientPtr client)
     if (rep.status == Success)
 	dev->valuator->mode = stuff->mode;
     else if (rep.status != AlreadyGrabbed)
+    {
+	switch(rep.status) {
+	    case BadMatch:
+	    case BadImplementation:
+	    case BadAlloc:
+		break;
+	    default:
+		rep.status = BadMode;
+	}
 	return rep.status;
+    }
 
     WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
     return Success;
commit 122fc0e7a0712df4ec2bd9ca6773f90bcd2095cf
Author: Chris Dekter <cdekter at gmail.com>
Date:   Thu Feb 11 16:34:09 2010 +1000

    Re-enable RECORD extension.
    
    RECORD was disabled during the switch to internal events. This patch
    modifies the record callback to work with internal events instead of
    xEvents. The InternalEvents are converted to core/Xi events as needed.
    
    Since record is a loadable extension, the EventTo* calls must be externed.
    
    Signed-off-by: Chris Dekter <cdekter at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index ee32ba8..a63b65b 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1051,16 +1051,19 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
             break;
     }
 
-#if 0
-    /* FIXME: I'm broken. Please fix me. Thanks */
     if (DeviceEventCallback) {
 	DeviceEventInfoRec eventinfo;
+	SpritePtr pSprite = device->spriteInfo->sprite;
 
-	eventinfo.events = (xEventPtr) xE;
-	eventinfo.count = count;
+	/* see comment in EnqueueEvents regarding the next three lines */
+	if (ev->any.type == ET_Motion)
+	    ev->device_event.root = WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id;
+
+	eventinfo.device = device;
+	eventinfo.event = ev;
 	CallCallbacks(&DeviceEventCallback, (pointer) & eventinfo);
     }
-#endif
+
     grab = device->deviceGrab.grab;
 
     switch(event->type)
diff --git a/dix/events.c b/dix/events.c
index 85c8f9a..c085a75 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1131,11 +1131,10 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
         event->type == ET_KeyRelease)
 	AccessXCancelRepeatKey(device->key->xkbInfo, event->detail.key);
 
-#if 0
-        /* FIXME: I'm broken now. Please fix me. */
     if (DeviceEventCallback)
     {
 	DeviceEventInfoRec eventinfo;
+
 	/*  The RECORD spec says that the root window field of motion events
 	 *  must be valid.  At this point, it hasn't been filled in yet, so
 	 *  we do it here.  The long expression below is necessary to get
@@ -1145,14 +1144,14 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
 	 *  the data that GetCurrentRootWindow relies on hasn't been
 	 *  updated yet.
 	 */
-	if (xE->u.u.type == DeviceMotionNotify)
-	    XE_KBPTR.root =
-		WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id;
-	eventinfo.events = xE;
-	eventinfo.count = nevents;
+	if (ev->any.type == ET_Motion)
+	    ev->device_event.root = WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id;
+
+	eventinfo.event = ev;
+	eventinfo.device = device;
 	CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
     }
-#endif
+
     if (event->type == ET_Motion)
     {
 #ifdef PANORAMIX
diff --git a/include/dix.h b/include/dix.h
index ed3acb6..6505fd0 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -576,8 +576,8 @@ typedef struct {
 extern _X_EXPORT CallbackListPtr DeviceEventCallback;
 
 typedef struct {
-    xEventPtr events;
-    int count;
+    InternalEvent *event;
+    DeviceIntPtr device;
 } DeviceEventInfoRec;
 
 extern int XItoCoreType(int xi_type);
@@ -585,7 +585,7 @@ extern Bool DevHasCursor(DeviceIntPtr pDev);
 extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev);
 extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev);
 extern Bool IsPointerEvent(InternalEvent *event);
-extern Bool IsMaster(DeviceIntPtr dev);
+extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev);
 
 extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
 extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
diff --git a/include/eventconvert.h b/include/eventconvert.h
index 277a6c4..b1196a0 100644
--- a/include/eventconvert.h
+++ b/include/eventconvert.h
@@ -30,9 +30,9 @@
 
 #define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16))
 
-_X_INTERNAL int EventToCore(InternalEvent *event, xEvent *core);
-_X_INTERNAL int EventToXI(InternalEvent *ev, xEvent **xi, int *count);
-_X_INTERNAL int EventToXI2(InternalEvent *ev, xEvent **xi);
+_X_EXPORT int EventToCore(InternalEvent *event, xEvent *core);
+_X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count);
+_X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi);
 _X_INTERNAL int GetCoreType(InternalEvent* ev);
 _X_INTERNAL int GetXIType(InternalEvent* ev);
 _X_INTERNAL int GetXI2Type(InternalEvent* ev);
diff --git a/record/record.c b/record/record.c
index 242544f..1a10c9e 100644
--- a/record/record.c
+++ b/record/record.c
@@ -42,6 +42,8 @@ and Jim Haggerty of Metheus.
 #include "set.h"
 #include "swaprep.h"
 #include "inputstr.h"
+#include "eventconvert.h"
+
 
 #include <stdio.h>
 #include <assert.h>
@@ -139,7 +141,8 @@ static int RecordDeleteContext(
     XID /*id*/
 );
 
-
+void RecordExtensionInit(void);
+
 /***************************************************************************/
 
 /* client private stuff */
@@ -727,6 +730,59 @@ RecordADeliveredEventOrError(CallbackListPtr *pcbl, pointer nulldata, pointer ca
 } /* RecordADeliveredEventOrError */
 
 
+static void
+RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP,
+			RecordContextPtr pContext,
+			xEvent* pev, int count)
+{
+    int ev; /* event index */
+
+    for (ev = 0; ev < count; ev++, pev++)
+    {
+	if (RecordIsMemberOfSet(pRCAP->pDeviceEventSet,
+		    pev->u.u.type & 0177))
+	{
+	    xEvent swappedEvent;
+	    xEvent *pEvToRecord = pev;
+#ifdef PANORAMIX
+	    xEvent shiftedEvent;
+
+	    if (!noPanoramiXExtension &&
+		    (pev->u.u.type == MotionNotify ||
+		     pev->u.u.type == ButtonPress ||
+		     pev->u.u.type == ButtonRelease ||
+		     pev->u.u.type == KeyPress ||
+		     pev->u.u.type == KeyRelease)) {
+		int scr = XineramaGetCursorScreen(inputInfo.pointer);
+		memcpy(&shiftedEvent, pev, sizeof(xEvent));
+		shiftedEvent.u.keyButtonPointer.rootX +=
+		    panoramiXdataPtr[scr].x -
+		    panoramiXdataPtr[0].x;
+		shiftedEvent.u.keyButtonPointer.rootY +=
+		    panoramiXdataPtr[scr].y -
+		    panoramiXdataPtr[0].y;
+		pEvToRecord = &shiftedEvent;
+	    }
+#endif /* PANORAMIX */
+
+	    if (pContext->pRecordingClient->swapped)
+	    {
+		(*EventSwapVector[pEvToRecord->u.u.type & 0177])
+		    (pEvToRecord, &swappedEvent);
+		pEvToRecord = &swappedEvent;
+	    }
+
+	    RecordAProtocolElement(pContext, NULL,
+		    XRecordFromServer,  pEvToRecord, SIZEOF(xEvent), 0);
+	    /* make sure device events get flushed in the absence
+	     * of other client activity
+	     */
+	    SetCriticalOutputPending();
+	}
+    } /* end for each event */
+
+} /* RecordADeviceEvent */
+
 /* RecordADeviceEvent
  *
  * Arguments:
@@ -756,55 +812,24 @@ RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
 	{
 	    if (pRCAP->pDeviceEventSet)
 	    {
-		int ev; /* event index */
-		xEvent *pev = pei->events;
-		for (ev = 0; ev < pei->count; ev++, pev++)
-		{
-		    if (RecordIsMemberOfSet(pRCAP->pDeviceEventSet,
-					    pev->u.u.type & 0177))
-		    {
-		        xEvent swappedEvent;
-		        xEvent *pEvToRecord = pev;
-#ifdef PANORAMIX
-		        xEvent shiftedEvent;
-
-			if (!noPanoramiXExtension &&
-			    (pev->u.u.type == MotionNotify ||
-			     pev->u.u.type == ButtonPress ||
-			     pev->u.u.type == ButtonRelease ||
-			     pev->u.u.type == KeyPress ||
-			     pev->u.u.type == KeyRelease)) {
-				int scr = XineramaGetCursorScreen(inputInfo.pointer);
-				memcpy(&shiftedEvent, pev, sizeof(xEvent));
-				shiftedEvent.u.keyButtonPointer.rootX +=
-				    panoramiXdataPtr[scr].x - 
-					panoramiXdataPtr[0].x;
-				shiftedEvent.u.keyButtonPointer.rootY +=
-				    panoramiXdataPtr[scr].y -
-					panoramiXdataPtr[0].y;
-				pEvToRecord = &shiftedEvent;
-			}
-#endif /* PANORAMIX */
+		int count;
+		xEvent *xi_events = NULL;
 
-			if (pContext->pRecordingClient->swapped)
-			{
-			    (*EventSwapVector[pEvToRecord->u.u.type & 0177])
-				(pEvToRecord, &swappedEvent);
-			    pEvToRecord = &swappedEvent;
-			}
+		/* TODO check return values */
+		if (IsMaster(pei->device))
+		{
+		    xEvent xE;
+		    EventToCore(pei->event, &xE);
+		    RecordSendProtocolEvents(pRCAP, pContext, &xE, 1);
+		}
 
-			RecordAProtocolElement(pContext, NULL,
-			   XRecordFromServer,  pEvToRecord, SIZEOF(xEvent), 0);
-			/* make sure device events get flushed in the absence
-			 * of other client activity
-			 */
-			SetCriticalOutputPending();
-		    }
-		} /* end for each event */
+		EventToXI(pei->event, &xi_events, &count);
+		RecordSendProtocolEvents(pRCAP, pContext, xi_events, count);
+		xfree(xi_events);
 	    } /* end this RCAP selects device events */
 	} /* end for each RCAP on this context */
     } /* end for each enabled context */
-} /* RecordADeviceEvent */
+}
 
 
 /* RecordFlushAllContexts
@@ -2866,13 +2891,6 @@ RecordCloseDown(ExtensionEntry *extEntry)
 void 
 RecordExtensionInit(void)
 {
-    /* FIXME Record is currently broken. Dont initialize it so that clients
-     * that require it can bail out correctly rather than waiting for stuff
-     * that'll never happen */
-    ErrorF("record: RECORD extension enabled at configure time.\n");
-    ErrorF("record: This extension is known to be broken, disabling extension now..\n");
-    ErrorF("record: http://bugs.freedesktop.org/show_bug.cgi?id=20500\n");
-#if 0
     ExtensionEntry *extentry;
 
     RTContext = CreateNewResourceType(RecordDeleteContext, "RecordContext");
@@ -2895,6 +2913,5 @@ RecordExtensionInit(void)
     }
     RecordErrorBase = extentry->errorBase;
 
-#endif
 } /* RecordExtensionInit */
 
commit 03ef00ae79687046dc9f9987857062a16ff2c2e0
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Wed Feb 17 11:40:44 2010 +0100

    EXA/mixed: Clean up exaPrepareAccessReg_mixed() a little.
    
    Signed-off-by: Michel Dänzer <daenzer at vmware.com>
    Acked-by: Maarten Maathuis <madman2003 at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index d200917..fb47151 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -165,10 +165,12 @@ void
 exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
 {
     ExaPixmapPriv(pPixmap);
+    Bool has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
     Bool success;
 
-    if ((success = ExaDoPrepareAccess(pPixmap, index)) &&
-	    pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
+    success = ExaDoPrepareAccess(pPixmap, index);
+
+    if (success && has_gpu_copy && pExaPixmap->pDamage) {
 	/* You cannot do accelerated operations while a buffer is mapped. */
 	exaFinishAccess(&pPixmap->drawable, index);
 	/* Update the gpu view of both deferred destination pixmaps and of
@@ -176,10 +178,24 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
 	 */
 	exaMoveInPixmap_mixed(pPixmap);
 	success = ExaDoPrepareAccess(pPixmap, index);
+
+	if (success) {
+	    /* We have a gpu pixmap that can be accessed, we don't need the cpu
+	     * copy anymore. Drivers that prefer DFS, should fail prepare
+	     * access.
+	     */
+	    DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+	    DamageDestroy(pExaPixmap->pDamage);
+	    pExaPixmap->pDamage = NULL;
+
+	    free(pExaPixmap->sys_ptr);
+	    pExaPixmap->sys_ptr = NULL;
+
+	    return;
+	}
     }
 
     if (!success) {
-	Bool has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
 	ExaMigrationRec pixmaps[1];
 
 	/* Do we need to allocate our system buffer? */
@@ -240,15 +256,6 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
 	pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
 	pPixmap->devKind = pExaPixmap->sys_pitch;
 	pExaPixmap->use_gpu_copy = FALSE;
-    /* We have a gpu pixmap that can be accessed, we don't need the cpu copy
-     * anymore. Drivers that prefer DFS, should fail prepare access. */
-    } else if (pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
-	DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
-	DamageDestroy(pExaPixmap->pDamage);
-	pExaPixmap->pDamage = NULL;
-
-	free(pExaPixmap->sys_ptr);
-	pExaPixmap->sys_ptr = NULL;
     }
 }
 
commit 9623daad7c864d46b0dfcbb6e689820b96cc8115
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Wed Feb 17 11:40:43 2010 +0100

    exa/mixed: fix gnome-panel corruption
    
    - A mapped pixmap can't be used for acceleration, any decent memory manager
    will refuse this.
    - Source pixmaps migrated with a bounding region are incomplete (from the
    gpu point of view), so do the upload unconditionally, instead of just for
    deferred destination pixmaps.
    - Fixes fd.o bug #26076.
    
    Signed-off-by: Maarten Maathuis <madman2003 at gmail.com>
    Acked-by: Michel Dänzer <michel at daenzer.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index 6816e6c..d200917 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -165,8 +165,20 @@ void
 exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
 {
     ExaPixmapPriv(pPixmap);
+    Bool success;
+
+    if ((success = ExaDoPrepareAccess(pPixmap, index)) &&
+	    pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
+	/* You cannot do accelerated operations while a buffer is mapped. */
+	exaFinishAccess(&pPixmap->drawable, index);
+	/* Update the gpu view of both deferred destination pixmaps and of
+	 * source pixmaps that were migrated with a bounding region.
+	 */
+	exaMoveInPixmap_mixed(pPixmap);
+	success = ExaDoPrepareAccess(pPixmap, index);
+    }
 
-    if (!ExaDoPrepareAccess(pPixmap, index)) {
+    if (!success) {
 	Bool has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
 	ExaMigrationRec pixmaps[1];
 
@@ -231,13 +243,6 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
     /* We have a gpu pixmap that can be accessed, we don't need the cpu copy
      * anymore. Drivers that prefer DFS, should fail prepare access. */
     } else if (pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
-	ExaScreenPriv(pPixmap->drawable.pScreen);
-
-	/* Copy back any deferred content if needed. */
-	if (pExaScr->deferred_mixed_pixmap &&
-	    pExaScr->deferred_mixed_pixmap == pPixmap)
-	    exaMoveInPixmap_mixed(pPixmap);
-
 	DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
 	DamageDestroy(pExaPixmap->pDamage);
 	pExaPixmap->pDamage = NULL;
commit 5b9a52be7e975e59e0bbc6b43539ecaff96b2ecd
Author: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
Date:   Thu Jan 28 11:08:34 2010 +0200

    os: Prevent core dump from being truncated.
    
    The problem fixed by this patch can be reproduced on Linux with the
    following steps.
    - Access NULL pointer intentionally in ProcessOtherEvent on key press.
    - Instead of saving core dump to a file, write it into a pipe.
      echo "|/usr/sbin/my-core-dumper" > /proc/sys/kernel/core_pattern
    - Dump the core by pressing a key.
    
    While the core is being dumped into the pipe, the smart schedule timer
    will cause a pending SIGALRM. Linux kernel stops writing data to the
    pipe when there are pending signals. This causes the core dump to be
    truncated. On my system I'm expecting a 6 MB dump but the size will be
    60 kB instead. The problem is solved if we block the SIGALRM caused by
    expired smart schedule timer.
    
    I haven't been able to reproduce this problem in the following cases.
    - Save core dump to a file instead of a pipe.
    - kill -SEGV `pidof Xorg`
    - Press a key to dump core while gdb is attached to Xorg.
    - Give option -dumbSched to Xorg.
    
    Also note that the fix works only when NoTrapSignals has the default
    value FALSE. The problem can still be reproduced if error signals
    aren't trapped. In addition to pending SIGALRM, there is a similar
    problem with pending SIGIO from the keyboard driver during core dump.
    
    Signed-off-by: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/composite/compwindow.c b/composite/compwindow.c
index c10cb9e..f2f6ea3 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -205,7 +205,7 @@ compPositionWindow (WindowPtr pWin, int x, int y)
 #ifdef COMPOSITE_DEBUG
     if ((pWin->redirectDraw != RedirectDrawNone) !=
 	(pWin->viewable && (GetCompWindow(pWin) != NULL)))
-	abort ();
+	OsAbort ();
 #endif
     if (pWin->redirectDraw != RedirectDrawNone)
     {
diff --git a/glx/glthread.c b/glx/glthread.c
index 4caaea1..8b9f618 100644
--- a/glx/glthread.c
+++ b/glx/glthread.c
@@ -129,7 +129,7 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
 _X_EXPORT unsigned long
 _glthread_GetID(void)
 {
-   abort();   /* XXX not implemented yet */
+   OsAbort();   /* XXX not implemented yet */
    return (unsigned long) 0;
 }
 
diff --git a/hw/dmx/examples/xinput.c b/hw/dmx/examples/xinput.c
index 74353a9..7421be3 100644
--- a/hw/dmx/examples/xinput.c
+++ b/hw/dmx/examples/xinput.c
@@ -233,7 +233,7 @@ int main(int argc, char **argv)
         int         total = 0;
 
 #define ADD(type)                                     \
-        if (cnt >= MAX_EVENTS) abort();               \
+        if (cnt >= MAX_EVENTS) OsAbort();             \
         names[cnt] = #type;                           \
         type(dev, event_type[cnt], event_list[cnt]);  \
         if (event_type[cnt]) ++cnt
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 7675c1e..1902ab8 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -335,7 +335,7 @@ AbortDDX(void)
     }
 
     if (kdCaughtSignal)
-        abort();
+        OsAbort();
 }
 
 void
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 2c206ff..72241a7 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1235,7 +1235,7 @@ ddxGiveUp(void)
 
     /* If an unexpected signal was caught, dump a core for debugging */
     if (xf86Info.caughtSignal)
-	abort();
+	OsAbort();
 }
 
 
diff --git a/hw/xquartz/GL/capabilities.c b/hw/xquartz/GL/capabilities.c
index 4306404..5f1f870 100644
--- a/hw/xquartz/GL/capabilities.c
+++ b/hw/xquartz/GL/capabilities.c
@@ -522,7 +522,7 @@ bool getGlCapabilities(struct glCapabilities *cap) {
 	    conf = malloc(sizeof(*conf));
 	    if(NULL == conf) {
             perror("malloc");
-            abort();
+            OsAbort();
 	    }
 
 	    /* Copy the struct. */
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index b7ec92a..2851aed 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -1705,7 +1705,7 @@ damageRemoveDamage (DamagePtr *pPrev, DamagePtr pDamage)
     }
 #if DAMAGE_VALIDATE_ENABLE
     ErrorF ("Damage not on list\n");
-    abort ();
+    OsAbort ();
 #endif
 }
 
@@ -1718,7 +1718,7 @@ damageInsertDamage (DamagePtr *pPrev, DamagePtr pDamage)
     for (pOld = *pPrev; pOld; pOld = pOld->pNext)
 	if (pOld == pDamage) {
 	    ErrorF ("Damage already on list\n");
-	    abort ();
+	    OsAbort ();
 	}
 #endif
     pDamage->pNext = *pPrev;
@@ -1971,7 +1971,7 @@ DamageRegister (DrawablePtr pDrawable,
     if (pDrawable->pScreen != pDamage->pScreen)
     {
 	ErrorF ("DamageRegister called with mismatched screens\n");
-	abort ();
+	OsAbort ();
     }
 #endif
 
@@ -1986,7 +1986,7 @@ DamageRegister (DrawablePtr pDrawable,
 	for (pOld = *pPrev; pOld; pOld = pOld->pNextWin)
 	    if (pOld == pDamage) {
 		ErrorF ("Damage already on window list\n");
-		abort ();
+		OsAbort ();
 	    }
 #endif
 	pDamage->pNextWin = *pPrev;
@@ -2040,7 +2040,7 @@ DamageUnregister (DrawablePtr	    pDrawable,
 #if DAMAGE_VALIDATE_ENABLE
 	if (!found) {
 	    ErrorF ("Damage not on window list\n");
-	    abort ();
+	    OsAbort ();
 	}
 #endif
     }
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 5320956..e78e2c8 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -978,7 +978,7 @@ StartFrameResize(WindowPtr pWin, Bool gravity,
                 copy_rect.y2 = oldY2;
             }
             else
-                abort();
+                OsAbort();
 
             Bpp = winRec->win->drawable.bitsPerPixel / 8;
             copy_rect_width = copy_rect.x2 - copy_rect.x1;
diff --git a/os/log.c b/os/log.c
index 03dc11f..0002e59 100644
--- a/os/log.c
+++ b/os/log.c
@@ -413,7 +413,7 @@ AbortServer(void)
     AbortDDX();
     fflush(stderr);
     if (CoreDump)
-	abort();
+	OsAbort();
     exit (1);
 }
 
@@ -537,7 +537,7 @@ FatalError(const char *f, ...)
 	beenhere = TRUE;
 	AbortServer();
     } else
-	abort();
+	OsAbort();
     /*NOTREACHED*/
 }
 
commit ca364ca82a760d8e5347a6f9f79636c9a5e4e03f
Author: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
Date:   Thu Jan 28 11:08:33 2010 +0200

    os: Introduce OsAbort for proper core dumps.
    
    Signed-off-by: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/os.h b/include/os.h
index dad1af7..453ab82 100644
--- a/include/os.h
+++ b/include/os.h
@@ -262,6 +262,8 @@ extern _X_EXPORT void OsBlockSignals (void);
 
 extern _X_EXPORT void OsReleaseSignals (void);
 
+extern _X_EXPORT void OsAbort (void);
+
 #if !defined(WIN32)
 extern _X_EXPORT int System(char *);
 extern _X_EXPORT pointer Popen(char *, char *);
diff --git a/os/utils.c b/os/utils.c
index 79399fa..21e25e0 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1310,6 +1310,18 @@ OsReleaseSignals (void)
 #endif
 }
 
+/*
+ * Pending signals may interfere with core dumping. Provide a
+ * mechanism to block signals when aborting.
+ */
+
+void
+OsAbort (void)
+{
+    OsBlockSignals();
+    abort();
+}
+
 #if !defined(WIN32)
 /*
  * "safer" versions of system(3), popen(3) and pclose(3) which give up
commit 031f92bf9ab15226df410012a0d1c9c390efc36d
Author: Oliver McFadden <oliver.mcfadden at nokia.com>
Date:   Wed Feb 3 10:05:20 2010 +0200

    parser: corrected xf86getBoolValue to use case insensitive compare
    
    commit c6e8637e29e0ca11dfb35c02da7ca6002ac8c597 introduced this
    regression; it can cause existing config files to be parsed incorrectly.
    
    Acked-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    Signed-off-by: Oliver McFadden <oliver.mcfadden at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 03cbc8a..cdca9ca 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -1207,21 +1207,21 @@ xf86getBoolValue(Bool *val, const char *str)
 	if (*str == '\0') {
 		*val = TRUE;
 	} else {
-		if (strcmp(str, "1") == 0)
+		if (xf86nameCompare(str, "1") == 0)
 			*val = TRUE;
-		else if (strcmp(str, "on") == 0)
+		else if (xf86nameCompare(str, "on") == 0)
 			*val = TRUE;
-		else if (strcmp(str, "true") == 0)
+		else if (xf86nameCompare(str, "true") == 0)
 			*val = TRUE;
-		else if (strcmp(str, "yes") == 0)
+		else if (xf86nameCompare(str, "yes") == 0)
 			*val = TRUE;
-		else if (strcmp(str, "0") == 0)
+		else if (xf86nameCompare(str, "0") == 0)
 			*val = FALSE;
-		else if (strcmp(str, "off") == 0)
+		else if (xf86nameCompare(str, "off") == 0)
 			*val = FALSE;
-		else if (strcmp(str, "false") == 0)
+		else if (xf86nameCompare(str, "false") == 0)
 			*val = FALSE;
-		else if (strcmp(str, "no") == 0)
+		else if (xf86nameCompare(str, "no") == 0)
 			*val = FALSE;
 		else
 			return FALSE;
commit be96fb2f02c13a6ee8aba40f7d4c3f9141f06cea
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Mon Feb 15 17:42:11 2010 -0800

    Solaris xf86OSRingBell() off-by-one error in filling iov[] array
    
    When generating sound buffers for /dev/audio bells, insert waveform
    for beep *or* silence, but not both, so we don't write one entry past
    the end of the iov buffer when the final bit of soundwave ends up in
    the final entry allocated in the iov array.
    
    Fixes OpenSolaris bug 6894890:
     http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6894890
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/solaris/sun_bell.c b/hw/xfree86/os-support/solaris/sun_bell.c
index 7f146ea..05d1749 100644
--- a/hw/xfree86/os-support/solaris/sun_bell.c
+++ b/hw/xfree86/os-support/solaris/sun_bell.c
@@ -126,14 +126,15 @@ xf86OSRingBell(int loudness, int pitch, int duration)
     iovcnt = 0;
 
     for (cnt = 0; cnt <= repeats; cnt++) {
-        iov[iovcnt].iov_base = (char *) samples;
-        iov[iovcnt++].iov_len = sizeof(samples);
         if (cnt == repeats) {
             /* Insert a bit of silence so that multiple beeps are distinct and
              * not compressed into a single tone.
              */
             iov[iovcnt].iov_base = (char *) silence;
             iov[iovcnt++].iov_len = sizeof(silence);
+        } else {
+            iov[iovcnt].iov_base = (char *) samples;
+            iov[iovcnt++].iov_len = sizeof(samples);
         }
         if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
             written = writev(audioFD, iov, iovcnt);
commit 2d40f22d1ec970a84b23aa42b1feca4feedeb4bb
Author: Matt Turner <mattst88 at gmail.com>
Date:   Mon Feb 15 20:05:24 2010 -0500

    Use C-style comments in x86emu
    
    Signed-off-by: Matt Turner <mattst88 at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/x86emu/validate.c b/hw/xfree86/x86emu/validate.c
index 239f6c1..b8c4d12 100644
--- a/hw/xfree86/x86emu/validate.c
+++ b/hw/xfree86/x86emu/validate.c
@@ -673,7 +673,7 @@ int main(int argc)
     VAL_LONG_LONG_BINARY(cmp_long);
 
     VAL_BYTE_UNARY(daa_byte);
-    VAL_BYTE_UNARY(das_byte);   // Fails for 0x9A (out of range anyway)
+    VAL_BYTE_UNARY(das_byte);   /* Fails for 0x9A (out of range anyway) */
 
     VAL_BYTE_UNARY(dec_byte);
     VAL_WORD_UNARY(dec_word);
diff --git a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
index 5530a3a..4c850a1 100644
--- a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
+++ b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
@@ -61,7 +61,7 @@ static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d)
                           : "cc");
 }
 
-#else // ! (__PIC__ && __i386__)
+#else /* ! (__PIC__ && __i386__) */
 
 #define x86EMU_HAS_HW_CPUID 1
 static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d)
@@ -73,7 +73,7 @@ static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d)
                           : "cc");
 }
 
-#endif // __PIC__ && __i386__
+#endif /* __PIC__ && __i386__ */
 
 
-#endif // __X86EMU_PRIM_X86_GCC_H
+#endif /* __X86EMU_PRIM_X86_GCC_H */


More information about the Xquartz-changes mailing list