[Xquartz-changes] xserver: Branch 'server-1.17-apple' - 60 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Mon Oct 26 13:24:55 PDT 2015


Rebased ref, commits from common ancestor:
commit 890d8e7a5f91436543f1b3eb28b9c33f022376a5
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 a99cee6..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 = malloc (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 d276e11261d1aac14570036cbf84993b7ab714eb
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 936a11b..a99cee6 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 f82de0aedf8716e2dbca5827007ea543502e7093
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 5f6c88e..936a11b 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 a725104..e14293a 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 23ce9e8..e0f1d4c 100644
--- a/render/mipict.h
+++ b/render/mipict.h
@@ -122,6 +122,16 @@ 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 void
 
 miTriStrip(CARD8 op,
            PicturePtr pSrc,
@@ -137,10 +147,27 @@ miTriFan(CARD8 op,
          PictFormatPtr maskFormat,
          INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
 
+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 6f240d1b8282a91e3e98a6e0832d1bebeaf936a8
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 27f2cc6..d898c43 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 6d5c2fe7beccfc471435980033837ff3e12900b2
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>
    (cherry picked from commit 47b00fa4bf3b67736957296492310f7fdd6c0a25)

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 1653574..6707598 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 780022a8a5d6f8abd02f8b568f522ce5aed99839
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Oct 26 13:03:59 2015 -0400

    xserver 1.17.3
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/configure.ac b/configure.ac
index d8f0e74..16832c2 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.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2015-06-16"
-RELEASE_NAME="lambic"
+AC_INIT([xorg-server], 1.17.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2015-10-26"
+RELEASE_NAME="Pumpkin Spice Latte"
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
commit d9344ef3ea4f3009d61240e0fefcfca40eaa7dca
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>
    (cherry picked from commit 413cb2ff1d754b5f19d77ff19cddf40793989c03)

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 88f22fc5dac502c7d57d0b53defda75b44dab985
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>
    (cherry picked from commit 2092f12a243b9f7682f542b593b77c96d455ec89)

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 9485307..4acaf33 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -62,18 +62,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
@@ -208,7 +214,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)
@@ -269,7 +276,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 0ca79007c940b09bd81823fc2e2276f08057247c
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>
    (cherry picked from commit f9a04d19aef77bf787b8d322305a6971d24a6ba1)

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index bc2732f..ddcb18b 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -314,8 +314,6 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
         if (err == Suspended) {
             if (!ClientIsAsleep(client))
                 ClientSleep(client, (ClientSleepProcPtr) doOpenFont, c);
-            else
-                goto xinerama_sleep;
             return TRUE;
         }
         break;
@@ -363,7 +361,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]);
     }
@@ -596,8 +593,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                 if (!ClientIsAsleep(client))
                     ClientSleep(client,
                                 (ClientSleepProcPtr) doListFontsAndAliases, c);
-                else
-                    goto xinerama_sleep;
                 return TRUE;
             }
 
@@ -623,8 +618,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                         ClientSleep(client,
                                     (ClientSleepProcPtr) doListFontsAndAliases,
                                     c);
-                    else
-                        goto xinerama_sleep;
                     return TRUE;
                 }
                 if (err == Successful)
@@ -642,8 +635,6 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                         ClientSleep(client,
                                     (ClientSleepProcPtr) doListFontsAndAliases,
                                     c);
-                    else
-                        goto xinerama_sleep;
                     return TRUE;
                 }
                 if (err == FontNameAlias) {
@@ -788,7 +779,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);
@@ -888,8 +878,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
                 if (!ClientIsAsleep(client))
                     ClientSleep(client,
                                 (ClientSleepProcPtr) doListFontsWithInfo, c);
-                else
-                    goto xinerama_sleep;
                 return TRUE;
             }
             if (err == Successful)
@@ -905,8 +893,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
                 if (!ClientIsAsleep(client))
                     ClientSleep(client,
                                 (ClientSleepProcPtr) doListFontsWithInfo, c);
-                else
-                    goto xinerama_sleep;
                 return TRUE;
             }
         }
@@ -1040,7 +1026,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);
@@ -1297,8 +1282,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) {
@@ -1352,7 +1335,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 */
@@ -1477,8 +1459,6 @@ doImageText(ClientPtr client, ITclosurePtr c)
 
             ClientSleep(client, (ClientSleepProcPtr) doImageText, c);
         }
-        else
-            goto xinerama_sleep;
         return TRUE;
     }
     else if (lgerr != Successful) {
@@ -1501,7 +1481,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 82000d6d0376bdd5c6bb4e0daefcb85879f7c5c7
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>
    (cherry picked from commit e09875701b980b8c4578fb310a922c9934c34eef)

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 2ae94d6e8978faff330e9433eddf1697ba4693f6
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>
    (cherry picked from commit 9a2a05a9a7ba02921fa29844c4cad41243c41326)

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 a88460ca82c7aed00177a5bb733b98a7f9b45968
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>
    (cherry picked from commit 85eb90ea45e89033b97bf71a13c5c70fec8f6871)

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 0f051cb4c3af6c3b906c2f210e3b6858dd7a5f53
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>
    (cherry picked from commit 9f0fcd14b52f8481cbb3b3b9c6e06f64ff003cc8)

diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index c8a2749..f3f1b1e 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 8a30fd207cd4f560696ffd4463284ef123970e96
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>
    (cherry picked from commit 610dd8a58a75bb6a5b7d7abbae476d1cc4be519e)

diff --git a/mi/miarc.c b/mi/miarc.c
index e8bc87e..d26f674 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1712,7 +1712,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);
commit 0c5ef339ae36b530745b883347accf11b21b1fd6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Dec 14 15:55:22 2011 +0000

    render: Propagate allocation failure from createSourcePicture()
    
    All the callers were already checking for failure, except that
    createSourcePicture() itself was failing to check whether it
    successfully allocated the Picture.
    
    [ajax: Rebase, fix line wrap of preceding line]
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 211d4c2d353b5e379716484055a3f58235ea65f4)

diff --git a/render/picture.c b/render/picture.c
index fdf034a..6e23e2b 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -856,7 +856,11 @@ createSourcePicture(void)
 {
     PicturePtr pPicture;
 
-    pPicture = dixAllocateScreenObjectWithPrivates(NULL, PictureRec, PRIVATE_PICTURE);
+    pPicture = dixAllocateScreenObjectWithPrivates(NULL, PictureRec,
+                                                   PRIVATE_PICTURE);
+    if (!pPicture)
+	return 0;
+
     pPicture->pDrawable = 0;
     pPicture->pFormat = 0;
     pPicture->pNext = 0;
commit 025ae119a7561a911533ca69c8232147273af300
Author: Arcady Goldmints-Orlov <arcadyg at nvidia.com>
Date:   Thu Oct 4 14:22:13 2012 -0700

    Fix alphamap interactions with wfb
    
    Set a destructor function on pixman images and call fbFinishAccess()
    from there, rather than directly from free_pixman_pict(). This ensures
    that fbFinishAccess() gets called even if pixman still has a reference
    to the image after free_pixman_pict(), as is the case for alphamaps.
    
    [ajax: Squash an unused variable warning in the non-wfb build]
    
    Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
    Signed-off-by: Arcady Goldmints-Orlov <arcadyg at nvidia.com>
    Reviewed-by: Søren Sandmann <ssp at redhat.com>
    (cherry picked from commit fbac451724f7e1b8ce6b6e0505cc33ccd41c5158)

diff --git a/fb/fbpict.c b/fb/fbpict.c
index c8378ad..5f6c88e 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -345,6 +345,11 @@ 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)
+{
+    fbFinishAccess((DrawablePtr)data);
+}
+
 static void
 set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
                      int *xoff, int *yoff, Bool is_alpha_map)
@@ -429,6 +434,10 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
         break;
     }
 
+    if (pict->pDrawable)
+        pixman_image_set_destroy_function(image, &image_destroy,
+                                          pict->pDrawable);
+
     pixman_image_set_filter(image, filter,
                             (pixman_fixed_t *) pict->filter_params,
                             pict->filter_nparams);
@@ -481,8 +490,8 @@ image_from_pict(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
 void
 free_pixman_pict(PicturePtr pict, pixman_image_t * image)
 {
-    if (image && pixman_image_unref(image) && pict->pDrawable)
-        fbFinishAccess(pict->pDrawable);
+    if (image)
+        pixman_image_unref(image);
 }
 
 Bool
commit 62e2aa02efe45198d6b013530d269815ebd4c9ba
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Sep 21 22:36:41 2015 -0700

    dri2: better checks for integer overflow in GetBuffers*
    
    Check for integer overflow before using stuff->count in a multiplication,
    to avoid compiler optimizing out due to undefined behaviour, but only
    after we've checked to make sure stuff->count is in the range of the
    request we're parsing.
    
    Reported-by: jes at posteo.de
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 6ca496b7c3ccfd677c8c1bee88cc509a5e3c9e04)

diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 221ec53..520b7cf 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -269,9 +269,11 @@ ProcDRI2GetBuffers(ClientPtr client)
     int status, width, height, count;
     unsigned int *attachments;
 
-    REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4);
-    if (stuff->count > (INT_MAX / 4))
+    REQUEST_AT_LEAST_SIZE(xDRI2GetBuffersReq);
+    /* stuff->count is a count of CARD32 attachments that follows */
+    if (stuff->count > (INT_MAX / sizeof(CARD32)))
         return BadLength;
+    REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * sizeof(CARD32));
 
     if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
                        &pDrawable, &status))
@@ -297,7 +299,13 @@ ProcDRI2GetBuffersWithFormat(ClientPtr client)
     int status, width, height, count;
     unsigned int *attachments;
 
-    REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * (2 * 4));
+    REQUEST_AT_LEAST_SIZE(xDRI2GetBuffersReq);
+    /* stuff->count is a count of pairs of CARD32s (attachments & formats)
+       that follows */
+    if (stuff->count > (INT_MAX / (2 * sizeof(CARD32))))
+        return BadLength;
+    REQUEST_FIXED_SIZE(xDRI2GetBuffersReq,
+                       stuff->count * (2 * sizeof(CARD32)));
     if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
                        &pDrawable, &status))
         return status;
commit 616239c15d03f5b527288965f7eee0edebdcf20f
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 21 07:16:13 2015 +0100

    Xext/xselinux: Warning fixes
    
    There's a 'const char *' adventure here that I'm mostly ignoring; some
    client information gets const poisoned. Worked around by adding a
    couple of casts. Ick.
    
    Added an _X_ATTRIBUTE_PRINTF to SELinuxLog.
    
    Ignore a couple of unused return values.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 9af111fe045d82192bacc722940e1d92a8ba4cbd)

diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index 48219a9..e69bfe7 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -147,7 +147,7 @@ SELinuxLabelClient(ClientPtr client)
         strncpy(subj->command, cmdname, COMMAND_LEN - 1);
 
         if (!cached)
-            free(cmdname);     /* const char * */
+            free((void *) cmdname);     /* const char * */
     }
 
  finish:
@@ -295,6 +295,9 @@ SELinuxAudit(void *auditdata,
 }
 
 static int
+SELinuxLog(int type, const char *fmt, ...) _X_ATTRIBUTE_PRINTF(2, 3);
+
+static int
 SELinuxLog(int type, const char *fmt, ...)
 {
     va_list ap;
@@ -316,6 +319,7 @@ SELinuxLog(int type, const char *fmt, ...)
     va_start(ap, fmt);
     vsnprintf(buf, MAX_AUDIT_MESSAGE_LENGTH, fmt, ap);
     rc = audit_log_user_avc_message(audit_fd, aut, buf, NULL, NULL, NULL, 0);
+    (void) rc;
     va_end(ap);
     LogMessageVerb(X_WARNING, 0, "%s", buf);
     return 0;
@@ -476,7 +480,7 @@ SELinuxExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
     }
 
     /* Perform the security check */
-    auditdata.extension = rec->ext->name;
+    auditdata.extension = (char *) rec->ext->name;
     rc = SELinuxDoCheck(subj, obj, SECCLASS_X_EXTENSION, rec->access_mode,
                         &auditdata);
     if (rc != Success)
