[Xquartz-changes] xserver: Branch 'server-1.18-apple' - 30 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Mon Oct 26 15:46:40 PDT 2015


Rebased ref, commits from common ancestor:
commit 80e2606c27481044a34d6ce711f5ba848c4be65d
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sat May 31 13:14:20 2014 -0700

    fb: Revert fb changes that broke XQuartz
    
        http://bugs.freedesktop.org/show_bug.cgi?id=26124
    
    Revert "Use new pixman_glyph_cache_t API that will be in pixman 0.28.0"
    Revert "fb: Fix origin of source picture in fbGlyphs"
    Revert "fb: Publish fbGlyphs and fbUnrealizeGlyph"
    
    This reverts commit 9cbcb5bd6a5360a128d15b77a02d8d3351f74366.
    This reverts commit 983e30361f49a67252d0b5d82630e70724d69dbf.
    This reverts commit 3c2c59eed3c68c0e5a93c38cf01eedad015e3157.

diff --git a/fb/fb.h b/fb/fb.h
index 256a1ee..8e87498 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1111,9 +1111,6 @@ extern _X_EXPORT void
 extern _X_EXPORT Bool
  fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
 
-extern _X_EXPORT void
-fbDestroyGlyphCache(void);
-
 /*
  * fbpixmap.c
  */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index be8274b..66dd633 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -65,152 +65,6 @@ fbComposite(CARD8 op,
     free_pixman_pict(pDst, dest);
 }
 
-static pixman_glyph_cache_t *glyphCache;
-
-void
-fbDestroyGlyphCache(void)
-{
-    if (glyphCache)
-    {
-	pixman_glyph_cache_destroy (glyphCache);
-	glyphCache = NULL;
-    }
-}
-
-static void
-fbUnrealizeGlyph(ScreenPtr pScreen,
-		 GlyphPtr pGlyph)
-{
-    if (glyphCache)
-	pixman_glyph_cache_remove (glyphCache, pGlyph, NULL);
-}
-
-void
-fbGlyphs(CARD8 op,
-	 PicturePtr pSrc,
-	 PicturePtr pDst,
-	 PictFormatPtr maskFormat,
-	 INT16 xSrc,
-	 INT16 ySrc, int nlist,
-	 GlyphListPtr list,
-	 GlyphPtr *glyphs)
-{
-#define N_STACK_GLYPHS 512
-    ScreenPtr pScreen = pDst->pDrawable->pScreen;
-    pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
-    pixman_glyph_t *pglyphs = stack_glyphs;
-    pixman_image_t *srcImage, *dstImage;
-    int srcXoff, srcYoff, dstXoff, dstYoff;
-    GlyphPtr glyph;
-    int n_glyphs;
-    int x, y;
-    int i, n;
-    int xDst = list->xOff, yDst = list->yOff;
-
-    miCompositeSourceValidate(pSrc);
-
-    n_glyphs = 0;
-    for (i = 0; i < nlist; ++i)
-	n_glyphs += list[i].len;
-
-    if (!glyphCache)
-	glyphCache = pixman_glyph_cache_create();
-
-    pixman_glyph_cache_freeze (glyphCache);
-
-    if (n_glyphs > N_STACK_GLYPHS) {
-	if (!(pglyphs = xallocarray(n_glyphs, sizeof(pixman_glyph_t))))
-	    goto out;
-    }
-
-    i = 0;
-    x = y = 0;
-    while (nlist--) {
-        x += list->xOff;
-        y += list->yOff;
-        n = list->len;
-        while (n--) {
-	    const void *g;
-
-            glyph = *glyphs++;
-
-	    if (!(g = pixman_glyph_cache_lookup (glyphCache, glyph, NULL))) {
-		pixman_image_t *glyphImage;
-		PicturePtr pPicture;
-		int xoff, yoff;
-
-		pPicture = GetGlyphPicture(glyph, pScreen);
-		if (!pPicture) {
-		    n_glyphs--;
-		    goto next;
-		}
-
-		if (!(glyphImage = image_from_pict(pPicture, FALSE, &xoff, &yoff)))
-		    goto out;
-
-		g = pixman_glyph_cache_insert(glyphCache, glyph, NULL,
-					      glyph->info.x,
-					      glyph->info.y,
-					      glyphImage);
-
-		free_pixman_pict(pPicture, glyphImage);
-
-		if (!g)
-		    goto out;
-	    }
-
-	    pglyphs[i].x = x;
-	    pglyphs[i].y = y;
-	    pglyphs[i].glyph = g;
-	    i++;
-
-	next:
-            x += glyph->info.xOff;
-            y += glyph->info.yOff;
-	}
-	list++;
-    }
-
-    if (!(srcImage = image_from_pict(pSrc, FALSE, &srcXoff, &srcYoff)))
-	goto out;
-
-    if (!(dstImage = image_from_pict(pDst, TRUE, &dstXoff, &dstYoff)))
-	goto out_free_src;
-
-    if (maskFormat) {
-	pixman_format_code_t format;
-	pixman_box32_t extents;
-
-	format = maskFormat->format | (maskFormat->depth << 24);
-
-	pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents);
-
-	pixman_composite_glyphs(op, srcImage, dstImage, format,
-				xSrc + srcXoff + extents.x1 - xDst, ySrc + srcYoff + extents.y1 - yDst,
-				extents.x1, extents.y1,
-				extents.x1 + dstXoff, extents.y1 + dstYoff,
-				extents.x2 - extents.x1,
-				extents.y2 - extents.y1,
-				glyphCache, n_glyphs, pglyphs);
-    }
-    else {
-	pixman_composite_glyphs_no_mask(op, srcImage, dstImage,
-					xSrc + srcXoff - xDst, ySrc + srcYoff - yDst,
-					dstXoff, dstYoff,
-					glyphCache, n_glyphs, pglyphs);
-    }
-
-    free_pixman_pict(pDst, dstImage);
-
-out_free_src:
-    free_pixman_pict(pSrc, srcImage);
-
-out:
-    pixman_glyph_cache_thaw(glyphCache);
-    if (pglyphs != stack_glyphs)
-	free(pglyphs);
-}
-
 static pixman_image_t *
 create_solid_fill_image(PicturePtr pict)
 {
@@ -470,8 +324,7 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
         return FALSE;
     ps = GetPictureScreen(pScreen);
     ps->Composite = fbComposite;
-    ps->Glyphs = fbGlyphs;
-    ps->UnrealizeGlyph = fbUnrealizeGlyph;
+    ps->Glyphs = miGlyphs;
     ps->CompositeRects = miCompositeRects;
     ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
     ps->AddTraps = fbAddTraps;
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 5cb8663..110f32d 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -65,20 +65,11 @@ fbTrapezoids(CARD8 op,
              INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps);
 
 extern _X_EXPORT void
+
 fbTriangles(CARD8 op,
             PicturePtr pSrc,
             PicturePtr pDst,
             PictFormatPtr maskFormat,
             INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris);
 
-extern _X_EXPORT void
-fbGlyphs(CARD8 op,
-	 PicturePtr pSrc,
-	 PicturePtr pDst,
-	 PictFormatPtr maskFormat,
-	 INT16 xSrc,
-	 INT16 ySrc, int nlist,
-	 GlyphListPtr list,
-	 GlyphPtr *glyphs);
-
 #endif                          /* _FBPICT_H_ */
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 71bcc5d..55330fc 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -32,7 +32,6 @@ fbCloseScreen(ScreenPtr pScreen)
     int d;
     DepthPtr depths = pScreen->allowedDepths;
 
-    fbDestroyGlyphCache();
     for (d = 0; d < pScreen->numDepths; d++)
         free(depths[d].vids);
     free(depths);
commit fb07b1901648850c008416b5a8dfa2f56cbb2466
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 c687aa7..256a1ee 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1321,8 +1321,7 @@ fbFillRegionSolid(DrawablePtr pDrawable,
                   RegionPtr pRegion, FbBits and, FbBits xor);
 
 extern _X_EXPORT pixman_image_t *image_from_pict(PicturePtr pict,
-                                                 Bool has_clip,
-                                                 int *xoff, int *yoff);
+                                                 Bool has_clip);
 
 extern _X_EXPORT void free_pixman_pict(PicturePtr, pixman_image_t *);
 
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 434d890..be8274b 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -46,23 +46,18 @@ fbComposite(CARD8 op,
             INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, 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, width, height);
