[Xquartz-changes] xserver: Branch 'server-1.10-apple' - 76 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Thu Dec 2 12:26:07 PST 2010


Rebased ref, commits from common ancestor:
commit c2733823b235d0b90be35ac103601de6458f56e6
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Oct 30 14:55:06 2010 -0700

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

diff --git a/configure.ac b/configure.ac
index 2363e38..4f2c7b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,12 @@ AC_PROG_SED
 # easier overrides at build time.
 XSERVER_CFLAGS='$(CWARNFLAGS)'
 
+dnl Explicitly add -fno-strict-aliasing since this option should disappear
+dnl from util-macros CWARNFLAGS
+if  test "x$GCC" = xyes ; then
+    XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing"
+fi
+
 dnl Check for dtrace program (needed to build Xserver dtrace probes)
 dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
 dnl ISDN trace program named dtrace
commit fc848c6bbb76c084502f6e26c57a3ff576b63557
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 021a940..0b248e1 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2079,11 +2079,8 @@ fbFillRegionSolid (DrawablePtr	pDrawable,
 		   FbBits	xor);
 
 extern _X_EXPORT pixman_image_t *
-image_from_pict (PicturePtr	pict,
-		 Bool		has_clip,
-		 int		*xoff,
-		 int		*yoff);
-
+image_from_pict (PicturePtr pict,
+		 Bool       has_clip);
 extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
 
 #endif /* _FB_H_ */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 7636040..af1920b 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -50,24 +50,19 @@ fbComposite (CARD8      op,
 	     CARD16     height)
 {
     pixman_image_t *src, *mask, *dest;
-    int src_xoff, src_yoff;
-    int msk_xoff, msk_yoff;
-    int dst_xoff, dst_yoff;
     
     miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
     if (pMask)
 	miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
     
-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
-    mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
-    dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+    src = image_from_pict (pSrc, TRUE);
+    mask = image_from_pict (pMask, TRUE);
+    dest = image_from_pict (pDst, TRUE);
 
     if (src && dest && !(pMask && !mask))
     {
 	pixman_image_composite (op, src, mask, dest,
-				xSrc + src_xoff, ySrc + src_yoff,
-				xMask + msk_xoff, yMask + msk_yoff,
-				xDst + dst_xoff, yDst + dst_yoff,
+				xSrc, ySrc, xMask, yMask, xDst, yDst,
 				width, height);
     }
 
@@ -146,22 +141,22 @@ create_conical_gradient_image (PictGradient *gradient)
 
 static pixman_image_t *
 create_bits_picture (PicturePtr pict,
-		     Bool       has_clip,
-		     int	*xoff,
-		     int	*yoff)
+		     Bool       has_clip)
 {
-    PixmapPtr pixmap;
     FbBits *bits;
     FbStride stride;
-    int bpp;
+    int bpp, xoff, yoff;
     pixman_image_t *image;
     
-    fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
-    fbGetPixmapBitsData(pixmap, bits, stride, bpp);
+    fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+
+    bits = (FbBits*)((CARD8*)bits +
+		     (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
+		     (pict->pDrawable->x + xoff) * (bpp / 8));
 
     image = pixman_image_create_bits (
 	pict->format,
-	pixmap->drawable.width, pixmap->drawable.height,
+	pict->pDrawable->width, pict->pDrawable->height,
 	(uint32_t *)bits, stride * sizeof (FbStride));
     
     
@@ -187,55 +182,33 @@ create_bits_picture (PicturePtr pict,
 	if (pict->clientClipType != CT_NONE)
 	    pixman_image_set_has_client_clip (image, TRUE);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+	pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
 
 	pixman_image_set_clip_region (image, pict->pCompositeClip);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+	pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
     }
     
     /* Indexed table */
     if (pict->pFormat->index.devPrivate)
 	pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
 
-    /* Add in drawable origin to position within the image */
-    *xoff += pict->pDrawable->x;
-    *yoff += pict->pDrawable->y;
-
     return image;
 }
 
 static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+image_from_pict_internal (PicturePtr pict, Bool has_clip, Bool is_alpha_map);
 
 static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties (pixman_image_t *image, PicturePtr pict, Bool is_alpha_map)
 {
     pixman_repeat_t repeat;
     pixman_filter_t filter;
     
     if (pict->transform)
     {
-	/* For source images, adjust the transform to account
-	 * for the drawable offset within the pixman image,
-	 * then set the offset to 0 as it will be used
-	 * to compute positions within the transformed image.
-	 */
-	if (!has_clip) {
-	    struct pixman_transform	adjusted;
-
-	    adjusted = *pict->transform;
-	    pixman_transform_translate(&adjusted,
-				       NULL,
-				       pixman_int_to_fixed(*xoff),
-				       pixman_int_to_fixed(*yoff));
-	    pixman_image_set_transform (image, &adjusted);
-	    *xoff = 0;
-	    *yoff = 0;
-	} else
-	    pixman_image_set_transform (image, pict->transform);
+	pixman_image_set_transform (
+	    image, (pixman_transform_t *)pict->transform);
     }
     
     switch (pict->repeatType)
@@ -265,8 +238,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
      */
     if (pict->alphaMap && !is_alpha_map)
     {
-	int alpha_xoff, alpha_yoff;
-	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
+	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, TRUE, TRUE);
 	
 	pixman_image_set_alpha_map (
 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -299,7 +271,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
 }
 
 static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+image_from_pict_internal (PicturePtr pict,
+		 Bool has_clip, Bool is_alpha_map)
 {
     pixman_image_t *image = NULL;
 
@@ -308,7 +281,7 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
 
     if (pict->pDrawable)
     {
-	image = create_bits_picture (pict, has_clip, xoff, yoff);
+	image = create_bits_picture (pict, has_clip);
     }
     else if (pict->pSourcePict)
     {
@@ -329,19 +302,18 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
 	    else if (sp->type == SourcePictTypeConical)
 		image = create_conical_gradient_image (gradient);
 	}
-	*xoff = *yoff = 0;
     }
     
     if (image)
-	set_image_properties (image, pict, has_clip, xoff, yoff, is_alpha_map);
+	set_image_properties (image, pict, is_alpha_map);
     
     return image;
 }
 
 pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict, Bool has_clip)
 {
-    return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+    return image_from_pict_internal (pict, has_clip, FALSE);
 }
 
 void
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index c309ceb..40cffd9 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -37,8 +37,7 @@ fbAddTraps (PicturePtr	pPicture,
 	    int		ntrap,
 	    xTrap	*traps)
 {
-    int image_xoff, image_yoff;
-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
 
     if (!image)
 	return;
@@ -54,8 +53,7 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
 		      int	    x_off,
 		      int	    y_off)
 {
-    int	mask_xoff, mask_yoff;
-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff);
+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
 
     if (!image)
 	return;
commit cd7ec17e8ff20c3cda045172ac92beb00438521e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Apr 30 13:08:25 2010 -0700

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

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

    XQuartz: Disable the Mac OS X screensaver when in full screen mode
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index e21303c..26b2c1f 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -62,6 +62,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <IOKit/pwr_mgt/IOPMLib.h>
+#include <pthread.h>
 
 #include <rootlessCommon.h>
 #include <Xplugin.h>
@@ -246,6 +247,40 @@ void QuartzUpdateScreens(void) {
     quartzProcs->UpdateScreen(pScreen);
 }
 
+static void pokeActivityCallback(CFRunLoopTimerRef timer, void *info) {
+    UpdateSystemActivity(OverallAct);
+}
+
+static void QuartzScreenSaver(int state) {
+    static CFRunLoopTimerRef pokeActivityTimer = NULL;
+    static CFRunLoopTimerContext pokeActivityContext = { 0, NULL, NULL, NULL, NULL };
+    static pthread_mutex_t pokeActivityMutex = PTHREAD_MUTEX_INITIALIZER;
+
+    pthread_mutex_lock(&pokeActivityMutex);
+    
+    if(state) {
+        if(pokeActivityTimer == NULL)
+            goto QuartzScreenSaverEnd;
+
+        CFRunLoopTimerInvalidate(pokeActivityTimer);
+        CFRelease(pokeActivityTimer);
+        pokeActivityTimer = NULL;
+    } else {
+        if(pokeActivityTimer != NULL)
+            goto QuartzScreenSaverEnd;
+        
+        pokeActivityTimer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 30, 0, 0, pokeActivityCallback, &pokeActivityContext);
+        if(pokeActivityTimer == NULL) {
+            ErrorF("Unable to create pokeActivityTimer.\n");
+            goto QuartzScreenSaverEnd;
+        }
+
+        CFRunLoopAddTimer(CFRunLoopGetMain(), pokeActivityTimer, kCFRunLoopCommonModes);
+    }
+QuartzScreenSaverEnd:
+    pthread_mutex_unlock(&pokeActivityMutex);
+}
+
 void QuartzShowFullscreen(int state) {
     int i;
     
@@ -256,6 +291,8 @@ void QuartzShowFullscreen(int state) {
         return;
     }
     
+    QuartzScreenSaver(!state);
+    
     if(XQuartzFullscreenVisible == state)
         return;
     
commit 3824417335ec00a87b51f8d05e592099b8507680
Merge: dab064f... f4f41c8...
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Dec 2 08:39:33 2010 -0800

    Merge remote branch 'vsyrjala/xv_reput'

commit dab064fa5e0b1f5c67222562ad5367005832cba1
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Nov 2 20:10:32 2010 +0100

    render: Fix byteswapping of gradient stops
    
    The function swapStops repeatedly swaps the color components as
    CARD16, but incorrectly steps over them as if they were CARD32.
    
    This causes half of the stops not to be swapped at all and some
    unrelated data be swapped instead.
    
    Signed-off-by: Andrea Canciani <ranma42 at gmail.com>
    Reviewed-by: Soren Sandmann <sandmann at daimi.au.dk>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/render/render.c b/render/render.c
index 00241f9..85a4392 100644
--- a/render/render.c
+++ b/render/render.c
@@ -2552,8 +2552,8 @@ static void swapStops(void *stuff, int num)
     }
     colors = (CARD16 *)(stops);
     for (i = 0; i < 4*num; ++i) {
-        swaps(stops, n);
-        ++stops;
+        swaps(colors, n);
+        ++colors;
     }
 }
 
commit 279ef1ffd787dba2f0d5056849b9cb15d36aa3eb
Author: Cyril Brulebois <kibi at debian.org>
Date:   Wed Dec 1 14:12:55 2010 +0100

    Fix screen number checks.
    
    screenInfo.numScreens is not a valid screen number, they go from 0 to
    numScreens - 1.
    
    Signed-off-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 7602128..6a0aae7 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -1531,7 +1531,7 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
     int i, p;
 
     screen = req->screen;