commit 87151fefb06dc96fac79e93a3151300bd8037f3d
Author: Eric Anholt <eric at anholt.net>
Date:   Mon May 5 11:10:06 2014 -0700

    x86emu: Fix some set-but-not-used warnings.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit e6f8a0340b72113474ccfbf1ea447558b705995a)

diff --git a/hw/xfree86/x86emu/debug.c b/hw/xfree86/x86emu/debug.c
index cbea994..72a06ff 100644
--- a/hw/xfree86/x86emu/debug.c
+++ b/hw/xfree86/x86emu/debug.c
@@ -233,9 +233,7 @@ X86EMU_dump_memory(u16 seg, u16 off, u32 amt)
     u32 start = off & 0xfffffff0;
     u32 end = (off + 16) & 0xfffffff0;
     u32 i;
-    u32 current;
 
-    current = start;
     while (end <= off + amt) {
         printk("%04x:%04x ", seg, start);
         for (i = start; i < off; i++)
@@ -261,8 +259,6 @@ x86emu_single_step(void)
     static int breakpoint;
     static int noDecode = 1;
 
-    char *p;
-
     if (DEBUG_BREAK()) {
         if (M.x86.saved_ip != breakpoint) {
             return;
@@ -279,7 +275,7 @@ x86emu_single_step(void)
     offset = M.x86.saved_ip;
     while (!done) {
         printk("-");
-        p = fgets(s, 1023, stdin);
+        (void)fgets(s, 1023, stdin);
         cmd = parse_line(s, ps, &ntok);
         switch (cmd) {
         case 'u':
commit 20bdec91712957c069c410ed34045f4090821ac7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jan 27 09:44:48 2014 +0000

    render: Fix leak of filter params
    
    ==11097== 2,048 (+1,640) bytes in 32 (+26) blocks are definitely lost in loss record 1,570 of 1,719
    ==11097==    at 0x4C2A2DB: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==11097==    by 0x225EF3: SetPicturePictFilter (filter.c:339)
    ==11097==    by 0x22DF4F: ProcRenderSetPictureFilter (render.c:1773)
    ==11097==    by 0x15D25D: Dispatch (dispatch.c:432)
    ==11097==    by 0x14C7B9: main (main.c:298)
    
    [ajax: Fixed whitespace]
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    (cherry picked from commit c7f84c880bbbb508016ad80390a11961b1c4214d)

diff --git a/render/picture.c b/render/picture.c
index cef7032..fdf034a 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1392,6 +1392,7 @@ FreePicture(void *value, XID pid)
 
     if (--pPicture->refcnt == 0) {
         free(pPicture->transform);
+        free(pPicture->filter_params);
 
         if (pPicture->pSourcePict) {
             if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
commit 5c0aea5fb3bda98a442b982b4622cc81a700ebd7
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Oct 14 17:07:29 2013 +0300

    xfree86: Fix the 1792x1344-75 EST III mode
    
    The correct refresh rate for this mode is 75, not 85.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
    (cherry picked from commit 98e170971c6b06d64a5bc7418bf6ae6ae985a3ae)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 6fb0f9b..f24294e 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -713,7 +713,7 @@ static const struct {
     {1600, 1200, 75, 0},
     {1600, 1200, 85, 0},
     {1792, 1344, 60, 0},
-    {1792, 1344, 85, 0},
+    {1792, 1344, 75, 0},
     {1856, 1392, 60, 0},
     {1856, 1392, 75, 0},
     {1920, 1200, 60, 1},
commit 293d0efe3c742f5010cddf5ad0420d0d1c43959b
Author: Michal Srb <msrb at suse.com>
Date:   Mon Oct 7 17:57:14 2013 +0300

    randr: Allow RRSelectInput for ProviderChange and ResourceChange events
    
    [ajax: To be clear, we already have code to emit these events, and it
     looks like it works, but to get them you'd have had to also ask for one
     of the other notify types.  This makes it possible to listen for e.g.
     ProviderChange alone.]
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Michal Srb <msrb at suse.com>
    (cherry picked from commit 91c7acfc3447a0073dd1db260cf05115d94ce7e8)

diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index b9346d3..7fee2bf 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -92,7 +92,9 @@ ProcRRSelectInput(ClientPtr client)
                          RRCrtcChangeNotifyMask |
                          RROutputChangeNotifyMask |
                          RROutputPropertyNotifyMask |
-                         RRProviderPropertyNotifyMask)) {
+                         RRProviderChangeNotifyMask |
+                         RRProviderPropertyNotifyMask |
+                         RRResourceChangeNotifyMask)) {
         ScreenPtr pScreen = pWin->drawable.pScreen;
 
         rrScrPriv(pScreen);
commit 833e3e84a077766b16b42d2b24931c14cd00bfb9
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Oct 20 11:44:28 2011 +0100

    exa: initialise mask_off_x and mask_off_y
    
    These get used at the end of the function in a calculation,
    even though the result isn't used its not pretty.
    
    Pointed out by coverity.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 4c7cefe24001279a558dd875949d40ede49ef702)

diff --git a/exa/exa_render.c b/exa/exa_render.c
index e3e5526..fc3ddea 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -636,7 +636,7 @@ exaTryDriverComposite(CARD8 op,
     RegionRec region;
     BoxPtr pbox;
     int nbox;
-    int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
+    int src_off_x, src_off_y, mask_off_x = 0, mask_off_y = 0, dst_off_x, dst_off_y;
     PixmapPtr pSrcPix = NULL, pMaskPix = NULL, pDstPix;
     ExaPixmapPrivPtr pSrcExaPix = NULL, pMaskExaPix = NULL, pDstExaPix;
 
commit 26a5364d507dff012283dc5d6f86b80c5936a807
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Jul 27 10:52:31 2011 +0200

    render: Allow single-stop gradients
    
    The Render specification allows single-stop gradients and pixman 0.22
    (X server requires >= 0.27.2 now) can rasterize them correctly.
    
    [ajax: update commit message]
    
    Signed-off-by: Andrea Canciani <ranma42 at gmail.com>
    Reviewed-by: Soren Sandmann <ssp at redhat.com>
    (cherry picked from commit 7ed0c3912e1cbab960df308b9d4ea618be757fd2)

diff --git a/render/picture.c b/render/picture.c
index 6ff31ba..cef7032 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -896,7 +896,7 @@ CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2,
 {
     PicturePtr pPicture;
 
-    if (nStops < 2) {
+    if (nStops < 1) {
         *error = BadValue;
         return 0;
     }
@@ -936,7 +936,7 @@ CreateRadialGradientPicture(Picture pid, xPointFixed * inner,
     PicturePtr pPicture;
     PictRadialGradient *radial;
 
-    if (nStops < 2) {
+    if (nStops < 1) {
         *error = BadValue;
         return 0;
     }
@@ -979,7 +979,7 @@ CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle,
 {
     PicturePtr pPicture;
 
-    if (nStops < 2) {
+    if (nStops < 1) {
         *error = BadValue;
         return 0;
     }
commit a22b828dad72091210234a9e671c93015c970ac6
Author: Cyril Brulebois <kibi at debian.org>
Date:   Sun Jun 5 23:32:26 2011 +0200

    man: Fix case for MIT-unspecified.
    
    include/site.h says that COMPILEDDISPLAYCLASS is MIT-unspecified, rather
    than MIT-Unspecified. Fix the manpage accordingly.
    
    Signed-off-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 4803f7139131cee7bbf50b32d667d6e60302df09)

diff --git a/man/Xserver.man b/man/Xserver.man
index 10b7b97..bc4c7fc 100644
--- a/man/Xserver.man
+++ b/man/Xserver.man
@@ -391,7 +391,7 @@ ends.
 .B \-class \fIdisplay-class\fP
 XDMCP has an additional display qualifier used in resource lookup for
 display-specific options.  This option sets that value, by default it
-is "MIT-Unspecified" (not a very useful value).
+is "MIT-unspecified" (not a very useful value).
 .TP 8
 .B \-cookie \fIxdm-auth-bits\fP
 When testing XDM-AUTHENTICATION-1, a private key is shared between the
commit 92f6b363972c13f564e1f8f555783fe9cb557db5
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Sep 22 19:25:43 2015 -0700

    protocol.txt: Add MIT-SHM 1.2 requests
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit a31bbc450a08622aadafc264b3efe57e465eaecb)

diff --git a/dix/protocol.txt b/dix/protocol.txt
index 0f49dd7..731844c 100644
--- a/dix/protocol.txt
+++ b/dix/protocol.txt
@@ -237,6 +237,8 @@ R002 MIT-SHM:Detach
 R003 MIT-SHM:PutImage
 R004 MIT-SHM:GetImage
 R005 MIT-SHM:CreatePixmap
+R006 MIT-SHM:AttachFd
+R007 MIT-SHM:CreateSegment
 V000 MIT-SHM:Completion
 E000 MIT-SHM:BadShmSeg
 R000 MIT-SUNDRY-NONSTANDARD:SetBugMode
commit 0b2a9db19bad7567ea30341f3432ae384a21c106
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Sep 22 19:25:42 2015 -0700

    protocol.txt: Add DRI3 1.0 requests
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 424ba5de56e2ddf173bb0d26daa821f12897f18f)

diff --git a/dix/protocol.txt b/dix/protocol.txt
index 871f7c6..0f49dd7 100644
--- a/dix/protocol.txt
+++ b/dix/protocol.txt
@@ -101,6 +101,12 @@ R011 DRI2:WaitSBC
 R012 DRI2:SwapInterval
 V000 DRI2:BufferSwapComplete
 V001 DRI2:InvalidateBuffers
+R000 DRI3:QueryVersion
+R001 DRI3:Open
+R002 DRI3:PixmapFromBuffer
+R003 DRI3:BufferFromPixmap
+R004 DRI3:FenceFromFD
+R005 DRI3:FDFromFence
 R000 Extended-Visual-Information:QueryVersion
 R001 Extended-Visual-Information:GetVisualInfo
 R000 FontCache:QueryVersion
commit d135b4cf6bc427f6f83f57ff70c673b64a6ae6af
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Sep 22 19:25:41 2015 -0700

    protocol.txt: Add Present 1.0 requests
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 7e6b7c799455fdeac082cf2a064fe1ba432e92ca)

diff --git a/dix/protocol.txt b/dix/protocol.txt
index cf612b5..871f7c6 100644
--- a/dix/protocol.txt
+++ b/dix/protocol.txt
@@ -235,6 +235,11 @@ V000 MIT-SHM:Completion
 E000 MIT-SHM:BadShmSeg
 R000 MIT-SUNDRY-NONSTANDARD:SetBugMode
 R001 MIT-SUNDRY-NONSTANDARD:GetBugMode
+R000 Present:QueryVersion
+R001 Present:Pixmap
+R002 Present:NotifyMSC
+R003 Present:SelectInput
+R004 Present:QueryCapabilities
 R000 RANDR:QueryVersion
 R001 RANDR:OldGetScreenInfo
 R002 RANDR:SetScreenConfig
commit 32f3432ea65f2eec01a7eed0e9bf93e1bc082241
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Sep 22 19:25:39 2015 -0700

    protocol.txt: Remove extensions that died before Xorg was born
    
    Adobe-DPS-Extension, DEC-XTRAP, X3D-PEX, XIE
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 1ea8fb96bc6a95d98dd67fc9d4c4e4b858383d34)

diff --git a/dix/protocol.txt b/dix/protocol.txt
index 4633e08..cf612b5 100644
--- a/dix/protocol.txt
+++ b/dix/protocol.txt
@@ -6,20 +6,6 @@
 #
 # This is a security-sensitive file, please set permissions as appropriate.
 #
-R001 Adobe-DPS-Extension:Init
-R002 Adobe-DPS-Extension:CreateContext
-R003 Adobe-DPS-Extension:CreateSpace
-R004 Adobe-DPS-Extension:GiveInput
-R005 Adobe-DPS-Extension:GetStatus
-R006 Adobe-DPS-Extension:DestroySpace
-R007 Adobe-DPS-Extension:Reset
-R008 Adobe-DPS-Extension:NotifyContext
-R009 Adobe-DPS-Extension:CreateContextFromID
-R010 Adobe-DPS-Extension:XIDFromContext
-R011 Adobe-DPS-Extension:ContextFromXID
-R012 Adobe-DPS-Extension:SetStatusMask
-R013 Adobe-DPS-Extension:CreateSecureContext
-R014 Adobe-DPS-Extension:NotifyWhenReady
 R000 Apple-DRI:QueryVersion
 R001 Apple-DRI:QueryDirectRenderingCapable
 R002 Apple-DRI:CreateSurface
@@ -65,22 +51,6 @@ R003 DAMAGE:Subtract
 R004 DAMAGE:Add
 V000 DAMAGE:Notify
 E000 DAMAGE:BadDamage
-R000 DEC-XTRAP:Reset
-R001 DEC-XTRAP:GetAvailable
-R002 DEC-XTRAP:Config
-R003 DEC-XTRAP:StartTrap
-R004 DEC-XTRAP:StopTrap
-R005 DEC-XTRAP:GetCurrent
-R006 DEC-XTRAP:GetStatistics
-R007 DEC-XTRAP:SimulateXEvent
-R008 DEC-XTRAP:GetVersion
-R009 DEC-XTRAP:GetLastInpTime
-V000 DEC-XTRAP:Event
-E002 DEC-XTRAP:BadIO
-E004 DEC-XTRAP:BadStatistics
-E005 DEC-XTRAP:BadDevices
-E007 DEC-XTRAP:BadScreen
-E008 DEC-XTRAP:BadSwapReq
 R000 DMX:DMXQueryVersion
 R001 DMX:DMXGetScreenCount
 R002 DMX:DMXGetScreenInfoDEPRECATED
@@ -614,125 +584,6 @@ E014 X11:BadIDChoice
 E015 X11:BadName
 E016 X11:BadLength
 E017 X11:BadImplementation
-R001 X3D-PEX:GetExtensionInfo
-R002 X3D-PEX:GetEnumeratedTypeInfo
-R003 X3D-PEX:GetImpDepConstants
-R004 X3D-PEX:CreateLookupTable
-R005 X3D-PEX:CopyLookupTable
-R006 X3D-PEX:FreeLookupTable
-R007 X3D-PEX:GetTableInfo
-R008 X3D-PEX:GetPredefinedEntries
-R009 X3D-PEX:GetDefinedIndices
-R010 X3D-PEX:GetTableEntry
-R011 X3D-PEX:GetTableEntries
-R012 X3D-PEX:SetTableEntries
-R013 X3D-PEX:DeleteTableEntries
-R014 X3D-PEX:CreatePipelineContext
-R015 X3D-PEX:CopyPipelineContext
-R016 X3D-PEX:FreePipelineContext
-R017 X3D-PEX:GetPipelineContext
-R018 X3D-PEX:ChangePipelineContext
-R019 X3D-PEX:CreateRenderer
-R020 X3D-PEX:FreeRenderer
-R021 X3D-PEX:ChangeRenderer
-R022 X3D-PEX:GetRendererAttributes
-R023 X3D-PEX:GetRendererDynamics
-R024 X3D-PEX:BeginRendering
-R025 X3D-PEX:EndRendering
-R026 X3D-PEX:BeginStructure
-R027 X3D-PEX:EndStructure
-R028 X3D-PEX:OutputCommands
-R029 X3D-PEX:Network
-R030 X3D-PEX:CreateStructure
-R031 X3D-PEX:CopyStructure
-R032 X3D-PEX:DestroyStructures
-R033 X3D-PEX:GetStructureInfo
-R034 X3D-PEX:GetElementInfo
-R035 X3D-PEX:GetStructuresInNetwork
-R036 X3D-PEX:GetAncestors
-R037 X3D-PEX:GetDescendants
-R038 X3D-PEX:FetchElements
-R039 X3D-PEX:SetEditingMode
-R040 X3D-PEX:SetElementPointer
-R041 X3D-PEX:SetElementPointerAtLabel
-R042 X3D-PEX:ElementSearch
-R043 X3D-PEX:StoreElements
-R044 X3D-PEX:DeleteElements
-R045 X3D-PEX:DeleteElementsToLabel
-R046 X3D-PEX:DeleteBetweenLabels
-R047 X3D-PEX:CopyElements
-R048 X3D-PEX:ChangeStructureRefs
-R049 X3D-PEX:CreateNameSet
-R050 X3D-PEX:CopyNameSet
-R051 X3D-PEX:FreeNameSet
-R052 X3D-PEX:GetNameSet
-R053 X3D-PEX:ChangeNameSet
-R054 X3D-PEX:CreateSearchContext
-R055 X3D-PEX:CopySearchContext
-R056 X3D-PEX:FreeSearchContext
-R057 X3D-PEX:GetSearchContext
-R058 X3D-PEX:ChangeSearchContext
-R059 X3D-PEX:SearchNetwork
-R060 X3D-PEX:CreatePhigsWks
-R061 X3D-PEX:FreePhigsWks
-R062 X3D-PEX:GetWksInfo
-R063 X3D-PEX:GetDynamics
-R064 X3D-PEX:GetViewRep
-R065 X3D-PEX:RedrawAllStructures
-R066 X3D-PEX:UpdateWorkstation
-R067 X3D-PEX:RedrawClipRegion
-R068 X3D-PEX:ExecuteDeferredActions
-R069 X3D-PEX:SetViewPriority
-R070 X3D-PEX:SetDisplayUpdateMode
-R071 X3D-PEX:MapDCtoWC
-R072 X3D-PEX:MapWCtoDC
-R073 X3D-PEX:SetViewRep
-R074 X3D-PEX:SetWksWindow
-R075 X3D-PEX:SetWksViewport
-R076 X3D-PEX:SetHlhsrMode
-R077 X3D-PEX:SetWksBufferMode
-R078 X3D-PEX:PostStructure
-R079 X3D-PEX:UnpostStructure
-R080 X3D-PEX:UnpostAllStructures
-R081 X3D-PEX:GetWksPostings
-R082 X3D-PEX:GetPickDevice
-R083 X3D-PEX:ChangePickDevice
-R084 X3D-PEX:CreatePickMeasure
-R085 X3D-PEX:FreePickMeasure
-R086 X3D-PEX:GetPickMeasure
-R087 X3D-PEX:UpdatePickMeasure
-R088 X3D-PEX:OpenFont
-R089 X3D-PEX:CloseFont
-R090 X3D-PEX:QueryFont
-R091 X3D-PEX:ListFonts
-R092 X3D-PEX:ListFontsWithInfo
-R093 X3D-PEX:QueryTextExtents
-R094 X3D-PEX:MatchRenderingTargets
-R095 X3D-PEX:Escape
-R096 X3D-PEX:EscapeWithReply
-R097 X3D-PEX:Elements
-R098 X3D-PEX:AccumulateState
-R099 X3D-PEX:BeginPickOne
-R100 X3D-PEX:EndPickOne
-R101 X3D-PEX:PickOne
-R102 X3D-PEX:BeginPickAll
-R103 X3D-PEX:EndPickAll
-R104 X3D-PEX:PickAll
-E000 X3D-PEX:ColorTypeError
-E001 X3D-PEX:erStateError
-E002 X3D-PEX:FloatingPointFormatError
-E003 X3D-PEX:LabelError
-E004 X3D-PEX:LookupTableError
-E005 X3D-PEX:NameSetError
-E006 X3D-PEX:PathError
-E007 X3D-PEX:FontError
-E008 X3D-PEX:PhigsWksError
-E009 X3D-PEX:PickMeasureError
-E010 X3D-PEX:PipelineContextError
-E011 X3D-PEX:erError
-E012 X3D-PEX:SearchContextError
-E013 X3D-PEX:StructureError
-E014 X3D-PEX:OutputCommandError
 R000 XC-APPGROUP:QueryVersion
 R001 XC-APPGROUP:Create
 R002 XC-APPGROUP:Destroy
@@ -876,39 +727,6 @@ E003 XFree86-VidModeExtension:ModeUnsuitable
 E004 XFree86-VidModeExtension:ExtensionDisabled
 E005 XFree86-VidModeExtension:ClientNotLocal
 E006 XFree86-VidModeExtension:ZoomLocked
-R001 XIE:QueryImageExtension
-R002 XIE:QueryTechniques
-R003 XIE:CreateColorList
-R004 XIE:DestroyColorList
-R005 XIE:PurgeColorList
-R006 XIE:QueryColorList
-R007 XIE:CreateLUT
-R008 XIE:DestroyLUT
-R009 XIE:CreatePhotomap
-R010 XIE:DestroyPhotomap
-R011 XIE:QueryPhotomap
-R012 XIE:CreateROI
-R013 XIE:DestroyROI
-R014 XIE:CreatePhotospace
-R015 XIE:DestroyPhotospace
-R016 XIE:ExecuteImmediate
-R017 XIE:CreatePhotoflo
-R018 XIE:DestroyPhotoflo
-R019 XIE:ExecutePhotoflo
-R020 XIE:ModifyPhotoflo
-R021 XIE:RedefinePhotoflo
-R022 XIE:PutClientData
-R023 XIE:GetClientData
-R024 XIE:QueryPhotoflo
-R025 XIE:Await
-R026 XIE:Abort
-E000 XIE:ColorListError
-E001 XIE:LUTError
-E002 XIE:PhotofloError
-E003 XIE:PhotomapError
-E004 XIE:PhotospaceError
-E005 XIE:ROIError
-E006 XIE:FloError
 R000 XINERAMA:QueryVersion
 R001 XINERAMA:GetState
 R002 XINERAMA:GetScreenCount
commit 5c5bc6a9c2050562e9330c0b7b98a5261ee0b113
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Sep 7 15:50:26 2010 +0300

    dix: remove dead extensions to protocol.txt
    
    lbx and mbe.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    (cherry picked from commit 593270038d8983b99aa0aaa24509da3cb944be5c)

diff --git a/dix/protocol.txt b/dix/protocol.txt
index f78ed58..4633e08 100644
--- a/dix/protocol.txt
+++ b/dix/protocol.txt
@@ -248,51 +248,6 @@ E009 GLX:BadFBConfig
 E010 GLX:BadPbuffer
 E011 GLX:BadCurrentDrawable
 E012 GLX:BadWindow
-R000 LBX:QueryVersion
-R001 LBX:StartProxy
-R002 LBX:StopProxy
-R003 LBX:Switch
-R004 LBX:NewClient
-R005 LBX:CloseClient
-R006 LBX:ModifySequence
-R007 LBX:AllowMotion
-R008 LBX:IncrementPixel
-R009 LBX:Delta
-R010 LBX:GetModifierMapping
-R011 LBX:QueryTag
-R012 LBX:InvalidateTag
-R013 LBX:PolyPoint
-R014 LBX:PolyLine
-R015 LBX:PolySegment
-R016 LBX:PolyRectangle
-R017 LBX:PolyArc
-R018 LBX:FillPoly
-R019 LBX:PolyFillRectangle
-R020 LBX:PolyFillArc
-R021 LBX:GetKeyboardMapping
-R022 LBX:QueryFont
-R023 LBX:ChangeProperty
-R024 LBX:GetProperty
-R025 LBX:TagData
-R026 LBX:CopyArea
-R027 LBX:CopyPlane
-R028 LBX:PolyText8
-R029 LBX:PolyText16
-R030 LBX:ImageText8
-R031 LBX:ImageText16
-R032 LBX:QueryExtension
-R033 LBX:PutImage
-R034 LBX:GetImage
-R035 LBX:BeginLargeRequest
-R036 LBX:LargeRequestData
-R037 LBX:EndLargeRequest
-R038 LBX:InternAtoms
-R039 LBX:GetWinAttrAndGeom
-R040 LBX:GrabCmap
-R041 LBX:ReleaseCmap
-R042 LBX:AllocColor
-R043 LBX:Sync
-E000 LBX:BadLbxClient
 R000 MIT-SCREEN-SAVER:QueryVersion
 R001 MIT-SCREEN-SAVER:QueryInfo
 R002 MIT-SCREEN-SAVER:SelectInput
@@ -310,20 +265,6 @@ V000 MIT-SHM:Completion
 E000 MIT-SHM:BadShmSeg
 R000 MIT-SUNDRY-NONSTANDARD:SetBugMode
 R001 MIT-SUNDRY-NONSTANDARD:GetBugMode
-R000 Multi-Buffering:GetBufferVersion
-R001 Multi-Buffering:CreateImageBuffers
-R002 Multi-Buffering:DestroyImageBuffers
-R003 Multi-Buffering:DisplayImageBuffers
-R004 Multi-Buffering:SetMBufferAttributes
-R005 Multi-Buffering:GetMBufferAttributes
-R006 Multi-Buffering:SetBufferAttributes
-R007 Multi-Buffering:GetBufferAttributes
-R008 Multi-Buffering:GetBufferInfo
-R009 Multi-Buffering:CreateStereoWindow
-R010 Multi-Buffering:ClearImageBufferArea
-V000 Multi-Buffering:ClobberNotify
-V001 Multi-Buffering:UpdateNotify
-E000 Multi-Buffering:BadBuffer
 R000 RANDR:QueryVersion
 R001 RANDR:OldGetScreenInfo
 R002 RANDR:SetScreenConfig
commit a55bfcc0df09920a5e3ec9f923d5168992a63f29
Author: Robert Hooker <sarvatt at ubuntu.com>
Date:   Fri Dec 3 23:42:27 2010 -0500

    Add new GLX events errors and requests to protocol.txt
    
    Based off of glproto 1.4.11.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Robert Hooker <robert.hooker at canonical.com>
    (cherry picked from commit 3cd56dd2cfbfcce6ba68c22450d51139208993ab)

diff --git a/dix/protocol.txt b/dix/protocol.txt
index fa2fcb1..f78ed58 100644
--- a/dix/protocol.txt
+++ b/dix/protocol.txt
@@ -159,6 +159,20 @@ R017 GLX:VendorPrivateWithReply
 R018 GLX:QueryExtensionsString
 R019 GLX:QueryServerString
 R020 GLX:ClientInfo
+R021 GLX:GetFBConfigs
+R022 GLX:CreatePixmap
+R023 GLX:DestroyPixmap
+R024 GLX:CreateNewContext
+R025 GLX:QueryContext
+R026 GLX:MakeContextCurrent
+R027 GLX:CreatePbuffer
+R028 GLX:DestroyPbuffer
+R029 GLX:GetDrawableAttributes
+R030 GLX:ChangeDrawableAttributes
+R031 GLX:CreateWindow
+R032 GLX:DeleteWindow
+R033 GLX:SetClientInfoARB
+R034 GLX:CreateContextAttribsARB
 R101 GLX:NewList
 R102 GLX:EndList
 R103 GLX:DeleteLists
@@ -201,6 +215,26 @@ R139 GLX:GetTexLevelParameteriv
 R140 GLX:IsEnabled
 R141 GLX:IsList
 R142 GLX:Flush
+R143 GLX:AreTexturesResident
+R144 GLX:DeleteTextures
+R145 GLX:GenTextures
+R146 GLX:IsTexture
+R147 GLX:GetColorTable
+R148 GLX:GetColorTableParameterfv
+R149 GLX:GetColorTableParameterfv
+R150 GLX:GetConvolutionFilter
+R151 GLX:GetConvolutionParameterfv
+R152 GLX:GetConvolutionParameteriv
+R153 GLX:GetSeparableFilter
+R154 GLX:GetHistogram
+R155 GLX:GetHistogramParameterfv
+R156 GLX:GetHistogramParameteriv
+R157 GLX:GetMinmax
+R158 GLX:GetMinmaxParameterfv
+R159 GLX:GetMinmaxParameteriv
+R160 GLX:GetCompressedTexImage
+V000 GLX:PbufferClobber
+V001 GLX:BufferSwapComplete
 E000 GLX:BadContext
 E001 GLX:BadContextState
 E002 GLX:BadDrawable
@@ -210,6 +244,10 @@ E005 GLX:BadCurrentWindow
 E006 GLX:BadRenderRequest
 E007 GLX:BadLargeRequest
 E008 GLX:UnsupportedPrivateRequest
+E009 GLX:BadFBConfig
+E010 GLX:BadPbuffer
+E011 GLX:BadCurrentDrawable
+E012 GLX:BadWindow
 R000 LBX:QueryVersion
 R001 LBX:StartProxy
 R002 LBX:StopProxy
commit 9cb53672b4b4c847544c37888db6e2ae354697a2
Author: Robert Hooker <sarvatt at ubuntu.com>
Date:   Fri Dec 3 23:39:51 2010 -0500

    Add DRI2 2.2/2.3 events and requests to protocol.txt
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Robert Hooker <robert.hooker at canonical.com>
    (cherry picked from commit 272ba9f021c6d08ebd6a2d96da3737f5630bcbd5)

diff --git a/dix/protocol.txt b/dix/protocol.txt
index c223795..fa2fcb1 100644
--- a/dix/protocol.txt
+++ b/dix/protocol.txt
@@ -124,6 +124,13 @@ R004 DRI2:DestroyDrawable
 R005 DRI2:GetBuffers
 R006 DRI2:CopyRegion
 R007 DRI2:GetBuffersWithFormat
+R008 DRI2:SwapBuffers
+R009 DRI2:GetMSC
+R010 DRI2:WaitMSC
+R011 DRI2:WaitSBC
+R012 DRI2:SwapInterval
+V000 DRI2:BufferSwapComplete
+V001 DRI2:InvalidateBuffers
 R000 Extended-Visual-Information:QueryVersion
 R001 Extended-Visual-Information:GetVisualInfo
 R000 FontCache:QueryVersion
commit 8810c46a98a107cf53b30696cfad6e388b73024d
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Sep 21 15:23:23 2015 -0400

    rootless: Fix bogus handling of broken root clip
    
    gcc quite correctly complains about this:
    
        In file included from ../../include/scrnintstr.h:51:0,
                         from rootlessValTree.c:98:
        In function 'RegionUninit.isra.1',
            inlined from 'RegionEmpty' at ../../include/regionstr.h:194:5,
            inlined from 'RootlessMiValidateTree' at rootlessValTree.c:490:9:
        ../../include/regionstr.h:166:9: warning: attempt to free a non-heap object 'RegionBrokenData' [-Wfree-nonheap-object]
                 free((_pReg)->data);
    
    So that'd crash if you ever got there.  RegionNull will do almost the
    same thing only without the free(), so let's do that instead; it might
    still not be an entirely sane way to recover, but it at least won't
    crash.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit fa0bb01899d586e02cf51892c17edd22e462a46c)

diff --git a/miext/rootless/rootlessValTree.c b/miext/rootless/rootlessValTree.c
index 0f7b76c..409e6a0 100644
--- a/miext/rootless/rootlessValTree.c
+++ b/miext/rootless/rootlessValTree.c
@@ -487,7 +487,7 @@ RootlessMiValidateTree(WindowPtr pRoot, /* Parent to validate */
     if (RegionBroken(&pRoot->clipList) && !RegionBroken(&pRoot->borderClip)) {
         // fixme this might not work, but hopefully doesn't happen anyway.
         kind = VTBroken;
-        RegionEmpty(&pRoot->clipList);
+        RegionNull(&pRoot->clipList);
         ErrorF("ValidateTree: BUSTED!\n");
     }
 
commit 9a4ea1f5ea7f813d28cf322aca6f2ea8c427bd1a
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 21 07:16:17 2015 +0100

    os/xdmcp: Just send XDMCP keepalive packets once every three minutes
    
    There was a complicated scheme to increase the time between keepalives
    from 3 minutes up to as much as 24 hours in an attempt to reduce
    network traffic from idle X terminals. X terminals receiving X
    traffic, or receiving user input would use the 3 minute value; X
    terminals without any network traffic would use a longer value.
    
    However, this was actually broken -- any activity in the X server,
    either client requests or user input, would end up resetting the
    keepalive timeout, so a user mashing on the keyboard would never
    discover that the XDMCP master had disappeared and have the session
    terminated, which was precisely the design goal of the XDMCP keepalive
    mechanism.
    
    Instead of attempting to fix this, accept the cost of a pair of XDMCP
    packets once every three minutes and just perform keepalives
    regularly.
    
    This will also make reworking the block and wakeup handler APIs to
    eliminate select masks easier.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit db1089eafc1c5371fa0030202de588d2e2b4f8e5)

diff --git a/os/xdmcp.c b/os/xdmcp.c
index b1ee5d2..7939b41 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -84,8 +84,6 @@ static int req_socklen;
 static CARD32 SessionID;
 static CARD32 timeOutTime;
 static int timeOutRtx;
-static CARD32 defaultKeepaliveDormancy = XDM_DEF_DORMANCY;
-static CARD32 keepaliveDormancy = XDM_DEF_DORMANCY;
 static CARD16 DisplayNumber;
 static xdmcp_states XDM_INIT_STATE = XDM_OFF;
 
@@ -632,6 +630,7 @@ XdmcpOpenDisplay(int sock)
     if (state != XDM_AWAIT_MANAGE_RESPONSE)
         return;
     state = XDM_RUN_SESSION;
+    timeOutTime = GetTimeInMillis() + XDM_DEF_DORMANCY * 1000;
     sessionSocket = sock;
 }
 
@@ -689,7 +688,6 @@ XdmcpWakeupHandler(void *data,        /* unused */
                    int i, void *pReadmask)
 {
     fd_set *last_select_mask = (fd_set *) pReadmask;
-    fd_set devicesReadable;
 
     if (state == XDM_OFF)
         return;
@@ -704,13 +702,6 @@ XdmcpWakeupHandler(void *data,        /* unused */
             FD_CLR(xdmcpSocket6, last_select_mask);
         }
 #endif
-        XFD_ANDSET(&devicesReadable, last_select_mask, &EnabledDevices);
-        if (XFD_ANYSET(&devicesReadable)) {
-            if (state == XDM_RUN_SESSION)
-                keepaliveDormancy = defaultKeepaliveDormancy;
-        }
-        if (XFD_ANYSET(&AllClients) && state == XDM_RUN_SESSION)
-            timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000;
     }
     else if (timeOutTime && (int) (GetTimeInMillis() - timeOutTime) >= 0) {
         if (state == XDM_RUN_SESSION) {
@@ -1399,15 +1390,8 @@ recv_alive_msg(unsigned length)
     if (XdmcpReadCARD8(&buffer, &SessionRunning) &&
         XdmcpReadCARD32(&buffer, &AliveSessionID)) {
         if (SessionRunning && AliveSessionID == SessionID) {
-            /* backoff dormancy period */
             state = XDM_RUN_SESSION;
-            if ((GetTimeInMillis() - LastEventTime(XIAllDevices).milliseconds) >
-                keepaliveDormancy * 1000) {
-                keepaliveDormancy <<= 1;
-                if (keepaliveDormancy > XDM_MAX_DORMANCY)
-                    keepaliveDormancy = XDM_MAX_DORMANCY;
-            }
-            timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000;
+            timeOutTime = GetTimeInMillis() + XDM_DEF_DORMANCY * 1000;
         }
         else {
             XdmcpDeadSession("Alive response indicates session dead");
commit abe44851018d0e5bace2971682e724aa7444e96f
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 21 07:16:16 2015 +0100

    os/xdmcp: Remove dead 'restart' code
    
    The X server used to wait for the user to hit a key or move the mouse
    before restarting the session after a keepalive failure. This,
    presumably, was to avoid having the X server continuously spew XDMCP
    protocol on the network while the XDM server was dead.
    
    Switching into this state was removed from the server some time before
    XFree86 4.3.99.16, so the remaining bits of code have been dead for
    over a decade, and no-one ever noticed.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit a3a40291330bad10401fe2bcdbc097ce742b026a)

diff --git a/os/xdmcp.c b/os/xdmcp.c
index b265db3..b1ee5d2 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -199,8 +199,6 @@ static void send_packet(void);
 
 static void timeout(void);
 
-static void restart(void);
-
 static void XdmcpBlockHandler(void              *data ,
                               struct timeval    **wt,
                               void              *LastSelectMask);
@@ -708,9 +706,7 @@ XdmcpWakeupHandler(void *data,        /* unused */
 #endif
         XFD_ANDSET(&devicesReadable, last_select_mask, &EnabledDevices);
         if (XFD_ANYSET(&devicesReadable)) {
-            if (state == XDM_AWAIT_USER_INPUT)
-                restart();
-            else if (state == XDM_RUN_SESSION)
+            if (state == XDM_RUN_SESSION)
                 keepaliveDormancy = defaultKeepaliveDormancy;
         }
         if (XFD_ANYSET(&AllClients) && state == XDM_RUN_SESSION)
@@ -936,14 +932,6 @@ timeout(void)
     send_packet();
 }
 
-static void
-restart(void)
-{
-    state = XDM_INIT_STATE;
-    timeOutRtx = 0;
-    send_packet();
-}
-
 static int
 XdmcpCheckAuthentication(ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type)
 {
commit c72d4f00277c977faecd697ef3407518f11f909d
Author: Egbert Eich <eich at freedesktop.org>
Date:   Tue Mar 31 09:06:46 2015 +0200

    randr: Remove senseless checks for xf86RandR12Key
    
    When xf86RandR12Key is not set we will not get to the places where
    these tests are done as the functions in question are not called.
    In most cases we would have crashed before these checks anyway.
    
    Signed-off-by: Egbert Eich <eich at freedesktop.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 3cd7d33380953f2a315dd79ab74d7340c83fd80a)

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index b1c306a..5c1ba71 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -683,11 +683,9 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
     Bool ret = FALSE;
     int c;
 
-    if (xf86RandR12Key) {
-        if (randrp->virtualX == -1 || randrp->virtualY == -1) {
-            randrp->virtualX = pScrn->virtualX;
-            randrp->virtualY = pScrn->virtualY;
-        }
+    if (randrp->virtualX == -1 || randrp->virtualY == -1) {
+        randrp->virtualX = pScrn->virtualX;
+        randrp->virtualY = pScrn->virtualY;
     }
     if (pRoot && pScrn->vtSema)
         (*pScrn->EnableDisableFBAccess) (pScrn, FALSE);
@@ -730,7 +728,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
     if (pRoot && pScrn->vtSema)
         (*pScrn->EnableDisableFBAccess) (pScrn, TRUE);
 #if RANDR_12_INTERFACE
-    if (xf86RandR12Key && pScreen->root && ret)
+    if (pScreen->root && ret)
         RRScreenSizeNotify(pScreen);
 #endif
     return ret;
@@ -826,9 +824,6 @@ xf86RandR12CreateScreenResources(ScreenPtr pScreen)
         xf86RandR12ScreenSetSize(pScreen, width, height, mmWidth, mmHeight);
     }
 
-    if (xf86RandR12Key == NULL)
-        return TRUE;
-
     if (randrp->virtualX == -1 || randrp->virtualY == -1) {
         randrp->virtualX = pScrn->virtualX;
         randrp->virtualY = pScrn->virtualY;
commit 7a53179425ab5112adcace1489cad6e8072af6b1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Oct 6 10:02:22 2014 +0100

    randr/prime: Don't stop on the first pipe when disabling ReplaceScanoutPixmap
    
    As we define sizeFits based on whether a CRTC is active, and skip trying
    to redirect the scanout on a disable pipe, we then attempt to undo it
    later and fail because crtc->scanout_pixmap != DRI2_Pixmap and
    !sizeFits. Paper over this failure by skipping unredirected CRTC when
    disabling.
    
    v2: Unwind upon failure
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84653
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Cc: Dave Airlie <airlied at redhat.com>
    Reported-by: Christoph Haag <haagch at frickel.club>
    Tested-by: Christoph Haag <haagch at frickel.club>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    (cherry picked from commit 245040f0d0b937efe14d947468a641a95398776a)

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index dca0691..3498745 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1663,23 +1663,30 @@ Bool
 RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable)
 {
     rrScrPriv(pDrawable->pScreen);
-    int i;
-    Bool size_fits = FALSE;
-    Bool changed = FALSE;
     Bool ret = TRUE;
+    PixmapPtr *saved_scanout_pixmap;
+    int i;
+
+    saved_scanout_pixmap = malloc(sizeof(PixmapPtr)*pScrPriv->numCrtcs);
+    if (saved_scanout_pixmap == NULL)
+        return FALSE;
 
     for (i = 0; i < pScrPriv->numCrtcs; i++) {
         RRCrtcPtr crtc = pScrPriv->crtcs[i];
+        Bool size_fits;
+
+        saved_scanout_pixmap[i] = crtc->scanout_pixmap;
 
         if (!crtc->mode && enable)
             continue;
+        if (!crtc->scanout_pixmap && !enable)
+            continue;
 
-        changed = FALSE;
-        if (crtc->mode && crtc->x == pDrawable->x &&
-            crtc->y == pDrawable->y &&
-            crtc->mode->mode.width == pDrawable->width &&
-            crtc->mode->mode.height == pDrawable->height)
-            size_fits = TRUE;
+        size_fits = (crtc->mode &&
+                     crtc->x == pDrawable->x &&
+                     crtc->y == pDrawable->y &&
+                     crtc->mode->mode.width == pDrawable->width &&
+                     crtc->mode->mode.height == pDrawable->height);
 
         /* is the pixmap already set? */
         if (crtc->scanout_pixmap == pPixmap) {
@@ -1687,32 +1694,48 @@ RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable)
             if (enable == FALSE) {
                 /* set scanout to NULL */
                 crtc->scanout_pixmap = NULL;
-                changed = TRUE;
-            } else {
-                /* if the size fits then we are already setup */
-                if (size_fits)
-                    return TRUE;
+            }
+            else if (!size_fits) {
                 /* if the size no longer fits then drop off */
                 crtc->scanout_pixmap = NULL;
-                changed = TRUE;
+                pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap);
+
+                (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y,
+                                        crtc->rotation, crtc->numOutputs, crtc->outputs);
+                saved_scanout_pixmap[i] = crtc->scanout_pixmap;
                 ret = FALSE;
             }
-        } else {
+            else {
+                /* if the size fits then we are already setup */
+            }
+        }
+        else {
             if (!size_fits)
-                return FALSE;
-            if (enable) {
+                ret = FALSE;
+            else if (enable)
                 crtc->scanout_pixmap = pPixmap;
-                pScrPriv->rrCrtcSetScanoutPixmap(crtc, pPixmap);
-                changed = TRUE;
-            }
+            else
+                /* reject an attempt to disable someone else's scanout_pixmap */
+                ret = FALSE;
         }
+    }
+
+    for (i = 0; i < pScrPriv->numCrtcs; i++) {
+        RRCrtcPtr crtc = pScrPriv->crtcs[i];
+
+        if (crtc->scanout_pixmap == saved_scanout_pixmap[i])
+            continue;
 
-        if (changed && pScrPriv->rrCrtcSet) {
+        if (ret) {
             pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap);
 
             (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y,
                                     crtc->rotation, crtc->numOutputs, crtc->outputs);
         }
+        else
+            crtc->scanout_pixmap = saved_scanout_pixmap[i];
     }
+    free(saved_scanout_pixmap);
+
     return ret;
 }
commit a85808ce3fc26511996d01e7e6ec1192b8c3d216
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Sep 18 08:44:07 2015 -0700

    Remove DECnet from Xserver.man
    
    DECnet support died in modularization (X11R7.0)
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 9d65a0de95a20632f2a6a04ba596dcdd76d9f5e2)

diff --git a/man/Xserver.man b/man/Xserver.man
index 1cf242d..10b7b97 100644
--- a/man/Xserver.man
+++ b/man/Xserver.man
@@ -428,7 +428,7 @@ elapse between autorepeat-generated keystrokes).
 loads keyboard description in \fIfilename\fP on server startup.
 .SH "NETWORK CONNECTIONS"
 The X server supports client connections via a platform-dependent subset of
-the following transport types: TCP/IP, Unix Domain sockets, DECnet,
+the following transport types: TCP/IP, Unix Domain sockets,
 and several varieties of SVR4 local connections.  See the DISPLAY
 NAMES section of the \fIX\fP(__miscmansuffix__) manual page to learn how to
 specify which transport type clients should try to use.
@@ -457,8 +457,8 @@ If no other authorization mechanism is being used,
 this list initially consists of the host on which the server is running as
 well as any machines listed in the file \fI/etc/X\fBn\fI.hosts\fR, where
 \fBn\fP is the display number of the server.  Each line of the file should
-contain either an Internet hostname (e.g. expo.lcs.mit.edu) or a DECnet
-hostname in double colon format (e.g. hydra::) or a complete name in the format
+contain either an Internet hostname (e.g. expo.lcs.mit.edu)
+or a complete name in the format
 \fIfamily\fP:\fIname\fP as described in the \fIxhost\fP(1) manual page.
 There should be no leading or trailing spaces on any lines.  For example:
 .sp
@@ -466,7 +466,6 @@ There should be no leading or trailing spaces on any lines.  For example:
 .nf
 joesworkstation
 corporate.company.com
-star::
 inet:bigcpu
 local:
 .fi
commit 49d04a43360267fb7cbbeec0ea4985ba224fb59c
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Thu Sep 17 16:04:33 2015 -0700

    privates: Clear screen-specific keys during CloseScreen
    
    The modesetting driver corrupts memory when used after a server regeneration
    because not enough memory is allocated for its pixmap privates.  This happens
    because its call to dixRegisterScreenSpecificPrivateKey() does nothing because
    key->initialized is still TRUE from the first server generation.  However, the
    key is not in the screen's linked list of screen-specific privates because
    that's freed and reallocated during the server generation loop in dix_main().
    
    Fix this by clearing key->initialized before CloseScreen and add a call to
    dixFreeScreenSpecificPrivates() for GPU screens.
    
    v2: Just set key->initialized to FALSE and move dixFreeScreenSpecificPrivates()
    calls to after CloseScreen.
    
    v3: Move dixFreeScreenSpecificPrivates() calls back to just before CloseScreen.
    
    Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 82eb490b0a341729f25d0c42a937fe29d99da521)

diff --git a/dix/main.c b/dix/main.c
index 09f9504..7c6ac94 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -337,6 +337,7 @@ dix_main(int argc, char *argv[], char *envp[])
         for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
             ScreenPtr pScreen = screenInfo.gpuscreens[i];
             FreeScratchPixmapsForScreen(pScreen);
+            dixFreeScreenSpecificPrivates(pScreen);
             (*pScreen->CloseScreen) (pScreen);
             dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
             free(pScreen);
diff --git a/dix/privates.c b/dix/privates.c
index e03b225..969d014 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -642,6 +642,15 @@ dixRegisterScreenSpecificPrivateKey(ScreenPtr pScreen, DevPrivateKey key,
 void
 dixFreeScreenSpecificPrivates(ScreenPtr pScreen)
 {
+    DevPrivateType t;
+
+    for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++) {
+        DevPrivateKey key;
+
+        for (key = pScreen->screenSpecificPrivates[t].key; key; key = key->next) {
+            key->initialized = FALSE;
+        }
+    }
 }
 
 /* Initialize screen-specific privates in AddScreen */
commit daf15b551631e8a98960e629039bef1880de8f82
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Jun 10 13:20:59 2015 -0400

    render: Simplify SProcRenderScale
    
    Since ProcRenderScale throws BadImplementation anyway it's pointless to
    waste time carefully swapping the request.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 67dd34fa734085ed67ba7790820fe4743d48b60f)

diff --git a/render/render.c b/render/render.c
index 723f380..93e43e7 100644
--- a/render/render.c
+++ b/render/render.c
@@ -2099,20 +2099,7 @@ SProcRenderComposite(ClientPtr client)
 static int
 SProcRenderScale(ClientPtr client)
 {
-    REQUEST(xRenderScaleReq);
-    REQUEST_SIZE_MATCH(xRenderScaleReq);
-    swaps(&stuff->length);
-    swapl(&stuff->src);
-    swapl(&stuff->dst);
-    swapl(&stuff->colorScale);
-    swapl(&stuff->alphaScale);
-    swaps(&stuff->xSrc);
-    swaps(&stuff->ySrc);
-    swaps(&stuff->xDst);
-    swaps(&stuff->yDst);
-    swaps(&stuff->width);
-    swaps(&stuff->height);
-    return (*ProcRenderVector[stuff->renderReqType]) (client);
+    return BadImplementation;
 }
 
 static int
commit 10a944889228acdeaf471766407fc84c8947e931
Author: Ian Scott <ian.scott at arteris.com>
Date:   Thu May 21 16:13:12 2015 -0700

    Xephyr: Paint with subimage for non-Glamor & non-XSHM case
    
    This improves the case for when we paint an area without SHM.
    xcb_image_subimage() is used to create a subimage for the damaged area, which
    is converted to native format if necessary.
    
    Signed-off-by: Ian Scott <ian.scott at arteris.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    (cherry picked from commit a579e6ba7763749d51d16e3a54941e06939df07a)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 71c1691..e19f57b 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1039,11 +1039,13 @@ hostx_paint_rect(KdScreenInfo *screen,
                           sx, sy, dx, dy, width, height, FALSE);
     }
     else {
-        /* This is slow and could be done better */
-        xcb_image_t *img = xcb_image_native (HostX.conn, scrpriv->ximg, 1);
-        xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, img, 0, 0, 0);
-        if (scrpriv->ximg != img)
+        xcb_image_t *subimg = xcb_image_subimage(scrpriv->ximg, sx, sy,
+                                                 width, height, 0, 0, 0);
+        xcb_image_t *img = xcb_image_native(HostX.conn, subimg, 1);
+        xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, img, dx, dy, 0);
+        if (subimg != img)
             xcb_image_destroy(img);