+                               xSrc, ySrc, xMask, yMask, xDst, yDst,
+                               width, height);
     }
 
     free_pixman_pict(pSrc, src);
@@ -289,20 +284,22 @@ create_conical_gradient_image(PictGradient * gradient)
 }
 
 static pixman_image_t *
-create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+create_bits_picture(PicturePtr pict, 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, (uint32_t *) bits,
+                                     pict->pDrawable->width,
+                                     pict->pDrawable->height, (uint32_t *) bits,
                                      stride * sizeof(FbStride));
 
     if (!image)
@@ -321,28 +318,21 @@ create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
         if (pict->clientClip)
             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);
 
 static void image_destroy(pixman_image_t *image, void *data)
@@ -351,32 +341,13 @@ static void image_destroy(pixman_image_t *image, void *data)
 }
 
 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, pict->transform);
     }
 
     switch (pict->repeatType) {
@@ -404,10 +375,8 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
      * as the alpha map for this operation
      */
     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);
+            image_from_pict_internal(pict->alphaMap, TRUE, TRUE);
 
         pixman_image_set_alpha_map(image, alpha_map, pict->alphaOrigin.x,
                                    pict->alphaOrigin.y);
@@ -445,8 +414,7 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
 }
 
 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;
 
@@ -454,7 +422,7 @@ image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
         return NULL;
 
     if (pict->pDrawable) {
-        image = create_bits_picture(pict, has_clip, xoff, yoff);
+        image = create_bits_picture(pict, has_clip);
     }
     else if (pict->pSourcePict) {
         SourcePict *sp = pict->pSourcePict;
@@ -472,19 +440,17 @@ 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 bf82f8f..0145ce9 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -36,13 +36,12 @@ fbAddTraps(PicturePtr pPicture,
            INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
-        return;
-
-    pixman_add_traps(image, x_off + dst_xoff, y_off + dst_yoff,
-                     ntrap, (pixman_trap_t *) traps);
+    if (!(image = image_from_pict (pPicture, FALSE)))
+	return;
+    
+    pixman_add_traps(image, x_off, y_off,
+                     ntrap, (pixman_trap_t *)traps);
 
     free_pixman_pict(pPicture, image);
 }
@@ -52,13 +51,12 @@ fbRasterizeTrapezoid(PicturePtr pPicture,
                      xTrapezoid * trap, int x_off, 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);
+    pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *)trap,
+                               x_off, y_off);
 
     free_pixman_pict(pPicture, image);
 }
@@ -68,14 +66,12 @@ fbAddTriangles(PicturePtr pPicture,
                INT16 x_off, INT16 y_off, int ntri, 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,
-                         ntri, (pixman_triangle_t *) tris);
+    
+    pixman_add_triangles(image, x_off, y_off, ntri,
+                         (pixman_triangle_t *)tris);
 
     free_pixman_pict(pPicture, image);
 }
@@ -98,13 +94,11 @@ fbShapes(CompositeShapesFunc composite,
          int16_t ySrc, int nshapes, int shape_size, 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) {
         pixman_format_code_t format;
@@ -121,9 +115,8 @@ fbShapes(CompositeShapesFunc composite,
 
             for (i = 0; i < nshapes; ++i) {
                 composite(op, src, dst, format,
-                          xSrc + src_xoff,
-                          ySrc + src_yoff,
-                          dst_xoff, dst_yoff, 1, shapes + i * shape_size);
+                          xSrc, ySrc, 0, 0, 
+                          1, shapes + i * shape_size);
             }
         }
         else {
@@ -143,8 +136,8 @@ fbShapes(CompositeShapesFunc composite,
             }
 
             composite(op, src, dst, format,
-                      xSrc + src_xoff,
-                      ySrc + src_yoff, dst_xoff, dst_yoff, nshapes, shapes);
+                      xSrc, ySrc, 0, 0,
+                      nshapes, shapes);
         }
 
         DamageRegionProcessPending(pDst->pDrawable);
commit e6ffce3a97b1259271e327833e8fd3fa7d26b4c1
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sat Nov 2 11:00:23 2013 -0700

    Use old miTrapezoids and miTriangles routines
    
    Reverts commits:
        788ccb9a8bcf6a4fb4054c507111eec3338fb969
        566f1931ee2916269e164e114bffaf2da1d039d1
    
    http://xquartz.macosforge.org/trac/ticket/525
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/fb/fbpict.c b/fb/fbpict.c
index 7ea0b66..434d890 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -508,10 +508,8 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
     ps->UnrealizeGlyph = fbUnrealizeGlyph;
     ps->CompositeRects = miCompositeRects;
     ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
-    ps->Trapezoids = fbTrapezoids;
     ps->AddTraps = fbAddTraps;
     ps->AddTriangles = fbAddTriangles;
-    ps->Triangles = fbTriangles;
 
     return TRUE;
 }
diff --git a/render/mipict.c b/render/mipict.c
index 4b85512..a39eb2c 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -575,8 +575,8 @@ miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
     ps->Composite = 0;          /* requires DDX support */
     ps->Glyphs = miGlyphs;
     ps->CompositeRects = miCompositeRects;
-    ps->Trapezoids = 0;
-    ps->Triangles = 0;
+    ps->Trapezoids = miTrapezoids;
+    ps->Triangles = miTriangles;
 
     ps->RasterizeTrapezoid = 0; /* requires DDX support */
     ps->AddTraps = 0;           /* requires DDX support */
diff --git a/render/mipict.h b/render/mipict.h
index 3241be4..8ee7a8a 100644
--- a/render/mipict.h
+++ b/render/mipict.h
@@ -102,9 +102,36 @@ miCompositeRects(CARD8 op,
                  xRenderColor * color, int nRect, xRectangle *rects);
 
 extern _X_EXPORT void
+miTriangles (CARD8	    op,
+	     PicturePtr	    pSrc,
+	     PicturePtr	    pDst,
+	     PictFormatPtr  maskFormat,
+	     INT16	    xSrc,
+	     INT16	    ySrc,
+	     int	    ntri,
+	     xTriangle	    *tris);
+
+extern _X_EXPORT PicturePtr
+miCreateAlphaPicture (ScreenPtr            pScreen, 
+                     PicturePtr    pDst,
+                     PictFormatPtr pPictFormat,
+                     CARD16        width,
+                     CARD16        height);
+
+extern _X_EXPORT void
  miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box);
 
 extern _X_EXPORT void
+miTrapezoids (CARD8        op,
+             PicturePtr    pSrc,
+             PicturePtr    pDst,
+             PictFormatPtr maskFormat,
+             INT16         xSrc,
+             INT16         ySrc,
+             int           ntrap,
+             xTrapezoid    *traps);
+
+extern _X_EXPORT void
  miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds);
 
 extern _X_EXPORT void
diff --git a/render/mitrap.c b/render/mitrap.c
index 17b6dcd..71c1857 100644
--- a/render/mitrap.c
+++ b/render/mitrap.c
@@ -34,6 +34,55 @@
 #include "picturestr.h"
 #include "mipict.h"
 
+PicturePtr
+miCreateAlphaPicture (ScreenPtr	    pScreen, 
+		      PicturePtr    pDst,
+		      PictFormatPtr pPictFormat,
+		      CARD16	    width,
+		      CARD16	    height)
+{
+    PixmapPtr	    pPixmap;
+    PicturePtr	    pPicture;
+    GCPtr	    pGC;
+    int		    error;
+    xRectangle	    rect;
+
+    if (width > 32767 || height > 32767)
+	return 0;
+
+    if (!pPictFormat)
+    {
+	if (pDst->polyEdge == PolyEdgeSharp)
+	    pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
+	else
+	    pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
+	if (!pPictFormat)
+	    return 0;
+    }
+
+    pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 
+					pPictFormat->depth, 0);
+    if (!pPixmap)
+	return 0;
+    pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
+    if (!pGC)
+    {
+	(*pScreen->DestroyPixmap) (pPixmap);
+	return 0;
+    }
+    ValidateGC (&pPixmap->drawable, pGC);
+    rect.x = 0;
+    rect.y = 0;
+    rect.width = width;
+    rect.height = height;
+    (*pGC->ops->PolyFillRect)(&pPixmap->drawable, pGC, 1, &rect);
+    FreeScratchGC (pGC);
+    pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
+			      0, 0, serverClient, &error);
+    (*pScreen->DestroyPixmap) (pPixmap);
+    return pPicture;
+}
+
 static xFixed
 miLineFixedX(xLineFixed * l, xFixed y, Bool ceil)
 {
@@ -79,3 +128,65 @@ miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box)
             box->x2 = x2;
     }
 }