-    if (screen > screenInfo.numScreens) {
+    if (screen >= screenInfo.numScreens) {
 	/* The client library must send a valid screen number. */
 	client->errorValue = screen;
 	return BadValue;
@@ -2680,7 +2680,7 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
     int numFBConfigs, i, p;
     __GLXscreenInfo *pGlxScreen;
 
-    if (screen > screenInfo.numScreens) {
+    if (screen >= screenInfo.numScreens) {
 	/* The client library must send a valid screen number. */
 	client->errorValue = screen;
 	return BadValue;
@@ -3102,7 +3102,7 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
    /*
     ** Look up screen and FBConfig.
     */
-    if (screen > screenInfo.numScreens) {
+    if (screen >= screenInfo.numScreens) {
         /* The client library must send a valid screen number. */
         client->errorValue = screen;
         return BadValue;
diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index 44f1c15..2294059 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -252,7 +252,7 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
 
     __GLX_SWAP_INT(&req->screen);
     screen = req->screen;
-    if (screen > screenInfo.numScreens) {
+    if (screen >= screenInfo.numScreens) {
 	/* The client library must send a valid screen number. */
 	client->errorValue = screen;
 	return BadValue;
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 8874a43..6945f5b 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -398,7 +398,7 @@ EphyrDuplicateVisual (unsigned int a_screen,
     int i=0 ;
 
     EPHYR_LOG ("enter\n") ; 
-    if (a_screen > screenInfo.numScreens) {
+    if (a_screen >= screenInfo.numScreens) {
         EPHYR_LOG_ERROR ("bad screen number\n") ;
         goto out;
     }
commit 8684543021b9b1aa165b1bc69bc58685cb5942c1
Author: Julien Cristau <jcristau at debian.org>
Date:   Tue Nov 30 17:23:10 2010 +0100

    DGA: fix screen number check
    
    screenInfo.numScreens is not a valid screen number, they go from 0 to
    numScreens - 1.
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index ca5d519..4bcf77e 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -99,7 +99,7 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
     char *deviceName;
     int nameSize;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (!DGAAvailable(stuff->screen))
@@ -133,7 +133,7 @@ ProcXDGACloseFramebuffer(ClientPtr client)
 {
     REQUEST(xXDGACloseFramebufferReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (!DGAAvailable(stuff->screen))
@@ -155,7 +155,7 @@ ProcXDGAQueryModes(ClientPtr client)
     xXDGAModeInfo info;
     XDGAModePtr mode;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
@@ -274,7 +274,7 @@ ProcXDGASetMode(ClientPtr client)
     ClientPtr owner;
     int size;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
     owner = DGA_GETCLIENT(stuff->screen);
 
@@ -363,7 +363,7 @@ ProcXDGASetViewport(ClientPtr client)
 {
     REQUEST(xXDGASetViewportReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -383,7 +383,7 @@ ProcXDGAInstallColormap(ClientPtr client)
     int rc;
     REQUEST(xXDGAInstallColormapReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -405,7 +405,7 @@ ProcXDGASelectInput(ClientPtr client)
 {
     REQUEST(xXDGASelectInputReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -425,7 +425,7 @@ ProcXDGAFillRectangle(ClientPtr client)
 {
     REQUEST(xXDGAFillRectangleReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -445,7 +445,7 @@ ProcXDGACopyArea(ClientPtr client)
 {
     REQUEST(xXDGACopyAreaReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -466,7 +466,7 @@ ProcXDGACopyTransparentArea(ClientPtr client)
 {
     REQUEST(xXDGACopyTransparentAreaReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -488,7 +488,7 @@ ProcXDGAGetViewportStatus(ClientPtr client)
     REQUEST(xXDGAGetViewportStatusReq);
     xXDGAGetViewportStatusReply rep;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -511,7 +511,7 @@ ProcXDGASync(ClientPtr client)
     REQUEST(xXDGASyncReq);
     xXDGASyncReply rep;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -556,7 +556,7 @@ ProcXDGAChangePixmapMode(ClientPtr client)
     xXDGAChangePixmapModeReply rep;
     int x, y;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -587,7 +587,7 @@ ProcXDGACreateColormap(ClientPtr client)
     REQUEST(xXDGACreateColormapReq);
     int result;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if(DGA_GETCLIENT(stuff->screen) != client)
@@ -625,7 +625,7 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
     int num, offset, flags;
     char *name;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
 	return BadValue;
 
     REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
@@ -664,7 +664,7 @@ ProcXF86DGADirectVideo(ClientPtr client)
     ClientPtr owner;
     REQUEST(xXF86DGADirectVideoReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
 	return BadValue;
     REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
 
@@ -718,7 +718,7 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
     REQUEST(xXF86DGAGetViewPortSizeReq);
     xXF86DGAGetViewPortSizeReply rep;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
 	return BadValue;
 
     REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
@@ -746,7 +746,7 @@ ProcXF86DGASetViewPort(ClientPtr client)
 {
     REQUEST(xXF86DGASetViewPortReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
 	return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
@@ -773,7 +773,7 @@ ProcXF86DGAGetVidPage(ClientPtr client)
     REQUEST(xXF86DGAGetVidPageReq);
     xXF86DGAGetVidPageReply rep;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
 	return BadValue;
 
     REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
@@ -792,7 +792,7 @@ ProcXF86DGASetVidPage(ClientPtr client)
 {
     REQUEST(xXF86DGASetVidPageReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
 	return BadValue;
 
     REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
@@ -810,7 +810,7 @@ ProcXF86DGAInstallColormap(ClientPtr client)
     int rc;
     REQUEST(xXF86DGAInstallColormapReq);
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
 	return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
@@ -837,7 +837,7 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
     REQUEST(xXF86DGAQueryDirectVideoReq);
     xXF86DGAQueryDirectVideoReply rep;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
 	return BadValue;
 
     REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
@@ -859,7 +859,7 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
     REQUEST(xXF86DGAViewPortChangedReq);
     xXF86DGAViewPortChangedReply rep;
 
-    if (stuff->screen > screenInfo.numScreens)
+    if (stuff->screen >= screenInfo.numScreens)
 	return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
commit 02449ee24b484c9fea501df5274d95a9f87cab23
Merge: afd6eb6... b85f906...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Nov 30 13:30:59 2010 -0800

    Merge remote branch 'ajax/for-keithp'

commit afd6eb66d5ef6a59be4c03da4588aaa2ee47b9ad
Merge: b169649... ffcbfa0...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Nov 30 13:28:13 2010 -0800

    Merge remote branch 'aplattner/for/keith'

commit b16964910d29c0bd039e8bb48bcf1199d709fe3e
Author: Ferry Huberts <ferry.huberts at pelagic.nl>
Date:   Tue Nov 30 19:06:55 2010 +0100

    dix: do not use bit-wise operators on the boolean result of BitIsOn
    
    Performing bit-wise operations on a boolean amounts to mixing types,
    is confusing and basically incorrect; one should only perform
    logical operations on booleans.
    
    Performing such operations relies on the implementation detail
    that a boolean is in fact an integer and that its value FALSE
    is implemented as zero.
    
    Signed-off-by: Ferry Huberts <ferry.huberts at pelagic.nl>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index f09d31c..25889de 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -112,12 +112,12 @@ set_button_up(DeviceIntPtr pDev, int button, int type)
 Bool
 button_is_down(DeviceIntPtr pDev, int button, int type)
 {
-    int ret = 0;
+    Bool ret = FALSE;
 
     if (type & BUTTON_PROCESSED)
-        ret |= BitIsOn(pDev->button->down, button);
+        ret = ret || BitIsOn(pDev->button->down, button);
     if (type & BUTTON_POSTED)
-        ret |= BitIsOn(pDev->button->postdown, button);
+        ret = ret || BitIsOn(pDev->button->postdown, button);
 
     return ret;
 }
@@ -143,12 +143,12 @@ set_key_up(DeviceIntPtr pDev, int key_code, int type)
 Bool
 key_is_down(DeviceIntPtr pDev, int key_code, int type)
 {
-    int ret = 0;
+    Bool ret = FALSE;
 
     if (type & KEY_PROCESSED)
-        ret |= BitIsOn(pDev->key->down, key_code);
+        ret = ret || BitIsOn(pDev->key->down, key_code);
     if (type & KEY_POSTED)
-        ret |= BitIsOn(pDev->key->postdown, key_code);
+        ret = ret || BitIsOn(pDev->key->postdown, key_code);
 
     return ret;
 }
commit 5f34853d6f936e8a1a317a59972b07e3f191d1ab
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Nov 15 11:25:13 2010 +1000

    xfree86: Bump classic driver default to 1024x768
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index d03310e..54fe021 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -1402,6 +1402,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
 	strategy &= ~LOOKUP_OPTIONAL_TOLERANCES;
     } else {
 	const char *type = "";
+        Bool specified = FALSE;
 
 	if (scrp->monitor->nHsync <= 0) {
 	    if (numTimings > 0) {
@@ -1412,11 +1413,13 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
 		}
 	    } else {
 		scrp->monitor->hsync[0].lo = 31.5;
-		scrp->monitor->hsync[0].hi = 37.9;
+		scrp->monitor->hsync[0].hi = 48.0;
 		scrp->monitor->nHsync = 1;
 	    }
 	    type = "default ";
-	}
+	} else {
+            specified = TRUE;
+        }
 	for (i = 0; i < scrp->monitor->nHsync; i++) {
 	    if (scrp->monitor->hsync[i].lo == scrp->monitor->hsync[i].hi)
 	      xf86DrvMsg(scrp->scrnIndex, X_INFO,
@@ -1445,7 +1448,9 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
 		scrp->monitor->nVrefresh = 1;
 	    }
 	    type = "default ";
-	}
+	} else {
+            specified = TRUE;
+        }
 	for (i = 0; i < scrp->monitor->nVrefresh; i++) {
 	    if (scrp->monitor->vrefresh[i].lo == scrp->monitor->vrefresh[i].hi)
 	      xf86DrvMsg(scrp->scrnIndex, X_INFO,
@@ -1459,10 +1464,16 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
 			 scrp->monitor->vrefresh[i].lo,
 			 scrp->monitor->vrefresh[i].hi);
 	}
+
+        type = "";
+	if (!scrp->monitor->maxPixClock && !specified) {
+            type = "default ";
+            scrp->monitor->maxPixClock = 65000.0;
+        }
 	if (scrp->monitor->maxPixClock) {
 	    xf86DrvMsg(scrp->scrnIndex, X_INFO,
-		       "%s: Using maximum pixel clock of %.2f MHz\n",
-		       scrp->monitor->id,
+		       "%s: Using %smaximum pixel clock of %.2f MHz\n",
+		       scrp->monitor->id, type,
 		       (float)scrp->monitor->maxPixClock / 1000.0);
 	}
     }
commit 903e0f6f0f0ec54151640fc459ff03dcba0522af
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Nov 27 10:46:44 2010 -0800

    Xserver-spec: Delete DBE Idioms section
    
    The code has been gone for a while
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/xml/Xserver-spec.xml b/doc/xml/Xserver-spec.xml
index 6299282..ae15346 100644
--- a/doc/xml/Xserver-spec.xml
+++ b/doc/xml/Xserver-spec.xml
@@ -1361,70 +1361,6 @@ The sample server implementation for these routines
 is in Xserver/os/util.c.
 </para>
 </section>
-<section>
-  <title>Idiom Support</title>
-<para>
-The DBE specification introduces the notion of idioms, which are
-groups of X requests which can be executed more efficiently when taken
-as a whole compared to being performed individually and sequentially.
-This following server internal support to allows DBE
-implementations, as well as other parts of the server,
-to do idiom processing.
-</para>
-<para>
-<blockquote><programlisting>
-
-	xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore)
-</programlisting></blockquote>
-If req is NULL, the return value will be a pointer to the start of the
-complete request that follows the one currently being executed for the
-client.  If req is not NULL, the function assumes that req is a
-pointer to a request in the client's request buffer, and the return
-value will be a pointer to the the start of the complete request that
-follows req.  If the complete request is not available, the function
-returns NULL; pointers to partial requests will never be returned.  If
-(and only if) readmore is TRUE, PeekNextRequest should try to read an
-additional request from the client if one is not already available in
-the client's request buffer.  If PeekNextRequest reads more data into
-the request buffer, it should not move or change the existing data.
-</para>
-<para>
-<blockquote><programlisting>
-
-	void SkipRequests(xReqPtr req, ClientPtr client, int numskipped)
-</programlisting></blockquote>
-The requests for the client up to and including the one specified by
-req will be skipped.  numskipped must be the number of requests being
-skipped.  Normal request processing will resume with the request that
-follows req.  The caller must not have modified the contents of the
-request buffer in any way (e.g., by doing byte swapping in place).
-</para>
-<para>
-Additionally, two macros in os.h operate on the xReq
-pointer returned by PeekNextRequest:
-<blockquote><programlisting>
-
-	int ReqLen(xReqPtr req, ClientPtr client)
-</programlisting></blockquote>
-The value of ReqLen is the request length in bytes of the given xReq.
-<blockquote><programlisting>
-
-	otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr)
-</programlisting></blockquote>
-The value of CastxReq is the conversion of the given request pointer
-to an otherReqTypePtr (which should be a pointer to a protocol
-structure type).  Only those fields which come after the length field
-of otherReqType may be accessed via the returned pointer.
-</para>
-<para>
-Thus the first two fields of a request, reqType and data, can be
-accessed directly using the xReq * returned by PeekNextRequest.  The
-next field, the length, can be accessed with ReqLen.  Fields beyond
-that can be accessed with CastxReq.  This complexity was necessary
-because of the reencoding of core protocol that can happen due to the
-BigRequests extension.
-</para>
-</section>
 </section>
 
 <section>
commit f4ba75a494cf9f4f5b0a979e9ceb519f4a6fcacc
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Nov 27 10:46:43 2010 -0800

    Remove unused ReqLen & CastxReq macros
    
    According to Xserver-spec, they were part of the now-deleted DBE "Idioms"
    code.   The last callers of them were removed in commits fe616f9230b6 &
    3d642905477f.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/os.h b/include/os.h
index efa202c..e882a0c 100644
--- a/include/os.h
+++ b/include/os.h
@@ -441,29 +441,6 @@ extern _X_EXPORT int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*
 
 extern _X_EXPORT void ddxUseMsg(void);
 
-/* int ReqLen(xReq *req, ClientPtr client)
- * Given a pointer to a *complete* request, return its length in bytes.
- * Note that if the request is a big request (as defined in the Big
- * Requests extension), the macro lies by returning 4 less than the
- * length that it actually occupies in the request buffer.  This is so you
- * can blindly compare the length with the various sz_<request> constants
- * in Xproto.h without having to know/care about big requests.
- */
-#define ReqLen(_pxReq, _client) \
- ((_pxReq->length ? \
-     (_client->swapped ? lswaps(_pxReq->length) : _pxReq->length) \
-  : ((_client->swapped ? \
-	lswapl(((CARD32*)_pxReq)[1]) : ((CARD32*)_pxReq)[1])-1) \
-  ) << 2)
-
-/* otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr)
- * Cast the given request to one of type otherReqTypePtr to access
- * fields beyond the length field.
- */
-#define CastxReq(_pxReq, otherReqTypePtr) \
-    (_pxReq->length ? (otherReqTypePtr)_pxReq \
-		    : (otherReqTypePtr)(((CARD32*)_pxReq)+1))
-
 /* stuff for ReplyCallback */
 extern _X_EXPORT CallbackListPtr ReplyCallback;
 typedef struct {
commit b85f9063c2370d7710523bccb8bf030a0710425b
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Nov 22 16:42:04 2010 -0500

    xfree86: Remove the xf8_16bpp overlay module
    
    Only one (marginal) driver was using it, and it's been fixed to just
    implement it directly.
    
    v2: Also fix sdksyms.sh (spotted by Jesse Adkins)
    v3: Also fix DESIGN.xml (spotted bu Julien Cristau)
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/configure.ac b/configure.ac
index 09a7211..2363e38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2237,7 +2237,6 @@ hw/xfree86/vbe/Makefile
 hw/xfree86/vgahw/Makefile
 hw/xfree86/x86emu/Makefile
 hw/xfree86/xaa/Makefile
-hw/xfree86/xf8_16bpp/Makefile
 hw/xfree86/utils/Makefile
 hw/xfree86/utils/cvt/Makefile
 hw/xfree86/utils/gtf/Makefile
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 116113b..575481e 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -32,12 +32,12 @@ DOC_SUBDIR = doc
 
 SUBDIRS = common ddc i2c x86emu $(INT10_SUBDIR) fbdevhw os-support parser \
 	  ramdac shadowfb $(VBE_SUBDIR) $(VGAHW_SUBDIR) $(XAA_SUBDIR) \
-	  xf8_16bpp loader dixmods exa modes \
+	  loader dixmods exa modes \
 	  $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
 
 DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
                parser ramdac shadowfb vbe vgahw xaa \
-               xf8_16bpp loader dixmods dri dri2 exa modes \
+               loader dixmods dri dri2 exa modes \
 	       utils doc
 
 bin_PROGRAMS = Xorg
diff --git a/hw/xfree86/doc/sgml/DESIGN.xml b/hw/xfree86/doc/sgml/DESIGN.xml
index 6c90a40..08f8bc8 100644
--- a/hw/xfree86/doc/sgml/DESIGN.xml
+++ b/hw/xfree86/doc/sgml/DESIGN.xml
@@ -1629,14 +1629,6 @@ Here is what <function>InitOutput()</function> does:
 	  </blockquote></para></blockquote>
 
       <para>
-    Currently, aperture remapping, as described here, should not be
-    attempted if the driver uses the <literal remap="tt">xf8_16bpp</literal> or
-    <literal remap="tt">xf8_32bpp</literal> framebuffer layers.  A pending
-    restructuring of VT switching will address this restriction in
-    the near future.
-      </para>
-
-      <para>
     Other layers may wrap the <function>ChipEnterVT()</function> and
     <function>ChipLeaveVT()</function> functions if they need to take some
     action when these events are received.
diff --git a/hw/xfree86/loader/sdksyms.sh b/hw/xfree86/loader/sdksyms.sh
index 1ca6789..4b3ed86 100755
--- a/hw/xfree86/loader/sdksyms.sh
+++ b/hw/xfree86/loader/sdksyms.sh
@@ -208,12 +208,6 @@ cat > sdksyms.c << EOF
  */
 
 
-/* hw/xfree86/xf8_16bpp/Makefile.am -- module */
-/*
-#include "cfb8_16.h"
- */
-
-
 /* mi/Makefile.am */
 #include "micmap.h"
 #include "miline.h"
diff --git a/hw/xfree86/xf8_16bpp/Makefile.am b/hw/xfree86/xf8_16bpp/Makefile.am
deleted file mode 100644
index 3c5b8c9..0000000
--- a/hw/xfree86/xf8_16bpp/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-module_LTLIBRARIES = libxf8_16bpp.la
-
-sdk_HEADERS = cfb8_16.h
-
-INCLUDES = $(XORG_INCS) -I$(top_srcdir)/fb
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-
-libxf8_16bpp_la_LDFLAGS = -avoid-version
-
-libxf8_16bpp_la_SOURCES = xf8_16module.c
diff --git a/hw/xfree86/xf8_16bpp/cfb8_16.h b/hw/xfree86/xf8_16bpp/cfb8_16.h
deleted file mode 100644
index b6ab955..0000000
--- a/hw/xfree86/xf8_16bpp/cfb8_16.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2006 Adam Jackson.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _CFB8_16_H
-#define _CFB8_16_H
-
-#include "regionstr.h"
-#include "windowstr.h"
-
-/* this has to stay misnamed for ABI reasons */
-
-extern _X_EXPORT Bool
-cfb8_16ScreenInit(ScreenPtr pScreen, pointer pbits16, pointer pbits8,
-                  int xsize, int ysize, int dpix, int dpiy,
-                  int width16, int width8);
-
-#endif /* _CFB8_16_H */
diff --git a/hw/xfree86/xf8_16bpp/xf8_16module.c b/hw/xfree86/xf8_16bpp/xf8_16module.c
deleted file mode 100644
index 6a4529a..0000000
--- a/hw/xfree86/xf8_16bpp/xf8_16module.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2006 Adam Jackson.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "misc.h"
-#include "servermd.h"
-#include "scrnintstr.h"
-#include "resource.h"
-#include "fb.h"
-#include "fboverlay.h"
-#include "cfb8_16.h"
-
-Bool
-cfb8_16ScreenInit(ScreenPtr pScreen, pointer pbits16, pointer pbits8,
-                  int xsize, int ysize, int dpix, int dpiy,
-                  int width16, int width8)
-{
-    return
-        (fbOverlaySetupScreen(pScreen, pbits16, pbits8, xsize, ysize,
-                              dpix, dpiy, width16, width8, 16, 8) &&
-         fbOverlayFinishScreenInit(pScreen, pbits16, pbits8, xsize, ysize,
-                                   dpix, dpiy, width16, width8, 16, 8, 16, 8));
-}
-
-#include "xf86Module.h"
-
-static MODULESETUPPROTO(xf8_16bppSetup);
-
-static XF86ModuleVersionInfo VersRec = {
-        "xf8_16bpp",
-        MODULEVENDORSTRING,
-        MODINFOSTRING1,
-        MODINFOSTRING2,
-        XORG_VERSION_CURRENT,
-        2, 0, 0,
-        ABI_CLASS_ANSIC,                /* Only need the ansic layer */
-        ABI_ANSIC_VERSION,
-        NULL,
-        {0,0,0,0}       /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData xf8_16bppModuleData = {
-    &VersRec,
-    xf8_16bppSetup,
-    NULL
-};
-
-static pointer
-xf8_16bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
-    return (pointer)LoadSubModule(module, "fb", NULL, NULL, NULL, NULL,
-			          errmaj, errmin);
-}
commit a861fe6a1cf56df76928d21707551602289963c1
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Nov 30 13:50:42 2010 -0500

    vbe: Refuse to believe tiny (or negative) panel sizes from PanelID
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c
index 7a64a4a..bcda5ec 100644
--- a/hw/xfree86/vbe/vbe.c
+++ b/hw/xfree86/vbe/vbe.c
@@ -1028,6 +1028,11 @@ VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data)
     if (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh)
 	return;
 
+    if (data->hsize < 320 || data->vsize < 240) {
+	xf86DrvMsg(scrnIndex, X_INFO, "...which I refuse to believe\n");
+	return;
+    }
+
     mode = xf86CVTMode(data->hsize, data->vsize, PANEL_HZ, 1, 0);
 
     pScrn->monitor->nHsync = 1;
commit 84a14fab8f930ef1855444ae4e9e3e14ee008328
Author: David Reveman <davidr at novell.com>
Date:   Wed Jan 6 14:55:48 2010 -0500

    composite: add panoramix support
    
    Taken from:
    50d2d8c8969c165582d215c6e85c4be9eac02b6a
    dbffd0d44a33dcc84898c7a891d7ba212f65cbb8
    9b5b102163b4eaa1b70647354fcab4f6e461c94c
    75f9b98af31abf537ac6616c99f3797deb7ba017
    07fba8b1f77a6bca44ea6568b346a18ce9d1e61d
    
    With minor style fixes, ported to dixLookupResourceByType, and ported
    away from client->noClientException and xalloc/xfree.
    
    v2: Fix a memory leak in PanoramiXCompositeNameWindowPixmap, spotted by
    James Jones.
    v3: Fix a buglet in PanoramiXCompositeUnredirectSubwindows, spotted by
    Dave Airlie.
    v4: Fix a style issue with resource lookup noted by Jamey Sharp.
    
    Reviewed-by: Dave Airlie <airlied at gmail.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 5a395fc..e6334bd 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -56,6 +56,9 @@ Equipment Corporation.
 #ifdef XFIXES
 #include "xfixesint.h"
 #endif
+#ifdef COMPOSITE
+#include "compint.h"
+#endif
 #include "modinit.h"
 #include "protocol-versions.h"
 
@@ -587,6 +590,10 @@ void PanoramiXExtensionInit(int argc, char *argv[])
 #ifdef XFIXES
     PanoramiXFixesInit ();
 #endif
+#ifdef COMPOSITE
+    PanoramiXCompositeInit ();
+#endif
+
 }
 
 extern Bool CreateConnectionBlock(void);
diff --git a/composite/compext.c b/composite/compext.c
index 30d9dc2..7fddbba 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -535,13 +535,6 @@ CompositeExtensionInit (void)
 	if (GetPictureScreenIfSet(pScreen) == NULL)
 	    return;
     }
-#ifdef PANORAMIX
-    /* Xinerama's rewriting of window drawing before Composite gets to it
-     * breaks Composite.
-     */
-    if (!noPanoramiXExtension)
-	return;
-#endif
 
     CompositeClientWindowType = CreateNewResourceType
 	(FreeCompositeClientWindow, "CompositeClientWindow");
@@ -582,3 +575,358 @@ CompositeExtensionInit (void)
     /* Initialization succeeded */
     noCompositeExtension = FALSE;
 }
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+
+int (*PanoramiXSaveCompositeVector[CompositeNumberRequests]) (ClientPtr);
+
+static int
+PanoramiXCompositeRedirectWindow (ClientPtr client)
+{
+    PanoramiXRes *win;
+    int rc = 0, j;
+    REQUEST(xCompositeRedirectWindowReq);
+
+    REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
+
+    if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+				      client, DixUnknownAccess))) {
+	client->errorValue = stuff->window;
+	return rc;
+    }
+
+    FOR_NSCREENS_FORWARD(j) {
+	stuff->window = win->info[j].id;
+	rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+	if (rc != Success) break;
+    }
+
+    return rc;
+}
+
+static int
+PanoramiXCompositeRedirectSubwindows (ClientPtr client)
+{
+    PanoramiXRes *win;
+    int rc = 0, j;
+    REQUEST(xCompositeRedirectSubwindowsReq);
+
+    REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
+
+    if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+				      client, DixUnknownAccess))) {
+	client->errorValue = stuff->window;
+	return rc;
+    }
+
+    FOR_NSCREENS_FORWARD(j) {
+	stuff->window = win->info[j].id;
+	rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+	if (rc != Success) break;
+    }
+
+    return rc;
+}
+
+static int
+PanoramiXCompositeUnredirectWindow (ClientPtr client)
+{
+    PanoramiXRes *win;
+    int rc = 0, j;
+    REQUEST(xCompositeUnredirectWindowReq);
+
+    REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
+
+    if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+				      client, DixUnknownAccess))) {
+	client->errorValue = stuff->window;
+	return rc;
+    }
+
+    FOR_NSCREENS_FORWARD(j) {
+	stuff->window = win->info[j].id;
+	rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+	if (rc != Success) break;
+    }
+
+    return rc;
+}
+
+static int
+PanoramiXCompositeUnredirectSubwindows (ClientPtr client)
+{
+    PanoramiXRes *win;
+    int rc = 0, j;
+    REQUEST(xCompositeUnredirectSubwindowsReq);
+
+    REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
+
+    if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+				      client, DixUnknownAccess))) {
+	client->errorValue = stuff->window;
+	return rc;
+    }
+
+    FOR_NSCREENS_FORWARD(j) {
+	stuff->window = win->info[j].id;
+	rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+	if (rc != Success) break;
+    }
+
+    return rc;
+}
+
+static int
+PanoramiXCompositeNameWindowPixmap (ClientPtr client)
+{
+    WindowPtr	    pWin;
+    CompWindowPtr   cw;
+    PixmapPtr	    pPixmap;
+    int rc;
+    PanoramiXRes *win, *newPix;
+    int i;
+    REQUEST(xCompositeNameWindowPixmapReq);
+
+    REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
+
+    if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+				      client, DixUnknownAccess))) {
+	client->errorValue = stuff->window;
+	return rc;
+    }
+
+    LEGAL_NEW_RESOURCE (stuff->pixmap, client);
+
+    if(!(newPix = malloc(sizeof(PanoramiXRes))))
+	return BadAlloc;
+
+    newPix->type = XRT_PIXMAP;
+    newPix->u.pix.shared = FALSE;
+    newPix->info[0].id = stuff->pixmap;
+
+    for (i = 1; i < PanoramiXNumScreens; i++)
+	newPix->info[i].id = FakeClientID (client->index);
+
+    FOR_NSCREENS(i) {
+	rc = dixLookupResourceByType ((void **) &pWin, win->info[i].id,
+				      RT_WINDOW, client, DixGetAttrAccess);
+	if (rc != Success)
+	{
+	    client->errorValue = stuff->window;
+	    free (newPix);
+	    return rc;
+	}
+
+	if (!pWin->viewable)
+	{
+	    free (newPix);
+	    return BadMatch;
+	}
+
+	cw = GetCompWindow (pWin);
+	if (!cw)
+	{
+	    free (newPix);
+	    return BadMatch;
+	}
+
+	pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+	if (!pPixmap)
+	{
+	    free (newPix);
+	    return BadMatch;
+	}
+
+	if (!AddResource (newPix->info[i].id, RT_PIXMAP,
+			  (pointer) pPixmap))
+	    return BadAlloc;
+
+	++pPixmap->refcnt;
+    }
+
+    if (!AddResource (stuff->pixmap, XRT_PIXMAP, (pointer) newPix))
+	return BadAlloc;
+
+    return Success;
+}
+
+
+static int
+PanoramiXCompositeGetOverlayWindow (ClientPtr client)
+{
+    REQUEST(xCompositeGetOverlayWindowReq);
+    xCompositeGetOverlayWindowReply rep;
+    WindowPtr pWin;
+    ScreenPtr pScreen;
+    CompScreenPtr cs;
+    CompOverlayClientPtr pOc;
+    int rc;
+    PanoramiXRes *win, *overlayWin = NULL;
+    int i;
+
+    REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
+
+    if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+				      client, DixUnknownAccess))) {
+	client->errorValue = stuff->window;
+	return rc;
+    }
+
+    cs = GetCompScreen(screenInfo.screens[0]);
+    if (!cs->pOverlayWin)
+    {
+	if(!(overlayWin = malloc(sizeof(PanoramiXRes))))
+	    return BadAlloc;
+
+	overlayWin->type = XRT_WINDOW;
+	overlayWin->u.win.root = FALSE;
+    }
+
+    FOR_NSCREENS_BACKWARD(i) {
+	rc = dixLookupResourceByType((pointer *)&pWin, win->info[i].id,
+				     RT_WINDOW, client, DixGetAttrAccess);
+	if (rc != Success)
+	{
+	    client->errorValue = stuff->window;
+	    return rc;
+	}
+	pScreen = pWin->drawable.pScreen;
+
+	/*
+	 * Create an OverlayClient structure to mark this client's
+	 * interest in the overlay window
+	 */
+	pOc = compCreateOverlayClient(pScreen, client);
+	if (pOc == NULL)
+	    return BadAlloc;
+
+	/*
+	 * Make sure the overlay window exists
+	 */
+	cs = GetCompScreen(pScreen);
+	if (cs->pOverlayWin == NULL)
+	    if (!compCreateOverlayWindow(pScreen))
+	    {
+		FreeResource (pOc->resource, RT_NONE);
+		return BadAlloc;
+	    }
+
+	rc = XaceHook(XACE_RESOURCE_ACCESS, client,
+		      cs->pOverlayWin->drawable.id,
+		      RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
+		      DixGetAttrAccess);
+	if (rc != Success)
+	{
+	    FreeResource (pOc->resource, RT_NONE);
+	    return rc;
+	}
+    }
+
+    if (overlayWin)
+    {
+	FOR_NSCREENS(i) {
+	    cs = GetCompScreen(screenInfo.screens[i]);
+	    overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
+	}
+
+	AddResource(overlayWin->info[0].id, XRT_WINDOW, overlayWin);
+    }
+
+    cs = GetCompScreen(screenInfo.screens[0]);
+
+    rep.type = X_Reply;
+    rep.sequenceNumber = client->sequence;
+    rep.length = 0;
+    rep.overlayWin = cs->pOverlayWin->drawable.id;
+
+    if (client->swapped)
+    {
+	int n;
+	swaps(&rep.sequenceNumber, n);
+	swapl(&rep.length, n);
+	swapl(&rep.overlayWin, n);
+    }
+    (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
+
+    return Success;
+}
+
+static int
+PanoramiXCompositeReleaseOverlayWindow (ClientPtr client)
+{
+    REQUEST(xCompositeReleaseOverlayWindowReq);
+    WindowPtr pWin;
+    ScreenPtr pScreen;
+    CompOverlayClientPtr pOc;
+    PanoramiXRes *win;
+    int i, rc;
+
+    REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
+
+    if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+				      client, DixUnknownAccess))) {
+	client->errorValue = stuff->window;
+	return rc;
+    }
+
+    FOR_NSCREENS_BACKWARD(i) {
+	if ((rc = dixLookupResourceByType((void **)&pWin, win->info[i].id,
+					  XRT_WINDOW, client,
+					  DixUnknownAccess))) {
+	    client->errorValue = stuff->window;
+	    return rc;
+	}
+	pScreen = pWin->drawable.pScreen;
+
+	/*
+	 * Has client queried a reference to the overlay window
+	 * on this screen? If not, generate an error.
+	 */
+	pOc = compFindOverlayClient (pWin->drawable.pScreen, client);
+	if (pOc == NULL)
+	    return BadMatch;
+
+	/* The delete function will free the client structure */
+	FreeResource (pOc->resource, RT_NONE);
+    }
+
+    return Success;
+}
+
+void
+PanoramiXCompositeInit (void)
+{
+    int i;
+
+    for (i = 0; i < CompositeNumberRequests; i++)
+	PanoramiXSaveCompositeVector[i] = ProcCompositeVector[i];
+    /*
+     * Stuff in Xinerama aware request processing hooks
+     */
+    ProcCompositeVector[X_CompositeRedirectWindow] =
+	PanoramiXCompositeRedirectWindow;
+    ProcCompositeVector[X_CompositeRedirectSubwindows] =
+	PanoramiXCompositeRedirectSubwindows;
+    ProcCompositeVector[X_CompositeUnredirectWindow] =
+	PanoramiXCompositeUnredirectWindow;
+    ProcCompositeVector[X_CompositeUnredirectSubwindows] =
+	PanoramiXCompositeUnredirectSubwindows;
+    ProcCompositeVector[X_CompositeNameWindowPixmap] =
+	PanoramiXCompositeNameWindowPixmap;
+    ProcCompositeVector[X_CompositeGetOverlayWindow] =
+	PanoramiXCompositeGetOverlayWindow;
+    ProcCompositeVector[X_CompositeReleaseOverlayWindow] =
+	PanoramiXCompositeReleaseOverlayWindow;
+}
+
+void
+PanoramiXCompositeReset (void)
+{
+    int i;
+
+    for (i = 0; i < CompositeNumberRequests; i++)
+	ProcCompositeVector[i] = PanoramiXSaveCompositeVector[i];
+}
+
+#endif
diff --git a/composite/compint.h b/composite/compint.h
index 80083b0..ae41c44 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -326,4 +326,7 @@ int
 compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
 		 int bw, WindowPtr pSib);
 
+void PanoramiXCompositeInit (void);
+void PanoramiXCompositeReset (void);
+
 #endif /* _COMPINT_H_ */
diff --git a/composite/compoverlay.c b/composite/compoverlay.c
index 67b566c..3bace79 100644
--- a/composite/compoverlay.c
+++ b/composite/compoverlay.c
@@ -48,6 +48,10 @@
 #include "compint.h"
 #include "xace.h"
 
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
 /* 
  * Delete the given overlay client list element from its screen list.
  */
@@ -128,10 +132,19 @@ compCreateOverlayWindow (ScreenPtr pScreen)
     WindowPtr	    pWin;
     XID		    attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
     int		    result;
+    int		    w = pScreen->width;
+    int		    h = pScreen->height;
+
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension)
+    {
+	w = PanoramiXPixWidth;
+	h = PanoramiXPixHeight;
+    }
+#endif
 
     pWin = cs->pOverlayWin = 
-	CreateWindow (cs->overlayWid, pRoot,
-		      0, 0, pScreen->width, pScreen->height, 0, 
+	CreateWindow (cs->overlayWid, pRoot, 0, 0, w, h, 0,
 		      InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
 		      pRoot->drawable.depth, 
 		      serverClient, pScreen->rootVisual, &result);
diff --git a/composite/compwindow.c b/composite/compwindow.c
index d17ff77..62283ee 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -47,6 +47,10 @@
 
 #include "compint.h"
 
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
 #ifdef COMPOSITE_DEBUG
 static int
 compCheckWindow (WindowPtr pWin, pointer data)
@@ -172,16 +176,26 @@ updateOverlayWindow(ScreenPtr pScreen)
 	CompScreenPtr cs;
 	WindowPtr pWin; /* overlay window */
 	XID vlist[2];
+	int w = pScreen->width;
+	int h = pScreen->height;
+
+#ifdef PANORAMIX
+	if (!noPanoramiXExtension)
+	{
+	    w = PanoramiXPixWidth;
+	    h = PanoramiXPixHeight;
+	}
+#endif
 
 	cs = GetCompScreen(pScreen);
 	if ((pWin = cs->pOverlayWin) != NULL) {
-		if ((pWin->drawable.width == pScreen->width) &&
-			(pWin->drawable.height == pScreen->height))
+		if ((pWin->drawable.width == w) &&
+			(pWin->drawable.height == h))
 			return Success;
 
 		/* Let's resize the overlay window. */
-		vlist[0] = pScreen->width;
-		vlist[1] = pScreen->height;
+		vlist[0] = w;
+		vlist[1] = h;
 		return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
 	}
 
diff --git a/configure.ac b/configure.ac
index 83bd96f..09a7211 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1980,7 +1980,7 @@ if test "x$DMX" = xyes; then
 	fi
 	DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
 	XDMX_CFLAGS="$DMXMODULES_CFLAGS"
-	XDMX_LIBS="$FB_LIB $MI_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $XEXT_LIB $MAIN_LIB $DIX_LIB $OS_LIB $FIXES_LIB"
+	XDMX_LIBS="$FB_LIB $MI_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $XEXT_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB"
 	XDMX_SYS_LIBS="$DMXMODULES_LIBS"
 	AC_SUBST([XDMX_CFLAGS])
 	AC_SUBST([XDMX_LIBS])
commit 6dea617e0f71a6fc7937e3a1e10474fa87488284
Author: David Reveman <davidr at novell.com>
Date:   Tue Jan 5 15:35:10 2010 -0500

    fixes: Add panoramix support
    
    Taken from:
    583f4dde81d8d5e9101b0289946e1914ea1ee124
    
    With minor style fixes and ported to dixLookupResourceByType.
    
    Reviewed-by: Dave Airlie <airlied at gmail.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index b73c53f..5a395fc 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -53,6 +53,9 @@ Equipment Corporation.
 #include "servermd.h"
 #include "resource.h"
 #include "picturestr.h"
+#ifdef XFIXES
+#include "xfixesint.h"
+#endif
 #include "modinit.h"
 #include "protocol-versions.h"
 
@@ -581,6 +584,9 @@ void PanoramiXExtensionInit(int argc, char *argv[])
     ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor;
 
     PanoramiXRenderInit ();
+#ifdef XFIXES
+    PanoramiXFixesInit ();
+#endif
 }
 
 extern Bool CreateConnectionBlock(void);
@@ -882,6 +888,9 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry)
     int		i;
 
     PanoramiXRenderReset ();
