[Xquartz-changes] xserver: Branch 'server-1.11-apple' - 15 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Wed Jan 18 11:48:11 PST 2012


Rebased ref, commits from common ancestor:
commit 3c8a8a6191bca28cfec2cc1c0f3dfcfb4dfa7268
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 eaa21ad..e65a1c0 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2049,11 +2049,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 57c93fd..127e5c7 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -50,24 +50,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);
     if (pMask)
 	miCompositeSourceValidate (pMask);
     
-    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);
     }
 
@@ -146,22 +141,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 (
 	(pixman_format_code_t)pict->format,
-	pixmap->drawable.width, pixmap->drawable.height,
+	pict->pDrawable->width, pict->pDrawable->height,
 	(uint32_t *)bits, stride * sizeof (FbStride));
 
     if (!image)
@@ -189,55 +184,33 @@ 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 pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+image_from_pict_internal (PicturePtr pict, Bool has_clip, Bool is_alpha_map);
 
 static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties (pixman_image_t *image, PicturePtr pict, Bool is_alpha_map)
 {
     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)
@@ -267,8 +240,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
      */
     if (pict->alphaMap && !is_alpha_map)
     {
-	int alpha_xoff, alpha_yoff;
-	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
+	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, TRUE, TRUE);
 	
 	pixman_image_set_alpha_map (
 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -301,7 +273,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
 }
 
 static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+image_from_pict_internal (PicturePtr pict,
+		 Bool has_clip, Bool is_alpha_map)
 {
     pixman_image_t *image = NULL;
 
@@ -310,7 +283,7 @@ image_from_pict_internal (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)
     {
@@ -331,19 +304,18 @@ image_from_pict_internal (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, is_alpha_map);
+	set_image_properties (image, pict, is_alpha_map);
     
     return image;
 }
 
 pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict, Bool has_clip)
 {
-    return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+    return image_from_pict_internal (pict, has_clip, FALSE);
 }
 
 void
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 0b5a638..fbe2647 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -39,12 +39,11 @@ fbAddTraps (PicturePtr	pPicture,
 	    xTrap	*traps)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
     
-    pixman_add_traps (image, x_off + dst_xoff, y_off + dst_yoff,
+    pixman_add_traps (image, x_off, y_off,
 		      ntrap, (pixman_trap_t *)traps);
 
     free_pixman_pict (pPicture, image);
@@ -57,14 +56,13 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
 		      int	    y_off)
 {
     pixman_image_t *image;
-    int	dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
 
     pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap,
-				x_off + dst_xoff,
-				y_off + dst_yoff);
+				x_off,
+				y_off);
 
     free_pixman_pict (pPicture, image);
 }
@@ -77,13 +75,12 @@ fbAddTriangles (PicturePtr  pPicture,
 		xTriangle *tris)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
     
     pixman_add_triangles (image,
-			  dst_xoff + x_off, dst_yoff + y_off,
+			  x_off, y_off,
 			  ntri, (pixman_triangle_t *)tris);
 
     free_pixman_pict (pPicture, image);