+
+
+void
+miTrapezoids (CARD8        op,
+             PicturePtr    pSrc,
+             PicturePtr    pDst,
+             PictFormatPtr maskFormat,
+             INT16         xSrc,
+             INT16         ySrc,
+             int           ntrap,
+             xTrapezoid    *traps)
+{
+    ScreenPtr          pScreen = pDst->pDrawable->pScreen;
+    PictureScreenPtr    ps = GetPictureScreen(pScreen);
+
+    /*
+     * Check for solid alpha add
+     */
+    if (op == PictOpAdd && miIsSolidAlpha (pSrc))
+    {
+       for (; ntrap; ntrap--, traps++)
+           (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
+    } 
+    else if (maskFormat)
+    {
+       PicturePtr      pPicture;
+       BoxRec          bounds;
+       INT16           xDst, yDst;
+       INT16           xRel, yRel;
+       
+       xDst = traps[0].left.p1.x >> 16;
+       yDst = traps[0].left.p1.y >> 16;
+
+       miTrapezoidBounds (ntrap, traps, &bounds);
+       if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
+           return;
+       pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
+                                        bounds.x2 - bounds.x1,
+                                        bounds.y2 - bounds.y1);
+       if (!pPicture)
+           return;
+       for (; ntrap; ntrap--, traps++)
+           (*ps->RasterizeTrapezoid) (pPicture, traps, 
+                                      -bounds.x1, -bounds.y1);
+       xRel = bounds.x1 + xSrc - xDst;
+       yRel = bounds.y1 + ySrc - yDst;
+       CompositePicture (op, pSrc, pPicture, pDst,
+                         xRel, yRel, 0, 0, bounds.x1, bounds.y1,
+                         bounds.x2 - bounds.x1,
+                         bounds.y2 - bounds.y1);
+       FreePicture (pPicture, 0);
+    }
+    else
+    {
+       if (pDst->polyEdge == PolyEdgeSharp)
+           maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
+       else
+           maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
+       for (; ntrap; ntrap--, traps++)
+           miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
+    }
+}
diff --git a/render/mitri.c b/render/mitri.c
index 922f22a..bdca9ca 100644
--- a/render/mitri.c
+++ b/render/mitri.c
@@ -65,3 +65,64 @@ miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds)
 {
     miPointFixedBounds(ntri * 3, (xPointFixed *) tris, bounds);
 }