+#ifdef XFIXES
+    PanoramiXFixesReset ();
+#endif
     screenInfo.numScreens = PanoramiXNumScreens;
     for (i = 256; i--; )
 	ProcVector[i] = SavedProcVector[i];
diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h
index 5b1a3a9..b0a5a6e 100644
--- a/Xext/panoramiXsrv.h
+++ b/Xext/panoramiXsrv.h
@@ -26,6 +26,7 @@ extern _X_EXPORT unsigned long XRT_WINDOW;
 extern _X_EXPORT unsigned long XRT_PIXMAP;
 extern _X_EXPORT unsigned long XRT_GC;
 extern _X_EXPORT unsigned long XRT_COLORMAP;
+extern _X_EXPORT unsigned long XRT_PICTURE;
 
 /*
  * Drivers are allowed to wrap this function.  Each wrapper can decide that the
diff --git a/xfixes/region.c b/xfixes/region.c
index 42d5d7c..81ead4d 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -842,3 +842,81 @@ SProcXFixesExpandRegion (ClientPtr client)
     return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
 }
 
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+
+int
+PanoramiXFixesSetGCClipRegion (ClientPtr client)
+{
+    REQUEST(xXFixesSetGCClipRegionReq);
+    int		    result = Success, j;
+    PanoramiXRes    *gc;
+    REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
+
+    if ((result = dixLookupResourceByType((void **)&gc, stuff->gc, XRT_GC,
+					  client, DixWriteAccess))) {
+	client->errorValue = stuff->gc;
+	return result;
+    }
+
+    FOR_NSCREENS_BACKWARD(j) {
+        stuff->gc = gc->info[j].id;
+        result = (*PanoramiXSaveXFixesVector[X_XFixesSetGCClipRegion]) (client);
+        if(result != Success) break;
+    }
+
+    return result;
+}
+
+int
+PanoramiXFixesSetWindowShapeRegion (ClientPtr client)
+{
+    int		    result = Success, j;
+    PanoramiXRes    *win;
+    REQUEST(xXFixesSetWindowShapeRegionReq);
+
+    REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
+
+    if ((result = dixLookupResourceByType((void **)&win, stuff->dest,
+					  XRT_WINDOW, client,
+					  DixWriteAccess))) {
+	client->errorValue = stuff->dest;
+	return result;
+    }
+
+    FOR_NSCREENS_FORWARD(j) {
+	stuff->dest = win->info[j].id;
+	result = (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
+        if(result != Success) break;
+    }
+
+    return result;
+}
+
+int
+PanoramiXFixesSetPictureClipRegion (ClientPtr client)
+{
+    REQUEST(xXFixesSetPictureClipRegionReq);
+    int		    result = Success, j;
+    PanoramiXRes    *pict;
+
+    REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+
+    if ((result = dixLookupResourceByType((void **)&pict, stuff->picture,
+					  XRT_PICTURE, client,
+					  DixWriteAccess))) {
+	client->errorValue = stuff->picture;
+	return result;
+    }
+
+    FOR_NSCREENS_BACKWARD(j) {
+        stuff->picture = pict->info[j].id;
+	result = (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
+        if(result != Success) break;
+    }
+
+    return result;
+}
+
+#endif
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index 215909d..5dbfbec 100644
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -262,3 +262,33 @@ XFixesExtensionInit(void)
 	SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion);
     }
 }
+
+#ifdef PANORAMIX
+
+int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr);
+
+void
+PanoramiXFixesInit (void)
+{
+    int i;
+
+    for (i = 0; i < XFixesNumberRequests; i++)
+	PanoramiXSaveXFixesVector[i] = ProcXFixesVector[i];
+    /*
+     * Stuff in Xinerama aware request processing hooks
+     */
+    ProcXFixesVector[X_XFixesSetGCClipRegion] = PanoramiXFixesSetGCClipRegion;
+    ProcXFixesVector[X_XFixesSetWindowShapeRegion] = PanoramiXFixesSetWindowShapeRegion;
+    ProcXFixesVector[X_XFixesSetPictureClipRegion] = PanoramiXFixesSetPictureClipRegion;
+}
+
+void
+PanoramiXFixesReset (void)
+{
+    int i;
+
+    for (i = 0; i < XFixesNumberRequests; i++)
+	ProcXFixesVector[i] = PanoramiXSaveXFixesVector[i];
+}
+
+#endif
diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h
index f3d5361..9e50993 100644
--- a/xfixes/xfixesint.h
+++ b/xfixes/xfixesint.h
@@ -255,6 +255,15 @@ ProcXFixesExpandRegion (ClientPtr client);
 int
 SProcXFixesExpandRegion (ClientPtr client);
 
+int
+PanoramiXFixesSetGCClipRegion (ClientPtr client);
+
+int
+PanoramiXFixesSetWindowShapeRegion (ClientPtr client);
+
+int
+PanoramiXFixesSetPictureClipRegion (ClientPtr client);
+
 /* Cursor Visibility (Version 4) */
 
 int 
@@ -269,4 +278,8 @@ ProcXFixesShowCursor (ClientPtr client);
 int 
 SProcXFixesShowCursor (ClientPtr client);
 
+extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr);
+void PanoramiXFixesInit (void);
+void PanoramiXFixesReset (void);
+
 #endif /* _XFIXESINT_H_ */
commit 1b3c57f075049250c6d059412af3d6954468a5b7
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Aug 20 12:25:23 2010 -0400

    xfree86: Remove unused xf86PixmapKeyRec
    
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 9f0dda9..b29ec51 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -62,9 +62,6 @@ extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
 extern _X_EXPORT DevPrivateKeyRec xf86CreateRootWindowKeyRec;
 #define xf86CreateRootWindowKey (&xf86CreateRootWindowKeyRec)
 
-extern _X_EXPORT DevPrivateKeyRec xf86PixmapKeyRec;
-#define xf86PixmapKey (&xf86PixmapKeyRec)
-
 extern _X_EXPORT ScrnInfoPtr *xf86Screens;	/* List of pointers to ScrnInfoRecs */
 extern _X_EXPORT const unsigned char byte_reversed[256];
 extern _X_EXPORT Bool fbSlotClaimed;
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 2c10005..6177f05 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -49,7 +49,6 @@
 
 DevPrivateKeyRec xf86CreateRootWindowKeyRec;
 DevPrivateKeyRec xf86ScreenKeyRec;
-DevPrivateKeyRec xf86PixmapKeyRec;
 
 ScrnInfoPtr *xf86Screens = NULL;	/* List of ScrnInfos */
 const unsigned char byte_reversed[256] =
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 06a167b..ef90fa5 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -732,8 +732,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
 	  FatalError("Cannot register DDX private keys");
 
   if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0) ||