+        xcb_image_destroy(subimg);
     }
 
     xcb_aux_sync(HostX.conn);
commit 0134dc1b56e8c7c19f655e583ff3f3ba0d6cae4e
Author: Daniel Drake <drake at endlessm.com>
Date:   Wed May 20 13:16:12 2015 -0600

    Keep SIGALRM restart flag after Popen
    
    Commit 94ab7455 added SA_RESTART to the SIGALRM handler.  However, the
    Popen code tears down and recreates the SIGALRM handler via OsSignal(),
    and this flag is dropped at this time.
    
    Clean the code to use just a single codepath for creating this signal
    handler, always applying SA_RESTART.
    
    [ajax: Fixed commit id]
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Daniel Drake <drake at endlessm.com>
    (cherry picked from commit 1f915e8b524dd02011158aa038935970684c7630)

diff --git a/os/utils.c b/os/utils.c
index 881d173..2b23430 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1208,14 +1208,15 @@ SmartScheduleTimer(int sig)
     SmartScheduleTime += SmartScheduleInterval;
 }
 
-void
-SmartScheduleInit(void)
+static int
+SmartScheduleEnable(void)
 {
+    int ret = 0;
 #ifdef SMART_SCHEDULE_POSSIBLE
     struct sigaction act;
 
     if (SmartScheduleDisable)
-        return;
+        return 0;
 
     memset((char *) &act, 0, sizeof(struct sigaction));
 
@@ -1224,11 +1225,40 @@ SmartScheduleInit(void)
     act.sa_handler = SmartScheduleTimer;
     sigemptyset(&act.sa_mask);
     sigaddset(&act.sa_mask, SIGALRM);
-    if (sigaction(SIGALRM, &act, 0) < 0) {
+    ret = sigaction(SIGALRM, &act, 0);
+#endif
+    return ret;
+}
+
+static int
+SmartSchedulePause(void)
+{
+    int ret = 0;
+#ifdef SMART_SCHEDULE_POSSIBLE
+    struct sigaction act;
+
+    if (SmartScheduleDisable)
+        return 0;
+
+    memset((char *) &act, 0, sizeof(struct sigaction));
+
+    act.sa_handler = SIG_IGN;
+    sigemptyset(&act.sa_mask);
+    ret = sigaction(SIGALRM, &act, 0);
+#endif
+    return ret;
+}
+
+void
+SmartScheduleInit(void)
+{
+    if (SmartScheduleDisable)
+        return;
+
+    if (SmartScheduleEnable() < 0) {
         perror("sigaction for smart scheduler");
         SmartScheduleDisable = TRUE;
     }
-#endif
 }
 
 #ifdef SIG_BLOCK
@@ -1403,8 +1433,6 @@ static struct pid {
     int pid;
 } *pidlist;
 
-OsSigHandlerPtr old_alarm = NULL;       /* XXX horrible awful hack */
-
 void *
 Popen(const char *command, const char *type)
 {
@@ -1427,8 +1455,7 @@ Popen(const char *command, const char *type)
     }
 
     /* Ignore the smart scheduler while this is going on */
-    old_alarm = OsSignal(SIGALRM, SIG_IGN);
-    if (old_alarm == SIG_ERR) {
+    if (SmartSchedulePause() < 0) {
         close(pdes[0]);
         close(pdes[1]);
         free(cur);
@@ -1441,7 +1468,7 @@ Popen(const char *command, const char *type)
         close(pdes[0]);
         close(pdes[1]);
         free(cur);
-        if (OsSignal(SIGALRM, old_alarm) == SIG_ERR)
+        if (SmartScheduleEnable() < 0)
             perror("signal");
         return NULL;
     case 0:                    /* child */
@@ -1616,7 +1643,7 @@ Pclose(void *iop)
     /* allow EINTR again */
     OsReleaseSignals();
 
-    if (old_alarm && OsSignal(SIGALRM, old_alarm) == SIG_ERR) {
+    if (SmartScheduleEnable() < 0) {
         perror("signal");
         return -1;
     }
commit f92c0b9f94deaa03f792c3c93efd802fec268e8f
Author: Daniel Drake <drake at endlessm.com>
Date:   Tue May 12 16:39:22 2015 -0600

    Allow system call restarts upon signal interruption
    
    The X server frequently deals with SIGIO and SIGALRM interruptions.
    If process execution is inside certain blocking system calls
    when these signals arrive, e.g. with the kernel blocked on
    a contended semaphore, the system calls will be interrupted.
    
    Some system calls are automatically restartable (the kernel re-executes
    them with the same parameters once the signal handler returns) but
    only if the signal handler allows it.
    
    Set SA_RESTART on the signal handlers to enable this convenient
    behaviour.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Daniel Drake <drake at endlessm.com>
    (cherry picked from commit 94ab7455abc213fc96760e29ab2e943ec682fb22)

diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c
index 45949f7..c746d02 100644
--- a/hw/xfree86/os-support/shared/sigio.c
+++ b/hw/xfree86/os-support/shared/sigio.c
@@ -178,7 +178,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure)
             }
             sigemptyset(&sa.sa_mask);
             sigaddset(&sa.sa_mask, SIGIO);
-            sa.sa_flags = 0;
+            sa.sa_flags = SA_RESTART;
             sa.sa_handler = xf86SIGIO;
             sigaction(SIGIO, &sa, &osa);
             xf86SigIOFuncs[i].fd = fd;
diff --git a/os/utils.c b/os/utils.c
index 74d73b3..881d173 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1220,6 +1220,7 @@ SmartScheduleInit(void)
     memset((char *) &act, 0, sizeof(struct sigaction));
 
     /* Set up the timer signal function */
+    act.sa_flags = SA_RESTART;
     act.sa_handler = SmartScheduleTimer;
     sigemptyset(&act.sa_mask);
     sigaddset(&act.sa_mask, SIGALRM);
commit d2e4a9d4ac2f479de23e15af5e528cfa2bffb30f
Author: Felix Janda <felix.janda at posteo.de>
Date:   Mon Aug 17 20:25:53 2015 +0200

    On linux use <termios.h> instead of <termio.h>
    
    <termio.h> is obsolete. Using <termios.h> instead fixes building with
    musl libc.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Felix Janda <felix.janda at posteo.de>
    (cherry picked from commit e8e3368298c98a1292bb1c727e2f3d56539e2eac)

diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index 6190fe6..95c3a73 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -183,11 +183,7 @@ extern _X_HIDDEN char xf86SolarisFbDev[PATH_MAX];
 #include <sys/types.h>
 #include <assert.h>
 
-#ifdef __linux__
-#include <termio.h>
-#else                           /* __GLIBC__ */
 #include <termios.h>
-#endif
 #ifdef __sparc__
 #include <sys/param.h>
 #endif
commit e863ab57eb94f32485a501e547eedc96f9249ad1
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Jul 29 11:30:15 2015 -0400

    glxproxy: Fix an obvious thinko in QueryExtensionsString
    
    gcc 5.1 throws a rather amusing warning here:
    
    glxcmdsswap.c: In function ‘__glXSwapQueryExtensionsString’:
    glxcmdsswap.c:439:1: warning: function might be candidate for attribute
    ‘noreturn’ [-Wsuggest-attribute=noreturn]
     __glXSwapQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
    
    This is entirely accurate, albeit curiously phrased: swapping some bits
    hanging off the end of a null pointer will make Xdmx crash, so from the
    perspective of code generation the function will indeed not return.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit dfa8b37cfb2589f2474f6fcc755dde77bfdd6fed)

diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index 600a6e1..5b1722d 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -438,7 +438,7 @@ __glXSwapUseXFont(__GLXclientState * cl, GLbyte * pc)
 int
 __glXSwapQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXQueryExtensionsStringReq *req = NULL;
+    xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
commit 1688b7517e91dba84244c01d1a01fa8145b4367a
Author: Ingo Schwarze <schwarze at usta.de>
Date:   Sun Aug 30 15:26:40 2015 +0200

    remove bogus \/ escapes
    
    some X manuals use then escape sequence \/ when they want to render
    a slash.  That's bad because \/ is not a slash but an italic
    correction, never producing any output, having no effect at all in
    terminal output, and only changing spacing in a minor way in typeset
    output.
    
    Signed-off-by: Matthieu Herrb <matthieu at herrb.eu>
    Reviewed-by: Mark Kettenis <kettenis at openbsd.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 634e357be2ec400f63bd5c42f706b709b6ddabc3)

diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man
index 3ff6aef..d88cc24 100644
--- a/hw/xfree86/man/Xorg.man
+++ b/hw/xfree86/man/Xorg.man
@@ -46,7 +46,7 @@ On most platforms, the "Local" connection type is a UNIX-domain socket.
 On some System V platforms, the "local" connection types also include
 STREAMS pipes, named pipes, and some other mechanisms.
 .TP 4
-.I TCP\/IP
+.I TCP/IP
 .B Xorg
 listens on port
 .RI 6000+ n ,
diff --git a/man/Xserver.man b/man/Xserver.man
index ac410cd..1cf242d 100644
--- a/man/Xserver.man
+++ b/man/Xserver.man
@@ -428,7 +428,7 @@ elapse between autorepeat-generated keystrokes).
 loads keyboard description in \fIfilename\fP on server startup.
 .SH "NETWORK CONNECTIONS"
 The X server supports client connections via a platform-dependent subset of
-the following transport types: TCP\/IP, Unix Domain sockets, DECnet,
+the following transport types: TCP/IP, Unix Domain sockets, DECnet,
 and several varieties of SVR4 local connections.  See the DISPLAY
 NAMES section of the \fIX\fP(__miscmansuffix__) manual page to learn how to
 specify which transport type clients should try to use.