+
+
+void
+miTriangles (CARD8	    op,
+	     PicturePtr	    pSrc,
+	     PicturePtr	    pDst,
+	     PictFormatPtr  maskFormat,
+	     INT16	    xSrc,
+	     INT16	    ySrc,
+	     int	    ntri,
+	     xTriangle	    *tris)
+{
+    ScreenPtr		pScreen = pDst->pDrawable->pScreen;
+    PictureScreenPtr    ps = GetPictureScreen(pScreen);
+    
+    /*
+     * Check for solid alpha add
+     */
+    if (op == PictOpAdd && miIsSolidAlpha (pSrc))
+    {
+	(*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
+    }
+    else if (maskFormat)
+    {
+	BoxRec		bounds;
+	PicturePtr	pPicture;
+	INT16		xDst, yDst;
+	INT16		xRel, yRel;
+	
+	xDst = tris[0].p1.x >> 16;
+	yDst = tris[0].p1.y >> 16;
+
+	miTriangleBounds (ntri, tris, &bounds);
+	if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
+	    return;
+	pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
+					 bounds.x2 - bounds.x1,
+					 bounds.y2 - bounds.y1);
+	if (!pPicture)
+	    return;
+	(*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
+	
+	xRel = bounds.x1 + xSrc - xDst;
+	yRel = bounds.y1 + ySrc - yDst;
+	CompositePicture (op, pSrc, pPicture, pDst,
+			  xRel, yRel, 0, 0, bounds.x1, bounds.y1,
+			  bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
+	FreePicture (pPicture, 0);
+    }
+    else
+    {
+	if (pDst->polyEdge == PolyEdgeSharp)
+	    maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
+	else
+	    maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
+	
+	for (; ntri; ntri--, tris++)
+	    miTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
+    }
+}
+
commit 3bac9cba7e395afbbd6753dd0639fd425a08cdc4
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Jan 13 12:00:57 2012 -0800

    sdksyms.sh: Use CPPFLAGS, not CFLAGS
    
    CFLAGS can include flags which are not useful to the preprocessor
    or can even cause it to fail.  This fixes a build issue on darwin
    when building for more than one architecture.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index c45d8c9..60a586d 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -48,8 +48,7 @@ DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
 bin_PROGRAMS = Xorg
 nodist_Xorg_SOURCES = sdksyms.c
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
+AM_CPPFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
 	-I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \
 	-I$(srcdir)/dri -I$(srcdir)/dri2 -I$(top_srcdir)/dri3
 
@@ -135,7 +134,7 @@ CLEANFILES = sdksyms.c sdksyms.dep Xorg.sh
 EXTRA_DIST += sdksyms.sh
 
 sdksyms.dep sdksyms.c: sdksyms.sh
-	$(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS)
+	$(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CPPFLAGS) $(AM_CPPFLAGS)
 
 SDKSYMS_DEP = sdksyms.dep
 -include $(SDKSYMS_DEP)
commit d8b7a900cf912cadb5915b3924dd6ce5a74505e7
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Oct 26 13:47:04 2015 -0400

    xserver 1.17.99.902 (1.18 RC2)
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/configure.ac b/configure.ac
index 220478a..9828cab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,9 +26,9 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.17.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2015-09-01"
-RELEASE_NAME="Nectarine"
+AC_INIT([xorg-server], 1.17.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2015-10-26"
+RELEASE_NAME="Amontillado"
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
commit 47b00fa4bf3b67736957296492310f7fdd6c0a25
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Oct 21 12:15:34 2015 -0400

    xfree86: Use same inb/outb asm code for i386 amd64 and ia64
    
    This matches the GCCUSESGAS path from the old monolith build (where that
    macro was actually set), and fixes the build on modern OSX.
    
    Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 85fb35c..5a1fdac 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -286,7 +286,7 @@ extern _X_EXPORT unsigned int inl(unsigned int port);
 #include <machine/pio.h>
 #endif                          /* __NetBSD__ */
 
-#elif defined(__amd64__)
+#elif defined(__amd64__) || defined(__i386__) || defined(__ia64__)
 
 #include <inttypes.h>
 
@@ -967,53 +967,6 @@ inl(unsigned PORT_SIZE port)
 
 #endif                          /* NDS32_MMIO_SWAP */
 
-#elif defined(__i386__) || defined(__ia64__)
-
-static __inline__ void
-outb(unsigned short port, unsigned char val)
-{
-    __asm__ __volatile__("out%B0 (%1)"::"a"(val), "d"(port));
-}
-
-static __inline__ void
-outw(unsigned short port, unsigned short val)
-{
-    __asm__ __volatile__("out%W0 (%1)"::"a"(val), "d"(port));
-}
-
-static __inline__ void
-outl(unsigned short port, unsigned int val)
-{
-    __asm__ __volatile__("out%L0 (%1)"::"a"(val), "d"(port));
-}
-
-static __inline__ unsigned int
-inb(unsigned short port)
-{
-    unsigned char ret;
-    __asm__ __volatile__("in%B0 (%1)":"=a"(ret):"d"(port));
-
-    return ret;
-}
-
-static __inline__ unsigned int
-inw(unsigned short port)
-{
-    unsigned short ret;
-    __asm__ __volatile__("in%W0 (%1)":"=a"(ret):"d"(port));
-
-    return ret;
-}
-
-static __inline__ unsigned int
-inl(unsigned short port)
-{
-    unsigned int ret;
-    __asm__ __volatile__("in%L0 (%1)":"=a"(ret):"d"(port));
-
-    return ret;
-}
-
 #endif                          /* arch madness */
 
 #else                           /* !GNUC */
commit c99fb550e06207e83ec89463fe32bd6bceca45f8
Author: Dave Airlie <airlied at gmail.com>
Date:   Sun Sep 13 07:45:15 2015 +1000

    xf86: don't add gpus from udev if autoAddGPU is set
    
    At startup the server wasn't adding devices, but nothing
    was blocking hotplug devices by the look of it.
    
    bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91388
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index f1e9423..96895a6 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -477,6 +477,9 @@ xf86platformAddDevice(int index)
     screenLayoutPtr layout;
     static const char *hotplug_driver_name = "modesetting";
 
+    if (!xf86Info.autoAddGPU)
+        return -1;
+
     /* force load the driver for now */
     xf86LoadOneModule(hotplug_driver_name, NULL);
 
commit 912f1fe2bb1b640d55fc44fcf636b6ca40d7f40b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Apr 5 10:32:03 2015 +0100

    Xv: Only stop the adaptors when the Pixmap is finally destroyed
    
    Pixmaps are reference counted and DestroyPixmap is called for the
    removal of every reference. However, we only want to stop the adaptors
    writing into the Pixmap just before the Pixmap is finally destroyed,
    similar to how Windows are handled.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
    Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 93e5f0c..0c6f25b 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -327,36 +327,24 @@ XvGetRTPort(void)
     return XvRTPort;
 }
 
-static Bool
-XvDestroyPixmap(PixmapPtr pPix)
+static void
+XvStopAdaptors(DrawablePtr pDrawable)
 {
-    Bool status;
-    ScreenPtr pScreen;
-    XvScreenPtr pxvs;
-    XvAdaptorPtr pa;
-    int na;
-    XvPortPtr pp;
-    int np;
-
-    pScreen = pPix->drawable.pScreen;
-
-    SCREEN_PROLOGUE(pScreen, DestroyPixmap);
-
-    pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
+    ScreenPtr pScreen = pDrawable->pScreen;
+    XvScreenPtr pxvs = dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
+    XvAdaptorPtr pa = pxvs->pAdaptors;
+    int na = pxvs->nAdaptors;
 
     /* CHECK TO SEE IF THIS PORT IS IN USE */
-
-    pa = pxvs->pAdaptors;
-    na = pxvs->nAdaptors;
     while (na--) {
-        np = pa->nPorts;
-        pp = pa->pPorts;
+        XvPortPtr pp = pa->pPorts;
+        int np = pa->nPorts;
 
         while (np--) {
-            if (pp->pDraw == (DrawablePtr) pPix) {
-                XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
+            if (pp->pDraw == pDrawable) {
+                XvdiSendVideoNotify(pp, pDrawable, XvPreempted);
 
-                (void) (*pp->pAdaptor->ddStopVideo) (pp, pp->pDraw);
+                (void) (*pp->pAdaptor->ddStopVideo) (pp, pDrawable);
 
                 pp->pDraw = NULL;
                 pp->client = NULL;
@@ -366,9 +354,19 @@ XvDestroyPixmap(PixmapPtr pPix)
         }
         pa++;
     }
+}
 
-    status = (*pScreen->DestroyPixmap) (pPix);
+static Bool
+XvDestroyPixmap(PixmapPtr pPix)
+{
+    ScreenPtr pScreen = pPix->drawable.pScreen;
+    Bool status;
+
+    if (pPix->refcnt == 1)
+        XvStopAdaptors(&pPix->drawable);
 
+    SCREEN_PROLOGUE(pScreen, DestroyPixmap);
+    status = (*pScreen->DestroyPixmap) (pPix);
     SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
 
     return status;
@@ -378,45 +376,13 @@ XvDestroyPixmap(PixmapPtr pPix)
 static Bool
 XvDestroyWindow(WindowPtr pWin)
 {
+    ScreenPtr pScreen = pWin->drawable.pScreen;
     Bool status;
-    ScreenPtr pScreen;
-    XvScreenPtr pxvs;
-    XvAdaptorPtr pa;
-    int na;
-    XvPortPtr pp;
-    int np;
 
-    pScreen = pWin->drawable.pScreen;
+    XvStopAdaptors(&pWin->drawable);
 
     SCREEN_PROLOGUE(pScreen, DestroyWindow);
-
-    pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
-
-    /* CHECK TO SEE IF THIS PORT IS IN USE */
-
-    pa = pxvs->pAdaptors;
-    na = pxvs->nAdaptors;
-    while (na--) {
-        np = pa->nPorts;
-        pp = pa->pPorts;
-
-        while (np--) {
-            if (pp->pDraw == (DrawablePtr) pWin) {
-                XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
-
-                (void) (*pp->pAdaptor->ddStopVideo) (pp, pp->pDraw);
-
-                pp->pDraw = NULL;
-                pp->client = NULL;
-                pp->time = currentTime;
-            }
-            pp++;
-        }
-        pa++;
-    }
-
     status = (*pScreen->DestroyWindow) (pWin);
-
     SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
 
     return status;
commit 413cb2ff1d754b5f19d77ff19cddf40793989c03
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Feb 16 09:49:18 2015 +0000

    present: Fix missed notify MSC computation
    
    Only treat divisor==0 as async to immediately report the actual vblank.
    If the user species a non-zero divisor, we should compute the missed
    vblank properly or else we report too early.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-by: Mario Kleiner <mario.kleiner.de at gmail.com>

diff --git a/present/present.c b/present/present.c
index 7ddffbd..beb4ff0 100644
--- a/present/present.c
+++ b/present/present.c
@@ -933,7 +933,7 @@ present_notify_msc(WindowPtr window,
                           0, 0,
                           NULL,
                           NULL, NULL,
-                          PresentOptionAsync,
+                          divisor == 0 ? PresentOptionAsync : 0,
                           target_msc, divisor, remainder, NULL, 0);
 }
 
commit 702c0a247f5523b43652befaf6be548ddbbe9dee
Author: Alberto Milone <alberto.milone at canonical.com>
Date:   Thu Dec 12 10:00:09 2013 +0100

    randr: make RROutputChanged change the main protocol screen not the gpu screen
    
    We only set changes on the main protocol screen as, for example
    in RRSetChanged() and RRTellChanged(), therefore we should follow
    the same logic when reporting that an output changed in
    RROutputChanged().
    
    This means that RRTellChanged() will then update the relevant
    timestamps also when events come from gpu screens.
    
    [ajax: Fix mixed code and decls]
    
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Alberto Milone <alberto.milone at canonical.com>

diff --git a/randr/rroutput.c b/randr/rroutput.c
index 10df4da..d12b9ba 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -31,15 +31,27 @@ RESTYPE RROutputType;
 void
 RROutputChanged(RROutputPtr output, Bool configChanged)
 {
+    /* set changed bits on the master screen only */
     ScreenPtr pScreen = output->pScreen;
+    rrScrPrivPtr mastersp;
 
     output->changed = TRUE;
-    if (pScreen) {
-        rrScrPriv(pScreen);
-        RRSetChanged(pScreen);
-        if (configChanged)
-            pScrPriv->configChanged = TRUE;
+    if (!pScreen)
+        return;
+
+    if (pScreen->isGPU) {
+        ScreenPtr master = pScreen->current_master;
+        if (!master)
+            return;
+        mastersp = rrGetScrPriv(master);
+    }
+    else {
+        mastersp = rrGetScrPriv(pScreen);
     }
+
+    RRSetChanged(pScreen);
+    if (configChanged)
+        mastersp->configChanged = TRUE;
 }
 
 /*
commit 2092f12a243b9f7682f542b593b77c96d455ec89
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Oct 21 11:36:06 2015 +0200

    linux: Do not call FatalError from xf86CloseConsole
    
    FatalError ends up calling xf86CloseConsole itself, so calling FatalError
    from within xf86CloseConsole is not a good idea.
    
    Make switch_to log errors using xf86Msg(X_WARNING, ...) and return success
    (or failure).
    
    This makes switch_to match the other error checking done in xf86CloseConsole
    which all logs warnings and continues.
    
    Add checking of the return value in xf86OpenConsole and call
    FatalError there when switch_to fails, to preserve the error-handling
    behavior of xf86OpenConsole.
    
    BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1269210
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index ec06a05..1ed213c 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -63,18 +63,24 @@ drain_console(int fd, void *closure)
     }
 }
 
-static void
+static int
 switch_to(int vt, const char *from)
 {
     int ret;
 
     SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
-    if (ret < 0)
-        FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
+    if (ret < 0) {
+        xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
+        return 0;
+    }
 
     SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
-    if (ret < 0)
-        FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
+    if (ret < 0) {
+        xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
+        return 0;
+    }
+
+    return 1;
 }
 
 #pragma GCC diagnostic push
@@ -233,7 +239,8 @@ xf86OpenConsole(void)
             /*
              * now get the VT.  This _must_ succeed, or else fail completely.
              */
-            switch_to(xf86Info.vtno, "xf86OpenConsole");
+            if (!switch_to(xf86Info.vtno, "xf86OpenConsole"))
+                FatalError("xf86OpenConsole: Switching VT failed\n");
 
             SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
             if (ret < 0)
@@ -294,7 +301,8 @@ xf86OpenConsole(void)
     else {                      /* serverGeneration != 1 */
         if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch) {
             /* now get the VT */
-            switch_to(xf86Info.vtno, "xf86OpenConsole");
+            if (!switch_to(xf86Info.vtno, "xf86OpenConsole"))
+                FatalError("xf86OpenConsole: Switching VT failed\n");
         }
     }
 }
commit ee06f674bbcd796324d6daf69bfb5d8856e94008
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Thu Oct 15 22:28:49 2015 -0700

    Xi: Silence some tautological warnings
    
    xichangehierarchy.c:424:23: warning: comparison of constant 536870911 with expression of type 'uint16_t'
          (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare,Semantic Issue]
        if (stuff->length > (INT_MAX >> 2))
            ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
    xichangehierarchy.c:438:26: warning: comparison of constant 536870911 with expression of type 'uint16_t'
          (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare,Semantic Issue]
            if ((any->length > (INT_MAX >> 2)) || (len < (any->length << 2)))
                 ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 2732445..8d5b577 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -421,9 +421,7 @@ ProcXIChangeHierarchy(ClientPtr client)
     if (!stuff->num_changes)
         return rc;
 
-    if (stuff->length > (INT_MAX >> 2))
-        return BadAlloc;
-    len = (stuff->length << 2) - sizeof(xXIAnyHierarchyChangeInfo);
+    len = ((size_t)stuff->length << 2) - sizeof(xXIAnyHierarchyChangeInfo);
 
     any = (xXIAnyHierarchyChangeInfo *) &stuff[1];
     while (stuff->num_changes--) {
@@ -435,7 +433,7 @@ ProcXIChangeHierarchy(ClientPtr client)
         SWAPIF(swaps(&any->type));
         SWAPIF(swaps(&any->length));
 
-        if ((any->length > (INT_MAX >> 2)) || (len < (any->length << 2)))
+        if (len < ((size_t)any->length << 2))
             return BadLength;
 
 #define CHANGE_SIZE_MATCH(type) \
commit 113c0bb4fd764da8c08d8f30abe350c7650c9fc2
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date:   Mon Oct 19 23:15:36 2015 +0200

    hurd: fix xorg-wrapper build
    
    hurd does not have any PATH_MAX limitation. misc.h provides a default value
    which is fine here.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Samuel Thibault <samuel.thibault at ens-lyon.org>

diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index 6f658d7..4c37cfc 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -44,6 +44,8 @@
 #include <xf86drm.h> /* For DRM_DEV_NAME */
 #endif
 
+#include "misc.h"
+
 #define CONFIG_FILE SYSCONFDIR "/X11/Xwrapper.config"
 
 static const char *progname;
commit f9a04d19aef77bf787b8d322305a6971d24a6ba1
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 21 07:16:12 2015 +0100

    fonts: Continue when font calls return Suspended more than once
    
    Patch 3ab6cd31cbdf8095b2948034fce5fb645422d8da fixed Xinerama
    interactions with font servers by not putting clients to sleep
    multiple times. However, it introduced additional changes dealing with
    libXfont routine returning Suspended more than once for the same
    request. This additional change was to abandon processing of the
    current request and free the closure data by jumping to
    'xinerama_sleep' in each of the functions.
    
    Font library functions shouldn't return Suspended more than once,
    except for ListFontsWithInfo, which produces multiple replies, and
    thus ends up returning Suspended many times during processing.
    
    With the jump to xinerama_sleep occurring after the first reply was
    processed, the closure for the request was freed and future calls into
    the ListFontsWithInfo callback resulted in dereferencing freed
    memory.
    
    This patch removes the added branches, reverting the code to its
    previous behaviour, which permitted multiple Suspended returns and
    simply waited for the client to be signaled again so that the callback
    could continue processing the request.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 968cee4..300bf04 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -313,8 +313,6 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
         if (err == Suspended) {
             if (!ClientIsAsleep(client))
                 ClientSleep(client, (ClientSleepProcPtr) doOpenFont, c);
-            else
-                goto xinerama_sleep;
             return TRUE;
         }
         break;
@@ -362,7 +360,6 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
                           c->fontid, FontToXError(err));
     }
     ClientWakeup(c->client);
- xinerama_sleep:
     for (i = 0; i < c->num_fpes; i++) {
         FreeFPE(c->fpe_list[i]);
     }
@@ -595,8 +592,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                 if (!ClientIsAsleep(client))
                     ClientSleep(client,
                                 (ClientSleepProcPtr) doListFontsAndAliases, c);
-                else
-                    goto xinerama_sleep;
                 return TRUE;
             }
 
@@ -622,8 +617,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                         ClientSleep(client,
                                     (ClientSleepProcPtr) doListFontsAndAliases,
                                     c);
-                    else
-                        goto xinerama_sleep;
                     return TRUE;
                 }
                 if (err == Successful)
@@ -641,8 +634,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                         ClientSleep(client,
                                     (ClientSleepProcPtr) doListFontsAndAliases,
                                     c);
-                    else
-                        goto xinerama_sleep;
                     return TRUE;
                 }
                 if (err == FontNameAlias) {
@@ -787,7 +778,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 
  bail:
     ClientWakeup(client);
- xinerama_sleep:
     for (i = 0; i < c->num_fpes; i++)
         FreeFPE(c->fpe_list[i]);
     free(c->fpe_list);
@@ -887,8 +877,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
                 if (!ClientIsAsleep(client))
                     ClientSleep(client,
                                 (ClientSleepProcPtr) doListFontsWithInfo, c);
-                else
-                    goto xinerama_sleep;
                 return TRUE;
             }
             if (err == Successful)