-      !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0) ||
-      !dixRegisterPrivateKey(&xf86PixmapKeyRec, PRIVATE_PIXMAP, 0))
+      !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0))
       FatalError("Cannot register DDX private keys");
 
   for (i = 0; i < xf86NumScreens; i++) {
commit 63b9d67d7f4f1fa108370c619e1d0d06baedbd4c
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Aug 19 18:40:24 2010 -0400

    mi: Remove unused miAllocateGCPrivateIndex
    
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/mi.h b/mi/mi.h
index 57837c4..c186940 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -456,10 +456,6 @@ extern _X_EXPORT Bool miScreenInit(
     VisualPtr /*visuals*/
 );
 
-extern _X_EXPORT DevPrivateKey miAllocateGCPrivateIndex(
-    void
-);
-
 /* mivaltree.c */
 
 extern _X_EXPORT int miShapedWindowIn(
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index d349206..fb01c68 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -283,17 +283,6 @@ miScreenInit(
     return miScreenDevPrivateInit(pScreen, width, pbits);
 }
 
-static DevPrivateKeyRec privateKeyRec;
-#define privateKey (&privateKeyRec)
-
-DevPrivateKey
-miAllocateGCPrivateIndex(void)
-{
-    if (!dixRegisterPrivateKey(&privateKeyRec, PRIVATE_GC, 0))
-	return NULL;
-    return privateKey;
-}
-
 DevPrivateKeyRec miZeroLineScreenKeyRec;
 
 void
commit 87f5b843a08fd92b4b31c04e3e6d947b8bc0d160
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Nov 19 16:25:51 2010 -0500

    render: Reshuffle and cull dead field from GlyphSetRec
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/render/glyphstr.h b/render/glyphstr.h
index 6c1a837..cc9f284 100644
--- a/render/glyphstr.h
+++ b/render/glyphstr.h
@@ -71,10 +71,9 @@ typedef struct _GlyphHash {
 
 typedef struct _GlyphSet {
     CARD32	    refcnt;
-    PictFormatPtr   format;
     int		    fdepth;
+    PictFormatPtr   format;
     GlyphHashRec    hash;
-    int             maxPrivate;
     PrivateRec      *devPrivates;
 } GlyphSetRec, *GlyphSetPtr;
 
commit 606e079cc4d9a9db3197652ca51683c36f74efb8
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Nov 19 16:17:48 2010 -0500

    dix: reshuffle WindowOptRec to fill a hole on LP64
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/include/windowstr.h b/include/windowstr.h
index 29b95fc..0b66ebb 100644
--- a/include/windowstr.h
+++ b/include/windowstr.h
@@ -79,8 +79,8 @@ typedef struct _DevCursorNode {
 } DevCursNodeRec, *DevCursNodePtr, *DevCursorList;
 
 typedef struct _WindowOpt {
-    VisualID		visual;		   /* default: same as parent */
     CursorPtr		cursor;		   /* default: window.cursorNone */
+    VisualID		visual;		   /* default: same as parent */
     Colormap		colormap;	   /* default: same as parent */
     Mask		dontPropagateMask; /* default: window.dontPropagate */
     Mask		otherEventMasks;   /* default: 0 */
commit fba5c8154dbc8f8c33801a5a43d7361cd6b54ffe
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Nov 19 15:21:31 2010 -0500

    dix: Remove unused ChangeSaveUnder hooks
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 813bda1..00d014c 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -345,14 +345,6 @@ typedef    Bool (* MarkOverlappedWindowsProcPtr)(
 	WindowPtr /*firstChild*/,
 	WindowPtr * /*pLayerWin*/);
 
-typedef    Bool (* ChangeSaveUnderProcPtr)(
-	WindowPtr /*pLayerWin*/,
-	WindowPtr /*firstChild*/);
-
-typedef    void (* PostChangeSaveUnderProcPtr)(
-	WindowPtr /*pLayerWin*/,
-	WindowPtr /*firstChild*/);
-
 typedef    int (* ConfigNotifyProcPtr)(
 	WindowPtr /*pWin*/,
 	int /*x*/,
@@ -527,8 +519,6 @@ typedef struct _Screen {
 
     MarkWindowProcPtr		MarkWindow;
     MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
-    ChangeSaveUnderProcPtr	ChangeSaveUnder;
-    PostChangeSaveUnderProcPtr	PostChangeSaveUnder;
     ConfigNotifyProcPtr		ConfigNotify;
     MoveWindowProcPtr		MoveWindow;
     ResizeWindowProcPtr		ResizeWindow;
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 33e3737..d349206 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -269,8 +269,6 @@ miScreenInit(
     pScreen->wakeupData = (pointer)0;
     pScreen->MarkWindow = miMarkWindow;
     pScreen->MarkOverlappedWindows = miMarkOverlappedWindows;
-    pScreen->ChangeSaveUnder = NULL;
-    pScreen->PostChangeSaveUnder = NULL;
     pScreen->MoveWindow = miMoveWindow;
     pScreen->ResizeWindow = miSlideAndSizeWindow;
     pScreen->GetLayerWindow = miGetLayerWindow;
commit c4c4676e6874b42c2371eee96faa2c2dbb59a704
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Nov 19 15:04:09 2010 -0500

    dix: Remove the backing store leftovers
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index 6d2f2d3..7a94627 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -283,8 +283,6 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
     if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL))
 	return FALSE;
 
-    miInitializeBackingStore(pScreen);
-
     if (dmxShadowFB) {
 	miDCInitialize(pScreen, &dmxPointerCursorFuncs);
     } else {
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 06c3661..c688eb0 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -1022,12 +1022,6 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
     fbInitValidateTree (pScreen);
 #endif
 
-#if 0
-    pScreen->backingStoreSupport = Always;
-    miInitializeBackingStore (pScreen);
-#endif
-
-
     /*
      * Wrap CloseScreen, the order now is:
      *	KdCloseScreen
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index e109734..53f82f9 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -875,13 +875,6 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 
     if (!ret) return FALSE;
 
-    miInitializeBackingStore(pScreen);
-
-    /*
-     * Circumvent the backing store that was just initialised.  This amounts
-     * to a truely bizarre way of initialising SaveDoomedAreas and friends.
-     */
-
     pScreen->InstallColormap = vfbInstallColormap;
     pScreen->UninstallColormap = vfbUninstallColormap;
     pScreen->ListInstalledColormaps = vfbListInstalledColormaps;
diff --git a/hw/xfree86/loader/sdksyms.sh b/hw/xfree86/loader/sdksyms.sh
index 3804324..1ca6789 100755
--- a/hw/xfree86/loader/sdksyms.sh
+++ b/hw/xfree86/loader/sdksyms.sh
@@ -255,8 +255,6 @@ cat > sdksyms.c << EOF
 
 /* include/Makefile.am */
 #include "XIstubs.h"
-#include "bstore.h"
-#include "bstorestr.h"
 #include "closestr.h"
 #include "closure.h"
 #include "colormap.h"
diff --git a/hw/xfree86/xaa/xaa.h b/hw/xfree86/xaa/xaa.h
index 2af954f..40b49e5 100644
--- a/hw/xfree86/xaa/xaa.h
+++ b/hw/xfree86/xaa/xaa.h
@@ -1241,8 +1241,6 @@ typedef struct _XAAInfoRec {
    GetImageProcPtr GetImage;
    GetSpansProcPtr GetSpans;
    CopyWindowProcPtr CopyWindow;
-   BackingStoreSaveAreasProcPtr SaveAreas;
-   BackingStoreRestoreAreasProcPtr RestoreAreas;
 
    unsigned int offscreenDepths;
    Bool offscreenDepthsInitialized;
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 0a6cab6..d0c7fc8 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -239,8 +239,6 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
 	       defaultVisual, /* root visual */
 	       numVisuals, visuals);
 
-/*  miInitializeBackingStore(pScreen); */
-
   pScreen->defColormap = (Colormap) FakeClientID(0);
   pScreen->minInstalledCmaps = MINCMAPS;
   pScreen->maxInstalledCmaps = MAXCMAPS;
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index fce3b2c..c8eade8 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -868,28 +868,6 @@ xf86SetRootClip (ScreenPtr pScreen, int enable)
 	    (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
     }
 
-    if (pWin->backStorage &&
-	((pWin->backingStore == Always) || WasViewable))
-    {
-	if (!WasViewable)
-	    pOldClip = &pWin->clipList; /* a convenient empty region */
-	bsExposed = (*pScreen->TranslateBackingStore)
-			     (pWin, 0, 0, pOldClip,
-			      pWin->drawable.x, pWin->drawable.y);
-	if (WasViewable)
-	    RegionDestroy(pOldClip);
-	if (bsExposed)
-	{
-	    RegionPtr	valExposed = NullRegion;
-
-	    if (pWin->valdata)
-		valExposed = &pWin->valdata->after.exposed;
-	    (*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
-	    if (valExposed)
-		RegionEmpty(valExposed);
-	    RegionDestroy(bsExposed);
-	}
-    }
     if (WasViewable)
     {
 	if (anyMarked)
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 57a0884..21036f4 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -394,13 +394,6 @@ winFinishScreenInitFB (int index,
     }
 #endif
 
-  /*
-   * Backing store support should reduce network traffic and increase
-   * performance.
-   */
-  miInitializeBackingStore (pScreen);
-
-  /* KDrive does miDCInitialize right after miInitializeBackingStore */
   /* Setup the cursor routines */
 #if CYGDEBUG
   winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n");
diff --git a/include/Makefile.am b/include/Makefile.am
index eb0e3a7..966d215 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,8 +1,6 @@
 if XORG
 sdk_HEADERS =		\
 	XIstubs.h	\
-	bstore.h	\
-	bstorestr.h	\
 	callback.h	\
 	closestr.h	\
 	closure.h	\
diff --git a/include/bstore.h b/include/bstore.h
deleted file mode 100644
index 843d6bb..0000000
--- a/include/bstore.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 1987 by the Regents of the University of California
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies.  The University of
- * California makes no representations about the suitability of this software
- * for any purpose.  It is provided "as is" without express or implied
- * warranty.
- */
-
-/*
- * Moved here from mi to allow wrapping of lower level backing store functions.
- * -- 1997.10.27  Marc Aurele La France (tsi at xfree86.org)
- */
-
-#ifndef _BSTORE_H_
-#define _BSTORE_H_
-
-#include "bstorestr.h"
-
-#endif /* _BSTORE_H_ */
diff --git a/include/bstorestr.h b/include/bstorestr.h
deleted file mode 100644
index cf7820b..0000000
--- a/include/bstorestr.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 1987 by the Regents of the University of California
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies.  The University of
- * California makes no representations about the suitability of this software
- * for any purpose.  It is provided "as is" without express or implied
- * warranty.
- */
-
-/*
- * Moved here from mi to allow wrapping of lower level backing store functions.
- * -- 1997.10.27  Marc Aurele La France (tsi at xfree86.org)
- */
-
-#ifndef _BSTORESTR_H_
-#define _BSTORESTR_H_
-
-#include "gc.h"
-#include "pixmap.h"
-#include "region.h"
-#include "window.h"
-
-typedef    void (* BackingStoreSaveAreasProcPtr)(
-	PixmapPtr /*pBackingPixmap*/,
-	RegionPtr /*pObscured*/,
-	int /*x*/,
-	int /*y*/,
-	WindowPtr /*pWin*/);
-
-typedef    void (* BackingStoreRestoreAreasProcPtr)(
-	PixmapPtr /*pBackingPixmap*/,
-	RegionPtr /*pExposed*/,
-	int /*x*/,
-	int /*y*/,
-	WindowPtr /*pWin*/);
-
-typedef    void (* BackingStoreSetClipmaskRgnProcPtr)(
-	GCPtr /*pBackingGC*/,
-	RegionPtr /*pbackingCompositeClip*/);
-
-typedef    PixmapPtr (* BackingStoreGetImagePixmapProcPtr)(void);
-
-typedef    PixmapPtr (* BackingStoreGetSpansPixmapProcPtr)(void);
-
-typedef struct _BSFuncs {
-	BackingStoreSaveAreasProcPtr SaveAreas;
-	BackingStoreRestoreAreasProcPtr RestoreAreas;
-	BackingStoreSetClipmaskRgnProcPtr SetClipmaskRgn;
-	BackingStoreGetImagePixmapProcPtr GetImagePixmap;
-	BackingStoreGetSpansPixmapProcPtr GetSpansPixmap;
-} BSFuncRec, *BSFuncPtr;
-
-#endif /* _BSTORESTR_H_ */
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index cd4fb70..813bda1 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -50,7 +50,6 @@ SOFTWARE.
 
 #include "screenint.h"
 #include "regionstr.h"
-#include "bstore.h"
 #include "colormap.h"
 #include "cursor.h"
 #include "validate.h"
@@ -213,48 +212,6 @@ typedef    PixmapPtr (* CreatePixmapProcPtr)(
 typedef    Bool (* DestroyPixmapProcPtr)(
 	PixmapPtr /*pPixmap*/);
 
-typedef    void (* SaveDoomedAreasProcPtr)(
-	WindowPtr /*pWindow*/,
-	RegionPtr /*prgnSave*/,
-	int /*xorg*/,
-	int /*yorg*/);
-
-typedef    RegionPtr (* RestoreAreasProcPtr)(
-	WindowPtr /*pWindow*/,
-	RegionPtr /*prgnRestore*/);
-
-typedef    void (* ExposeCopyProcPtr)(
-	WindowPtr /*pSrc*/,
-	DrawablePtr /*pDst*/,
-	GCPtr /*pGC*/,
-	RegionPtr /*prgnExposed*/,
-	int /*srcx*/,
-	int /*srcy*/,
-	int /*dstx*/,
-	int /*dsty*/,
-	unsigned long /*plane*/);
-
-typedef    RegionPtr (* TranslateBackingStoreProcPtr)(
-	WindowPtr /*pWindow*/,
-	int /*windx*/,
-	int /*windy*/,
-	RegionPtr /*oldClip*/,
-	int /*oldx*/,
-	int /*oldy*/);
-
-typedef    RegionPtr (* ClearBackingStoreProcPtr)(
-	WindowPtr /*pWindow*/,
-	int /*x*/,
-	int /*y*/,
-	int /*w*/,
-	int /*h*/,
-	Bool /*generateExposures*/);
-
-typedef    void (* DrawGuaranteeProcPtr)(
-	WindowPtr /*pWindow*/,
-	GCPtr /*pGC*/,
-	int /*guarantee*/);
-    
 typedef    Bool (* RealizeFontProcPtr)(
 	ScreenPtr /*pScreen*/,
 	FontPtr /*pFont*/);
@@ -511,20 +468,6 @@ typedef struct _Screen {
     CreatePixmapProcPtr		CreatePixmap;
     DestroyPixmapProcPtr	DestroyPixmap;
 
-    /* Backing store procedures */
-
-    SaveDoomedAreasProcPtr	SaveDoomedAreas;
-    RestoreAreasProcPtr		RestoreAreas;
-    ExposeCopyProcPtr		ExposeCopy;
-    TranslateBackingStoreProcPtr TranslateBackingStore;
-    ClearBackingStoreProcPtr	ClearBackingStore;
-    DrawGuaranteeProcPtr	DrawGuarantee;
-    /*
-     * A read/write copy of the lower level backing store vector is needed now
-     * that the functions can be wrapped.
-     */
-    BSFuncRec			BackingStoreFuncs;
-    
     /* Font procedures */
 
     RealizeFontProcPtr		RealizeFont;
diff --git a/mi/Makefile.am b/mi/Makefile.am
index f6dabda..96ceeaa 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -12,9 +12,7 @@ libmi_la_SOURCES = 	\
 	mi.h		\
 	miarc.c		\
 	mibitblt.c	\
-	mibstore.c	\
 	mibstore.h	\
-	mibstorest.h	\
 	micmap.c	\
 	micmap.h	\
 	micoord.h	\
diff --git a/mi/mibstore.c b/mi/mibstore.c
index 262b494..827b9b2 100644
--- a/mi/mibstore.c
+++ b/mi/mibstore.c
@@ -40,10 +40,4 @@
 void
 miInitializeBackingStore (ScreenPtr pScreen)
 {
-    pScreen->SaveDoomedAreas = NULL;
-    pScreen->RestoreAreas = NULL;
-    pScreen->ExposeCopy = NULL;
-    pScreen->TranslateBackingStore = NULL;
-    pScreen->ClearBackingStore = NULL;
-    pScreen->DrawGuarantee = NULL;
 }
diff --git a/mi/mibstore.h b/mi/mibstore.h
index ef7e187..c23caac 100644
--- a/mi/mibstore.h
+++ b/mi/mibstore.h
@@ -18,8 +18,6 @@
 
 #include "screenint.h"
 
-extern _X_EXPORT void miInitializeBackingStore(
-    ScreenPtr /*pScreen*/
-);
+#define miInitializeBackingStore(x) do {} while (0)
 
 #endif /* _MIBSTORE_H */
diff --git a/mi/mibstorest.h b/mi/mibstorest.h
deleted file mode 100644
index ccf4fb7..0000000
--- a/mi/mibstorest.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * mibstorest.h
- *
- * internal structure definitions for mi backing store
- */
-
-
-/*
-
-Copyright 1989, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-*/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "mibstore.h"
-#include "regionstr.h"
-
-/*
- * One of these structures is allocated per GC used with a backing-store
- * drawable.
- */
-
-typedef struct {
-    GCPtr	    pBackingGC;	    /* Copy of the GC but with graphicsExposures
-				     * set FALSE and the clientClip set to
-				     * clip output to the valid regions of the
-				     * backing pixmap. */
-    int		    guarantee;      /* GuaranteeNothing, etc. */
-    unsigned long   serialNumber;   /* clientClip computed time */
-    unsigned long   stateChanges;   /* changes in parent gc since last copy */
-    GCOps	    *wrapOps;	    /* wrapped ops */
-    GCFuncs	    *wrapFuncs;	    /* wrapped funcs */
-} miBSGCRec, *miBSGCPtr;
-
-/*
- * one of these structures is allocated per Window with backing store
- */
-
-typedef struct {
-    PixmapPtr	  pBackingPixmap;   /* Pixmap for saved areas */
-    short	  x;		    /* origin of pixmap relative to window */
-    short	  y;
-    RegionRec	  SavedRegion;	    /* Valid area in pBackingPixmap */
-    char    	  viewable; 	    /* Tracks pWin->viewable so SavedRegion may
-				     * be initialized correctly when the window
-				     * is first mapped */
-    char    	  status;    	    /* StatusNoPixmap, etc. */
-    char	  backgroundState;  /* background type */
-    PixUnion	  background;	    /* background pattern */
-} miBSWindowRec, *miBSWindowPtr;
-
-#define StatusNoPixmap	1	/* pixmap has not been created */
-#define StatusVirtual	2	/* pixmap is virtual, tiled with background */
-#define StatusVDirty	3	/* pixmap is virtual, visiblt has contents */
-#define StatusBadAlloc	4	/* pixmap create failed, do not try again */
-#define StatusContents	5	/* pixmap is created, has valid contents */
-
-typedef struct {
-    /*
-     * screen func wrappers
-     */
-    CloseScreenProcPtr	CloseScreen;
-    GetImageProcPtr	GetImage;
-    GetSpansProcPtr	GetSpans;
-    ChangeWindowAttributesProcPtr ChangeWindowAttributes;
-    CreateGCProcPtr	CreateGC;
-    DestroyWindowProcPtr DestroyWindow;
-} miBSScreenRec, *miBSScreenPtr;
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 661ecb2..33e3737 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -280,13 +280,6 @@ miScreenInit(
     pScreen->SetShape = miSetShape;
     pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow;
 
-    pScreen->SaveDoomedAreas = 0;
-    pScreen->RestoreAreas = 0;
-    pScreen->ExposeCopy = 0;
-    pScreen->TranslateBackingStore = 0;
-    pScreen->ClearBackingStore = 0;
-    pScreen->DrawGuarantee = 0;
-
     miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS);
 
     return miScreenDevPrivateInit(pScreen, width, pbits);
diff --git a/mi/mivalidate.h b/mi/mivalidate.h
index ef258c0..18700ac 100644
--- a/mi/mivalidate.h
+++ b/mi/mivalidate.h
@@ -40,8 +40,7 @@ typedef union _Validate {
 	DDXPointRec	oldAbsCorner;	/* old window position */
 	RegionPtr	borderVisible;	/* visible region of border, */
 					/* non-null when size changes */
-	Bool		resized;	/* unclipped winSize has changed - */
-					/* don't call SaveDoomedAreas */
+	Bool		resized;	/* unclipped winSize has changed */
     } before;
     struct AfterValidate {
 	RegionRec	exposed;	/* exposed regions, absolute pos */
diff --git a/miext/rootless/rootlessValTree.c b/miext/rootless/rootlessValTree.c
index e2c4ffe..d242600 100644
--- a/miext/rootless/rootlessValTree.c
+++ b/miext/rootless/rootlessValTree.c
@@ -471,18 +471,6 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
 			       universe, &pParent->clipList);
     }
 
-    /*
-     * One last thing: backing storage. We have to try to save what parts of
-     * the window are about to be obscured. We can just subtract the universe
-     * from the old clipList and get the areas that were in the old but aren't
-     * in the new and, hence, are about to be obscured.
-     */
-    if (pParent->backStorage && !resized)
-    {
-	RegionSubtract(exposed, &pParent->clipList, universe);
-	(* pScreen->SaveDoomedAreas)(pParent, exposed, dx, dy);
-    }
-    
     /* HACK ALERT - copying contents of regions, instead of regions */
     {
 	RegionRec   tmp;
commit 48bc8d0dd99284f509bc6de01a8fd24a7bfc69d5
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Oct 6 09:56:56 2010 -0400

    render: repack PictureRec
    
    Eliminate the unused dither field, move filter and stateChanges into the
    bitfield, and reorder elements to pack holes on LP64.
    
    sizeof(PictureRec)      ILP32       LP64
    before:                    84        152
    after:                     72        120
    
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 915e767..ab26593 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -1011,8 +1011,6 @@ void dmxValidatePicture(PicturePtr pPicture, Mask mask)
 	    attribs.poly_edge = pPicture->polyEdge;
 	if (mask & CPPolyMode)
 	    attribs.poly_mode = pPicture->polyMode;
-	if (mask & CPDither)
-	    attribs.dither = pPicture->dither;
 	if (mask & CPComponentAlpha)
 	    attribs.component_alpha = pPicture->componentAlpha;
 
diff --git a/render/picture.c b/render/picture.c
index 896eaa7..0028cc7 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -735,13 +735,12 @@ SetPictureToDefaults (PicturePtr    pPicture)
 
     pPicture->transform = 0;
 
-    pPicture->dither = None;
     pPicture->filter = PictureGetFilterId (FilterNearest, -1, TRUE);
     pPicture->filter_params = 0;
     pPicture->filter_nparams = 0;
 
     pPicture->serialNumber = GC_CHANGE_SERIAL_BIT;
-    pPicture->stateChanges = (1 << (CPLastBit+1)) - 1;
+    pPicture->stateChanges = -1;
     pPicture->pSourcePict = 0;
 }
 
@@ -1261,7 +1260,7 @@ ChangePicture (PicturePtr	pPicture,
 	    }
 	    break;
 	case CPDither:
-	    pPicture->dither = NEXT_VAL(Atom);
+	    (void) NEXT_VAL(Atom); /* unimplemented */
 	    break;
 	case CPComponentAlpha:
 	    {
@@ -1480,7 +1479,6 @@ CopyPicture (PicturePtr	pSrc,
 	    pDst->polyMode = pSrc->polyMode;
 	    break;
 	case CPDither:
-	    pDst->dither = pSrc->dither;
 	    break;
 	case CPComponentAlpha:
 	    pDst->componentAlpha = pSrc->componentAlpha;
diff --git a/render/picturestr.h b/render/picturestr.h
index 5c6c41e..ae69eef 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -151,8 +151,6 @@ typedef struct _Picture {
     PictFormatShort format;	    /* PICT_FORMAT */
     int		    refcnt;
     CARD32	    id;
-    PicturePtr	    pNext;	    /* chain on same drawable */
-
     unsigned int    repeat : 1;
     unsigned int    graphicsExposures : 1;
     unsigned int    subWindowMode : 1;
@@ -162,7 +160,11 @@ typedef struct _Picture {
     unsigned int    clientClipType : 2;
     unsigned int    componentAlpha : 1;
     unsigned int    repeatType : 2;
-    unsigned int    unused : 21;
+    unsigned int    filter : 3;
+    unsigned int    stateChanges : CPLastBit;
+    unsigned int    unused : 18 - CPLastBit;
+
+    PicturePtr	    pNext;	    /* chain on same drawable */
 
     PicturePtr	    alphaMap;
     DDXPointRec	    alphaOrigin;
@@ -170,9 +172,6 @@ typedef struct _Picture {
     DDXPointRec	    clipOrigin;
     pointer	    clientClip;
 
-    Atom	    dither;
-
-    unsigned long   stateChanges;
     unsigned long   serialNumber;
 
     RegionPtr	    pCompositeClip;
@@ -181,10 +180,9 @@ typedef struct _Picture {
 
     PictTransform   *transform;
 
-    int		    filter;
+    SourcePictPtr   pSourcePict;
     xFixed	    *filter_params;
     int		    filter_nparams;
-    SourcePictPtr   pSourcePict;
 } PictureRec;
 
 typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id,
@@ -205,6 +203,7 @@ typedef struct {
 #define PictFilterBest		4
 
 #define PictFilterConvolution	5
+/* if you add an 8th filter, expand the filter bitfield above */
 
 typedef struct {
     char	    *alias;
commit ffcbfa0063bdc7c9ad5ac724285c7b6e67044c18
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Mon Nov 15 20:43:18 2010 -0800

    xfree86: Fix rotation of 2-color non-interleaved cursor images
    
    When RandR 1.2's transformation code is enabled, it rotates the cursor
    image so that it appears upright on a rotated screen.  This code
    completely mangles 2-color cursors on hardware where the the mask and
    source images are not interleaved due to two problems:
    
    1. stride is calculated as (width / 4) rather than (width / 8), so the
       expression (y * stride) skips two lines instead of one for every
       time y is incremented.
    2. cursor_bitpos ignores the 'mask' parameter if the hardware doesn't
       specify any of the HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_* flags.
    
    To fix this, refactor the code to pass the whole xf86CursorInfoPtr
    through to cursor_bitpos and compute the correct stride there based on
    the flags.  If none of the SOURCE_MASK_INTERLEAVE flags are set, use
    the total cursor size to move the 'image' variable into the mask part
    of the image before computing the desired byte pointer.
    
    Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Robert Morell <rmorell at nvidia.com>
    Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
    Tested-by: Cyril Brulebois <kibi at debian.org>

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index ab07b60..0667447 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -1,5 +1,6 @@
 /*
  * Copyright © 2007 Keith Packard
+ * Copyright © 2010 Aaron Plattner
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -126,12 +127,33 @@ xf86_crtc_rotate_coord_back (Rotation    rotation,
     *y_src = y_dst;
 }
 
+struct cursor_bit {
+    CARD8 *byte;
+    char bitpos;
+};
+
 /*
  * Convert an x coordinate to a position within the cursor bitmap
  */
-static int
-cursor_bitpos (int flags, int x, Bool mask)
+static struct cursor_bit
+cursor_bitpos (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y,
+	       Bool mask)
 {
+    const int flags = cursor_info->Flags;
+    const Bool interleaved =
+	!!(flags & (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
+		    HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 |
+		    HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 |
+		    HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 |
+		    HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64));
+    const int width = cursor_info->MaxWidth;
+    const int height = cursor_info->MaxHeight;
+    const int stride = interleaved ? width / 4 : width / 8;
+
+    struct cursor_bit ret;
+
+    image += y * stride;
+
     if (flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK)
 	mask = !mask;
     if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED)
@@ -149,29 +171,33 @@ cursor_bitpos (int flags, int x, Bool mask)
 	x = ((x & ~31) << 1) | (mask << 5) | (x & 31);
     else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64)
 	x = ((x & ~63) << 1) | (mask << 6) | (x & 63);
-    return x;
+    else if (mask)
+	image += stride * height;
+
+    ret.byte = image + (x / 8);
+    ret.bitpos = x & 7;
+
+    return ret;
 }
 
 /*
  * Fetch one bit from a cursor bitmap
  */
 static CARD8
-get_bit (CARD8 *image, int stride, int flags, int x, int y, Bool mask)
+get_bit (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
 {
-    x = cursor_bitpos (flags, x, mask);
-    image += y * stride;
-    return (image[(x >> 3)] >> (x & 7)) & 1;
+    struct cursor_bit bit = cursor_bitpos(image, cursor_info, x, y, mask);
+    return (*bit.byte >> bit.bitpos) & 1;
 }
 
 /*
  * Set one bit in a cursor bitmap
  */
 static void
-set_bit (CARD8 *image, int stride, int flags, int x, int y, Bool mask)
+set_bit (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
 {
-    x = cursor_bitpos (flags, x, mask);
-    image += y * stride;
-    image[(x >> 3)] |= 1 << (x & 7);
+    struct cursor_bit bit = cursor_bitpos(image, cursor_info, x, y, mask);
+    *bit.byte |= 1 << bit.bitpos;
 }
     
 /*
@@ -186,7 +212,6 @@ xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src)
     CARD32		*cursor_image = (CARD32 *) xf86_config->cursor_image;
     int			x, y;
     int			xin, yin;
-    int			stride = cursor_info->MaxWidth >> 2;
     int			flags = cursor_info->Flags;
     CARD32		bits;
 
@@ -201,10 +226,10 @@ xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src)
 				    cursor_info->MaxWidth,
 				    cursor_info->MaxHeight,
 				    x, y, &xin, &yin);
-	    if (get_bit (src, stride, flags, xin, yin, TRUE) ==
+	    if (get_bit (src, cursor_info, xin, yin, TRUE) ==
 		((flags & HARDWARE_CURSOR_INVERT_MASK) == 0))
 	    {
-		if (get_bit (src, stride, flags, xin, yin, FALSE))
+		if (get_bit (src, cursor_info, xin, yin, FALSE))
 		    bits = xf86_config->cursor_fg;
 		else
 		    bits = xf86_config->cursor_bg;
@@ -407,7 +432,6 @@ xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src)
         int x, y;
     	int xin, yin;
 	int stride = cursor_info->MaxWidth >> 2;
-	int flags = cursor_info->Flags;
 	
 	cursor_image = xf86_config->cursor_image;
 	memset(cursor_image, 0, cursor_info->MaxHeight * stride);
@@ -419,10 +443,10 @@ xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src)
 					cursor_info->MaxWidth,
 					cursor_info->MaxHeight,
 					x, y, &xin, &yin);
-		if (get_bit(src, stride, flags, xin, yin, FALSE))
-		    set_bit(cursor_image, stride, flags, x, y, FALSE);
-		if (get_bit(src, stride, flags, xin, yin, TRUE))
-		    set_bit(cursor_image, stride, flags, x, y, TRUE);
+		if (get_bit(src, cursor_info, xin, yin, FALSE))
+		    set_bit(cursor_image, cursor_info, x, y, FALSE);
+		if (get_bit(src, cursor_info, xin, yin, TRUE))
+		    set_bit(cursor_image, cursor_info, x, y, TRUE);
 	    }
     }
     crtc->funcs->load_cursor_image (crtc, cursor_image);
commit 7ee965a300c9eddcc1acacf9414cfe3e589222a8
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue May 11 09:16:19 2010 -0400

    linux: Refactor VT switch on {re,}generation and shutdown
    
    This makes more things fatal than were fatal before, but that's correct;
    if you need the VT, then failing to get it on regeneration means things
    are about to go very very badly.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 58051d7..9c71a42 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -59,6 +59,16 @@ drain_console(int fd, void *closure)
     }
 }
 
+static void
+switch_to(int vt, const char *from)
+{
+    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt) < 0)
+        FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
+
+    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt) < 0)
+        FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
+}
+
 void
 xf86OpenConsole(void)
 {
@@ -174,13 +184,7 @@ xf86OpenConsole(void)
 	    /*
 	     * now get the VT.  This _must_ succeed, or else fail completely.
 	     */
-	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
-	        FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n",
-		           strerror(errno));
-
-	    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
-	        FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
-			   strerror(errno));
+            switch_to(xf86Info.vtno, "xf86OpenConsole");
 
 	    if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
 	        FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
@@ -227,16 +231,8 @@ xf86OpenConsole(void)
     } else { 	/* serverGeneration != 1 */
         if (!ShareVTs && VTSwitch)
         {
-	    /*
-	     * now get the VT
-	     */
-	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
-	        xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed %s\n",
-		        strerror(errno));
-
-	    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
-	        xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed %s\n",
-		        strerror(errno));
+	    /* now get the VT */
+            switch_to(xf86Info.vtno, "xf86OpenConsole");
         }
     }
 }
@@ -281,13 +277,7 @@ xf86CloseConsole(void)
          * Perform a switch back to the active VT when we were started
          */
         if (activeVT >= 0) {
-	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT) < 0)
-	        xf86Msg(X_WARNING, "xf86CloseConsole: VT_ACTIVATE failed: %s\n",
-		        strerror(errno));
-	    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, activeVT) < 0)
-		xf86Msg(X_WARNING,
-			"xf86CloseConsole: VT_WAITACTIVE failed: %s\n",
-			strerror(errno));
+            switch_to(activeVT, "xf86CloseConsole");
 	    activeVT = -1;
         }
     }
commit 0def735c6a9fab19acc4b806def6921a702f617f
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue May 11 08:40:33 2010 -0400

    xfree86: Remove dead ifdefs from VT switching
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/shared/VTsw_usl.c b/hw/xfree86/os-support/shared/VTsw_usl.c
index d4ef0f7..818de17 100644
--- a/hw/xfree86/os-support/shared/VTsw_usl.c
+++ b/hw/xfree86/os-support/shared/VTsw_usl.c
@@ -31,10 +31,6 @@
 #include "xf86Priv.h"
 #include "xf86_OSlib.h"
 
-#ifdef OSHEADER
-# include OSHEADER
-#endif
-
 /*
  * Handle the VT-switching interface for OSs that use USL-style ioctl()s
  * (the sysv, sco, and linux subdirs).
@@ -63,16 +59,9 @@ xf86VTSwitchAway(void)
 {
 	xf86Info.vtRequestsPending = FALSE;
 	if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
-	{
 		return FALSE;
-	}
 	else
-	{
-#ifdef OSSWITCHAWAY
-	        OSSWITCHAWAY;
-#endif
 		return TRUE;
-	}
 }
 
 Bool
@@ -80,13 +69,9 @@ xf86VTSwitchTo(void)
 {
 	xf86Info.vtRequestsPending = FALSE;
 	if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
-	{
 		return FALSE;
-	}
 	else
-	{
 		return TRUE;
-	}
 }
 
 Bool
commit 96a7a7d197d5f96e7aa51928155d4b8d5a115875
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon May 10 18:40:09 2010 -0400

    linux: Don't muck about with tty permissions
    
    This is not X's job.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 9b50ccd..58051d7 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -43,42 +43,10 @@ static Bool VTSwitch = TRUE;
 static Bool ShareVTs = FALSE;
 static int activeVT = -1;
 
-static int vtPermSave[4];
 static char vtname[11];
 static struct termios tty_attr; /* tty state to restore */
 static int tty_mode; /* kbd mode to restore */
 
-static int
-saveVtPerms(void)
-{
-    /* We need to use stat to get permissions. */
-    struct stat svtp;
-
-    /* Do them numerically ordered, hard coded tty0 first. */
-    if (stat("/dev/tty0", &svtp) != 0)
-	return 0;
-    vtPermSave[0] = (int)svtp.st_uid;
-    vtPermSave[1] = (int)svtp.st_gid;
-
-    /* Now check the console we are dealing with. */
-    if (stat(vtname, &svtp) != 0)
-	return 0;
-    vtPermSave[2] = (int)svtp.st_uid;
-    vtPermSave[3] = (int)svtp.st_gid;
-
-    return 1;
-}
-
-static void
-restoreVtPerms(void)
-{
-    if (geteuid() == 0) {
-	 /* Set the terminal permissions back to before we started. */
-	 (void)chown("/dev/tty0", vtPermSave[0], vtPermSave[1]);
-	 (void)chown(vtname, vtPermSave[2], vtPermSave[3]);
-    }
-}
-
 static void *console_handler;
 
 static void
@@ -177,34 +145,6 @@ xf86OpenConsole(void)
 	    FatalError("xf86OpenConsole: Cannot open virtual console"
 		       " %d (%s)\n", xf86Info.vtno, strerror(errno));
 
-        if (!ShareVTs)
-        {
-	    /*
-	     * Grab the vt ownership before we overwrite it.
-	     * Hard coded /dev/tty0 into this function as well for below.
-	     */
-	    if (!saveVtPerms())
-	        xf86Msg(X_WARNING,
-		        "xf86OpenConsole: Could not save ownership of VT\n");
-
-	    if (geteuid() == 0) {
-		    /* change ownership of the vt */
-		    if (chown(vtname, getuid(), getgid()) < 0)
-			    xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n",
-				    vtname, strerror(errno));
-
-		    /*
-		     * the current VT device we're running on is not
-		     * "console", we want to grab all consoles too
-		     *
-		     * Why is this needed??
-		     */
-		    if (chown("/dev/tty0", getuid(), getgid()) < 0)
-			    xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n",
-				    strerror(errno));
-	    }
-        }
-
 	/*
 	 * Linux doesn't switch to an active vt after the last close of a vt,
 	 * so we do this ourselves by remembering which is active now.
@@ -352,8 +292,6 @@ xf86CloseConsole(void)
         }
     }
     close(xf86Info.consoleFd);	/* make the vt-manager happy */
-
-    restoreVtPerms();		/* restore the permissions */
 }
 
 int
commit 6ce1908ba4959aaa0a48171acb62cf6a5d5cbf18
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed May 12 08:50:54 2010 -0400

    xfree86: Remove os-support/sysv
    
    Nothing's using it, the SysV derivatives we support have their own
    custom versions.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/configure.ac b/configure.ac
index bd027cd..83bd96f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2230,7 +2230,6 @@ hw/xfree86/os-support/misc/Makefile
 hw/xfree86/os-support/linux/Makefile
 hw/xfree86/os-support/sco/Makefile
 hw/xfree86/os-support/solaris/Makefile
-hw/xfree86/os-support/sysv/Makefile
 hw/xfree86/parser/Makefile
 hw/xfree86/ramdac/Makefile
 hw/xfree86/shadowfb/Makefile
diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am
index 04997a6..b50f441 100644
--- a/hw/xfree86/os-support/Makefile.am
+++ b/hw/xfree86/os-support/Makefile.am
@@ -1,5 +1,5 @@
 SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
-DIST_SUBDIRS = bsd bus misc linux solaris sysv sco hurd
+DIST_SUBDIRS = bsd bus misc linux solaris sco hurd
 
 sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h
 
diff --git a/hw/xfree86/os-support/sysv/Makefile.am b/hw/xfree86/os-support/sysv/Makefile.am
deleted file mode 100644
index e86e70a..0000000
--- a/hw/xfree86/os-support/sysv/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_DIST = sysv_init.c sysv_video.c
diff --git a/hw/xfree86/os-support/sysv/sysv_init.c b/hw/xfree86/os-support/sysv/sysv_init.c
deleted file mode 100644
index 9a423ff..0000000
--- a/hw/xfree86/os-support/sysv/sysv_init.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Wexelblat <dwex at goblin.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Thomas Roell and David Wexelblat 
- * not be used in advertising or publicity pertaining to distribution of 
- * the software without specific, written prior permission.  Thomas Roell and
- * David Wexelblat makes no representations about the suitability of this 
- * software for any purpose.  It is provided "as is" without express or 
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO 
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 
- * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR 
- * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-static Bool KeepTty = FALSE;
-#ifdef SVR4
-static Bool Protect0 = FALSE;
-#endif
-static int VTnum = -1;
-
-
-void
-xf86OpenConsole()
-{
-    int fd;
-    struct vt_mode VT;
-    char vtname1[10],vtname2[10];
-    MessageType from = X_PROBED;
-
-    if (serverGeneration == 1) 
-    {
-    	/* check if we're run with euid==0 */
-    	if (geteuid() != 0)
-	{
-      	    FatalError("xf86OpenConsole: Server must be suid root\n");
-	}
-
-#ifdef SVR4
-	/* Protect page 0 to help find NULL dereferencing */
-	/* mprotect() doesn't seem to work */
-	if (Protect0)
-	{
-	    int fd = -1;
-
-	    if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0)
-	    {
-		xf86Msg(X_WARNING,
-			"xf86OpenConsole: cannot open /dev/zero (%s)\n",
-			strerror(errno));
-	    }
-	    else
-	    {
-		if ((int)mmap(0, 0x1000, PROT_NONE,
-			      MAP_FIXED | MAP_SHARED, fd, 0) == -1)
-		{
-		    xf86Msg(X_WARNING,
-			"xf86OpenConsole: failed to protect page 0 (%s)\n",
-			strerror(errno));
-		}
-		close(fd);
-	    }
-	}
-#endif
-    	/*
-     	 * setup the virtual terminal manager
-     	 */
-    	if (VTnum != -1) 
-	{
-      	    xf86Info.vtno = VTnum;
-	    from = X_CMDLINE;
-    	}
-    	else 
-	{
-      	    if ((fd = open("/dev/console",O_WRONLY,0)) < 0) 
-	    {
-        	FatalError(
-		    "xf86OpenConsole: Cannot open /dev/console (%s)\n",
-		    strerror(errno));
-	    }
-      	    if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || 
-		(xf86Info.vtno == -1))
-	    {
-        	FatalError("xf86OpenConsole: Cannot find a free VT\n");
-	    }
-           close(fd);
-        }
-	xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
-
-	sprintf(vtname1,"/dev/vc%02d",xf86Info.vtno); /* ESIX */
-	sprintf(vtname2,"/dev/vt%02d",xf86Info.vtno); /* rest of the world */
-
-	if (!KeepTty)
-    	{
-    	    setpgrp();
-	}
-
-	if (((xf86Info.consoleFd = open(vtname1, O_RDWR|O_NDELAY, 0)) < 0) &&
-	    ((xf86Info.consoleFd = open(vtname2, O_RDWR|O_NDELAY, 0)) < 0))
-	{
-            FatalError("xf86OpenConsole: Cannot open %s (%s) (%s)\n",
-		       vtname2, vtname1, strerror(errno));
-	}
-
-	/* change ownership of the vt */
-	if (chown(vtname1, getuid(), getgid()) < 0)
-	{
-            chown(vtname2, getuid(), getgid());
-	}
-
-	/*
-	 * now get the VT
-	 */
-	if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
-	{
-    	    xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
-	}
-	if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
-	{
-	    xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
-	}
-	if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) 
-	{
-	    FatalError("xf86OpenConsole: VT_GETMODE failed\n");
-	}
-
-	signal(SIGUSR1, xf86VTRequest);
-
-	VT.mode = VT_PROCESS;
-	VT.relsig = SIGUSR1;
-	VT.acqsig = SIGUSR1;
-	if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) 
-	{
-	    FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
-	}
-	if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
-	{
-	    FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
-	}
-    }
-    else 
-    {   
-	/* serverGeneration != 1 */
-	/*
-	 * now get the VT
-	 */
-	if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
-	{
-	    xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
-	}
-	if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
-	{
-      	    xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
-	}
-	/*
-	 * If the server doesn't have the VT when the reset occurs,
-	 * this is to make sure we don't continue until the activate
-	 * signal is received.
-	 */
-	if (!xf86Screens[0]->vtSema)
-	    sleep(5);
-    }
-    return;
-}
-
-void
-xf86CloseConsole()
-{
-    struct vt_mode   VT;
-
-#if 0
-    ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno);
-    ioctl(xf86Info.consoleFd, VT_WAITACTIVE, 0);
-#endif
-    ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);  /* Back to text mode ... */
-    if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
-    {
-	VT.mode = VT_AUTO;
-	ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
-    }
-    close(xf86Info.consoleFd);                 /* make the vt-manager happy */
-    return;
-}
-
-int
-xf86ProcessArgument(int argc, char *argv[], int i)
-{
-	/*
-	 * Keep server from detaching from controlling tty.  This is useful 
-	 * when debugging (so the server can receive keyboard signals.
-	 */
-	if (!strcmp(argv[i], "-keeptty"))
-	{
-		KeepTty = TRUE;
-		return 1;
-	}
-#ifdef SVR4
-	/*
-	 * Undocumented flag to protect page 0 from read/write to help
-	 * catch NULL pointer dereferences.  This is purely a debugging
-	 * flag.
-	 */
-	if (!strcmp(argv[i], "-protect0"))
-	{
-		Protect0 = TRUE;
-		return 1;
-	}
-#endif
-	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
-	{
-		if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
-		{
-			UseMsg();
-			VTnum = -1;
-			return 0;
-		}
-		return 1;
-	}
-	return 0;
-}
-
-void
-xf86UseMsg()
-{
-	ErrorF("vtXX                   use the specified VT number\n");
-	ErrorF("-keeptty               ");
-	ErrorF("don't detach controlling tty (for debugging only)\n");
-	return;
-}
diff --git a/hw/xfree86/os-support/sysv/sysv_video.c b/hw/xfree86/os-support/sysv/sysv_video.c
deleted file mode 100644
index 480abe5..0000000
--- a/hw/xfree86/os-support/sysv/sysv_video.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Wexelblat <dwex at goblin.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Thomas Roell and David Wexelblat 
- * not be used in advertising or publicity pertaining to distribution of 
- * the software without specific, written prior permission.  Thomas Roell and
- * David Wexelblat makes no representations about the suitability of this 
- * software for any purpose.  It is provided "as is" without express or 
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO 
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 
- * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR 
- * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86OSpriv.h"
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-#ifndef SI86IOPL
-#define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
-#define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
-#else
-#define SET_IOPL() sysi86(SI86IOPL,3)
-#define RESET_IOPL() sysi86(SI86IOPL,0)
-#endif
-
-/***************************************************************************/
-/* Video Memory Mapping section                                            */
-/***************************************************************************/
-
-/*
- * XXX Support for SVR3 will need to be reworked if needed.  In particular
- * the Region parameter is no longer passed, and will need to be dealt
- * with internally if required.
- * OK, i'll rework that thing ... (clean it up a lot)
- * SVR3 Support only with SVR3_MMAPDRV (mr)
- * 
- */
-
-#ifdef HAS_SVR3_MMAPDRV
-#ifndef MMAP_DEBUG
-#define MMAP_DEBUG	3
-#endif
-
-struct kd_memloc MapDSC;
-int mmapFd = -2;
-
-static int
-mmapStat(pointer Base, unsigned long Size) {
-
-	int nmmreg,i=0,region=-1;
-	mmapinfo_t *ibuf;
-
-	nmmreg = ioctl(mmapFd, GETNMMREG);
-
-	if(nmmreg <= 0)
-	   xf86MsgVerb(X_INFO, MMAP_DEBUG,
-			  "\nNo physical memory mapped currently.\n\n");
-	else {
-	  if((ibuf = (mmapinfo_t *)malloc(nmmreg*sizeof(mmapinfo_t))) == NULL) 
-		xf86Msg(X_WARNING,
-			  "Couldn't allocate memory 4 mmapinfo_t\n");
-	  else {
-	     if(ioctl(mmapFd, GETMMREG, ibuf) != -1)
-		{ 
-		   xf86MsgVerb(X_INFO, MMAP_DEBUG,
-				"# mmapStat: [Size=%x,Base=%x]\n", Size, Base);
-		   xf86MsgVerb(X_INFO, MMAP_DEBUG,
-		     "#      Physical Address     Size      Reference Count\n");
-		for(i = 0; i < nmmreg; i++) {
-		   xf86MsgVerb(X_INFO, MMAP_DEBUG,
-                      "%-4d   0x%08X         %5dk                %5d	",
-          	      i, ibuf[i].physaddr, ibuf[i].length/1024, ibuf[i].refcnt);
-		   if (ibuf[i].physaddr == Base || ibuf[i].length == Size ) {
-			xf86MsgVerb(X_INFO, MMAP_DEBUG,"MATCH !!!");
-			if (region==-1) region=i;
-                      }
-		   xf86ErrorFVerb(MMAP_DEBUG, "\n");
-		}
-		xf86ErrorFVerb(MMAP_DEBUG, "\n");
-		}
-	     free(ibuf);
-	   }
-	}
-	if (region == -1 && nmmreg > 0) region=region * i;
-	return region;
-}
-#endif
-
-
-static Bool
-linearVidMem()
-{
-#ifdef SVR4
-	return TRUE;
-#elif defined(HAS_SVR3_MMAPDRV)
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-		    "# xf86LinearVidMem: MMAP 2.2.2 called\n");
-
-	if(mmapFd >= 0) return TRUE;
-
-	if ((mmapFd = open("/dev/mmap", O_RDWR)) != -1)
-	{
-	    if(ioctl(mmapFd, GETVERSION) < 0x0222) {
-		xf86Msg(X_WARNING,
-			"xf86LinearVidMem: MMAP 2.2.2 or above required\n");
-		xf86ErrorF("\tlinear memory access disabled\n");
-		return FALSE;
-	    }
-	    return TRUE;
-	}
-	xf86Msg(X_WARNING, "xf86LinearVidMem: failed to open /dev/mmap (%s)\n",
-	        strerror(errno));
-	xf86ErrorF("\tlinear memory access disabled\n");
-	return FALSE;
-#endif
-}
-
-static pointer
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
-	pointer base;
-	int fd;
-
-#if defined(SVR4)
-	fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
-	if (fd < 0)
-	{
-		FatalError("xf86MapVidMem: failed to open %s (%s)\n",
-			   DEV_MEM, strerror(errno));
-	}
-	base = mmap((caddr_t)0, Size,
-		    (flags & VIDMEM_READONLY) ?
-		     PROT_READ : (PROT_READ | PROT_WRITE),
-		    MAP_SHARED, fd, (off_t)Base);
-	close(fd);
-	if (base == MAP_FAILED)
-	{
-		FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
-			   "xf86MapVidMem", Size, Base, strerror(errno));
-	}
-#else /* SVR4 */
-#ifdef HAS_SVR3_MMAPDRV
-
-	xf86MsgVerb(X_INFO, MMAP_DEBUG, "# xf86MapVidMem: MMAP 2.2.2 called\n");
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-			"MMAP_VERSION: 0x%x\n",ioctl(mmapFd, GETVERSION));
-	if (ioctl(mmapFd, GETVERSION) == -1)
-	{
-		xf86LinearVidMem();
-	}
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-			"MMAP_VERSION: 0x%x\n",ioctl(mmapFd, GETVERSION));
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-		"xf86MapVidMem: Screen: %d\n", ScreenNum);
-	mmapStat(Base,Size);
-	/* To force the MMAP driver to provide the address */
-	base = (pointer)0;
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-			"xf86MapVidMem: [s=%x,a=%x]\n", Size, Base);
-	MapDSC.vaddr    = (char *)base;
-	MapDSC.physaddr = (char *)Base;
-	MapDSC.length   = Size;
-	MapDSC.ioflg    = 1;
-	if(mmapFd >= 0)
-	{
-	    if((base = (pointer)ioctl(mmapFd, MAP, &MapDSC)) == (pointer)-1)
-	    {
-		FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
-			   "xf86MapVidMem", Size, Base, strerror(errno));
-		/* NOTREACHED */
-	    }
-
-	    /* Next time we want the same address! */
-	    MapDSC.vaddr    = (char *)base;
-	}
-
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-			"MapDSC.vaddr   : 0x%x\n", MapDSC.vaddr);
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-			"MapDSC.physaddr: 0x%x\n", MapDSC.physaddr);
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-			"MapDSC.length  : %d\n", MapDSC.length);
-	mmapStat(Base,Size);
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-			"xf86MapVidMem: [s=%x,a=%x,b=%x]\n", Size, Base, base);
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-			"xf86MapVidMem: SUCCEED Mapping FrameBuffer \n");
-#endif /* HAS_SVR3_MMAPDRV */
-#endif /* SVR4 */
-	return base;
-}
-
-/* ARGSUSED */
-static void
-unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
-{
-#if defined (SVR4)
-	munmap(Base, Size);
-#else /* SVR4 */
-#ifdef HAS_SVR3_MMAPDRV
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-	        "# xf86UnMapVidMem: UNMapping FrameBuffer\n");
-	mmapStat(Base,Size);
-	ioctl(mmapFd, UNMAPRM , Base);
-	mmapStat(Base,Size);
-	xf86MsgVerb(X_INFO, MMAP_DEBUG,
-		"# xf86UnMapVidMem: Screen: %d [v=%x]\n", ScreenNum, Base);
-#endif /* HAS_SVR3_MMAPDRV */
-#endif /* SVR4 */
-	return;
-}
-
-#if defined(SVR4) && defined(__i386__) && !defined(sun)
-/*
- * For some SVR4 versions, a 32-bit read is done for the first location
- * in each page when the page is first mapped.  If this is done while
- * memory access is enabled for regions that have read side-effects,
- * this can cause unexpected results, including lockups on some hardware.
- * This function is called to make sure each page is mapped while it is
- * safe to do so.
- */
-
-/*
- * XXX Should get this the correct way (see os/xalloc.c), but since this is
- * for one platform I'll be lazy.
- */
-#define X_PAGE_SIZE 4096
-
-static void
-readSideEffects(int ScreenNum, pointer Base, unsigned long Size)
-{
-	unsigned long base, end, addr;
-	CARD32 val;
-
-	base = (unsigned long)Base;
-	end = base + Size;
-
-	for (addr = base; addr < end; addr += X_PAGE_SIZE)
-		val = *(volatile CARD32 *)addr;
-}
-#endif
-
-void
-xf86OSInitVidMem(VidMemInfoPtr pVidMem)
-{
-	pVidMem->linearSupported = linearVidMem();
-	pVidMem->mapMem = mapVidMem;
-	pVidMem->unmapMem = unmapVidMem;
-#if defined(SVR4) && defined(__i386__) && !defined(sun)
-	pVidMem->readSideEffects = readSideEffects;
-#endif
-	pVidMem->initialised = TRUE;
-}
-	
-/***************************************************************************/
-/* I/O Permissions section                                                 */
-/***************************************************************************/
-
-static Bool ExtendedEnabled = FALSE;
-static Bool InitDone = FALSE;
-
-Bool
-xf86EnableIO()
-{
-	int i;
-
-	if (ExtendedEnabled)
-		return TRUE;
-
-	if (SET_IOPL() < 0)
-	{
-	    xf86Msg(X_WARNING,
-			"xf86EnableIO: Failed to set IOPL for extended I/O\n");
-	    return FALSE;
-	}
-	ExtendedEnabled = TRUE;
-
-	return TRUE;
-}
-	
-void
-xf86DisableIO()
-{
-	if (!ExtendedEnabled)
-		return;
-
-	RESET_IOPL();
-	ExtendedEnabled = FALSE;
-
-	return;
-}
commit 01159ffc4718ba48ab7b16acaffd8008f9803811
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon May 10 18:14:49 2010 -0400

    linux: Remove redundant variable
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 7ee9046..9b50ccd 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -39,7 +39,6 @@
 #include <sys/stat.h>
 
 static Bool KeepTty = FALSE;