commit e9385b42a3f6cb1eadd5080019b9faf9538e5608
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Aug 17 18:37:10 2015 -0700

    mi: Always initialize edge1 and edge2 in miLineArc
    
    This eliminates a warning generated when miLineArcD is inlined and the
    compiler can't figure out that edge1 and edge2 are always initialized
    before being used.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit bca4f4b56c7619d17f9df46f7aac392ea01a9429)

diff --git a/mi/miwideline.c b/mi/miwideline.c
index 452d74f..6f0b9bc 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -1458,7 +1458,7 @@ miLineArc(DrawablePtr pDraw,
     int xorgi = 0, yorgi = 0;
     Spans spanRec;
     int n;
-    PolyEdgeRec edge1, edge2;
+    PolyEdgeRec edge1 = { 0 }, edge2 = { 0 };
     int edgey1, edgey2;
     Bool edgeleft1, edgeleft2;
 
commit 00b3f5a2eda7b819057d9e150754dc0a509f6e39
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Aug 13 09:25:37 2015 +1000

    rootless: rename w->_w to avoid shadow warnings
    
    fixes:
    In file included from rootlessWindow.c:51:0:
    rootlessWindow.c: In function 'RootlessResizeWindow':
    rootlessCommon.h:198:19: warning: declaration of 'w' shadows a parameter [-Wshadow]
             WindowPtr w = pWin;                     \
                       ^
    rootlessWindow.c:1292:9: note: in expansion of macro 'HUGE_ROOT'
             HUGE_ROOT(pWin);
             ^
    rootlessWindow.c:1262:35: note: shadowed declaration is here
                          unsigned int w, unsigned int h, WindowPtr pSib)
                                       ^
    In file included from rootlessWindow.c:51:0:
    rootlessCommon.h:207:19: warning: declaration of 'w' shadows a parameter [-Wshadow]
             WindowPtr w = pWin;                     \
                       ^
    rootlessWindow.c:1296:9: note: in expansion of macro 'NORMAL_ROOT'
             NORMAL_ROOT(pWin);
             ^
    rootlessWindow.c:1262:35: note: shadowed declaration is here
                          unsigned int w, unsigned int h, WindowPtr pSib)
                                       ^
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit d4710004367ab8eab794a12385ca7ed3acc9a0e0)

diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h
index 3e19481..7fdea22 100644
--- a/miext/rootless/rootlessCommon.h
+++ b/miext/rootless/rootlessCommon.h
@@ -194,19 +194,19 @@ extern RegionRec rootlessHugeRoot;
 
 #define HUGE_ROOT(pWin)                         \
     do {                                        \
-        WindowPtr w = pWin;                     \
-        while (w->parent)                       \
-            w = w->parent;                      \
-        saveRoot = w->winSize;                  \
-        w->winSize = rootlessHugeRoot;          \
+        WindowPtr _w = pWin;                     \
+        while (_w->parent)                       \
+            _w = _w->parent;                      \
+        saveRoot = _w->winSize;                  \
+        _w->winSize = rootlessHugeRoot;          \
     } while (0)
 
 #define NORMAL_ROOT(pWin)                       \
     do {                                        \
-        WindowPtr w = pWin;                     \
-        while (w->parent)                       \
-            w = w->parent;                      \
-        w->winSize = saveRoot;                  \
+        WindowPtr _w = pWin;                     \
+        while (_w->parent)                       \
+            _w = _w->parent;                      \
+        _w->winSize = saveRoot;                  \
     } while (0)
 
 // Returns TRUE if this window is a top-level window (i.e. child of the root)
commit 3aacda0aea221f703d469de82a8a6778677b34d0
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Aug 13 09:25:36 2015 +1000

    rootless: fix warnings due to lack of const keeping.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 7f506b8099d23c2f045ad26cc5cff00109b69d7b)

diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h
index fd9c941..3e19481 100644
--- a/miext/rootless/rootlessCommon.h
+++ b/miext/rootless/rootlessCommon.h
@@ -70,8 +70,8 @@ extern DevPrivateKeyRec rootlessWindowOldPixmapPrivateKeyRec;
 
 // RootlessGCRec: private per-gc data
 typedef struct {
-    GCFuncs *originalFuncs;
-    GCOps *originalOps;
+    const GCFuncs *originalFuncs;
+    const GCOps *originalOps;
 } RootlessGCRec;
 
 // RootlessScreenRec: per-screen private data
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index 4fba26c..235b3ab 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -403,7 +403,7 @@ RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
 #define GCOP_UNWRAP(pGC) \
     RootlessGCRec *gcrec = (RootlessGCRec *) \
         dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \
-    GCFuncs *saveFuncs = pGC->funcs; \
+    const GCFuncs *saveFuncs = pGC->funcs; \
     (pGC)->funcs = gcrec->originalFuncs; \
     (pGC)->ops = gcrec->originalOps;
 
commit 02c94ccddf4fc9ea08555e929b051201ad5fbc79
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Aug 4 13:17:02 2015 -0400

    xwayland: Don't (double) destroy input resources in CloseScreen
    
    By the time we get here we've already done CloseDownDevices, so on the
    second regeneration you get:
    
        Invalid read of size 4
           at 0x43402A: RemoveDevice (devices.c:1125)
           by 0x427902: xwl_seat_destroy (xwayland-input.c:568)
           by 0x42649C: xwl_close_screen (xwayland.c:116)
           by 0x4B7F67: CursorCloseScreen (cursor.c:187)
           by 0x536003: AnimCurCloseScreen (animcur.c:106)
           by 0x539831: present_close_screen (present_screen.c:64)
           by 0x43E486: dix_main (main.c:351)
           by 0x30D70206FF: (below main) (libc-start.c:289)
         Address 0x980e1a0 is 64 bytes inside a block of size 904
    
           at 0x4A07D6A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
           by 0x434158: RemoveDevice (devices.c:1157)
           by 0x42F77B: CloseDeviceList (devices.c:1017)
           by 0x430246: CloseDownDevices (devices.c:1047)
           by 0x43E3EB: dix_main (main.c:333)
           by 0x30D70206FF: (below main) (libc-start.c:289)
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Daniel Stone <daniels at collabora.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 533fb627398e20f863234d780f4463e37007515b)

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 4639048..f4d8fab 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -565,8 +565,6 @@ create_input_device(struct xwl_screen *xwl_screen, uint32_t id)
 void
 xwl_seat_destroy(struct xwl_seat *xwl_seat)
 {
-    RemoveDevice(xwl_seat->pointer, FALSE);
-    RemoveDevice(xwl_seat->keyboard, FALSE);
     wl_seat_destroy(xwl_seat->seat);
     wl_surface_destroy(xwl_seat->cursor);
     if (xwl_seat->cursor_frame_cb)
commit 71e4b536cd16c1880889e5a3a88f550674c12882
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Aug 4 13:17:01 2015 -0400

    xwayland: Don't (double) destroy RANDR resources in CloseScreen
    
    By the time we get here we've already been through FreeAllResources,
    which has already torn down the RANDR objects, so on the second
    regeneration you get:
    
        Invalid read of size 4
           at 0x51C6F0: RRCrtcDestroy (rrcrtc.c:659)
           by 0x4285F5: xwl_output_destroy (xwayland-output.c:191)
           by 0x426464: xwl_close_screen (xwayland.c:112)
           by 0x4B7F77: CursorCloseScreen (cursor.c:187)
           by 0x536013: AnimCurCloseScreen (animcur.c:106)
           by 0x539841: present_close_screen (present_screen.c:64)
           by 0x43E496: dix_main (main.c:351)
           by 0x30D70206FF: (below main) (libc-start.c:289)
         Address 0x4cc6640 is 0 bytes inside a block of size 728 free'd
           at 0x4A07D6A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
           by 0x51BCCF: RRCrtcDestroyResource (rrcrtc.c:689)
           by 0x45CD91: doFreeResource (resource.c:872)
           by 0x45DE56: FreeClientResources (resource.c:1138)
           by 0x45DF06: FreeAllResources (resource.c:1153)
           by 0x43E3BD: dix_main (main.c:321)
           by 0x30D70206FF: (below main) (libc-start.c:289)
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Daniel Stone <daniels at collabora.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 11f4cc47a815c5d6284b1338e748e2605b2dd779)

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 155cbc1..7e5484c 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -188,8 +188,6 @@ void
 xwl_output_destroy(struct xwl_output *xwl_output)
 {
     wl_output_destroy(xwl_output->output);
-    RRCrtcDestroy(xwl_output->randr_crtc);
-    RROutputDestroy(xwl_output->randr_output);
     free(xwl_output);
 }
 
commit 75399d32f686e8aaa11a5afafacf9fdfad3d1bb4
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jul 27 13:54:00 2015 -0700

    glamor: Don't try to free the pixmap priv if we fail to allocate FBO.
    
    Fixes a regression since a2a2f6e34bd49e7ae31779274d52e800595660bc.  I
    missed this in testing on x86, because we never fail to allocate an
    FBO.  We do hit this path on VC4, though.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit ea03e314f98e5d8ed7bf7a508006a3d84014bde5)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 21252bc..6c2ff28 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -207,7 +207,6 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 
     if (fbo == NULL) {
         fbDestroyPixmap(pixmap);
-        free(pixmap_priv);
         return fbCreatePixmap(screen, w, h, depth, usage);
     }
 
commit 288b355f48c58cbe458cf92d78246a8abcccd946
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sun Jul 19 08:24:39 2015 -0700

    Xserver.man: -retro is used when starting the server, not the stipple
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 6916d32ab3ec1aa922094abce7fac22884ee4e83)

diff --git a/man/Xserver.man b/man/Xserver.man
index 3bf844f..ac410cd 100644
--- a/man/Xserver.man
+++ b/man/Xserver.man
@@ -238,7 +238,7 @@ turns off auto-repeat.
 turns on auto-repeat.
 .TP 8
 .B -retro
-starts the stipple with the classic stipple and cursor visible.  The default
+starts the server with the classic stipple and cursor visible.  The default
 is to start with a black root window, and to suppress display of the cursor
 until the first time an application calls XDefineCursor(). For kdrive
 servers, this implies -zap.
commit abfda3b941281e12cec35e36dd0e9d87e59ce699
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue May 19 11:31:25 2015 -0400

    glx: Implement GLX_ARB_context_flush_control
    
    This extension allows clients to opt out of the implicit glFlush on
    context release, which is quite nice for performance for clients using
    multiple contexts.  The server doesn't really need to be aware of the
    client's decision, at least for direct contexts, but it does need to not
    reject the context attribute out of hand.
    
    This patch won't do anything unless built against a Mesa that defines
    the __DRI2_FLUSH_CONTROL extension (and a new enough glxext.h, but
    that's been there since 10.3 at least).
    
    Reviewed-by: James Jones <jajones at nvidia.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 995ff11422eb49160abfe276f471e412b16cab9d)

diff --git a/glx/createcontext.c b/glx/createcontext.c
index cbeddec..d06bc1f 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -87,6 +87,9 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
     int minor_version = 0;
     uint32_t flags = 0;
     uint32_t render_type = GLX_RGBA_TYPE;
+#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB
+    uint32_t flush = GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB;
+#endif
     __GLXcontext *ctx = NULL;
     __GLXcontext *shareCtx = NULL;
     __GLXscreen *glxScreen;
@@ -194,6 +197,15 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
 
             break;
 
+#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB
+        case GLX_CONTEXT_RELEASE_BEHAVIOR_ARB:
+            flush = attribs[2 * i + 1];
+            if (flush != GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB
+                && flush != GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB)
+                return BadValue;
+            break;
+#endif
+
         default:
             return BadValue;
         }
@@ -333,6 +345,9 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
     ctx->drawPriv = NULL;
     ctx->readPriv = NULL;
     ctx->resetNotificationStrategy = reset;
+#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB
+    ctx->releaseBehavior = flush;
+#endif
 
     /* Add the new context to the various global tables of GLX contexts.
      */