@@ -904,8 +892,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
                 if (!ClientIsAsleep(client))
                     ClientSleep(client,
                                 (ClientSleepProcPtr) doListFontsWithInfo, c);
-                else
-                    goto xinerama_sleep;
                 return TRUE;
             }
         }
@@ -1039,7 +1025,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
     WriteSwappedDataToClient(client, length, &finalReply);
  bail:
     ClientWakeup(client);
- xinerama_sleep:
     for (i = 0; i < c->num_fpes; i++)
         FreeFPE(c->fpe_list[i]);
     free(c->reply);
@@ -1296,8 +1281,6 @@ doPolyText(ClientPtr client, PTclosurePtr c)
                     client_state = START_SLEEP;
                     continue;   /* on to steps 3 and 4 */
                 }
-                else
-                    goto xinerama_sleep;
                 return TRUE;
             }
             else if (lgerr != Successful) {
@@ -1351,7 +1334,6 @@ doPolyText(ClientPtr client, PTclosurePtr c)
     }
     if (ClientIsAsleep(client)) {
         ClientWakeup(c->client);
- xinerama_sleep:
         ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
 
         /* Unreference the font from the scratch GC */
@@ -1476,8 +1458,6 @@ doImageText(ClientPtr client, ITclosurePtr c)
 
             ClientSleep(client, (ClientSleepProcPtr) doImageText, c);
         }
-        else
-            goto xinerama_sleep;
         return TRUE;
     }
     else if (lgerr != Successful) {
@@ -1500,7 +1480,6 @@ doImageText(ClientPtr client, ITclosurePtr c)
     }
     if (ClientIsAsleep(client)) {
         ClientWakeup(c->client);
- xinerama_sleep:
         ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
 
         /* Unreference the font from the scratch GC */
commit 5b582a4a0350c253d729efb31b710851ae9a958e
Merge: 1d4aa67 27ad212
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Oct 19 12:23:22 2015 -0400

    Merge remote-tracking branch 'jeremyhu/master'

commit 1d4aa672424d8b1629fda11400b88607b5066965
Author: Julien Cristau <jcristau at debian.org>
Date:   Mon Oct 19 15:42:30 2015 +0200

    xorg-wrapper: when starting the server as root, reset its environment
    
    When the server is privileged, we shouldn't be passing the user's
    environment directly.
    
    Clearing the environment is recommended by the libdbus maintainers, see
    https://bugs.freedesktop.org/show_bug.cgi?id=52202
    
    v2: rename envp to empty_envp (Jeremy)
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83849
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index 75d120a..6f658d7 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -194,6 +194,7 @@ int main(int argc, char *argv[])
     int total_cards = 0;
     int allowed = CONSOLE_ONLY;
     int needs_root_rights = -1;
+    char *const empty_envp[1] = { NULL, };
 
     progname = argv[0];
 
@@ -271,7 +272,10 @@ int main(int argc, char *argv[])
     }
 
     argv[0] = buf;