-static int VTnum = -1;
 static Bool VTSwitch = TRUE;
 static Bool ShareVTs = FALSE;
 static int activeVT = -1;
@@ -112,8 +111,7 @@ xf86OpenConsole(void)
 	/*
 	 * setup the virtual terminal manager
 	 */
-	if (VTnum != -1) {
-	    xf86Info.vtno = VTnum;
+	if (xf86Info.vtno != -1) {
 	    from = X_CMDLINE;
 	} else {
 
@@ -382,10 +380,10 @@ xf86ProcessArgument(int argc, char *argv[], int i)
         }
 	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
 	{
-		if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
+		if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0)
 		{
 			UseMsg();
-			VTnum = -1;
+			xf86Info.vtno = -1;
 			return 0;
 		}
 		return 1;
commit a80780a7638f847c3be20e5e0c7fe85e83d9bdd1
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Nov 17 09:03:06 2010 -0500

    glx: Remove swap barrier and hyperpipe support
    
    Never implemented in any open source driver.  The implementation
    assumed explicit DDX driver knowledge of how the client-side driver
    worked, since at the time the server's GL renderer was not a DRI driver.
    But now, it is, so any implementation of these should be done with
    additional DRI driver API, like the swap control extension.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/glx/Makefile.am b/glx/Makefile.am
index 9d9fa3c..d708872 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -68,7 +68,6 @@ libglx_la_SOURCES = \
 	indirect_program.c \
 	indirect_table.h \
 	indirect_texture_compression.c \
-        g_disptab.h \
         glxbyteorder.h \
         glxcmds.c \
         glxcmdsswap.c \
diff --git a/glx/g_disptab.h b/glx/g_disptab.h
deleted file mode 100644
index 9b4308b..0000000
--- a/glx/g_disptab.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _GLX_g_disptab_h_
-#define _GLX_g_disptab_h_
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-extern int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDisp_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDisp_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDisp_DestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc);
-extern int __glXDisp_QueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDisp_HyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc);
-
-extern int __glXDispSwap_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDispSwap_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDispSwap_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDispSwap_DestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc);
-extern int __glXDispSwap_QueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDispSwap_HyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc);
-
-#endif /* _GLX_g_disptab_h_ */
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 8d13c15..de9c3f0 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -38,7 +38,6 @@
 #include "glxserver.h"
 #include <GL/glxtokens.h>
 #include <unpack.h>
-#include "g_disptab.h"
 #include <pixmapstr.h>
 #include <windowstr.h>
 #include "glxutil.h"
@@ -2061,238 +2060,6 @@ int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
     }
 }
 
-extern RESTYPE __glXSwapBarrierRes;
-
-int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc;
-    XID drawable = req->drawable;
-    int barrier = req->barrier;
-    DrawablePtr pDraw;
-    int screen, rc;
-    __GLXscreen *pGlxScreen;
-
-    rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess);
-    pGlxScreen = glxGetScreen(pDraw->pScreen);
-    if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) {
-	screen = pDraw->pScreen->myNum;
-        if (pGlxScreen->swapBarrierFuncs) {
-            int ret = pGlxScreen->swapBarrierFuncs->bindSwapBarrierFunc(screen, drawable, barrier);
-            if (ret == Success) {
-                if (barrier)
-                    /* add source for cleanup when drawable is gone */
-                    AddResource(drawable, __glXSwapBarrierRes, (pointer)(intptr_t)screen);
-                else
-                    /* delete source */
-                    FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE);
-            }
-            return ret;
-        }
-    }
-    client->errorValue = drawable;
-    return __glXError(GLXBadDrawable);
-}
-
-
-int __glXDisp_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXQueryMaxSwapBarriersSGIXReq *req =
-                                    (xGLXQueryMaxSwapBarriersSGIXReq *) pc;
-    xGLXQueryMaxSwapBarriersSGIXReply reply;
-    int screen = req->screen;
-    __GLXscreen *pGlxScreen;
-
-    pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
-    if (pGlxScreen->swapBarrierFuncs)
-        reply.max = pGlxScreen->swapBarrierFuncs->queryMaxSwapBarriersFunc(screen);
-    else
-        reply.max = 0;
-
-
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-
-    if (client->swapped) {
-        __GLX_DECLARE_SWAP_VARIABLES;
-        __GLX_SWAP_SHORT(&reply.sequenceNumber);
-    }
-
-    WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply,
-                        (char *) &reply);
-    return Success;
-}
-
-#define GLX_BAD_HYPERPIPE_SGIX 92
-
-int __glXDisp_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXQueryHyperpipeNetworkSGIXReq * req = (xGLXQueryHyperpipeNetworkSGIXReq *) pc;
-    xGLXQueryHyperpipeNetworkSGIXReply reply;
-    int screen = req->screen;
-    void *rdata = NULL;
-
-    int length=0;
-    int npipes=0;
-
-    int n= 0;
-    __GLXscreen *pGlxScreen;
-
-    pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
-    if (pGlxScreen->hyperpipeFuncs) {
-        rdata =
-            (pGlxScreen->hyperpipeFuncs->queryHyperpipeNetworkFunc(screen, &npipes, &n));
-    }
-    length = __GLX_PAD(n) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = length;
-    reply.n = n;
-    reply.npipes = npipes;
-
-    if (client->swapped) {
-        __GLX_DECLARE_SWAP_VARIABLES;
-        __GLX_SWAP_SHORT(&reply.sequenceNumber);
-        __GLX_SWAP_INT(&reply.length);
-        __GLX_SWAP_INT(&reply.n);
-        __GLX_SWAP_INT(&reply.npipes);
-    }
-    WriteToClient(client, sz_xGLXQueryHyperpipeNetworkSGIXReply,
-                  (char *) &reply);
-
-    WriteToClient(client, length << 2, (char *)rdata);
-
-    return Success;
-}
-
-int __glXDisp_DestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXDestroyHyperpipeConfigSGIXReq * req =
-        (xGLXDestroyHyperpipeConfigSGIXReq *) pc;
-    xGLXDestroyHyperpipeConfigSGIXReply reply;
-    int screen = req->screen;
-    int  success = GLX_BAD_HYPERPIPE_SGIX;
-    int hpId ;
-    __GLXscreen *pGlxScreen;
-
-    hpId = req->hpId;
-
-    pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
-    if (pGlxScreen->hyperpipeFuncs) {
-        success = pGlxScreen->hyperpipeFuncs->destroyHyperpipeConfigFunc(screen, hpId);
-    }
-
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = __GLX_PAD(0) >> 2;
-    reply.n = 0;
-    reply.success = success;
-
-
-    if (client->swapped) {
-        __GLX_DECLARE_SWAP_VARIABLES;
-        __GLX_SWAP_SHORT(&reply.sequenceNumber);
-    }
-    WriteToClient(client,
-                  sz_xGLXDestroyHyperpipeConfigSGIXReply,
-                  (char *) &reply);
-    return Success;
-}
-
-int __glXDisp_QueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXQueryHyperpipeConfigSGIXReq * req =
-        (xGLXQueryHyperpipeConfigSGIXReq *) pc;
-    xGLXQueryHyperpipeConfigSGIXReply reply;
-    int screen = req->screen;
-    void *rdata = NULL;
-    int length;
-    int npipes=0;
-    int n= 0;
-    int hpId;
-    __GLXscreen *pGlxScreen;
-
-    hpId = req->hpId;
-
-    pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
-    if (pGlxScreen->hyperpipeFuncs) {
-        rdata = pGlxScreen->hyperpipeFuncs->queryHyperpipeConfigFunc(screen, hpId,&npipes, &n);
-    }
-
-    length = __GLX_PAD(n) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = length;
-    reply.n = n;
-    reply.npipes = npipes;
-
-
-    if (client->swapped) {
-        __GLX_DECLARE_SWAP_VARIABLES;
-        __GLX_SWAP_SHORT(&reply.sequenceNumber);
-        __GLX_SWAP_INT(&reply.length);
-        __GLX_SWAP_INT(&reply.n);
-        __GLX_SWAP_INT(&reply.npipes);
-    }
-
-    WriteToClient(client, sz_xGLXQueryHyperpipeConfigSGIXReply,
-                  (char *) &reply);
-
-    WriteToClient(client, length << 2, (char *)rdata);
-
-    return Success;
-}
-
-int __glXDisp_HyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXHyperpipeConfigSGIXReq * req =
-        (xGLXHyperpipeConfigSGIXReq *) pc;
-    xGLXHyperpipeConfigSGIXReply reply;
-    int screen = req->screen;
-    void *rdata;
-
-    int npipes=0, networkId;
-    int hpId=-1;
-    __GLXscreen *pGlxScreen;
-
-    pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
-    networkId = (int)req->networkId;
-    npipes = (int)req->npipes;
-    rdata = (void *)(req +1);
-
-    if (pGlxScreen->hyperpipeFuncs) {
-        pGlxScreen->hyperpipeFuncs->hyperpipeConfigFunc(screen,networkId,
-                                                        &hpId, &npipes,
-                                                        (void *) rdata);
-    }
-
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = __GLX_PAD(0) >> 2;
-    reply.n = 0;
-    reply.npipes = npipes;
-    reply.hpId = hpId;
-
-    if (client->swapped) {
-        __GLX_DECLARE_SWAP_VARIABLES;
-        __GLX_SWAP_SHORT(&reply.sequenceNumber);
-        __GLX_SWAP_INT(&reply.npipes);
-        __GLX_SWAP_INT(&reply.hpId);
-    }
-
-    WriteToClient(client, sz_xGLXHyperpipeConfigSGIXReply,
-                  (char *) &reply);
-
-    return Success;
-}
-
-
 /************************************************************************/
 
 /*
diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index c414dc8..ce4d69a 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -37,7 +37,6 @@
 #include "glxutil.h"
 #include <GL/glxtokens.h>
 #include <unpack.h>
-#include "g_disptab.h"
 #include <pixmapstr.h>
 #include <windowstr.h>
 #include "glxext.h"
diff --git a/glx/glxdri.c b/glx/glxdri.c
index db3fcd5..7717fcf 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -56,7 +56,6 @@
 #include "glxutil.h"
 #include "glxdricommon.h"
 
-#include "g_disptab.h"
 #include "glapitable.h"
 #include "glapi.h"
 #include "glthread.h"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 0b69201..1111183 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -48,7 +48,6 @@
 #include "glxutil.h"
 #include "glxdricommon.h"
 
-#include "g_disptab.h"
 #include "glapitable.h"
 #include "glapi.h"
 #include "glthread.h"
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index dc12f57..08ea338 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -48,7 +48,6 @@
 #include "glxutil.h"
 #include "glxdricommon.h"
 
-#include "g_disptab.h"
 #include "glapitable.h"
 #include "glapi.h"
 #include "glthread.h"
diff --git a/glx/glxext.c b/glx/glxext.c
index f5ebe4f..4bd5d6b 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -39,7 +39,6 @@
 #include <registry.h>
 #include "privates.h"
 #include <os.h>
-#include "g_disptab.h"
 #include "unpack.h"
 #include "glxutil.h"
 #include "glxext.h"
@@ -58,7 +57,6 @@ __GLXcontext *__glXContextList;
 */
 RESTYPE __glXContextRes;
 RESTYPE __glXDrawableRes;