diff --git a/glx/extension_string.c b/glx/extension_string.c
index 4bef96f..e881d21 100644
--- a/glx/extension_string.c
+++ b/glx/extension_string.c
@@ -72,6 +72,7 @@ struct extension_info {
 static const struct extension_info known_glx_extensions[] = {
 /*   GLX_ARB_get_proc_address is implemented on the client. */
     /* *INDENT-OFF* */
+    { GLX(ARB_context_flush_control),   VER(0,0), N, },
     { GLX(ARB_create_context),          VER(0,0), N, },
     { GLX(ARB_create_context_profile),  VER(0,0), N, },
     { GLX(ARB_create_context_robustness), VER(0,0), N, },
diff --git a/glx/extension_string.h b/glx/extension_string.h
index e7d3932..bac7b06 100644
--- a/glx/extension_string.h
+++ b/glx/extension_string.h
@@ -36,7 +36,8 @@
 
 enum {
 /*   GLX_ARB_get_proc_address is implemented on the client. */
-    ARB_create_context_bit = 0,
+    ARB_context_flush_control_bit = 0,
+    ARB_create_context_bit,
     ARB_create_context_profile_bit,
     ARB_create_context_robustness_bit,
     ARB_fbconfig_float_bit,
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index f5f2bab..cbd4ede 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -334,6 +334,19 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
      */
     glxc->resetNotificationStrategy = GLX_NO_RESET_NOTIFICATION_ARB;
 
+#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB
+    /* The GLX_ARB_context_flush_control spec says:
+     *
+     *     "The default value [for GLX_CONTEXT_RELEASE_BEHAVIOR] is
+     *     CONTEXT_RELEASE_BEHAVIOR_FLUSH, and may in some cases be changed
+     *     using platform-specific context creation extensions."
+     *
+     * Without using glXCreateContextAttribsARB, there is no way to specify a
+     * non-default release behavior.
+     */
+    glxc->releaseBehavior = GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB;
+#endif
+
     /* Add the new context to the various global tables of GLX contexts.
      */
     if (!__glXAddContext(glxc)) {
@@ -626,7 +639,12 @@ DoMakeCurrent(__GLXclientState * cl,
         /*
          ** Flush the previous context if needed.
          */
-        if (prevglxc->hasUnflushedCommands) {
+        Bool need_flush = GL_TRUE;
+#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB
+        if (prevglxc->releaseBehavior == GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB)
+            need_flush = GL_FALSE;
+#endif
+        if (prevglxc->hasUnflushedCommands && need_flush) {
             if (__glXForceCurrent(cl, tag, (int *) &error)) {
                 glFlush();
                 prevglxc->hasUnflushedCommands = GL_FALSE;
diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index 677898a..0733281 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -108,6 +108,11 @@ struct __GLXcontext {
      */
     GLenum resetNotificationStrategy;
 
+    /**
+     * Context release behavior
+     */
+    GLenum releaseBehavior;
+
     /*
      ** Buffers for feedback and selection.
      */
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index bcd57a4..6fb3d92 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -921,6 +921,13 @@ initializeExtensions(__GLXDRIscreen * screen)
                        "AIGLX: enabled GLX_ARB_create_context_robustness\n");
         }
 
+#ifdef __DRI2_FLUSH_CONTROL
+        if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0) {
+            __glXEnableExtension(screen->glx_enable_bits,
+                                 "GLX_ARB_context_flush_control\n");
+        }
+#endif
+
         /* Ignore unknown extensions */
     }
 }
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 938d5bd..e8e53bf 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -425,6 +425,14 @@ initializeExtensions(__GLXDRIscreen * screen)
             screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
             /* GLX_EXT_texture_from_pixmap is always enabled. */
         }
+
+#ifdef __DRI2_FLUSH_CONTROL
+        if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0) {
+            __glXEnableExtension(screen->glx_enable_bits,
+                                 "GLX_ARB_context_flush_control\n");
+        }
+#endif
+
     }
 }
 
commit 23d52080a5d9c03dc2707e71f6d878c58d000a55
Author: Fredrik Höglund <fredrik at kde.org>
Date:   Thu Sep 10 23:33:20 2015 +0200

    present: Don't stash the MSC value when present_get_ust_msc fails
    
    Otherwise we stash an uninitalized value, and later use it to compute
    the msc_offset for the window.  Also initialize ust and crtc_msc so we
    never use uninitalized values when present_get_ust_msc fails.
    
    This fixes clients getting stuck waiting indefinitely for an idle
    event when a CRTC is turned off.
    
    Signed-off-by: Fredrik Höglund <fredrik at kde.org>
    Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
    (cherry picked from commit f6ce23fbfc8804204fa103f98b94478387b94040)

diff --git a/present/present.c b/present/present.c
index a634601..7ddffbd 100644
--- a/present/present.c
+++ b/present/present.c
@@ -710,9 +710,9 @@ present_pixmap(WindowPtr window,
                present_notify_ptr notifies,
                int num_notifies)
 {
-    uint64_t                    ust;
+    uint64_t                    ust = 0;
     uint64_t                    target_msc;
-    uint64_t                    crtc_msc;
+    uint64_t                    crtc_msc = 0;
     int                         ret;
     present_vblank_ptr          vblank, tmp;
     ScreenPtr                   screen = window->drawable.pScreen;
@@ -734,13 +734,15 @@ present_pixmap(WindowPtr window,
             target_crtc = present_get_crtc(window);
     }
 
-    present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc);
+    ret = present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc);
 
     target_msc = present_window_to_crtc_msc(window, target_crtc, window_msc, crtc_msc);
 
-    /* Stash the current MSC away in case we need it later
-     */
-    window_priv->msc = crtc_msc;
+    if (ret == Success) {
+        /* Stash the current MSC away in case we need it later
+         */
+        window_priv->msc = crtc_msc;
+    }
 
     /* Adjust target_msc to match modulus
      */
commit 2a561fac70c8b04305eab6372298a128e6553d3f
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Sep 23 11:19:00 2015 +1000

    glx: fix regression with copy sub buffer disappearing
    
    So copy sub buffer isn't a core extensions it's a driver extension
    which means we are using totally the wrong interface to query for it
    here, which means bad things happen when you roll out this code,
    for instance MESA_copy_sub_buffer stops working.
    
    This is just the hack I'm sticking in Fedora to avoid the regression
    for now, but hopefully will inspire us.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 6da3f5d04f6a1cda0c858280f9561f9fbc323275)

diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index e25ca47..938d5bd 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -396,6 +396,9 @@ initializeExtensions(__GLXDRIscreen * screen)
     const __DRIextension **extensions;
     int i;
 
+    __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
+    LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
+
     if (screen->swrast->base.version >= 3) {
         __glXEnableExtension(screen->glx_enable_bits,
                              "GLX_ARB_create_context");
@@ -416,8 +419,6 @@ initializeExtensions(__GLXDRIscreen * screen)
         if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
             screen->copySubBuffer =
                 (const __DRIcopySubBufferExtension *) extensions[i];
-            __glXEnableExtension(screen->glx_enable_bits,
-                                 "GLX_MESA_copy_sub_buffer");
         }
 
         if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
commit 92effabee1fe7225709acdca4adb2783b78392d4
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Jul 22 15:37:23 2015 +0900

    glamor: Make our EGL context current before calling into GL in glamor_init
    
    Without this, the context of another screen may be current, or no context
    at all if glamor_egl_init failed for another screen.
    
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 0a458a908ec071a4da5d22c760581e0c5ec885ce)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index a8cc810..21252bc 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -379,6 +379,20 @@ glamor_init(ScreenPtr screen, unsigned int flags)
         goto fail;
     }
 
+    glamor_priv->saved_procs.close_screen = screen->CloseScreen;
+    screen->CloseScreen = glamor_close_screen;
+
+    /* If we are using egl screen, call egl screen init to
+     * register correct close screen function. */
+    if (flags & GLAMOR_USE_EGL_SCREEN) {
+        glamor_egl_screen_init(screen, &glamor_priv->ctx);
+    } else {
+        if (!glamor_glx_screen_init(&glamor_priv->ctx))
+            goto fail;
+    }
+
+    glamor_make_current(glamor_priv);
+
     if (epoxy_is_desktop_gl())
         glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP;
     else
@@ -463,18 +477,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 
     glamor_set_debug_level(&glamor_debug_level);
 
-    glamor_priv->saved_procs.close_screen = screen->CloseScreen;
-    screen->CloseScreen = glamor_close_screen;
-
-    /* If we are using egl screen, call egl screen init to
-     * register correct close screen function. */
-    if (flags & GLAMOR_USE_EGL_SCREEN) {
-        glamor_egl_screen_init(screen, &glamor_priv->ctx);
-    } else {
-        if (!glamor_glx_screen_init(&glamor_priv->ctx))
-            goto fail;
-    }
-
     glamor_priv->saved_procs.create_screen_resources =
         screen->CreateScreenResources;
     screen->CreateScreenResources = glamor_create_screen_resources;
commit a420301a8bc9376a174315bc32d3cd7e89dacd7f
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jul 15 17:56:11 2015 +1000

    glamor: make current in prepare paths
    
    Lots of the accel paths only make current once they start
    doing someting, so a lot of them call the bail paths without
    make current, which means on PRIME systems for example
    we end up in the wrong context.
    
    Add a prepare pixmap in the prepare fallback path.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90667
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer at amd.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit db5337afb248edf81087cf8d74006fc496d70589)

diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c
index fb85d90..40b7b4f 100644
--- a/glamor/glamor_prepare.c
+++ b/glamor/glamor_prepare.c
@@ -45,6 +45,8 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv))
         return TRUE;
 
+    glamor_make_current(glamor_priv);
+
     RegionInit(&region, box, 1);
 
     /* See if it's already mapped */
commit fb17307b1bbb6842a2c76c0a934c4f50aaea69d1
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Fri Jul 10 15:28:52 2015 +0900

    glamor: Use glamor_prepare_access_box() for PutImage/GetImage fallback
    
    Fixes slow text display in xdvi.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91260
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 1a18513a4eb3fa22459dd9f7d8f0e275aff679ec)

diff --git a/glamor/glamor_image.c b/glamor/glamor_image.c
index b38b412..90fda40 100644
--- a/glamor/glamor_image.c
+++ b/glamor/glamor_image.c
@@ -88,7 +88,7 @@ static void
 glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
                       int w, int h, int leftPad, int format, char *bits)
 {
-    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW))
+    if (glamor_prepare_access_box(drawable, GLAMOR_ACCESS_RW, x, y, w, h))
         fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
     glamor_finish_access(drawable);
 }
@@ -150,7 +150,7 @@ static void
 glamor_get_image_bail(DrawablePtr drawable, int x, int y, int w, int h,
                       unsigned int format, unsigned long plane_mask, char *d)
 {
-    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO))
+    if (glamor_prepare_access_box(drawable, GLAMOR_ACCESS_RO, x, y, w, h))
         fbGetImage(drawable, x, y, w, h, format, plane_mask, d);
     glamor_finish_access(drawable);
 }
commit 8415eca0abc00ec96cb94cd656b58edbfa8f09a3
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Mon Jul 6 18:45:51 2015 -0700

    glamor: Use a single glTexImage2D call for core font atlas texture data v2
    
    Instead of one glTexSubImage2D call for each glyph.
    
    This significantly reduces the amount of time it takes for xterm to start
    up on a fresh X server with the radeonsi driver.
    
    v2: Use GLYPHWIDTHBYTESPADDED instead of hardcoding 4 bytes glyph
        alignment (Keith Packard)
    
    [ajax 1.17: fix up summary as suggested by Michel]
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 732e3b9c08532f40656010eac9d128601cc88c3f)

diff --git a/glamor/glamor_font.c b/glamor/glamor_font.c
index cc0fecf..6b3a16a 100644
--- a/glamor/glamor_font.c
+++ b/glamor/glamor_font.c
@@ -45,6 +45,7 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
     unsigned char       c[2];
     CharInfoPtr         glyph;
     unsigned long       count;
+    char                *bits;
 
     if (glamor_priv->glsl_version < 130)
         return NULL;
@@ -62,8 +63,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
     if (glamor_font->realized)
         return glamor_font;
 
-    glamor_font->realized = TRUE;
-
     /* Figure out how many glyphs are in the font */
     num_cols = font->info.lastCol - font->info.firstCol + 1;
     num_rows = font->info.lastRow - font->info.firstRow + 1;
@@ -81,6 +80,10 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
     overall_width = glyph_width_bytes * num_cols;
     overall_height = glyph_height * num_rows;
 
+    bits = malloc(overall_width * overall_height);
+    if (!bits)
+        return NULL;
+
     /* Check whether the font has a default character */
     c[0] = font->info.lastRow + 1;
     c[1] = font->info.lastCol + 1;
@@ -100,12 +103,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 
-    /* Allocate storage */
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_R8UI, overall_width, overall_height,
-                 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, NULL);
-
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
-
     /* Paint all of the glyphs */
     for (row = 0; row < num_rows; row++) {
         for (col = 0; col < num_cols; col++) {
@@ -114,13 +111,29 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
 
             (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph);
 
-            if (count)
-                glTexSubImage2D(GL_TEXTURE_2D, 0, col * glyph_width_bytes, row * glyph_height,
-                                GLYPHWIDTHBYTES(glyph), GLYPHHEIGHTPIXELS(glyph),
-                                GL_RED_INTEGER, GL_UNSIGNED_BYTE, glyph->bits);
+            if (count) {
+                char *dst = bits + row * glyph_height * overall_width +
+                    col * glyph_width_bytes;
+                char *src = glyph->bits;
+                unsigned y;
+
+                for (y = 0; y < GLYPHHEIGHTPIXELS(glyph); y++) {
+                    memcpy(dst, src, GLYPHWIDTHBYTES(glyph));
+                    dst += overall_width;
+                    src += GLYPHWIDTHBYTESPADDED(glyph);
+                }
+            }
         }
     }
 
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_R8UI, overall_width, overall_height,
+                 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, bits);
+
+    free(bits);
+
+    glamor_font->realized = TRUE;
+
     return glamor_font;
 }
 


More information about the Xquartz-changes mailing list