-    (void) execv(argv[0], argv);
+    if (getuid() == geteuid())
+        (void) execv(argv[0], argv);
+    else
+        (void) execve(argv[0], argv, empty_envp);
     fprintf(stderr, "%s: Failed to execute %s: %s\n",
         progname, buf, strerror(errno));
     exit(1);
commit 08c4912406b965bbac0a3a52413c374a073c051b
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date:   Mon Oct 19 14:47:43 2015 +0200

    xorg-wrapper: fix build without libdrm
    
    Signed-off-by: Samuel Thibault <samuel.thibault at ens-lyon.org>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/configure.ac b/configure.ac
index 7db7187..220478a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -926,8 +926,6 @@ fi
 AM_CONDITIONAL(SYSTEMD_LOGIND, [test "x$SYSTEMD_LOGIND" = xyes])
 
 if test "x$SUID_WRAPPER" = xyes; then
-        dnl The wrapper uses libdrm headers, so ensure they are available
-        PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
         dnl This is a define so that if some platforms want to put the wrapper
         dnl somewhere else this can be easily changed
         AC_DEFINE_DIR(SUID_WRAPPER_DIR, libexecdir, [Where to install the Xorg binary and Xorg.wrap])
diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index 22e97ad..75d120a 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -39,8 +39,10 @@
 #include <sys/consio.h>
 #endif
 #include <unistd.h>
+#ifdef WITH_LIBDRM
 #include <drm.h>
 #include <xf86drm.h> /* For DRM_DEV_NAME */
+#endif
 
 #define CONFIG_FILE SYSCONFDIR "/X11/Xwrapper.config"
 
@@ -183,7 +185,9 @@ static int on_console(int fd)
 
 int main(int argc, char *argv[])
 {
+#ifdef WITH_LIBDRM
     struct drm_mode_card_res res;
+#endif
     char buf[PATH_MAX];
     int i, r, fd;
     int kms_cards = 0;
@@ -219,6 +223,7 @@ int main(int argc, char *argv[])
         }
     }
 
+#ifdef WITH_LIBDRM
     /* Detect if we need root rights, except when overriden by the config */
     if (needs_root_rights == -1) {
         for (i = 0; i < 16; i++) {
@@ -237,6 +242,7 @@ int main(int argc, char *argv[])
             close(fd);
         }
     }
+#endif
 
     /* If we've found cards, and all cards support kms, drop root rights */
     if (needs_root_rights == 0 || (total_cards && kms_cards == total_cards)) {
commit a4cd8ee5f8e8de776c7f764656770311cdbde0d2
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date:   Mon Oct 19 14:47:42 2015 +0200

    hurd: disable detecting drm
    
    Signed-off-by: Samuel Thibault <samuel.thibault at ens-lyon.org>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/configure.ac b/configure.ac
index e434720..7db7187 100644
--- a/configure.ac
+++ b/configure.ac
@@ -752,6 +752,11 @@ case $host_os in
 			XF86VIDMODE=no
 		fi
 		;;
+	gnu*)
+		DRM=no
+		DRI2=no
+		DRI3=no
+		;;
 	*) XQUARTZ=no ;;
 esac
 