-RESTYPE __glXSwapBarrierRes;
 
 /*
 ** Reply for most singles.
@@ -228,19 +226,6 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
     return GL_TRUE;
 }
 
-extern RESTYPE __glXSwapBarrierRes;
-
-static int SwapBarrierGone(int screen, XID drawable)
-{
-    __GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
-
-    if (pGlxScreen->swapBarrierFuncs) {
-        pGlxScreen->swapBarrierFuncs->bindSwapBarrierFunc(screen, drawable, 0);
-    }
-    FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE);
-    return True;
-}
-
 /************************************************************************/
 
 /*
@@ -358,9 +343,7 @@ void GlxExtensionInit(void)
 					    "GLXContext");
     __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone,
 					     "GLXDrawable");
-    __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone,
-						"GLXSwapBarrier");
-    if (!__glXContextRes || !__glXDrawableRes || !__glXSwapBarrierRes)
+    if (!__glXContextRes || !__glXDrawableRes)
 	return;
 
     if (!dixRegisterPrivateKey(&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (__GLXclientState)))
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 8515e14..496cf9e 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -175,8 +175,6 @@ static char GLXServerExtensions[] =
 			"GLX_SGI_make_current_read "
 #ifndef __APPLE__
 			"GLX_SGIS_multisample "
-                        "GLX_SGIX_hyperpipe "
-                        "GLX_SGIX_swap_barrier "
 #endif
 			"GLX_SGIX_fbconfig "
 			"GLX_SGIX_pbuffer "
@@ -184,31 +182,6 @@ static char GLXServerExtensions[] =
                         "GLX_INTEL_swap_event"
 			;
 
-/*
- * If your DDX driver wants to register support for swap barriers or hyperpipe
- * topology, it should call __glXHyperpipeInit() or __glXSwapBarrierInit()
- * with a dispatch table of functions to handle the requests.   In the XFree86
- * DDX, for example, you would call these near the bottom of the driver's
- * ScreenInit method, after DRI has been initialized.
- *
- * This should be replaced with a better method when we teach the server how
- * to load DRI drivers.
- */
-
-void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs)
-{
-    __GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
-
-    pGlxScreen->hyperpipeFuncs = funcs;
-}
-
-void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs)
-{
-    __GLXscreen *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
-
-    pGlxScreen->swapBarrierFuncs = funcs;
-}
-
 static Bool
 glxCloseScreen (int index, ScreenPtr pScreen)
 {
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index 861e03c..93b4109 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -35,21 +35,6 @@
  * Silicon Graphics, Inc.
  */
 
-typedef struct {
-    void * (* queryHyperpipeNetworkFunc)(int, int *, int *);
-    void * (* queryHyperpipeConfigFunc)(int, int, int *, int *);
-    int    (* destroyHyperpipeConfigFunc)(int, int);
-    void * (* hyperpipeConfigFunc)(int, int, int *, int *, void *);
-} __GLXHyperpipeExtensionFuncs;
-
-typedef struct {
-    int    (* bindSwapBarrierFunc)(int, XID, int);
-    int    (* queryMaxSwapBarriersFunc)(int);
-} __GLXSwapBarrierExtensionFuncs;
-
-void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs);
-void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
-
 typedef struct __GLXconfig __GLXconfig;
 struct __GLXconfig {
     __GLXconfig *next;
@@ -144,9 +129,6 @@ struct __GLXscreen {
     int            (*swapInterval)  (__GLXdrawable *drawable,
 				     int interval);
 
-    __GLXHyperpipeExtensionFuncs *hyperpipeFuncs;
-    __GLXSwapBarrierExtensionFuncs *swapBarrierFuncs;
-
     ScreenPtr pScreen;
 
     /* Linked list of valid fbconfigs for this screen. */
diff --git a/glx/indirect_table.c b/glx/indirect_table.c
index cb32026..01d1da3 100644
--- a/glx/indirect_table.c
+++ b/glx/indirect_table.c
@@ -30,7 +30,6 @@
 #include "glxext.h"
 #include "indirect_dispatch.h"
 #include "indirect_reqsize.h"
-#include "g_disptab.h"
 #include "indirect_table.h"
 
 /*****************************************************************/
diff --git a/glx/xfont.c b/glx/xfont.c
index b4081cf..9943784 100644
--- a/glx/xfont.c
+++ b/glx/xfont.c
@@ -35,7 +35,6 @@
 #include "glxserver.h"
 #include "glxutil.h"
 #include "unpack.h"
-#include "g_disptab.h"
 #include "glapitable.h"
 #include "glapi.h"
 #include "glthread.h"
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 58f78fb..bdc7c3d 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -586,8 +586,6 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
     screen->base.createContext  = __glXAquaScreenCreateContext;
     screen->base.createDrawable = __glXAquaScreenCreateDrawable;
     screen->base.swapInterval = /*FIXME*/ NULL;
-    screen->base.hyperpipeFuncs = NULL;
-    screen->base.swapBarrierFuncs = NULL;
     screen->base.pScreen       = pScreen;
     
     screen->base.fbconfigs = __glXAquaCreateVisualConfigs(&screen->base.numFBConfigs, pScreen->myNum);
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 5d7391d..c9831f3 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -649,8 +649,6 @@ glxWinScreenProbe(ScreenPtr pScreen)
       screen->base.createContext = glxWinCreateContext;
       screen->base.createDrawable = glxWinCreateDrawable;
       screen->base.swapInterval = glxWinScreenSwapInterval;
-      screen->base.hyperpipeFuncs = NULL;
-      screen->base.swapBarrierFuncs = NULL;
       screen->base.pScreen = pScreen;
 
       if (strstr(wgl_extensions, "WGL_ARB_pixel_format"))
commit f4f41c812d2ba5edba7e0e0dbaab4bbf0af834b3
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:34:56 2010 +0300

    xfree86/xv: Provide a ModeSet hook
    
    Reput all ports when the display mode or panning has been changed by
    RandR code. This makes the overlays appear in the correct position
    on the screen.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index d323006..016db1f 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -104,6 +104,7 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
 static Bool xf86XVEnterVT(int, int);
 static void xf86XVLeaveVT(int, int);
 static void xf86XVAdjustFrame(int index, int x, int y, int flags);
+static void xf86XVModeSet(ScrnInfoPtr pScrn);
 
 /* misc */
 
@@ -287,6 +288,7 @@ xf86XVScreenInit(
   ScreenPriv->EnterVT = pScrn->EnterVT;
   ScreenPriv->LeaveVT = pScrn->LeaveVT;
   ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
+  ScreenPriv->ModeSet = pScrn->ModeSet;
 
   pScreen->DestroyWindow = xf86XVDestroyWindow;
   pScreen->WindowExposures = xf86XVWindowExposures;
@@ -295,6 +297,7 @@ xf86XVScreenInit(
   pScrn->LeaveVT = xf86XVLeaveVT;
   if(pScrn->AdjustFrame)
      pScrn->AdjustFrame = xf86XVAdjustFrame;
+  pScrn->ModeSet = xf86XVModeSet;
 
   if(!xf86XVInitAdaptors(pScreen, adaptors, num))
 	return FALSE;
@@ -1241,6 +1244,7 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
   pScrn->EnterVT = ScreenPriv->EnterVT;
   pScrn->LeaveVT = ScreenPriv->LeaveVT;
   pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
+  pScrn->ModeSet = ScreenPriv->ModeSet;
 
   for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
        xf86XVFreeAdaptor(pa);
@@ -1344,6 +1348,26 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
   xf86XVReputOrStopAllPorts(pScrn);
 }
 
+static void
+xf86XVModeSet(ScrnInfoPtr pScrn)
+{
+    ScreenPtr pScreen = pScrn->pScreen;
+    XF86XVScreenPtr ScreenPriv;
+
+    /* Can be called before pScrn->pScreen is set */
+    if (!pScreen)
+	return;
+
+    ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+
+    if (ScreenPriv->ModeSet) {
+	pScrn->ModeSet = ScreenPriv->ModeSet;
+	(*pScrn->ModeSet)(pScrn);
+	pScrn->ModeSet = xf86XVModeSet;
+    }
+
+    xf86XVReputOrStopAllPorts(pScrn);
+}
 
 /**** XvAdaptorRec fields ****/
 
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index 3191c4c..88e7a0e 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -44,6 +44,7 @@ typedef struct {
    Bool                         (*EnterVT)(int, int);
    void                         (*LeaveVT)(int, int);
    GCPtr			videoGC;
+   xf86ModeSetProc		*ModeSet;
 } XF86XVScreenRec, *XF86XVScreenPtr;
 
 typedef struct {
commit 640c8716e0400e35afd7e91efc826fc447ea6745
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Thu Oct 28 18:13:02 2010 +0300

    xfree86/modes: Provide a ModeSet hook in ScrnInfo
    
    Add a new hook ModeSet that will be called after display mode is
    changed, or after the display has been panned.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index ce6b07f..a65237a 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -498,7 +498,7 @@ typedef struct _confdrirec {
 /* These values should be adjusted when new fields are added to ScrnInfoRec */
 #define NUM_RESERVED_INTS		16
 #define NUM_RESERVED_POINTERS		14
-#define NUM_RESERVED_FUNCS		11
+#define NUM_RESERVED_FUNCS		10
 
 typedef pointer (*funcPointer)(void);
 
@@ -652,6 +652,7 @@ typedef Bool xf86PMEventProc              (int, pmEvent, Bool);
 typedef void xf86DPMSSetProc		  (ScrnInfoPtr, int, int);
 typedef void xf86LoadPaletteProc   (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
 typedef void xf86SetOverscanProc          (ScrnInfoPtr, int);
+typedef void xf86ModeSetProc              (ScrnInfoPtr);
 
 
 /*
@@ -802,6 +803,7 @@ typedef struct _ScrnInfoRec {
     xf86LoadPaletteProc			*LoadPalette;
     xf86SetOverscanProc			*SetOverscan;
     xorgDriverFuncProc			*DriverFunc;
+    xf86ModeSetProc			*ModeSet;
 
     /*
      * This can be used when the minor ABI version is incremented.
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 7fc2a60..74d91ed 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -371,6 +371,8 @@ done:
 	crtc->active = TRUE;
 	if (scrn->pScreen)
 	    xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
+	if (scrn->ModeSet)
+	    scrn->ModeSet(scrn);
     } else {
 	crtc->x = saved_x;
 	crtc->y = saved_y;
@@ -407,12 +409,16 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
 void
 xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y)
 {
+    ScrnInfoPtr scrn = crtc->scrn;
+
     crtc->x = x;
     crtc->y = y;
     if (crtc->funcs->set_origin) {
 	if (!xf86CrtcRotate (crtc))
 	    return;
 	crtc->funcs->set_origin (crtc, x, y);
+	if (scrn->ModeSet)
+	    scrn->ModeSet(scrn);
     }
     else
 	xf86CrtcSetMode (crtc, &crtc->mode, crtc->rotation, x, y);
@@ -2894,6 +2900,8 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
     }
     if (pScrn->pScreen)
 	xf86_crtc_notify(pScrn->pScreen);
+    if (pScrn->ModeSet)
+	pScrn->ModeSet(pScrn);
 }
 
 #ifdef RANDR_12_INTERFACE
commit a942534ca3908418c407115c6393263c2fe05931
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Tue Nov 2 16:05:13 2010 +0200

    xfree86/xv: Pass all coordinate arguments to ReputImage
    
    Pass all of the src/dst coordinates to ReputImage so that drivers
    don't necessarily have to do double bookkeeping.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 66cf685..d323006 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -939,7 +939,10 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv)
   }
 
   ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn,
+			portPriv->vid_x, portPriv->vid_y,
 			WinBox.x1, WinBox.y1,
+			portPriv->vid_w, portPriv->vid_h,
+			portPriv->drw_w, portPriv->drw_h,
 			&ClipRegion, portPriv->DevPriv.ptr,
 			portPriv->pDraw);
 
@@ -1493,6 +1496,8 @@ xf86XVPutStill(
 
      xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
      portPriv->isOn = XV_ON;
+     portPriv->vid_x = vid_x;  portPriv->vid_y = vid_y;
+     portPriv->vid_w = vid_w;  portPriv->vid_h = vid_h;
      portPriv->drw_x = drw_x;  portPriv->drw_y = drw_y;
      portPriv->drw_w = drw_w;  portPriv->drw_h = drw_h;
      portPriv->type = 0;  /* no mask means it's transient and should
@@ -1796,6 +1801,8 @@ xf86XVPutImage(
 	(portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
 
      portPriv->isOn = XV_ON;
+     portPriv->vid_x = src_x;  portPriv->vid_y = src_y;
+     portPriv->vid_w = src_w;  portPriv->vid_h = src_h;
      portPriv->drw_x = drw_x;  portPriv->drw_y = drw_y;
      portPriv->drw_w = drw_w;  portPriv->drw_h = drw_h;
      portPriv->type = 0;  /* no mask means it's transient and should
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index 973b1d0..47061fe 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -111,7 +111,9 @@ typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn,
 	short src_w, short src_h, short drw_w, short drw_h,
 	int image, unsigned char* buf, short width, short height, Bool Sync,
 	RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
-typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn, short drw_x, short drw_y,
+typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn,
+	short src_x, short src_y, short drw_x, short drw_y,
+	short src_w, short src_h, short drw_w, short drw_h,
 	RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
 typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn, 
 	int image, unsigned short *width, unsigned short *height, 
commit 0fef4e94480f2bf1157ce5f92fcb0c7dd1585371
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Tue Nov 2 16:23:02 2010 +0200

    xfree86/xv: Document VIDEO_CLIP_TO_VIEWPORT incompatibility with reput
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index 1b43fcb..973b1d0 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -36,6 +36,10 @@
 #define VIDEO_INVERT_CLIPLIST			0x00000002
 #define VIDEO_OVERLAID_IMAGES			0x00000004
 #define VIDEO_OVERLAID_STILLS			0x00000008
+/*
+ * Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended.
+ * It can make reput behaviour inconsistent.
+ */
 #define VIDEO_CLIP_TO_VIEWPORT			0x00000010
 
 typedef struct {
commit 5f8ec1ade8b485f48de8c72011409219afad9dd7
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Tue Nov 2 16:04:36 2010 +0200

    xfree86/xv: Add some helpful comments about ReputImage
    
    Document the fact that ReputImage is used for stills as well as images.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index f1cdfe6..66cf685 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -556,7 +556,7 @@ xf86XVInitAdaptors(
       adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
       adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
       adaptorPriv->PutImage = adaptorPtr->PutImage;
-      adaptorPriv->ReputImage = adaptorPtr->ReputImage;
+      adaptorPriv->ReputImage = adaptorPtr->ReputImage; /* image/still */
 
       pa->devPriv.ptr = (pointer)adaptorPriv;
 
@@ -873,6 +873,7 @@ CLIP_VIDEO_BAILOUT:
   return ret;
 }
 
+/* Reput image/still */
 static int
 xf86XVReputImage(XvPortRecPrivatePtr portPriv)
 {
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index c3db6cc..1b43fcb 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -165,7 +165,7 @@ typedef struct {
   GetPortAttributeFuncPtr GetPortAttribute;
   QueryBestSizeFuncPtr QueryBestSize;
   PutImageFuncPtr PutImage;
-  ReputImageFuncPtr ReputImage;
+  ReputImageFuncPtr ReputImage; /* image/still */
   QueryImageAttributesFuncPtr QueryImageAttributes;
   ClipNotifyFuncPtr ClipNotify;
 } XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
commit b4ebde23d25bef1b891902d75b2db3aad92685b7
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Mon Nov 1 20:27:25 2010 +0200

    xfree86/xv: Fix ReputImage clipping
    
    PutImage/PutStill respect the GC clip, however ReputImage does not.
    PutImage/PutStill are supposed to be oneshot operations so ReputImage
    should never expand the area covered by the clip, instead it should
    only shrink if the window clip shrinks. So commandeer clientClip
    into use by ReputImage and initially make it a copy of the original
    GC composite clip. Whenever ReputImage needs reclipping update
    clientClip with the newly calculated composite clip.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 8ccdf06..f1cdfe6 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -703,6 +703,27 @@ xf86XVCopyClip(
     portPriv->subWindowMode = pGC->subWindowMode;
 }
 
+static void
+xf86XVCopyCompositeClip(XvPortRecPrivatePtr portPriv,
+			GCPtr pGC,
+			DrawablePtr pDraw)
+{
+    if (!portPriv->clientClip)
+	portPriv->clientClip = RegionCreate(NullBox, 1);
+    /* Keep the original GC composite clip around for ReputImage */
+    RegionCopy(portPriv->clientClip, pGC->pCompositeClip);
+    RegionTranslate(portPriv->clientClip,
+		    -pDraw->x, -pDraw->y);
+
+    /* get rid of the old clip list */
+    if (portPriv->pCompositeClip && portPriv->FreeCompositeClip)
+	RegionDestroy(portPriv->pCompositeClip);
+
+    portPriv->pCompositeClip = pGC->pCompositeClip;
+    portPriv->FreeCompositeClip = FALSE;
+    portPriv->subWindowMode = pGC->subWindowMode;
+}
+
 static int
 xf86XVRegetVideo(XvPortRecPrivatePtr portPriv)
 {
@@ -863,6 +884,11 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv)
 
   xf86XVUpdateCompositeClip(portPriv);
 
+  /* the clip can get smaller over time */
+  RegionCopy(portPriv->clientClip, portPriv->pCompositeClip);
+  RegionTranslate(portPriv->clientClip,
+		  -portPriv->pDraw->x, -portPriv->pDraw->y);
+
   /* translate the video region to the screen */
   WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
   WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
@@ -1411,6 +1437,8 @@ xf86XVPutStill(
   WinBox.x2 = WinBox.x1 + drw_w;
   WinBox.y2 = WinBox.y1 + drw_h;
 
+  xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
+
   RegionInit(&WinRegion, &WinBox, 1);
   RegionNull(&ClipRegion);
   RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
@@ -1479,6 +1507,10 @@ PUT_STILL_BAILOUT:
 	portPriv->isOn = XV_PENDING;
   }
 
+  /* This clip was copied and only good for one shot */
+  if(!portPriv->FreeCompositeClip)
+     portPriv->pCompositeClip = NULL;
+
   RegionUninit(&WinRegion);
   RegionUninit(&ClipRegion);
 
@@ -1700,6 +1732,8 @@ xf86XVPutImage(
 
   if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
 
+  xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
+
   WinBox.x1 = pDraw->x + drw_x;
   WinBox.y1 = pDraw->y + drw_y;
   WinBox.x2 = WinBox.x1 + drw_w;
@@ -1776,6 +1810,10 @@ PUT_IMAGE_BAILOUT:
 	portPriv->isOn = XV_PENDING;
   }
 
+  /* This clip was copied and only good for one shot */
+  if(!portPriv->FreeCompositeClip)
+     portPriv->pCompositeClip = NULL;
+
   RegionUninit(&WinRegion);
   RegionUninit(&ClipRegion);
 
commit 7294236bdb29b4fa7a7bc27aff9c786c5a33c544
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Mon Nov 1 20:02:40 2010 +0200

    xfree86/xv: Remove clipOrg from XvPortRecPrivate
    
    clipOrg never changes except when clientClip changes, so instead of
    keeping copies of both originals translate clientClip by clipOrg
    immediately and just keep the translated clientClip.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index e4c5082..8ccdf06 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -661,8 +661,7 @@ xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
    pCompositeClip = RegionCreate(NullBox, 1);
    RegionCopy(pCompositeClip, portPriv->clientClip);
    RegionTranslate(pCompositeClip,
-			portPriv->pDraw->x + portPriv->clipOrg.x,
-			portPriv->pDraw->y + portPriv->clipOrg.y);
+		   portPriv->pDraw->x, portPriv->pDraw->y);
    RegionIntersect(pCompositeClip, pregWin, pCompositeClip);
 
    portPriv->pCompositeClip = pCompositeClip;
@@ -687,6 +686,8 @@ xf86XVCopyClip(
 	    portPriv->clientClip = RegionCreate(NullBox, 1);
 	/* Note: this is in window coordinates */
 	RegionCopy(portPriv->clientClip, pGC->clientClip);
+	RegionTranslate(portPriv->clientClip,
+			pGC->clipOrg.x, pGC->clipOrg.y);
     } else if(portPriv->clientClip) { /* free the old clientClip */
 	RegionDestroy(portPriv->clientClip);
 	portPriv->clientClip = NULL;
@@ -697,7 +698,6 @@ xf86XVCopyClip(
 	RegionDestroy(portPriv->pCompositeClip);
     }
 
-    portPriv->clipOrg = pGC->clipOrg;
     portPriv->pCompositeClip = pGC->pCompositeClip;
     portPriv->FreeCompositeClip = FALSE;
     portPriv->subWindowMode = pGC->subWindowMode;
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index 7623d29..3191c4c 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -67,7 +67,6 @@ typedef struct {
    DrawablePtr pDraw;
    unsigned char type;
    unsigned int subWindowMode;
-   DDXPointRec clipOrg;
    RegionPtr clientClip;
    RegionPtr pCompositeClip;
    Bool FreeCompositeClip;
commit 47d8bd0a999693f47fd244dc876ef7f8fcd52854
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:31:14 2010 +0300

    xfree86/xv: Factor out the meat of xf86XVAdjustFrame for later reuse
    
    No functional change.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index f70a2ef..e4c5082 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1035,6 +1035,40 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
     }
 }
 
+static void
+xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
+{
+    ScreenPtr pScreen = pScrn->pScreen;
+    XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+    XvAdaptorPtr pa;
+    int c, i;
+
+    for (c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) {
+	XvPortPtr pPort = pa->pPorts;
+
+	for (i = pa->nPorts; i > 0; i--, pPort++) {
+	    XvPortRecPrivatePtr pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
+	    WindowPtr pWin = (WindowPtr)pPriv->pDraw;
+	    Bool visible;
+
+	    if (pPriv->isOn == XV_OFF || !pWin)
+		continue;
+
+	    visible = pWin->visibility == VisibilityUnobscured ||
+		      pWin->visibility == VisibilityPartiallyObscured;
+
+	    /*
+	     * Stop and remove still/images if
+	     * ReputImage isn't supported.
+	     */
+	    if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
+		visible = FALSE;
+
+	    xf86XVReputOrStopPort(pPriv, pWin, visible);
+	}
+    }
+}
+
 /****  ScreenRec fields ****/
 
 static Bool
@@ -1269,11 +1303,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
 {
   ScrnInfoPtr pScrn = xf86Screens[index];
   ScreenPtr pScreen = pScrn->pScreen;
-  XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
-  WindowPtr pWin;
-  XvAdaptorPtr pa;
-  int c, i;
 
   if(ScreenPriv->AdjustFrame) {
 	pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
@@ -1281,33 +1311,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
 	pScrn->AdjustFrame = xf86XVAdjustFrame;
   }
 
-  for(c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) {
-      XvPortPtr pPort = pa->pPorts;
-      XvPortRecPrivatePtr pPriv;
-
-      for(i = pa->nPorts; i > 0; i--, pPort++) {
-	Bool visible;
-
-	pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
-
-	pWin = (WindowPtr)pPriv->pDraw;
-
-	if (pPriv->isOn == XV_OFF || !pWin)
-	    continue;
-
-	visible = pWin->visibility == VisibilityUnobscured ||
-		  pWin->visibility == VisibilityPartiallyObscured;
-
-	/*
-	 * Stop and remove still/images if
-	 * ReputImage isn't supported.
-	 */
-	if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
-	    visible = FALSE;
-
-	xf86XVReputOrStopPort(pPriv, pWin, visible);
-     }
-  }
+  xf86XVReputOrStopAllPorts(pScrn);
 }
 
 
commit 3d4d0237a3981820a9b7290f69c7172a48659a10
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:14:34 2010 +0300

    xfree86/xv: Change the behaviour of AdjustFrame to reput everything
    
    Also reput PutVideo/GetVideo ports in AdjustFrame. This makes the
    overlay track the screen panning instead of staying stationary in the
    wrong place.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 59232a8..f70a2ef 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1286,24 +1286,26 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
       XvPortRecPrivatePtr pPriv;
 
       for(i = pa->nPorts; i > 0; i--, pPort++) {
+	Bool visible;
+
 	pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
 
-	if(!pPriv->type && (pPriv->isOn != XV_OFF)) { /* overlaid still/image */
-	  pWin = (WindowPtr)pPriv->pDraw;
+	pWin = (WindowPtr)pPriv->pDraw;
 
-	  if ((pPriv->AdaptorRec->ReputImage) &&
-	     ((pWin->visibility == VisibilityUnobscured) ||
-	      (pWin->visibility == VisibilityPartiallyObscured)))
-	  {
-	      xf86XVReputImage(pPriv);
-	  } else if (pPriv->isOn == XV_ON) {
-	     (*pPriv->AdaptorRec->StopVideo)(
-				 pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
-	     xf86XVRemovePortFromWindow(pWin, pPriv);
-	     pPriv->isOn = XV_PENDING;
-	     continue;
-	  }
-	}
+	if (pPriv->isOn == XV_OFF || !pWin)
+	    continue;
+
+	visible = pWin->visibility == VisibilityUnobscured ||
+		  pWin->visibility == VisibilityPartiallyObscured;
+
+	/*
+	 * Stop and remove still/images if
+	 * ReputImage isn't supported.
+	 */
+	if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
+	    visible = FALSE;
+
+	xf86XVReputOrStopPort(pPriv, pWin, visible);
      }
   }
 }
commit d794be81218934ad4580211c7a0a27cb71eb5d60
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 18:07:32 2010 +0300

    xfree86/xv: No need to free composite clip in AdjustFrame
    
    Nothing should change in AdjustFrame that would need the composite clip
    to be recomputed.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index cbbff40..59232a8 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1289,12 +1289,6 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
 	pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
 
 	if(!pPriv->type && (pPriv->isOn != XV_OFF)) { /* overlaid still/image */
-
-	  if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
-	     RegionDestroy(pPriv->pCompositeClip);
-
-	  pPriv->pCompositeClip = NULL;
-
 	  pWin = (WindowPtr)pPriv->pDraw;
 
 	  if ((pPriv->AdaptorRec->ReputImage) &&
commit 6051c7e940767b7120ad9c7e9188aee6a6f62b94
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:05:02 2010 +0300

    xfree86/xv: Change the behaviour of ClipNotify to reput instead of stop
    
    When ClipNotify gets called for a visible window, reput instead of
    stopping the port. This eliminates nasty overlay flickering that
    happens during clip changes.
    
    If the window is invisible or if ReputImage isn't supported stop
    and remove the port from the window as was done before.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 4ed1177..cbbff40 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1116,10 +1116,11 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
   XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
   XvPortRecPrivatePtr pPriv;
-  Bool visible = (pWin->visibility == VisibilityUnobscured) ||
-		 (pWin->visibility == VisibilityPartiallyObscured);
 
   while(WinPriv) {
+     Bool visible = pWin->visibility == VisibilityUnobscured ||
+		    pWin->visibility == VisibilityPartiallyObscured;
+
      pPriv = WinPriv->PortRec;
 
      if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
@@ -1131,24 +1132,15 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
         (*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr,
                                          pWin, dx, dy);
 
-     /* Stop everything except images, but stop them too if the
-	window isn't visible.  But we only remove the images. */
-
-     if(pPriv->type || !visible) {
-	if(pPriv->isOn == XV_ON) {
-	    (*pPriv->AdaptorRec->StopVideo)(
-			pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
-	    pPriv->isOn = XV_PENDING;
-	}
-
-	if(!pPriv->type) {  /* overlaid still/image */
-	    WinPriv = WinPriv->next;
-	    xf86XVRemovePortFromWindow(pWin, pPriv);
-	    continue;
-	}
-     }
+     /*
+      * Stop and remove still/images if
+      * ReputImage isn't supported.
+      */
+     if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
+	visible = FALSE;
 
      WinPriv = WinPriv->next;
+     xf86XVReputOrStopPort(pPriv, pWin, visible);
   }
 
   if(ScreenPriv->ClipNotify) {
commit 27707ac5bdf6831630944f02f2128951a529faab
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:00:24 2010 +0300

    xfree86/xv: Allow xf86XVReputOrStopPort() to stop PutVideo/GetVideo ports
    
    Modify xf86XVReputOrStopPort() to allow stopping of all types of ports.
    Will be useful later.
    
    No functional change.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 581e8a7..4ed1177 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1007,8 +1007,20 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
 static void
 xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
 		      WindowPtr pWin,
-		      Bool AreasExposed)
+		      Bool visible)
 {
+    if (!visible) {
+	if (pPriv->isOn == XV_ON) {
+	    (*pPriv->AdaptorRec->StopVideo)(pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+	    pPriv->isOn = XV_PENDING;
+	}
+
+	if (!pPriv->type) /* overlaid still/image*/
+	    xf86XVRemovePortFromWindow(pWin, pPriv);
+
+	return;
+    }
+
     switch (pPriv->type) {
     case XvInputMask:
 	xf86XVReputVideo(pPriv);
@@ -1019,14 +1031,6 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
     default:  /* overlaid still/image*/
 	if (pPriv->AdaptorRec->ReputImage)
 	    xf86XVReputImage(pPriv);
-	else if (AreasExposed) {
-	    if (pPriv->isOn == XV_ON) {
-		(*pPriv->AdaptorRec->StopVideo)(pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
-		pPriv->isOn = XV_PENDING;
-	    }
-
-	    xf86XVRemovePortFromWindow(pWin, pPriv);
-	}
 	break;
     }
 }
@@ -1088,10 +1092,19 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
   if (!pWin->valdata) return;
 
   while(WinPriv) {
+     Bool visible = TRUE;
+
      pPriv = WinPriv->PortRec;
 
+     /*
+      * Stop and remove still/images if areas were exposed and
+      * ReputImage isn't supported.
+      */
+     if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
+	visible = !AreasExposed;
+
      WinPriv = WinPriv->next;
-     xf86XVReputOrStopPort(pPriv, pWin, AreasExposed);
+     xf86XVReputOrStopPort(pPriv, pWin, visible);
   }
 }
 
commit 38987aae199982f17eae664f3a28ff5941d3ee73
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 16:51:24 2010 +0300

    xfree86/xv: Factor out the meat of xf86XVWindowExposures for later reuse
    
    No fucntional change.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index f9b3d93..581e8a7 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1004,6 +1004,33 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
      portPriv->pDraw = NULL;
 }
 
+static void
+xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
+		      WindowPtr pWin,
+		      Bool AreasExposed)
+{
+    switch (pPriv->type) {
+    case XvInputMask:
+	xf86XVReputVideo(pPriv);
+	break;
+    case XvOutputMask:
+	xf86XVRegetVideo(pPriv);
+	break;
+    default:  /* overlaid still/image*/
+	if (pPriv->AdaptorRec->ReputImage)
+	    xf86XVReputImage(pPriv);
+	else if (AreasExposed) {
+	    if (pPriv->isOn == XV_ON) {
+		(*pPriv->AdaptorRec->StopVideo)(pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+		pPriv->isOn = XV_PENDING;
+	    }
+
+	    xf86XVRemovePortFromWindow(pWin, pPriv);
+	}
+	break;
+    }
+}
+
 /****  ScreenRec fields ****/
 
 static Bool
@@ -1063,32 +1090,8 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
   while(WinPriv) {
      pPriv = WinPriv->PortRec;
 
-     /* Reput anyone with a reput function */
-
-     switch(pPriv->type) {
-     case XvInputMask:
-	xf86XVReputVideo(pPriv);
-	break;
-     case XvOutputMask:
-	xf86XVRegetVideo(pPriv);
-	break;
-     default:  /* overlaid still/image*/
-	if (pPriv->AdaptorRec->ReputImage)
-	   xf86XVReputImage(pPriv);
-	else if(AreasExposed) {
-	    if (pPriv->isOn == XV_ON) {
-		(*pPriv->AdaptorRec->StopVideo)(
-		    pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
-		pPriv->isOn = XV_PENDING;
-	    }
-
-	    WinPriv = WinPriv->next;
-	    xf86XVRemovePortFromWindow(pWin, pPriv);
-	    continue;
-	}
-	break;
-     }
      WinPriv = WinPriv->next;
+     xf86XVReputOrStopPort(pPriv, pWin, AreasExposed);
   }
 }
 
commit 0178173f0579c4b9dd0cf60b9cd3e5d264f86ae4
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 16:39:13 2010 +0300

    xfree86/xv: Eliminate two open coded copies of xf86XVRemovePortFromWindow
    
    No functional change.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 532f0b2..f9b3d93 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1048,7 +1048,6 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
   ScreenPtr pScreen = pWin->drawable.pScreen;
   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
   XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
-  XF86XVWindowPtr pPrev;
   XvPortRecPrivatePtr pPriv;
   Bool AreasExposed;
 
@@ -1061,8 +1060,6 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
   /* filter out XClearWindow/Area */
   if (!pWin->valdata) return;
 
-  pPrev = NULL;
-
   while(WinPriv) {
      pPriv = WinPriv->PortRec;
 
@@ -1079,28 +1076,18 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
 	if (pPriv->AdaptorRec->ReputImage)
 	   xf86XVReputImage(pPriv);
 	else if(AreasExposed) {
-	    XF86XVWindowPtr tmp;
-
 	    if (pPriv->isOn == XV_ON) {
 		(*pPriv->AdaptorRec->StopVideo)(
 		    pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
 		pPriv->isOn = XV_PENDING;
 	    }
-	    pPriv->pDraw = NULL;
 
-	    if(!pPrev)
-		dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
-			      WinPriv->next);
-	    else
-	       pPrev->next = WinPriv->next;
-	    tmp = WinPriv;
 	    WinPriv = WinPriv->next;
-	    free(tmp);
+	    xf86XVRemovePortFromWindow(pWin, pPriv);
 	    continue;
 	}
 	break;
      }
-     pPrev = WinPriv;
      WinPriv = WinPriv->next;
   }
 }
@@ -1112,7 +1099,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
   ScreenPtr pScreen = pWin->drawable.pScreen;
   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
   XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
-  XF86XVWindowPtr tmp, pPrev = NULL;
   XvPortRecPrivatePtr pPriv;
   Bool visible = (pWin->visibility == VisibilityUnobscured) ||
 		 (pWin->visibility == VisibilityPartiallyObscured);
@@ -1140,21 +1126,12 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
 	}
 
 	if(!pPriv->type) {  /* overlaid still/image */
-	    pPriv->pDraw = NULL;
-
-	    if(!pPrev)
-		dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
-			      WinPriv->next);
-	    else
-	       pPrev->next = WinPriv->next;
-	    tmp = WinPriv;
 	    WinPriv = WinPriv->next;
-	    free(tmp);
+	    xf86XVRemovePortFromWindow(pWin, pPriv);
 	    continue;
 	}
      }
 
-     pPrev = WinPriv;
      WinPriv = WinPriv->next;
   }
 
commit b02858b5af47d524001ec571737cc92f6a6f06d3
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 16:54:42 2010 +0300

    xfree86/xv: Remove useless NULL check from ClipNotify
    
    WinPriv->PortRec should never be NULL as WinPriv itself would be removed
    from the list when the port is removed from the window.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 4676130..532f0b2 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1120,8 +1120,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
   while(WinPriv) {
      pPriv = WinPriv->PortRec;
 
-     if(!pPriv) goto next;
- 
      if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
 	RegionDestroy(pPriv->pCompositeClip);
 
@@ -1156,7 +1154,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
 	}
      }
 
-next:
      pPrev = WinPriv;
      WinPriv = WinPriv->next;
   }