@@ -110,13 +107,11 @@ fbShapes (CompositeShapesFunc	composite,
 	  const uint8_t *	shapes)
 {
     pixman_image_t *src, *dst;
-    int src_xoff, src_yoff;
-    int dst_xoff, dst_yoff;
 
     miCompositeSourceValidate (pSrc);
 
-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
-    dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+    src = image_from_pict (pSrc, FALSE);
+    dst = image_from_pict (pDst, TRUE);
 
     if (src && dst)
     {
@@ -136,10 +131,10 @@ fbShapes (CompositeShapesFunc	composite,
 	    for (i = 0; i < nshapes; ++i)
 	    {
 		composite (op, src, dst, format,
-			   xSrc + src_xoff,
-			   ySrc + src_yoff,
-			   dst_xoff,
-			   dst_yoff,
+			   xSrc,
+			   ySrc,
+			   0,
+			   0,
 			   1, shapes + i * shape_size);
 	    }
 	}
@@ -162,10 +157,10 @@ fbShapes (CompositeShapesFunc	composite,
 	    }
 	    
 	    composite (op, src, dst, format,
-		       xSrc + src_xoff,
-		       ySrc + src_yoff,
-		       dst_xoff,
-		       dst_yoff,
+		       xSrc,
+		       ySrc,
+		       0,
+		       0,
 		       nshapes, shapes);
 	}
 
commit aa6571e295aace7d6c910c158e07e7341296c12b
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Apr 30 13:08:25 2010 -0700

    Workaround the GC clipping problem in miPaintWindow and add some debugging output.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/mi/miexpose.c b/mi/miexpose.c
index 0f1ebe5..dcbfe1c 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -521,6 +521,7 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
 void RootlessStartDrawing(WindowPtr pWin);
 void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
 Bool IsFramedWindow(WindowPtr pWin);
+#include "../fb/fb.h"
 #endif 
 
 void
@@ -548,24 +549,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     Bool	solid = TRUE;
     DrawablePtr	drawable = &pWin->drawable;
 
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
+    ErrorF("      Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
+	                               prgn->extents.x2 - prgn->extents.x1,
+	                               prgn->extents.y2 - prgn->extents.y1);
+    ErrorF("      Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
+	                                       pWin->winSize.extents.x1, pWin->winSize.extents.y1,
+	                                       pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
+					       pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+    ErrorF("     Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
+				       pWin->drawable.width, pWin->drawable.height);
+#endif
+
 #ifdef ROOTLESS
     if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
 	return;
-
-    if(IsFramedWindow(pWin)) {
-        RootlessStartDrawing(pWin);
-        RootlessDamageRegion(pWin, prgn);
-    
-        if(pWin->backgroundState == ParentRelative) {
-            if((what == PW_BACKGROUND) || 
-               (what == PW_BORDER && !pWin->borderIsPixel))
-                RootlessSetPixmapOfAncestors(pWin);
-        }
-    }
 #endif
     
     if (what == PW_BACKGROUND)
     {
+#ifdef ROOTLESS
+	if(IsFramedWindow(pWin)) {
+	    RootlessStartDrawing(pWin);
+	    RootlessDamageRegion(pWin, prgn);
+
+	    if(pWin->backgroundState == ParentRelative) {
+		RootlessSetPixmapOfAncestors(pWin);
+	    }
+	}
+#endif
+
 	while (pWin->backgroundState == ParentRelative)
 	    pWin = pWin->parent;
 
@@ -591,6 +605,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     {
 	PixmapPtr   pixmap;
 
+#ifdef ROOTLESS
+	if(IsFramedWindow(pWin)) {
+	    RootlessStartDrawing(pWin);
+	    RootlessDamageRegion(pWin, prgn);
+	    
+	    if(!pWin->borderIsPixel &&
+		pWin->backgroundState == ParentRelative) {
+		RootlessSetPixmapOfAncestors(pWin);
+	    }
+	}
+#endif
+
 	tile_x_off = drawable->x;
 	tile_y_off = drawable->y;
 	
@@ -599,6 +625,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 	    return;
 	pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
 	drawable = &pixmap->drawable;
+
+#ifdef XQUARTZ_CLIP_DEBUG
+	ErrorF("     Draw: %d %d %d %d\n",
+	       drawable->x, drawable->y, drawable->width, drawable->height);    
+#endif
+	
 #ifdef COMPOSITE
 	draw_x_off = pixmap->screen_x;
 	draw_y_off = pixmap->screen_y;
@@ -661,6 +693,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     ChangeGC (NullClient, pGC, gcmask, gcval);
     ValidateGC (drawable, pGC);
 
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("       GC: %d %d %d %d\n",
+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+    
+#ifdef XQUARTZ
+    /* Looks like our clipping isn't set right for some reason:
+     * http://xquartz.macosforge.org/trac/ticket/290
+     */
+    if(what == PW_BORDER) {
+
+#if 0
+	if(solid) {
+#if 1
+	    fbFillRegionSolid(&pWin->drawable,
+			      prgn,
+			      0,
+			      fbReplicatePixel(fill.pixel,
+					       pWin->drawable.bitsPerPixel));
+#else
+	    fbFillRegionSolid(drawable,
+			      prgn,
+			      0,
+			      fbReplicatePixel(fill.pixel,
+					       drawable->bitsPerPixel));
+#endif
+	    return;
+	}
+#endif
+    
+	pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
+	pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
+	pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
+	pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
+	
+	if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
+	    pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
+	if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
+	    pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
+    }
+#endif
+
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("       GC: %d %d %d %d\n",
+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);    
+#endif
+
     numRects = RegionNumRects(prgn);
     pbox = RegionRects(prgn);
     for (i= numRects; --i >= 0; pbox++, prect++)
commit ec84a1ce40f94a1f02dd8ef99c50f88e6bc13e5c
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Oct 30 14:55:06 2010 -0700

    configure.ac: Add -fno-strict-aliasing to CFLAGS
    
    This should address https://bugs.freedesktop.org/show_bug.cgi?id=31238
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index 65fbc8c..5f2d083 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,12 @@ XORG_PROG_RAWCPP
 # easier overrides at build time.
 XSERVER_CFLAGS='$(CWARNFLAGS)'
 
+dnl Explicitly add -fno-strict-aliasing since this option should disappear
+dnl from util-macros CWARNFLAGS
+if  test "x$GCC" = xyes ; then
+    XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing"
+fi
+
 dnl Check for dtrace program (needed to build Xserver dtrace probes)
 dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
 dnl ISDN trace program named dtrace
commit b747a91485184649c05aba6fa10734f70e926032
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jan 18 11:47:21 2012 -0800

    XQuartz: Bump bundle version to 2.7.1
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index a4b8e19..60251f7 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -19,9 +19,9 @@
 	<key>CFBundlePackageType</key>
 		<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-		<string>2.7.0</string>
+		<string>2.7.1</string>
 	<key>CFBundleVersion</key>
-		<string>2.7.0</string>
+		<string>2.7.1</string>
 	<key>CFBundleSignature</key>
 		<string>x11a</string>
 	<key>CSResourcesFileMapped</key>
@@ -37,9 +37,9 @@
 	<key>LSApplicationCategoryType</key>
 		<string>public.app-category.utilities</string>
 	<key>NSHumanReadableCopyright</key>
-		<string>© 2003-2011 Apple Inc.
+		<string>© 2003-2012 Apple Inc.
 © 2003 XFree86 Project, Inc.
-© 2003-2011 X.org Foundation, Inc.
+© 2003-2012 X.org Foundation, Inc.
 </string>
 	<key>NSMainNibFile</key>
 		<string>main</string>
commit a1ed67fa0551ee2b39d002d3b786a2017b37c7ac
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jan 6 13:20:45 2012 +1000

    render: don't bother with animated cursors on floating slaves (#39989)
    
    X.Org Bug 39989 <http://bugs.freedesktop.org/show_bug.cgi?id=39989>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit bbb6b8c834e0e1491ca14403b5d0840dd14380d3)

diff --git a/render/animcur.c b/render/animcur.c
index 31cbab9..8d4a9c2 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -208,6 +208,9 @@ AnimCurDisplayCursor (DeviceIntPtr pDev,
     AnimCurScreenPtr    as = GetAnimCurScreen(pScreen);
     Bool		ret;
 
+    if (IsFloating(pDev))
+	    return FALSE;
+
     Unwrap (as, pScreen, DisplayCursor);
     if (IsAnimCur(pCursor))
     {
commit f89c39e6c9e20ffc3c1ae228ee601c2ab9007ff4
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Jan 9 15:04:10 2012 +1000

    dix: Update pointer limits for floating devices too (#43635)
    
    When the screen is restructured, the pointer limits need to be reset for
    floating slave devices as well, not just for master pointers. Only skip
    devices that don't have a cursor (attached slaves and keyboard)
    
    Bug reproducer: float an absolute slave device, rotate the screen - the
    device is now confined to a section of the screen only.
    
    X.Org Bug 43635 <http://bugs.freedesktop.org/show_bug.cgi?id=43635>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    (cherry picked from commit 35bd77e9d0701daae87d681900d749604fc6471f)

diff --git a/dix/events.c b/dix/events.c
index 8e7f9c3..7d2d0e3 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1356,7 +1356,7 @@ ScreenRestructured (ScreenPtr pScreen)
 
     for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
     {
-        if (!DevHasCursor(pDev))
+        if (!IsFloating(pDev) && !DevHasCursor(pDev))
             continue;
 
         /* GrabDevice doesn't have a confineTo field, so we don't need to
commit dea9377a257a402b2c7fe4a96c958d951a7d4579
Author: Zhigang Gong <zhigang.gong at linux.intel.com>
Date:   Wed Jan 4 07:01:19 2012 +0000

    mi/mibitblt: Fix an overflow bug of bit shift.
    
    When depth equal to 32 and planeMask equal to 0, the overflow will
    occur and cause the pixmap can't be cleared. There are some test
    cases in XTS hit this bug, and this fix can eliminate the corresponding
    failures.
    
    Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit f4956faab9ccf9aba6cf9603f4489f5dad19a347)

diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 49e17bd..6e00557 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -648,7 +648,7 @@ miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h,
     depth = pDraw->depth;
     if(format == ZPixmap)
     {
-	if ( (((1<<depth)-1)&planeMask) != (1<<depth)-1 )
+	if ( (((1LL<<depth)-1)&planeMask) != (1LL<<depth)-1 )
 	{
 	    ChangeGCVal gcv;
 	    xPoint pt;
commit d2db5100b1bafeeea8c1febd390631c8f8abb094
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Oct 28 21:29:50 2011 -0700

    Convert DetermineClientCmd to use strdup instead of malloc+strncpy
    
    *cmdname is initialized to NULL earlier in the function, so it's
    okay to overwrite it with NULL if strdup fails, don't need that
    extra check.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 780133f9ae7fada462714b47e79d26075bbd9abe)

diff --git a/os/client.c b/os/client.c
index aa9be84..fbccf22 100644
--- a/os/client.c
+++ b/os/client.c
@@ -234,13 +234,7 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
     /* Contruct the process name without arguments. */
     if (cmdname)
     {
-        char *name = malloc(cmdsize);
-        if (name)
-        {
-            strncpy(name, path, cmdsize);
-            name[cmdsize - 1] = '\0';
-            *cmdname = name;
-        }
+        *cmdname = strdup(path);
     }
 
     /* Construct the arguments for client process. */
commit 5b28bcb340e279e7f4e76617e86b439092367690
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Dec 13 21:23:12 2011 -0500

    dix: Tune dixLookupDrawable for success
    
    The vast vast vast majority of resource lookups are successful.  Move some
    work to the error paths so we don't punish success.
    
    Before:
    40000000 trep @   0.0009 msec (1109091.3/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square
    
    After:
    40000000 trep @   0.0009 msec (1148346.9/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (2091666.1/sec): ShmPutImage 10x10 square
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 8f9bdfd293ad8e45755efe8d764b4dcc2a724f51)

diff --git a/dix/dixutils.c b/dix/dixutils.c
index 1e31346..cfb0397 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -202,13 +202,12 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
     int rc;
 
     *pDraw = NULL;
-    client->errorValue = id;
-
-    if (id == INVALID)
-	return BadDrawable;
 
     rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
 
+    if (rc != Success)
+	client->errorValue = id;
+
     if (rc == BadValue)
 	return BadDrawable;
     if (rc != Success)
commit e1ea93fec93b13d18df4451210aaaf322b769b6a
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Dec 13 20:23:40 2011 -0500

    dix: Tune dtrace hooks around Dispatch
    
    Don't call LookupMajorName if the hooks aren't active, it's quite expensive.
    
    Before:
    40000000 trep @   0.0009 msec (1087458.5/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (2012238.6/sec): ShmPutImage 10x10 square
    
    After:
    40000000 trep @   0.0009 msec (1109091.3/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 83a98543b58c661a22574a6f8d8f9d777c0955b8)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index a13274c..316384a 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -425,9 +425,11 @@ Dispatch(void)
 			client->minorOp = ext->MinorOpcode(client);
 		}
 #ifdef XSERVER_DTRACE
-		XSERVER_REQUEST_START(LookupMajorName(client->majorOp), client->majorOp,
-			      ((xReq *)client->requestBuffer)->length,
-			      client->index, client->requestBuffer);
+		if (XSERVER_REQUEST_START_ENABLED())
+		    XSERVER_REQUEST_START(LookupMajorName(client->majorOp),
+					  client->majorOp,
+					  ((xReq *)client->requestBuffer)->length,
+					  client->index, client->requestBuffer);
 #endif
 		if (result > (maxBigRequestSize << 2))
 		    result = BadLength;
@@ -438,8 +440,10 @@ Dispatch(void)
 		    XaceHookAuditEnd(client, result);
 		}
 #ifdef XSERVER_DTRACE
-		XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp), client->majorOp,
-			      client->sequence, client->index, result);
+		if (XSERVER_REQUEST_DONE_ENABLED())
+		    XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp),
+					 client->majorOp, client->sequence,
+					 client->index, result);
 #endif
 
 		if (client->noClientException != Success)
commit 9eaa0b5c89f645c50ea90e07e8b49ebacf4349a0
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Dec 13 21:00:05 2011 -0500

    xace: ricer tuning for XaceHook
    
    gcc doesn't want to hoist the check for XaceHooks[hook] != NULL above the
    varargs code for some reason, so do it ourselves.
    
    Before:
    40000000 trep @   0.0010 msec (1050420.2/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (1921147.6/sec): ShmPutImage 10x10 square
    
    After:
    40000000 trep @   0.0009 msec (1087458.5/sec): PutImage 10x10 square
    60000000 trep @   0.0005 msec (2012238.6/sec): ShmPutImage 10x10 square
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 11977fab546da35d579ebe285e3c26864007805e)

diff --git a/Xext/xace.c b/Xext/xace.c
index c757cad..ef69fe3 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -101,6 +101,10 @@ int XaceHook(int hook, ...)
     } u;
     int *prv = NULL;	/* points to return value from callback */
     va_list ap;		/* argument list */
+
+    if (!XaceHooks[hook])
+	return Success;
+
     va_start(ap, hook);
 
     /* Marshal arguments for passing to callback.
commit a3b6ecc893e17028cfbe16d8d7981c9037fc0766
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Jan 3 10:45:45 2012 +1000

    xfree86: split warning about missing identifier or input driver
    
    Check for identifier first and bail if it's missing (also remove the current
    identifier check after we've already bailed due to missing identifiers)
    
    If a driver is missing, warn but also say that we may have added this device
    already. I see too many bugreports with incorrectly shortened log files.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    (cherry picked from commit 75953ccb9e9e5f1dbbaa44c714716a0049e22aae)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index d22fdc8..6625545 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -939,15 +939,16 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
         pInfo->attrs = DuplicateInputAttributes(attrs);
     }
 
-    if (!pInfo->driver || !pInfo->name) {
-        xf86Msg(X_INFO, "No input driver/identifier specified (ignoring)\n");
+    if (!pInfo->name) {
+        xf86Msg(X_INFO, "No identifier specified, ignoring this device.\n");
         rval = BadRequest;
         goto unwind;
     }
 
-    if (!pInfo->name) {
-        xf86Msg(X_ERROR, "No device identifier specified (ignoring)\n");
-        rval = BadMatch;
+    if (!pInfo->driver) {
+        xf86Msg(X_INFO, "No input driver specified, ignoring this device.\n");
+        xf86Msg(X_INFO, "This device may have been added with another device file.\n");
+        rval = BadRequest;
         goto unwind;
     }
 
commit 4a339afc586d55a9a248b893f007219d79c72600
Author: Julien Cristau <jcristau at debian.org>
Date:   Fri Dec 30 20:41:25 2011 +0100

    os: don't ignore failure from dladdr
    
    If dladdr returns 0, don't go and use the returned Dl_info, it may
    contain garbage.
    
    X.Org bug#44315 <https://bugs.freedesktop.org/show_bug.cgi?id=44315>
    
    Reported-and-tested-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 6269977c91071e0ea16ca5b4b8e15fd6db0b6fcf)

diff --git a/os/backtrace.c b/os/backtrace.c
index 7ca6dab..f3255c7 100644
--- a/os/backtrace.c
+++ b/os/backtrace.c
@@ -44,7 +44,11 @@ void xorg_backtrace(void)
     ErrorF("\nBacktrace:\n");
     size = backtrace(array, 64);
     for (i = 0; i < size; i++) {
-	dladdr(array[i], &info);
+	int rc = dladdr(array[i], &info);
+	if (rc == 0) {
+	    ErrorF("%d: ?? [%p]\n", i, array[i]);
+	    continue;
+	}
 	mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)";
 	if (info.dli_saddr)
 	    ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod,
commit 9a4be7e99f0e832df87b8e7fb548793dd4b52717
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Mon Jan 2 13:23:59 2012 +0000

    Add OpenBSD support to DetermineClientCmd()
    
    Uses kvm_getargv() from libkvm.
    
    Signed-off-by: Matthieu Herrb <matthieu.herrb at laas.fr>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 6d6d4cb6043905d850834946e9bfc526ed5a9ef7)

diff --git a/configure.ac b/configure.ac
index fdaa583..65fbc8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -999,6 +999,13 @@ if test "x$RES" = xyes && test "x$CLIENTIDS" = xyes; then
 else
 	CLIENTIDS=no
 fi
+if test "x$CLIENTIDS" = xyes; then
+	case $host_os in
+	openbsd*)
+		SYS_LIBS="$SYS_LIBS -lkvm"
+	;;
+	esac
+fi
 AC_MSG_RESULT([$CLIENTIDS])
 AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes])
 
diff --git a/os/client.c b/os/client.c
index e297f8c..aa9be84 100644
--- a/os/client.c
+++ b/os/client.c
@@ -64,6 +64,15 @@
 #include <procfs.h>
 #endif
 
+#ifdef __OpenBSD__
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/types.h>
+
+#include <kvm.h>
+#include <limits.h>
+#endif
+
 /**
  * Try to determine a PID for a client from its connection
  * information. This should be called only once when new client has
@@ -172,7 +181,39 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
         if (cmdargs && sp)
             *cmdargs = strdup(sp);
     }
-#else /* not Solaris */
+#elif defined(__OpenBSD__)
+    /* on OpenBSD use kvm_getargv() */
+    {
+	kvm_t *kd;
+	char errbuf[_POSIX2_LINE_MAX];
+	char **argv;
+	struct kinfo_proc *kp;
+	size_t len = 0;
+	int i, n;
+
+	kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
+	if (kd == NULL)
+		return;
+	kp = kvm_getprocs(kd, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), &n);
+	if (n != 1)
+		return;
+	argv = kvm_getargv(kd, kp, 0);
+	*cmdname = strdup(argv[0]);
+	i = 1;
+	while (argv[i] != NULL) {
+		len += strlen(argv[i]) + 1;
+		i++;
+	}
+	*cmdargs = calloc(1, len);
+	i = 1;
+	while (argv[i] != NULL) {
+		strlcat(*cmdargs, argv[i], len);
+		strlcat(*cmdargs, " ", len);
+		i++;
+	}
+	kvm_close(kd);
+    }
+#else /* Linux using /proc/pid/cmdline */
 
     /* Check if /proc/pid/cmdline exists. It's not supported on all
      * operating systems. */
commit 8046717d720c1bbbf02ba986622bc96c6b52a36c
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Dec 24 10:00:56 2011 -0800

    Add Solaris support to DetermineClientCmd
    
    Uses /proc/pid/psinfo to read command & partial arguments.
    
    Moves cmdsize & argsize variables into non-Solaris #else clause
    to avoid unused variable warnings.
    
    Fixes format mismatch errors when building with DEBUG defined on
    a 64-bit platform (where Mask is defined as CARD32).
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit cfc4c3d7fa8bd4da4c08b2ab8e6f85435f75353a)

diff --git a/os/client.c b/os/client.c
index b534977..e297f8c 100644
--- a/os/client.c
+++ b/os/client.c
@@ -59,6 +59,11 @@
 #include "os.h"
 #include "dixstruct.h"
 
+#ifdef __sun
+#include <errno.h>
+#include <procfs.h>
+#endif
+
 /**
  * Try to determine a PID for a client from its connection
  * information. This should be called only once when new client has
@@ -117,8 +122,6 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
 {
     char path[PATH_MAX + 1];
     int totsize = 0;
-    int cmdsize = 0;
-    int argsize = 0;
     int fd = 0;
 
     if (cmdname)
@@ -129,6 +132,48 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
     if (pid == -1)
         return;
 
+#ifdef __sun /* Solaris */
+    /* Solaris does not support /proc/pid/cmdline, but makes information
+     * similar to what ps shows available in a binary structure in the
+     * /proc/pid/psinfo file. */
+    if (snprintf(path, sizeof(path), "/proc/%d/psinfo", pid) < 0)
+        return;
+    fd = open(path, O_RDONLY);
+    if (fd < 0)
+    {
+        ErrorF ("Failed to open %s: %s\n", path, strerror(errno));
+        return;
+    }
+    else
+    {
+        psinfo_t psinfo = { 0 };
+        char *sp;
+
+        totsize = read(fd, &psinfo, sizeof(psinfo_t));
+        close(fd);
+        if (totsize <= 0)
+            return;
+
+        /* pr_psargs is the first PRARGSZ (80) characters of the command
+         * line string - assume up to the first space is the command name,
+         * since it's not delimited.   While there is also pr_fname, that's
+         * more limited, giving only the first 16 chars of the basename of
+         * the file that was exec'ed, thus cutting off many long gnome
+         * command names, or returning "isapython2.6" for all python scripts.
+         */
+        psinfo.pr_psargs[PRARGSZ-1] = '\0';
+        sp = strchr(psinfo.pr_psargs, ' ');
+        if (sp)
+            *sp++ = '\0';
+
+        if (cmdname)
+            *cmdname = strdup(psinfo.pr_psargs);
+
+        if (cmdargs && sp)
+            *cmdargs = strdup(sp);
+    }
+#else /* not Solaris */
+
     /* Check if /proc/pid/cmdline exists. It's not supported on all
      * operating systems. */
     if (snprintf(path, sizeof(path), "/proc/%d/cmdline", pid) < 0)
@@ -146,7 +191,6 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
     path[totsize - 1] = '\0';
 
     /* Contruct the process name without arguments. */
-    cmdsize = strlen(path) + 1;
     if (cmdname)
     {
         char *name = malloc(cmdsize);
@@ -159,10 +203,14 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
     }
 
     /* Construct the arguments for client process. */
-    argsize = totsize - cmdsize;
-    if (cmdargs && (argsize > 0))
+    if (cmdargs)
     {
-        char *args = malloc(argsize);
+        int cmdsize = strlen(path) + 1;
+        int argsize = totsize - cmdsize;
+        char *args = NULL;
+
+        if (argsize > 0)
+            args = malloc(argsize);
         if (args)
         {
             int i = 0;
@@ -175,6 +223,7 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
             *cmdargs = args;
         }
     }
+#endif
 }
 
 /**
@@ -198,9 +247,9 @@ void ReserveClientIds(struct _Client *client)
         DetermineClientCmd(client->clientIds->pid, &client->clientIds->cmdname, &client->clientIds->cmdargs);
 
     DebugF("client(%lx): Reserved pid(%d).\n",
-           client->clientAsMask, client->clientIds->pid);
+           (unsigned long) client->clientAsMask, client->clientIds->pid);
     DebugF("client(%lx): Reserved cmdname(%s) and cmdargs(%s).\n",
-           client->clientAsMask,
+           (unsigned long) client->clientAsMask,
            client->clientIds->cmdname ? client->clientIds->cmdname : "NULL",
            client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL");
 #endif /* CLIENTIDS */
@@ -222,9 +271,9 @@ void ReleaseClientIds(struct _Client *client)
         return;
 
     DebugF("client(%lx): Released pid(%d).\n",
-           client->clientAsMask, client->clientIds->pid);
+           (unsigned long) client->clientAsMask, client->clientIds->pid);
     DebugF("client(%lx): Released cmdline(%s) and cmdargs(%s).\n",
-           client->clientAsMask,
+           (unsigned long) client->clientAsMask,
            client->clientIds->cmdname ? client->clientIds->cmdname : "NULL",
            client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL");
 


More information about the Xquartz-changes mailing list