commit 27ad21254f257bac6c647315d749ee69f20c24e0
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sun Oct 18 23:01:53 2015 -0700

    XQuartz: Cleanup formatting of DarwinEQInit that was butchered by automation a few years ago
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 0c8e7c4..5577297 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -367,14 +367,12 @@ DarwinEQInit(void)
 {
     int *p;
 
-    for (p = darwin_x11_modifier_mask_list, darwin_all_modifier_mask = 0; *p;
-         p++) {
+    for (p = darwin_x11_modifier_mask_list; *p; p++) {
         darwin_x11_modifier_mask |= *p;
     }
 
-    for (p = darwin_all_modifier_mask_additions,
-         darwin_all_modifier_mask = darwin_x11_modifier_mask;
-         *p; p++) {
+    darwin_all_modifier_mask = darwin_x11_modifier_mask;
+    for (p = darwin_all_modifier_mask_additions; *p; p++) {
         darwin_all_modifier_mask |= *p;
     }
 
@@ -387,7 +385,6 @@ DarwinEQInit(void)
      */
     if (!darwinEvents) {
         darwinEvents = InitEventList(GetMaximumEventsNum());
-        ;
 
         if (!darwinEvents)
             FatalError("Couldn't allocate event buffer\n");
commit 3db7e332d374bf8cee581c31b7d50d7ac0509187
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sun Oct 18 23:03:23 2015 -0700

    XQuartz: Make sure that darwin_all_modifier_mask_additions is 0-terminated
    
    Found by ASan
    
    X.Org X Server 1.17.99.901 Build Date: 20151018
    ================================================================
    ==40471==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000101fed7a4 at pc 0x000101584030 bp 0x70000029f920 sp 0x70000029f918
    READ of size 4 at 0x000101fed7a4 thread T7
        #0 0x10158402f in DarwinEQInit darwinEvents.c:377
        #1 0x10157f3bc in InitInput darwin.c:566
        #2 0x101be87ad in dix_main main.c:268
        #3 0x10159131b in server_thread quartzStartup.c:66
        #4 0x7fff8a535c12 in _pthread_body (/usr/lib/system/libsystem_pthread.dylib+0x3c12)
        #5 0x7fff8a535b8f in _pthread_start (/usr/lib/system/libsystem_pthread.dylib+0x3b8f)
        #6 0x7fff8a533374 in thread_start (/usr/lib/system/libsystem_pthread.dylib+0x1374)
    
    0x000101fed7a4 is located 0 bytes to the right of global variable 'darwin_all_modifier_mask_additions' defined in 'darwinEvents.c:181:12'
    (0x101fed7a0) of size 4
    SUMMARY: AddressSanitizer: global-buffer-overflow darwinEvents.c:377 DarwinEQInit
    Shadow bytes around the buggy address:
      0x1000203fdaa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdac0: f9 f9 f9 f9 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9
      0x1000203fdad0: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 00 00 00 00
      0x1000203fdae0: 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00 00 f9 f9 f9
    =>0x1000203fdaf0: f9 f9 f9 f9[04]f9 f9 f9 f9 f9 f9 f9 00 00 00 00
      0x1000203fdb00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdb10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdb20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdb30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdb40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07
      Heap left redzone:       fa
      Heap right redzone:      fb
      Freed heap region:       fd
      Stack left redzone:      f1
      Stack mid redzone:       f2
      Stack right redzone:     f3
      Stack partial redzone:   f4
      Stack after return:      f5
      Stack use after scope:   f8
      Global redzone:          f9
      Global init order:       f6
      Poisoned by user:        f7
      Container overflow:      fc
      Array cookie:            ac
      Intra object redzone:    bb
      ASan internal:           fe
      Left alloca redzone:     ca
      Right alloca redzone:    cb
    Thread T7 created by T0 here:
        #0 0x10242ee99 in wrap_pthread_create
    (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/7.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib+0x37e99)
        #1 0x101591089 in create_thread quartzStartup.c:78
        #2 0x101590ed9 in QuartzInitServer quartzStartup.c:95
        #3 0x1015697eb in X11ApplicationMain X11Application.m:1277
        #4 0x101575dc0 in X11ControllerMain X11Controller.m:984
        #5 0x10159171a in server_main quartzStartup.c:127
        #6 0x101540fc0 in do_start_x11_server bundle-main.c:436
        #7 0x101544869 in _Xstart_x11_server mach_startupServer.c:189
        #8 0x101545c96 in mach_startup_server mach_startupServer.c:398
        #9 0x7fff8d1b70f3 in mach_msg_server (/usr/lib/system/libsystem_kernel.dylib+0x110f3)
        #10 0x1015416e7 in main bundle-main.c:774
        #11 0x7fff8bd975ac in start (/usr/lib/system/libdyld.dylib+0x35ac)
        #12 0x0  (<unknown module>)
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 9bf2f14..0c8e7c4 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -178,7 +178,7 @@ static int darwin_x11_modifier_mask_list[] = {
     0
 };
 
-static int darwin_all_modifier_mask_additions[] = { NX_SECONDARYFNMASK, };
+static int darwin_all_modifier_mask_additions[] = { NX_SECONDARYFNMASK, 0 };
 
 static void
 DarwinUpdateModifiers(int pressed,                    // KeyPress or KeyRelease
commit ec6294116cc41ff1c3be081b626952fb7e614244
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Oct 18 23:12:52 2015 -0700

    osinit: Silence -Wunused-variable warnings
    
    osinit.c:161:24: warning: unused variable 'devnull' [-Wunused-variable,Unused Entity Issue]
        static const char *devnull = "/dev/null";
                           ^
    osinit.c:162:10: warning: unused variable 'fname' [-Wunused-variable,Unused Entity Issue]
        char fname[PATH_MAX];
             ^
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/os/osinit.c b/os/osinit.c
index ddd3fce..6ec2f11 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -158,8 +158,10 @@ void
 OsInit(void)
 {
     static Bool been_here = FALSE;
+#ifndef XQUARTZ
     static const char *devnull = "/dev/null";
     char fname[PATH_MAX];
+#endif
 
     if (!been_here) {
 #if !defined(WIN32) || defined(__CYGWIN__)
commit 0a5d54f721de7e3ab3b6f4b080190a92bbe3429b
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Oct 18 23:12:51 2015 -0700

    dix: Silence -Wunused-variable warning by moving window.c off of legacy region defines
    
    window.c:223:15: warning: unused variable 'pScreen' [-Wunused-variable,Unused Entity Issue]
        ScreenPtr pScreen = pWin->drawable.pScreen;
                  ^
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/dix/window.c b/dix/window.c
index d57f320..69b5a7c 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -220,7 +220,6 @@ log_window_info(WindowPtr pWin, int depth)
     int i;
     const char *win_name, *visibility;
     BoxPtr rects;
-    ScreenPtr pScreen = pWin->drawable.pScreen;
 
     for (i = 0; i < (depth << 2); i++)
         ErrorF(" ");
@@ -240,7 +239,7 @@ log_window_info(WindowPtr pWin, int depth)
         ErrorF(" (%s compositing: pixmap %x)",
                (pWin->redirectDraw == RedirectDrawAutomatic) ?
                "automatic" : "manual",
-               (unsigned) pScreen->GetWindowPixmap(pWin)->drawable.id);
+               (unsigned) pWin->drawable.pScreen->GetWindowPixmap(pWin)->drawable.id);
 #endif
 
     switch (pWin->visibility) {
@@ -259,10 +258,10 @@ log_window_info(WindowPtr pWin, int depth)
     }
     ErrorF(", %s", visibility);
 
-    if (REGION_NOTEMPTY(pScreen, &pWin->clipList)) {
+    if (RegionNotEmpty(&pWin->clipList)) {
         ErrorF(", clip list:");
-        rects = REGION_RECTS(&pWin->clipList);
-        for (i = 0; i < REGION_NUM_RECTS(&pWin->clipList); i++)
+        rects = RegionRects(&pWin->clipList);
+        for (i = 0; i < RegionNumRects(&pWin->clipList); i++)
             ErrorF(" [(%d, %d) to (%d, %d)]",
                    rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
         ErrorF("; extents [(%d, %d) to (%d, %d)]",
commit e09875701b980b8c4578fb310a922c9934c34eef
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Oct 18 23:12:50 2015 -0700

    glx: Fix header length error checking in __glXDisp_RenderLarge
    
    glxcmds.c:2206:46: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare,Semantic Issue]
            if ((cmdlen = safe_pad(hdr->length)) < 0)
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index cbd4ede..0416dac 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2182,7 +2182,7 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
         __GLXrenderSizeData entry;
         int extra = 0;
         int left = (req->length << 2) - sz_xGLXRenderLargeReq;
-        size_t cmdlen;
+        int cmdlen;
         int err;
 
         /*
commit 5dc415048e4091b18cd7d123ebeae8f95ed5a4f5
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Oct 18 23:12:49 2015 -0700

    randr: Silence -Wshift-negative-value warnings
    
    rrtransform.c:199:23: warning: shifting a negative signed value is undefined [-Wshift-negative-value,Semantic Issue]
                rot_cos = F(-1);
                          ^~~~~
    rrtransform.c:114:14: note: expanded from macro 'F'
                    ^~~~~~~~~~~~~~
    ../render/picture.h:200:24: note: expanded from macro 'IntToxFixed'
                            ^~~~~~~~~~~~~~~~~~~~~~
    /opt/X11/include/pixman-1/pixman.h:130:56: note: expanded from macro 'pixman_int_to_fixed'
                                                               ~~~ ^
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 26b0649..d32b43a 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -196,7 +196,7 @@ RRTransformCompute(int x,
             f_rot_sin = 0;
             f_rot_dx = width;
             f_rot_dy = height;
-            rot_cos = F(-1);
+            rot_cos = F(~0u);
             rot_sin = F(0);
             rot_dx = F(width);
             rot_dy = F(height);
@@ -207,7 +207,7 @@ RRTransformCompute(int x,
             f_rot_dx = 0;
             f_rot_dy = width;
             rot_cos = F(0);
-            rot_sin = F(-1);
+            rot_sin = F(~0u);
             rot_dx = F(0);
             rot_dy = F(width);
             break;
@@ -230,7 +230,7 @@ RRTransformCompute(int x,
         scale_dy = 0;
         if (rotation & RR_Reflect_X) {
             f_scale_x = -1;
-            scale_x = F(-1);
+            scale_x = F(~0u);
             if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
                 f_scale_dx = width;
                 scale_dx = F(width);
@@ -242,7 +242,7 @@ RRTransformCompute(int x,
         }
         if (rotation & RR_Reflect_Y) {
             f_scale_y = -1;
-            scale_y = F(-1);
+            scale_y = F(~0u);
             if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
                 f_scale_dy = height;
                 scale_dy = F(height);
commit 9a2a05a9a7ba02921fa29844c4cad41243c41326
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:42 2015 -0700

    xdmcp: Declare XdmcpFatal _X_NORETURN
    
    xdmcp.c:1404:1: warning: function 'XdmcpFatal' could be declared with attribute 'noreturn'
    [-Wmissing-noreturn,Semantic Issue]
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/os/xdmcp.c b/os/xdmcp.c
index 7939b41..5bdcbe9 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1399,6 +1399,7 @@ recv_alive_msg(unsigned length)
     }
 }
 
+_X_NORETURN
 static void
 XdmcpFatal(const char *type, ARRAY8Ptr status)
 {
commit a7a00e4bd8153e0386c7e58d6b30a7a96f15fdb0
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:39 2015 -0700

    security: Silence some benign -Wformat warnings
    
    XID may be either 'unsigned long' or 'unsigned int' depending on:
    
    typedef unsigned long CARD64;
    typedef unsigned int CARD32;
    typedef unsigned long long CARD64;
    typedef unsigned long CARD32;
    
    typedef unsigned long XID;
    typedef CARD32 XID;
    
    so when building with -Wformat, we get some warnings that are benign.  This silences them.
    
    security.c:215:52: warning: format specifies type 'int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
        SecurityAudit("revoked authorization ID %d\n", pAuth->id);
                                                ~~     ^~~~~~~~~
                                                %lu
      CC       dpmsstubs.lo
    security.c:553:25: warning: format specifies type 'int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
             client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
                            ^~~~~~~~~
    security.c:553:55: warning: format specifies type 'int' but the argument has type 'CARD32' (aka 'unsigned long')
          [-Wformat,Format String Issue]
             client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
                                                          ^~~~~~~~~~~~~~
    security.c:554:10: warning: format specifies type 'int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
             pAuth->group, eventMask);
             ^~~~~~~~~~~~
    security.c:554:24: warning: format specifies type 'int' but the argument has type 'Mask' (aka 'unsigned long')
          [-Wformat,Format String Issue]
             pAuth->group, eventMask);
                           ^~~~~~~~~
    security.c:781:19: warning: format specifies type 'unsigned int' but the argument has type 'Mask' (aka 'unsigned
    long')
          [-Wformat,Format String Issue]
                      requested, rec->id, cid,
                      ^~~~~~~~~
    security.c:781:30: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
                      requested, rec->id, cid,
                                 ^~~~~~~
    security.c:863:23: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
                          rec->pWin->drawable.id, wClient(rec->pWin)->index,
                          ^~~~~~~~~~~~~~~~~~~~~~
    security.c:893:31: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
                                  rec->pWin->drawable.id,
                                  ^~~~~~~~~~~~~~~~~~~~~~
    security.c:915:39: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
                      rec->client->index, rec->pWin->drawable.id,
                                          ^~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/Xext/security.c b/Xext/security.c
index cce7c46..04382ff 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -212,7 +212,7 @@ SecurityDeleteAuthorization(void *value, XID id)
                 CloseDownClient(clients[i]);
         }
 
-    SecurityAudit("revoked authorization ID %d\n", pAuth->id);
+    SecurityAudit("revoked authorization ID %lu\n", (unsigned long)pAuth->id);
     free(pAuth);
     return Success;
 
@@ -549,9 +549,9 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
     WriteToClient(client, authdata_len, pAuthdata);
 
     SecurityAudit
-        ("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
-         client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
-         pAuth->group, eventMask);
+        ("client %d generated authorization %lu trust %d timeout %lu group %lu events %lu\n",
+         client->index, (unsigned long)pAuth->id, pAuth->trustLevel, (unsigned long)pAuth->timeout,
+         (unsigned long)pAuth->group, (unsigned long)eventMask);
 
     /* the request succeeded; don't call RemoveAuthorization or free pAuth */
     return Success;
@@ -776,9 +776,9 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
             return;
     }
 
-    SecurityAudit("Security: denied client %d access %x to resource 0x%x "
+    SecurityAudit("Security: denied client %d access %lx to resource 0x%lx "
                   "of client %d on request %s\n", rec->client->index,
-                  requested, rec->id, cid,
+                  (unsigned long)requested, (unsigned long)rec->id, cid,
                   SecurityLookupRequestName(rec->client));
     rec->status = BadAccess;    /* deny access */
 }
@@ -858,9 +858,9 @@ SecurityProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
 
     if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
         SecurityAudit("Security: denied client %d access to property %s "
-                      "(atom 0x%x) window 0x%x of client %d on request %s\n",
+                      "(atom 0x%x) window 0x%lx of client %d on request %s\n",
                       rec->client->index, NameForAtom(name), name,
-                      rec->pWin->drawable.id, wClient(rec->pWin)->index,
+                      (unsigned long)rec->pWin->drawable.id, wClient(rec->pWin)->index,
                       SecurityLookupRequestName(rec->client));
         rec->status = BadAccess;
     }
@@ -887,10 +887,10 @@ SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
                 rec->events[i].u.u.type != ClientMessage) {
 
                 SecurityAudit("Security: denied client %d from sending event "
-                              "of type %s to window 0x%x of client %d\n",
+                              "of type %s to window 0x%lx of client %d\n",
                               rec->client->index,
                               LookupEventName(rec->events[i].u.u.type),
-                              rec->pWin->drawable.id,
+                              (unsigned long)rec->pWin->drawable.id,
                               wClient(rec->pWin)->index);
                 rec->status = BadAccess;
                 return;
@@ -911,8 +911,8 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
         return;
 
     SecurityAudit("Security: denied client %d from receiving an event "
-                  "sent to window 0x%x of client %d\n",
-                  rec->client->index, rec->pWin->drawable.id,
+                  "sent to window 0x%lx of client %d\n",
+                  rec->client->index, (unsigned long)rec->pWin->drawable.id,
                   wClient(rec->pWin)->index);
     rec->status = BadAccess;
 }
commit aa73d587fece225753d8e6b8773a9c8b85823bd9
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:38 2015 -0700

    xres: Silence -Wunused-function warnings when building !COMPOSITE or !RENDER
    
    xres.c:422:1: warning: unused function 'ResFindCompositeClientWindowPixmaps' [-Wunused-function,Unused Entity Issue]
    ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata)
    ^
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/Xext/xres.c b/Xext/xres.c
index 6b87c3d..83cc691 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -410,21 +410,21 @@ ResFindGCPixmaps(void *value, XID id, void *cdata)
         *bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap);
 }
 
+#ifdef RENDER
 static void
 ResFindPicturePixmaps(void *value, XID id, void *cdata)
 {
-#ifdef RENDER
     ResFindResourcePixmaps(value, id, PictureType, cdata);
-#endif
 }
+#endif
 
+#ifdef COMPOSITE
 static void
 ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata)
 {
-#ifdef COMPOSITE
     ResFindResourcePixmaps(value, id, CompositeClientWindowType, cdata);
-#endif
 }
+#endif
 
 static int
 ProcXResQueryClientPixmapBytes(ClientPtr client)
commit 85eb90ea45e89033b97bf71a13c5c70fec8f6871
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:36 2015 -0700

    xdmauth: Correct miscall of abs() to instrad call labs()
    
    xdmauth.c:230:13: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of
    type
    'int'
          which may cause truncation of value [-Wabsolute-value,Semantic Issue]
            if (abs(now - client->time) > TwentyFiveMinutes) {
                ^
    xdmauth.c:230:13: note: use function 'labs' instead [Semantic Issue]
            if (abs(now - client->time) > TwentyFiveMinutes) {
                ^~~
                labs
    xdmauth.c:302:9: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type
    'int' which
          may cause truncation of value [-Wabsolute-value,Semantic Issue]
        if (abs(client->time - now) > TwentyMinutes) {
            ^
    xdmauth.c:302:9: note: use function 'labs' instead [Semantic Issue]
        if (abs(client->time - now) > TwentyMinutes) {
            ^~~
            labs
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/os/xdmauth.c b/os/xdmauth.c
index f11cbb9..482bc67 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -227,7 +227,7 @@ XdmClientAuthTimeout(long now)
     prev = 0;
     for (client = xdmClients; client; client = next) {
         next = client->next;
-        if (abs(now - client->time) > TwentyFiveMinutes) {
+        if (labs(now - client->time) > TwentyFiveMinutes) {
             if (prev)
                 prev->next = next;
             else
@@ -299,7 +299,7 @@ XdmAuthorizationValidate(unsigned char *plain, int length,
     }
     now += clockOffset;
     XdmClientAuthTimeout(now);
-    if (abs(client->time - now) > TwentyMinutes) {
+    if (labs(client->time - now) > TwentyMinutes) {
         free(client);
         if (reason)
             *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
commit 9f0fcd14b52f8481cbb3b3b9c6e06f64ff003cc8
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:35 2015 -0700

    randr: Correct a miscall of abs() to instead call fabs()
    
    rrtransform.c:124:22: warning: using integer absolute value function 'abs' when
          argument is of floating point type [-Wabsolute-value,Semantic Issue]
                if ((v = abs(f_transform->m[j][i])) > max)
                         ^
    rrtransform.c:124:22: note: use function 'fabs' instead [Semantic Issue]
                if ((v = abs(f_transform->m[j][i])) > max)
                         ^~~
                         fabs
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 6137f85..26b0649 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -121,7 +121,7 @@ RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
 
     for (j = 0; j < 3; j++)
         for (i = 0; i < 3; i++)
-            if ((v = abs(f_transform->m[j][i])) > max)
+            if ((v = fabs(f_transform->m[j][i])) > max)
                 max = v;
     scale = limit / max;
     for (j = 0; j < 3; j++)
commit 610dd8a58a75bb6a5b7d7abbae476d1cc4be519e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:34 2015 -0700

    mi: Correct a miscall of abs() to instead call fabs()
    
    miarc.c:1714:9: warning: using integer absolute value function
    'abs' when
          argument is of floating point type [-Wabsolute-value,Semantic Issue]
        if (abs(parc->angle2) >= 360.0)
            ^
    miarc.c:1714:9: note: use function 'fabs' instead [Semantic Issue]
        if (abs(parc->angle2) >= 360.0)
            ^~~
            fabs
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/mi/miarc.c b/mi/miarc.c
index 5e854b3..2588ee4 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1711,7 +1711,7 @@ miGetArcPts(SppArcPtr parc,     /* points to an arc */
         y1 = y2;
     }
     /* adjust the last point */
-    if (abs(parc->angle2) >= 360.0)
+    if (fabs(parc->angle2) >= 360.0)
         poly[cpt + i - 1] = poly[0];
     else {
         poly[cpt + i - 1].x = (miDcos(st + et) * parc->width / 2.0 + xc);


More information about the Xquartz-changes mailing list