commit 23e3d1f23318ce69623f91908f888a09f8b74ac2
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Nov 26 10:00:49 2010 +1000

    dix: remove now unnecessary !! before BitIsOn()
    
    The macro has been changed to do this already, no need for double
    not-not-ing.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index 0d59290..f09d31c 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -115,9 +115,9 @@ button_is_down(DeviceIntPtr pDev, int button, int type)
     int ret = 0;
 
     if (type & BUTTON_PROCESSED)
-        ret |= !!BitIsOn(pDev->button->down, button);
+        ret |= BitIsOn(pDev->button->down, button);
     if (type & BUTTON_POSTED)
-        ret |= !!BitIsOn(pDev->button->postdown, button);
+        ret |= BitIsOn(pDev->button->postdown, button);
 
     return ret;
 }
@@ -146,9 +146,9 @@ key_is_down(DeviceIntPtr pDev, int key_code, int type)
     int ret = 0;
 
     if (type & KEY_PROCESSED)
-        ret |= !!BitIsOn(pDev->key->down, key_code);
+        ret |= BitIsOn(pDev->key->down, key_code);
     if (type & KEY_POSTED)
-        ret |= !!BitIsOn(pDev->key->postdown, key_code);
+        ret |= BitIsOn(pDev->key->postdown, key_code);
 
     return ret;
 }
commit 42dc91e32a02b6b21ff5c45f465f3349e5822615
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Nov 24 14:20:30 2010 +1000

    include: let BitIsOn() return a boolean value.
    
    Simply returning the mask bit breaks checks like
        BitIsOn(mask, 0) != BitIsOn(mask, 1);
    as used in 048e93593e3f7a99a7d2a219e1ce2bdc9d407807.
    
    The naming of this macro suggests that it should return boolean values
    anyway. This patch also adds a few simple tests for these macros to make
    sure they don't accidentally break in the future.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Pat Kane <pekane52 at gmail.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/include/inputstr.h b/include/inputstr.h
index d4c253e..44de9c4 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -57,7 +57,7 @@ SOFTWARE.
 #include "geext.h"
 #include "privates.h"
 
-#define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
+#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
 #define SetBit(ptr, bit)  (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
 #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
 extern _X_EXPORT int CountBits(const uint8_t *mask, int len);
diff --git a/test/input.c b/test/input.c
index 4ccfaff..1fe228c 100644
--- a/test/input.c
+++ b/test/input.c
@@ -1050,7 +1050,22 @@ static void dix_valuator_mode(void)
         g_assert(valuator_get_mode(&dev, i) == Relative);
 }
 
+static void include_bit_test_macros(void)
+{
+    uint8_t mask[9] = { 0 };
+    int i;
 
+    for (i = 0; i < sizeof(mask)/sizeof(mask[0]); i++)
+    {
+        g_assert(BitIsOn(mask, i) == 0);
+        SetBit(mask, i);
+        g_assert(BitIsOn(mask, i) == 1);
+        g_assert(!!(mask[i/8] & (1 << (i % 8))));
+        g_assert(CountBits(mask, sizeof(mask)) == 1);
+        ClearBit(mask, i);
+        g_assert(BitIsOn(mask, i) == 0);
+    }
+}
 
 int main(int argc, char** argv)
 {
@@ -1066,6 +1081,7 @@ int main(int argc, char** argv)
     g_test_add_func("/dix/input/grab_matching", dix_grab_matching);
     g_test_add_func("/dix/input/valuator_mode", dix_valuator_mode);
     g_test_add_func("/include/byte_padding_macros", include_byte_padding_macros);
+    g_test_add_func("/include/bit_test_macros", include_bit_test_macros);
     g_test_add_func("/Xi/xiproperty/register-unregister", xi_unregister_handlers);
 
 
commit 4e0f8f666e61390206c42ad2087477a912525bc7
Merge: 400ddf2... 639600f...
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Nov 24 11:47:33 2010 -0800

    Merge remote branch 'whot/for-keith'

commit 400ddf2f58ce673c74d4e8ee829729cd3c75f8c9
Merge: 7250f07... e074f74...
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Nov 24 11:46:18 2010 -0800

    Merge remote branch 'jeremyhu/master'

commit 7250f078c12fd20d5ac9150f54495926e5121461
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Nov 21 14:27:58 2010 -0500

    doc: refactor Makefile and xmlrules.in code for reusability
    
    A different approach which requires less variables setting
    and internal knowledge of the reused code.
    Changing from "install" to "not install" is very easy now.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/xml/Makefile.am b/doc/xml/Makefile.am
index ab3839b..6c8178a 100644
--- a/doc/xml/Makefile.am
+++ b/doc/xml/Makefile.am
@@ -22,14 +22,9 @@
 #
 
 SUBDIRS = dtrace
+doc_sources =  Xserver-spec.xml
 
-XML_FILES = Xserver-spec.xml
-
-include $(top_srcdir)/doc/xml/xmlrules.in
-
+# Developer's documentation is not installed
 if ENABLE_DEVEL_DOCS
-noinst_DATA = $(BUILT_DOC_FILES)
+include $(top_srcdir)/doc/xml/xmlrules-noinst.in
 endif
-CLEANFILES = $(CLEAN_DOC_FILES)
-
-EXTRA_DIST = $(XML_FILES)
diff --git a/doc/xml/dtrace/Makefile.am b/doc/xml/dtrace/Makefile.am
index 10b4f04..1a5ad15 100644
--- a/doc/xml/dtrace/Makefile.am
+++ b/doc/xml/dtrace/Makefile.am
@@ -21,18 +21,16 @@
 # DEALINGS IN THE SOFTWARE.
 #
 
-XML_FILES = Xserver-DTrace.xml
-
-include $(top_srcdir)/doc/xml/xmlrules.in
+doc_sources =  Xserver-DTrace.xml
 
 if ENABLE_DOCS
+
+# This user's documentation is installed only if tracing is available
 if XSERVER_DTRACE
-doc_DATA = $(BUILT_DOC_FILES)
+include $(top_srcdir)/doc/xml/xmlrules-inst.in
 else
-noinst_DATA = $(BUILT_DOC_FILES)
-endif
+include $(top_srcdir)/doc/xml/xmlrules-noinst.in
 endif
 
-CLEANFILES = $(CLEAN_DOC_FILES)
+endif
 
-EXTRA_DIST = $(XML_FILES)
diff --git a/doc/xml/xmlrules-inst.in b/doc/xml/xmlrules-inst.in
new file mode 100644
index 0000000..9b90278
--- /dev/null
+++ b/doc/xml/xmlrules-inst.in
@@ -0,0 +1,23 @@
+
+# The doc_sources variable contains one or more DocBook/XML source file.
+# The generated documents will be installed in $(docdir),
+# The DocBook/XML files will always be included in the tarball
+
+dist_doc_DATA = $(doc_sources)
+
+if HAVE_XMLTO
+doc_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+doc_DATA += $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+doc_DATA += $(doc_sources:.xml=.txt)
+endif
+
+CLEANFILES = $(doc_DATA)
+include $(top_srcdir)/doc/xml/xmlrules.in
+
+endif HAVE_XMLTO
+
diff --git a/doc/xml/xmlrules-noinst.in b/doc/xml/xmlrules-noinst.in
new file mode 100644
index 0000000..0333652
--- /dev/null
+++ b/doc/xml/xmlrules-noinst.in
@@ -0,0 +1,22 @@
+
+# The doc_sources variable contains one or more DocBook/XML source file.
+# The generated documents will NOT be installed in $(docdir),
+# The DocBook/XML files will always be included in the tarball
+
+dist_noinst_DATA = $(doc_sources)
+
+if HAVE_XMLTO
+noinst_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+noinst_DATA += $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+noinst_DATA += $(doc_sources:.xml=.txt)
+endif
+
+CLEANFILES = $(noinst_DATA)
+include $(top_srcdir)/doc/xml/xmlrules.in
+
+endif HAVE_XMLTO
diff --git a/doc/xml/xmlrules.in b/doc/xml/xmlrules.in
index fd34243..f6a2e4f 100644
--- a/doc/xml/xmlrules.in
+++ b/doc/xml/xmlrules.in
@@ -21,24 +21,15 @@
 # DEALINGS IN THE SOFTWARE.
 #
 
-# This file is included by Makefile.am in subdirectories that have
-# DocBook XML documentation files.
-#
-# No files are automatically distributed or installed by this subset of rules
-# Any files to be distributed or installed would be listed in the including
-# Makefile.am
-
-TXT_FILES  = $(XML_FILES:%.xml=%.txt)
-HTML_FILES = $(XML_FILES:%.xml=%.html)
-PDF_FILES  = $(XML_FILES:%.xml=%.pdf)
-
-BUILT_DOC_FILES =
-
-SUFFIXES = .xml .txt .html .pdf
+# This file provides pattern rules to generate html/pdf/txt from DocBook/XML
+# A stylesheet is used if xorg-sgml-doctools is installed
+# This file is included by xmlrules-inst.in for installable user's documentation
+# It is included by xmlrules-noinst for non installable developer's documentation
+# If the server version or release date changes, autogen && make
 
 XML_ENT_DIR = $(abs_top_builddir)/doc/xml
+SUFFIXES = .xml .txt .html .pdf
 
-if HAVE_XMLTO
 XMLTO_FLAGS = --searchpath $(XML_ENT_DIR)
 
 if HAVE_STYLESHEETS
@@ -46,23 +37,11 @@ XMLTO_FLAGS += -m $(XSL_STYLESHEET) \
 	--stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
 endif
 
-if HAVE_XMLTO_TEXT
-BUILT_DOC_FILES += $(TXT_FILES)
 %.txt: %.xml $(XML_ENT_DIR)/xserver.ent
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
-endif
 
-BUILT_DOC_FILES += $(HTML_FILES)
 %.html: %.xml $(XML_ENT_DIR)/xserver.ent
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
 
-if HAVE_FOP
-BUILT_DOC_FILES += $(PDF_FILES)
 %.pdf: %.xml $(XML_ENT_DIR)/xserver.ent
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
-endif
-
-endif HAVE_XMLTO
-
-CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES)
-
diff --git a/hw/dmx/doc/Makefile.am b/hw/dmx/doc/Makefile.am
index 3b22850..6dea366 100644
--- a/hw/dmx/doc/Makefile.am
+++ b/hw/dmx/doc/Makefile.am
@@ -19,14 +19,12 @@
 #  NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 #  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-XML_FILES = dmx.xml scaled.xml
-
-include $(top_srcdir)/doc/xml/xmlrules.in
+doc_sources = dmx.xml scaled.xml
 
+# Developer's documentation is not installed
 if ENABLE_DEVEL_DOCS
-noinst_DATA = $(BUILT_DOC_FILES)
+include $(top_srcdir)/doc/xml/xmlrules-noinst.in
 endif
-CLEANFILES = $(CLEAN_DOC_FILES)
 
 if HAVE_DOXYGEN
 
diff --git a/hw/xfree86/doc/sgml/Makefile.am b/hw/xfree86/doc/sgml/Makefile.am
index efed19d..10eca86 100644
--- a/hw/xfree86/doc/sgml/Makefile.am
+++ b/hw/xfree86/doc/sgml/Makefile.am
@@ -19,13 +19,9 @@
 #  NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 #  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-XML_FILES = DESIGN.xml
-
-include $(top_srcdir)/doc/xml/xmlrules.in
+doc_sources = DESIGN.xml
 
+# Developer's documentation is not installed
 if ENABLE_DEVEL_DOCS
-noinst_DATA = $(BUILT_DOC_FILES)
+include $(top_srcdir)/doc/xml/xmlrules-noinst.in
 endif
-CLEANFILES = $(CLEAN_DOC_FILES)
-
-EXTRA_DIST = $(XML_FILES)
commit f33512b70cf0350a62df2ee2287a870d5fc991a8
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Nov 21 14:27:57 2010 -0500

    xmlrules.in: use $(top_srcdir) rather than ../../../ [...]
    
    Relative paths don't always work in distcheck when srcdir not = builddir
    include $(top_srcdir)/doc/xml/xmlrules.in
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/xml/Makefile.am b/doc/xml/Makefile.am
index e66f192..ab3839b 100644
--- a/doc/xml/Makefile.am
+++ b/doc/xml/Makefile.am
@@ -25,7 +25,7 @@ SUBDIRS = dtrace
 
 XML_FILES = Xserver-spec.xml
 
-include xmlrules.in
+include $(top_srcdir)/doc/xml/xmlrules.in
 
 if ENABLE_DEVEL_DOCS
 noinst_DATA = $(BUILT_DOC_FILES)
diff --git a/doc/xml/dtrace/Makefile.am b/doc/xml/dtrace/Makefile.am
index a95d374..10b4f04 100644
--- a/doc/xml/dtrace/Makefile.am
+++ b/doc/xml/dtrace/Makefile.am
@@ -23,7 +23,7 @@
 
 XML_FILES = Xserver-DTrace.xml
 
-include ../xmlrules.in
+include $(top_srcdir)/doc/xml/xmlrules.in
 
 if ENABLE_DOCS
 if XSERVER_DTRACE
diff --git a/hw/dmx/doc/Makefile.am b/hw/dmx/doc/Makefile.am
index 58306d2..3b22850 100644
--- a/hw/dmx/doc/Makefile.am
+++ b/hw/dmx/doc/Makefile.am
@@ -21,7 +21,7 @@
 
 XML_FILES = dmx.xml scaled.xml
 
-include ../../../doc/xml/xmlrules.in
+include $(top_srcdir)/doc/xml/xmlrules.in
 
 if ENABLE_DEVEL_DOCS
 noinst_DATA = $(BUILT_DOC_FILES)
diff --git a/hw/xfree86/doc/sgml/Makefile.am b/hw/xfree86/doc/sgml/Makefile.am
index 5322b42..efed19d 100644
--- a/hw/xfree86/doc/sgml/Makefile.am
+++ b/hw/xfree86/doc/sgml/Makefile.am
@@ -21,7 +21,7 @@
 
 XML_FILES = DESIGN.xml
 
-include ../../../../doc/xml/xmlrules.in
+include $(top_srcdir)/doc/xml/xmlrules.in
 
 if ENABLE_DEVEL_DOCS
 noinst_DATA = $(BUILT_DOC_FILES)
commit c25b407f22456f50eef90d9bc5e026c05415c021
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Nov 21 14:27:56 2010 -0500

    xmlrules.in: specify the xserver entities depedencies on the target
    
    The generated docs will rebuild when the xserver.ent file changes.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/xml/xmlrules.in b/doc/xml/xmlrules.in
index f3b76f9..fd34243 100644
--- a/doc/xml/xmlrules.in
+++ b/doc/xml/xmlrules.in
@@ -48,17 +48,17 @@ endif
 
 if HAVE_XMLTO_TEXT
 BUILT_DOC_FILES += $(TXT_FILES)
-%.txt: %.xml
+%.txt: %.xml $(XML_ENT_DIR)/xserver.ent
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
 endif
 
 BUILT_DOC_FILES += $(HTML_FILES)
-%.html: %.xml
+%.html: %.xml $(XML_ENT_DIR)/xserver.ent
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
 
 if HAVE_FOP
 BUILT_DOC_FILES += $(PDF_FILES)
-%.pdf: %.xml
+%.pdf: %.xml $(XML_ENT_DIR)/xserver.ent
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
 endif
 
@@ -66,8 +66,3 @@ endif HAVE_XMLTO
 
 CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES)
 
-# All the files we build depend on the entities
-$(BUILT_DOC_FILES): $(XML_ENT_DIR)/xserver.ent
-
-$(XML_ENT_DIR)/xserver.ent:
-	(cd $(XML_ENT_DIR) && $(MAKE) $(AM_MAKEFLAGS) $(@F))
commit 73841074eb856e6be3b9f9e3fc2d2721443166ab
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Nov 21 14:27:55 2010 -0500

    xmlrules.in: use pattern rules to enable dependencies
    
    This will allow a dependency to be specified as done in libX11:
    
    %.html: %.xml $(dist_spec_DATA)
    	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/xml/xmlrules.in b/doc/xml/xmlrules.in
index 987d6b6..f3b76f9 100644
--- a/doc/xml/xmlrules.in
+++ b/doc/xml/xmlrules.in
@@ -48,17 +48,17 @@ endif
 
 if HAVE_XMLTO_TEXT
 BUILT_DOC_FILES += $(TXT_FILES)
-.xml.txt:
+%.txt: %.xml
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
 endif
 
 BUILT_DOC_FILES += $(HTML_FILES)
-.xml.html:
+%.html: %.xml
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
 
 if HAVE_FOP
 BUILT_DOC_FILES += $(PDF_FILES)
-.xml.pdf:
+%.pdf: %.xml
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
 endif
 
commit 97e307dda201d6ba28a723c21a95e484921d1b08
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Nov 21 14:27:54 2010 -0500

    xmlrules.in: no need to setup xmlto flags when configuring --without-xmlto
    
    The AM conditional HAVE_XMLTO should wrap more statements.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/xml/xmlrules.in b/doc/xml/xmlrules.in
index c455ded..987d6b6 100644
--- a/doc/xml/xmlrules.in
+++ b/doc/xml/xmlrules.in
@@ -37,6 +37,8 @@ BUILT_DOC_FILES =
 SUFFIXES = .xml .txt .html .pdf
 
 XML_ENT_DIR = $(abs_top_builddir)/doc/xml
+
+if HAVE_XMLTO
 XMLTO_FLAGS = --searchpath $(XML_ENT_DIR)
 
 if HAVE_STYLESHEETS
@@ -44,7 +46,6 @@ XMLTO_FLAGS += -m $(XSL_STYLESHEET) \
 	--stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
 endif
 
-if HAVE_XMLTO
 if HAVE_XMLTO_TEXT
 BUILT_DOC_FILES += $(TXT_FILES)
 .xml.txt:
@@ -61,7 +62,7 @@ BUILT_DOC_FILES += $(PDF_FILES)
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
 endif
 
-endif
+endif HAVE_XMLTO
 
 CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES)
 
commit 1a7b14d1183057fc69a5da446e898104b65c8347
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Nov 21 14:27:53 2010 -0500

    xmlrules.in: remove unrequired "@rm -f $@" from doc targets
    
    Unable to find a purpose for this, not used anywhere else
    but in the font module.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/xml/xmlrules.in b/doc/xml/xmlrules.in
index f828eef..c455ded 100644
--- a/doc/xml/xmlrules.in
+++ b/doc/xml/xmlrules.in
@@ -48,19 +48,16 @@ if HAVE_XMLTO
 if HAVE_XMLTO_TEXT
 BUILT_DOC_FILES += $(TXT_FILES)
 .xml.txt:
-	@rm -f $@
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
 endif
 
 BUILT_DOC_FILES += $(HTML_FILES)
 .xml.html:
-	@rm -f $@
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
 
 if HAVE_FOP
 BUILT_DOC_FILES += $(PDF_FILES)
 .xml.pdf:
-	@rm -f $@
 	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
 endif
 
commit d3c523bd124dc1a3f4539f7f6cd4868adbfc25e1
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Nov 21 14:27:52 2010 -0500

    doc: HTML file generation: use the installed copy of xorg.css
    
    Currently the xorg.css file is copied in each location
    where a DocBook/XML file resides. This produces about
    70 copies in the $(docdir) install tree for all of xorg.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/xml/.gitignore b/doc/xml/.gitignore
index 3d050f0..4961738 100644
--- a/doc/xml/.gitignore
+++ b/doc/xml/.gitignore
@@ -3,4 +3,3 @@ xserver.ent
 Xserver-spec.html
 Xserver-spec.pdf
 Xserver-spec.txt
-xorg.css
diff --git a/doc/xml/dtrace/.gitignore b/doc/xml/dtrace/.gitignore
index a43c4e1..e2a21d1 100644
--- a/doc/xml/dtrace/.gitignore
+++ b/doc/xml/dtrace/.gitignore
@@ -1,4 +1,3 @@
 Xserver-DTrace.html
 Xserver-DTrace.pdf
 Xserver-DTrace.txt
-xorg.css
diff --git a/doc/xml/xmlrules.in b/doc/xml/xmlrules.in
index b7fda11..f828eef 100644
--- a/doc/xml/xmlrules.in
+++ b/doc/xml/xmlrules.in
@@ -40,11 +40,8 @@ XML_ENT_DIR = $(abs_top_builddir)/doc/xml
 XMLTO_FLAGS = --searchpath $(XML_ENT_DIR)
 
 if HAVE_STYLESHEETS
-XMLTO_FLAGS += -m $(XSL_STYLESHEET)
-BUILT_DOC_FILES += xorg.css
-
-xorg.css: $(STYLESHEET_SRCDIR)/xorg.css
-	$(AM_V_GEN)cp -pf $(STYLESHEET_SRCDIR)/xorg.css $@
+XMLTO_FLAGS += -m $(XSL_STYLESHEET) \
+	--stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
 endif
 
 if HAVE_XMLTO
@@ -69,7 +66,7 @@ endif
 
 endif
 
-CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES) xorg.css
+CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES)
 
 # All the files we build depend on the entities
 $(BUILT_DOC_FILES): $(XML_ENT_DIR)/xserver.ent
commit 504e3010e976ccc008ff48417850b594beaee2ec
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Nov 19 22:09:05 2010 -0800

    Xorg.man: Replace XDarwin reference with Xquartz
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre
index 805f3a3..86e89a9 100644
--- a/hw/xfree86/doc/man/Xorg.man.pre
+++ b/hw/xfree86/doc/man/Xorg.man.pre
@@ -32,8 +32,8 @@ SPARC and PowerPC.  The most widely supported operating systems are the
 free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD,
 OpenBSD, and Solaris.  Commercial UNIX operating systems such as
 UnixWare are also supported.  Other supported operating systems include
-GNU Hurd.  Darwin and Mac OS X are supported with the
-XDarwin(__appmansuffix__) X server.  Win32/Cygwin is supported with the 
+GNU Hurd.  Mac OS X is supported with the
+Xquartz(__appmansuffix__) X server.  Win32/Cygwin is supported with the
 XWin(__appmansuffix__) X server.
 .PP
 .SH "NETWORK CONNECTIONS"
commit 566d09a5cd6452ee2e05e23d2205e7c3aa31f0da
Author: Bill Nottingham <notting at redhat.com>
Date:   Mon Nov 15 11:25:14 2010 +1000

    xfree86: store the screen's gamma information on init.
    
    This fixes a gamma issue on vt switch observed with KDM. VT switching away
    and back would result in a black screen. Avoid this by storing the current
    gamma information on init.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=533217
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index f562f58..2fe0c47 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1757,6 +1757,7 @@ xf86RandR12Init12 (ScreenPtr pScreen)
     ScrnInfoPtr		pScrn = xf86Screens[pScreen->myNum];
     rrScrPrivPtr	rp = rrGetScrPriv(pScreen);
     XF86RandRInfoPtr	randrp  = XF86RANDRINFO(pScreen);
+    int i;
 
     rp->rrGetInfo = xf86RandR12GetInfo12;
     rp->rrScreenSetSize = xf86RandR12ScreenSetSize;
@@ -1786,6 +1787,9 @@ xf86RandR12Init12 (ScreenPtr pScreen)
      */
     if (!xf86RandR12SetInfo12 (pScreen))
 	return FALSE;
+    for (i = 0; i < rp->numCrtcs; i++) {
+	xf86RandR12CrtcGetGamma(pScreen, rp->crtcs[i]);
+    }
     return TRUE;
 }
 
commit c050aa2f5fa6a7ff8ce4f91def14ca44f799f067
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Nov 15 11:25:12 2010 +1000

    xfree86: apply gamma settings on EnterVT.
    
    When entering the VT, re-apply the saved gamma settings for each screen.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index ba0862a..f562f58 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1731,6 +1731,7 @@ xf86RandR12EnterVT (int screen_index, int flags)
     ScreenPtr        pScreen = screenInfo.screens[screen_index];
     ScrnInfoPtr	     pScrn = xf86Screens[screen_index];
     XF86RandRInfoPtr randrp  = XF86RANDRINFO(pScreen);
+    rrScrPrivPtr     rp = rrGetScrPriv(pScreen);
     Bool	     ret;
 
     if (randrp->orig_EnterVT) {
@@ -1742,6 +1743,11 @@ xf86RandR12EnterVT (int screen_index, int flags)
 	    return FALSE;
     }
 
+    /* reload gamma */
+    int i;
+    for (i = 0; i < rp->numCrtcs; i++)
+	xf86RandR12CrtcSetGamma(pScreen, rp->crtcs[i]);
+
     return RRGetInfo (pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */
 }
 
commit e074f745a80b87d1d82fb39489d7f35163d7552a
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Nov 23 16:03:48 2010 -0800

    XQuartz: Remove unused CloseInputDevice stub
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c
index 15d9c52..8bb83ca 100644
--- a/hw/xquartz/darwinXinput.c
+++ b/hw/xquartz/darwinXinput.c
@@ -63,25 +63,6 @@ SOFTWARE.
 #include "XIstubs.h"
 #include "darwin.h"
 
-/***********************************************************************
- *
- * Caller:	ProcXCloseDevice
- *
- * Take care of implementation-dependent details of closing a device.
- * Some implementations may actually close the device, others may just
- * remove this clients interest in that device.
- *
- * The default implementation is to do nothing (assume all input devices
- * are initialized during X server initialization and kept open).
- *
- */
-
-void
-CloseInputDevice(DeviceIntPtr d, ClientPtr client)
-{
-  DEBUG_LOG("CloseInputDevice(%p, %p)\n", d, client);
-}
-
 /****************************************************************************
  *
  * Caller:	ProcXSetDeviceMode
commit 639600fa7ebad7a4953d0b632abeff2d339a49c6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Nov 23 13:30:05 2010 +1000

    dix: add a fixme about a corner-case that should probably be fixed.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index f19c991..0d59290 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1255,6 +1255,10 @@ GetProximityEvents(EventList *events, DeviceIntPtr pDev, int type, const Valuato
             valuator_mask_unset(&mask, i);
     }
 
+    /* FIXME: posting proximity events with relative valuators only results
+     * in an empty event, EventToXI() will fail to convert → no event sent
+     * to client. */
+
     events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events);
 
     event = (DeviceEvent *) events->event;
commit 0aca9e8424d8b978053a29c4468f800fc2e7238c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Nov 23 13:04:19 2010 +1000

    dix: fix typo, set the second valuator with the y-axis data.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index f80e87c..f19c991 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1186,7 +1186,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
     if (valuator_mask_isset(&mask, 0))
         valuator_mask_set(&mask, 0, x);
     if (valuator_mask_isset(&mask, 1))
-        valuator_mask_set(&mask, 0, y);
+        valuator_mask_set(&mask, 1, y);
 
     clipValuators(pDev, &mask);
 
commit 45131bb67f9eacb3b55de4bcd3730fb9bb028e8a
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Nov 23 12:55:50 2010 +1000

    dix: GetProximityEvents needs to check up to the last valuator
    
    valuator_mask_size() returns the highest valuator set as opposed to the
    number of set bits (which obviously changes as we unset valuators).
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index 5f4fb66..f80e87c 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1248,7 +1248,7 @@ GetProximityEvents(EventList *events, DeviceIntPtr pDev, int type, const Valuato
     valuator_mask_copy(&mask, mask_in);
 
     /* ignore relative axes for proximity. */
-    for (i = 0; i < valuator_mask_num_valuators(&mask); i++)
+    for (i = 0; i < valuator_mask_size(&mask); i++)
     {
         if (valuator_mask_isset(&mask, i) &&
             valuator_get_mode(pDev, i) == Relative)
commit 048e93593e3f7a99a7d2a219e1ce2bdc9d407807
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Nov 23 11:15:52 2010 +1000

    dix: when converting to XI 1.x events, use the first_valuator's device mode
    
    Don't stop processing events when a valuator's mode doesn't match the 0th
    valuator's mode. Instead, start with the first_valuator in the event and
    keep stacking them on until the first valuator with a different mode is hit.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index b92169e..dd17898 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -324,14 +324,16 @@ countValuators(DeviceEvent *ev, int *first)
 
     for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
     {
-        /* Assume mode of 0th valuator matches XI1 device mode. Stop when the
-         * event mode changes since XI1 can't handle mixed mode devices.
-         */
-        if (BitIsOn(ev->valuators.mode, i) != BitIsOn(ev->valuators.mode, 0))
-            break;
-
         if (BitIsOn(ev->valuators.mask, i))
         {
+            /* Assume mode of first_valuator matches XI1 device mode. Stop when the
+             * event mode changes since XI1 can't handle mixed mode devices.
+             */
+            if (first_valuator > -1 &&
+                 BitIsOn(ev->valuators.mode, i) !=
+                 BitIsOn(ev->valuators.mode, first_valuator))
+                break;
+
             if (first_valuator == -1)
                 first_valuator = i;
             last_valuator = i;
commit 4f3e670fd28fceec384ff0d4ca7c1ff8d7a872ad
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Nov 23 10:59:52 2010 +1000

    dix: when comparing axis modes, compare the bits, not the bytes.
    
    The DeviceEvent's mode field is a set of bits for each valuator, not bytes.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 46eb4ff..b92169e 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -327,7 +327,7 @@ countValuators(DeviceEvent *ev, int *first)
         /* Assume mode of 0th valuator matches XI1 device mode. Stop when the
          * event mode changes since XI1 can't handle mixed mode devices.
          */
-        if (ev->valuators.mode[i] != ev->valuators.mode[0])
+        if (BitIsOn(ev->valuators.mode, i) != BitIsOn(ev->valuators.mode, 0))
             break;
 
         if (BitIsOn(ev->valuators.mask, i))
commit 6f12934d4ea52f17ac7b21e92f4f929db165f83d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Nov 23 10:58:32 2010 +1000

    dix: replace a manual valuator check with valuator_get_mode().
    
    This check was missing the OutOfProximity mask and resulted in the wrong
    bits being set in InternalEvents.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index 06a0da0..5f4fb66 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -210,7 +210,7 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
         if (valuator_mask_isset(mask, i))
         {
             SetBit(event->valuators.mask, i);
-            if (dev->valuator->axes[i].mode == Absolute)
+            if (valuator_get_mode(dev, i) == Absolute)
                 SetBit(event->valuators.mode, i);
             event->valuators.data[i] = valuator_mask_get(mask, i);
             event->valuators.data_frac[i] =
commit ebe3ddaf284ad388835da9cbaa6ad61fa21ce6dd
Author: Simon Thum <simon.thum at gmx.de>
Date:   Fri Nov 19 11:09:21 2010 +1000

    dix: fix up valuators passed to acceleration code.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Simon Thum <simon.thum at gmx.de>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index a288e36..06a0da0 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1159,11 +1159,16 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
              * should be converted to masked valuators. */
             int vals[2];
             vals[0] = valuator_mask_isset(&mask, 0) ?
-                      valuator_mask_get(&mask, 0) : pDev->last.valuators[0];
+                      valuator_mask_get(&mask, 0) : 0;
             vals[1] = valuator_mask_isset(&mask, 1) ?
-                      valuator_mask_get(&mask, 1) : pDev->last.valuators[1];
+                      valuator_mask_get(&mask, 1) : 0;
             accelPointer(pDev, 0, 2, vals, ms);
 
+            if (valuator_mask_isset(&mask, 0))
+                valuator_mask_set(&mask, 0, vals[0]);
+            if (valuator_mask_isset(&mask, 1))
+                valuator_mask_set(&mask, 1, vals[1]);
+
             /* The pointer acceleration code modifies the fractional part
              * in-place, so we need to extract this information first */
             x_frac = pDev->last.remainder[0];
commit d435e1ecb86e2fe6292b5945262956644f979bbb
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 5 11:08:27 2010 +1000

    test: reduce range of byte-padding macro tests.
    
    Byte padding and conversion is interesting for the rage of 0-8 bytes, and
    then interesting towards the end of the valid range (INT_MAX - 7 and INT_MAX
    - 3).
    
    Note: this changes the upper range for pad_to_int32() and bytes_to_int32()
    from the previous (INT_MAX - 4) to (INT_MAX - 3).
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/test/input.c b/test/input.c
index 13a441e..4ccfaff 100644
--- a/test/input.c
+++ b/test/input.c
@@ -683,45 +683,82 @@ static void dix_grab_matching(void)
     g_assert(rc == TRUE);
 }
 
-static void include_byte_padding_macros(void)
+static void test_bits_to_byte(int i)
 {
-    int i;
-    g_test_message("Testing bits_to_bytes()");
-
-    /* the macros don't provide overflow protection */
-    for (i = 0; i < INT_MAX - 7; i++)
-    {
         int expected_bytes;
         expected_bytes = (i + 7)/8;
 
         g_assert(bits_to_bytes(i) >= i/8);
         g_assert((bits_to_bytes(i) * 8) - i <= 7);
         g_assert(expected_bytes == bits_to_bytes(i));
-    }
+}
 
-    g_test_message("Testing bytes_to_int32()");
-    for (i = 0; i < INT_MAX - 3; i++)
-    {
+static void test_bytes_to_int32(int i)
+{
         int expected_4byte;
         expected_4byte = (i + 3)/4;
 
         g_assert(bytes_to_int32(i) <= i);
         g_assert((bytes_to_int32(i) * 4) - i <= 3);
         g_assert(expected_4byte == bytes_to_int32(i));
-    }
-
-    g_test_message("Testing pad_to_int32");
+}
 
-    for (i = 0; i < INT_MAX - 3; i++)
-    {
+static void test_pad_to_int32(int i)
+{
         int expected_bytes;
         expected_bytes = ((i + 3)/4) * 4;
 
         g_assert(pad_to_int32(i) >= i);
         g_assert(pad_to_int32(i) - i <= 3);
         g_assert(expected_bytes == pad_to_int32(i));
-    }
+}
+static void include_byte_padding_macros(void)
+{
+    g_test_message("Testing bits_to_bytes()");
+
+    /* the macros don't provide overflow protection */
+    test_bits_to_byte(0);
+    test_bits_to_byte(1);
+    test_bits_to_byte(2);
+    test_bits_to_byte(7);
+    test_bits_to_byte(8);
+    test_bits_to_byte(0xFF);
+    test_bits_to_byte(0x100);
+    test_bits_to_byte(INT_MAX - 9);
+    test_bits_to_byte(INT_MAX - 8);
+
+    g_test_message("Testing bytes_to_int32()");
+
+    test_bytes_to_int32(0);
+    test_bytes_to_int32(1);
+    test_bytes_to_int32(2);
+    test_bytes_to_int32(7);
+    test_bytes_to_int32(8);
+    test_bytes_to_int32(0xFF);
+    test_bytes_to_int32(0x100);
+    test_bytes_to_int32(0xFFFF);
+    test_bytes_to_int32(0x10000);
+    test_bytes_to_int32(0xFFFFFF);
+    test_bytes_to_int32(0x1000000);
+    test_bytes_to_int32(INT_MAX - 4);
+    test_bytes_to_int32(INT_MAX - 3);
+
+    g_test_message("Testing pad_to_int32");
 
+    test_pad_to_int32(0);
+    test_pad_to_int32(0);
+    test_pad_to_int32(1);
+    test_pad_to_int32(2);
+    test_pad_to_int32(7);
+    test_pad_to_int32(8);
+    test_pad_to_int32(0xFF);
+    test_pad_to_int32(0x100);
+    test_pad_to_int32(0xFFFF);
+    test_pad_to_int32(0x10000);
+    test_pad_to_int32(0xFFFFFF);
+    test_pad_to_int32(0x1000000);
+    test_pad_to_int32(INT_MAX - 4);
+    test_pad_to_int32(INT_MAX - 3);
 }
 
 static void xi_unregister_handlers(void)
commit f49ee9074a66883a3c525b0d6e71589123288465
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 5 10:59:52 2010 +1000

    test: compare byte padding macros against the expected bytes.
    
    We calculate the expected bytes for each value, let's use it.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/test/input.c b/test/input.c
index f8ce4b2..13a441e 100644
--- a/test/input.c
+++ b/test/input.c
@@ -696,6 +696,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(bits_to_bytes(i) >= i/8);
         g_assert((bits_to_bytes(i) * 8) - i <= 7);
+        g_assert(expected_bytes == bits_to_bytes(i));
     }
 
     g_test_message("Testing bytes_to_int32()");
@@ -706,6 +707,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(bytes_to_int32(i) <= i);
         g_assert((bytes_to_int32(i) * 4) - i <= 3);
+        g_assert(expected_4byte == bytes_to_int32(i));
     }
 
     g_test_message("Testing pad_to_int32");
@@ -717,6 +719,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(pad_to_int32(i) >= i);
         g_assert(pad_to_int32(i) - i <= 3);
+        g_assert(expected_bytes == pad_to_int32(i));
     }
 
 }
commit b31df0439fe336a43a2355e2f1fb223d86045a05
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Nov 22 15:14:02 2010 +1000

    xfree86: add missing linebreak in error message.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Magnus Kessler <Magnus.Kessler at gmx.net>

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 3664d46..81bb707 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -1296,7 +1296,7 @@ xf86ScaleAxis(int	Cx,
     }
     else {
 	X = 0;
-	ErrorF ("Divide by Zero in xf86ScaleAxis");
+	ErrorF ("Divide by Zero in xf86ScaleAxis\n");
     }
     
     if (X > to_max)
commit 31737fff08ec19b394837341d5e358ec401f5cd8
Author: Chase Douglas <chase.douglas at ubuntu.com>
Date:   Mon Nov 15 11:42:12 2010 -0500

    Fix transformAbsolute
    
    transformAbsolute must use old values if valuator mask doesn't have new
    ones, and it must only set new values if there was a change.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/getevents.c b/dix/getevents.c
index bc5841f..a288e36 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1057,14 +1057,18 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
     struct pixman_f_vector p;
 
     /* p' = M * p in homogeneous coordinates */
-    p.v[0] = valuator_mask_get(mask, 0);
-    p.v[1] = valuator_mask_get(mask, 1);
+    p.v[0] = (valuator_mask_isset(mask, 0) ? valuator_mask_get(mask, 0) :
+              dev->last.valuators[0]);
+    p.v[1] = (valuator_mask_isset(mask, 1) ? valuator_mask_get(mask, 1) :
+              dev->last.valuators[1]);
     p.v[2] = 1.0;
 
     pixman_f_transform_point(&dev->transform, &p);
 
-    valuator_mask_set(mask, 0, lround(p.v[0]));
-    valuator_mask_set(mask, 1, lround(p.v[1]));
+    if (lround(p.v[0]) != dev->last.valuators[0])
+        valuator_mask_set(mask, 0, lround(p.v[0]));
+    if (lround(p.v[1]) != dev->last.valuators[1])
+        valuator_mask_set(mask, 1, lround(p.v[1]));
 }
 
 /**
commit 463841f45aafd1227bac652965c9ea337dd527fa
Author: Chase Douglas <chase.douglas at ubuntu.com>
Date:   Mon Nov 15 11:42:11 2010 -0500

    Fix GPE Y axis scaling
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/getevents.c b/dix/getevents.c
index 9553728..bc5841f 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1139,7 +1139,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
             }
             if (valuator_mask_isset(&mask, 1))
             {
-                scaled = rescaleValuatorAxis(valuator_mask_get(&mask, 0),
+                scaled = rescaleValuatorAxis(valuator_mask_get(&mask, 1),
                                              0.0, &y_frac, NULL,
                                              pDev->valuator->axes + 1,
                                              scr->height);
commit a6b9e8f1e5d5d0b3b0f121a6f677eeca7aab1950
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Aug 25 11:06:38 2010 -0400

    linux: Fix CPU usage bug in console fd flushing
    
    If the vt gets a vhangup from under us, then the tty will appear ready
    in select(), but trying to tcflush() it will return -EIO, so we'll spin
    around at 100% CPU for no reason.  Notice this condition and unregister
    the handler if it happens.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index bf61ceb..7ee9046 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -85,7 +85,11 @@ static void *console_handler;
 static void
 drain_console(int fd, void *closure)
 {
-    tcflush(fd, TCIOFLUSH);
+    errno = 0;
+    if (tcflush(fd, TCIOFLUSH) == -1 && errno == EIO) {
+	xf86RemoveGeneralHandler(console_handler);
+	console_handler = NULL;
+    }
 }
 
 void
commit ecdbe817fd7eb53fd1e7485c0492355f7f002d2a
Author: Dan Horák <dan at danny.cz>
Date:   Tue Jun 22 19:45:26 2010 +0200

    XF86CONFIGDIR is undefined when built with --disable-xorg (#28672)
    
    The 10-evdev.conf file gets installed as /usr/share/X11/10-evdev.conf on
    platforms that built the server with --disable-xorg like s390/s390x. The
    definition/installation should be guarded with "if XORG" because it makes
    sense only when built with xorg.
    
    X.Org Bug 28672 <http://bugs.freedesktop.org/show_bug.cgi?id=28672>
    
    Signed-off-by: Dan Horák <dan at danny.cz>
    Acked-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/config/Makefile.am b/config/Makefile.am
index e1f1c4e..4a2e873 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -9,8 +9,10 @@ AM_CFLAGS += $(UDEV_CFLAGS)
 libconfig_la_SOURCES += udev.c
 libconfig_la_LIBADD = $(UDEV_LIBS)
 
+if XORG
 xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR)
 xorgconfd_DATA = 10-evdev.conf
+endif
 
 else
 


More information about the Xquartz-changes mailing list