xserver: Branch 'XACE-SELINUX' - 59 commits

Eamon Walsh ewalsh at kemper.freedesktop.org
Wed Jun 20 15:48:12 PDT 2007


 GL/glx/glxdri.c                         |   39 
 Xext/Makefile.am                        |    1 
 composite/compext.c                     |    2 
 configure.ac                            |   30 
 dix/devices.c                           |    2 
 dix/dispatch.c                          |   10 
 dix/dixutils.c                          |    2 
 dix/events.c                            |    7 
 dix/tables.c                            |   15 
 fb/Makefile.am                          |    4 
 fb/fb.h                                 |    6 
 fb/fbcopy.c                             |   24 
 fb/fbedge.c                             |  314 ---
 fb/fbedgeimp.h                          |  145 -
 fb/fbfill.c                             |   19 
 fb/fbmmx.c                              | 2791 +-------------------------------
 fb/fbmmx.h                              |  264 ---
 fb/fbpict.c                             |  372 ++--
 fb/fbpict.h                             |   12 
 fb/fbtrap.c                             |  103 -
 fb/fbwindow.c                           |   27 
 fb/wfbrename.h                          |    2 
 hw/kdrive/linux/agp.c                   |    2 
 hw/xfree86/common/compiler.h            |    2 
 hw/xfree86/common/xf86Build.h.in        |    1 
 hw/xfree86/common/xf86Config.c          |   48 
 hw/xfree86/common/xf86Events.c          |   28 
 hw/xfree86/common/xf86Init.c            |    8 
 hw/xfree86/common/xf86Mode.c            |    2 
 hw/xfree86/common/xf86Module.h          |    2 
 hw/xfree86/common/xf86Xinput.c          |   62 
 hw/xfree86/common/xf86Xinput.h          |    2 
 hw/xfree86/common/xf86xv.c              |   42 
 hw/xfree86/ddc/Makefile.am              |    4 
 hw/xfree86/ddc/ddcProperty.c            |   11 
 hw/xfree86/ddc/edid.h                   |    4 
 hw/xfree86/ddc/interpret_vdif.c         |  132 -
 hw/xfree86/ddc/print_vdif.c             |  225 --
 hw/xfree86/ddc/vdif.h                   |  174 -
 hw/xfree86/ddc/xf86DDC.c                |   41 
 hw/xfree86/ddc/xf86DDC.h                |    8 
 hw/xfree86/doc/man/xorg.conf.man.pre    | 1290 ++++++++------
 hw/xfree86/dri/dri.c                    |   30 
 hw/xfree86/dri/drimodule.c              |    2 
 hw/xfree86/dri/xf86dri.c                |   34 
 hw/xfree86/loader/xf86sym.c             |   53 
 hw/xfree86/modes/xf86Crtc.c             |   11 
 hw/xfree86/modes/xf86EdidModes.c        |    6 
 hw/xfree86/os-support/bsd/bsd_bell.c    |    4 
 hw/xfree86/os-support/bsd/i386_video.c  |    5 
 hw/xfree86/os-support/bus/linuxPci.c    |    4 
 hw/xfree86/os-support/hurd/hurd_video.c |   44 
 hw/xfree86/os-support/linux/lnx_video.c |    2 
 hw/xnest/Xnest.man.pre                  |  604 ++++--
 hw/xprint/Makefile.am                   |    6 
 hw/xwin/winmultiwindowclass.c           |    2 
 include/dixstruct.h                     |    4 
 include/servermd.h                      |   10 
 mi/mieq.c                               |   22 
 os/Makefile.am                          |    3 
 os/access.c                             |   31 
 os/auth.c                               |   12 
 os/k5auth.c                             |  799 ---------
 os/osdep.h                              |   23 
 os/utils.c                              |   14 
 randr/Makefile.am                       |   10 
 randr/randr.c                           |    3 
 render/mipict.c                         |   58 
 render/mipict.h                         |    6 
 render/picturestr.h                     |    4 
 render/renderedge.c                     |  119 -
 render/renderedge.h                     |   15 
 72 files changed, 1897 insertions(+), 6322 deletions(-)

New commits:
diff-tree e2a720c9a17dc860ee0a858c2b21fd71e86cdcd0 (from parents)
Merge: 878cac71aa0018deee861b297638c0744dba631b 3f9adb18f127318d054f30a57e3a77176e14c692
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Mon Jun 11 15:29:11 2007 -0400

    Merge branch 'master' into XACE-SELINUX
    
    Conflicts:
    
    	dix/dixutils.c

diff --cc dix/dixutils.c
index 4d082cd,c1e30ff..14ef7e6
@@@ -271,8 -269,6 +271,8 @@@
      int clientIndex = CLIENT_ID(rid);
      client->errorValue = rid;
  
-     dixLookupResource(&pRes, rid, RC_ANY, client, DixReadAccess);
++    dixLookupResource(&pRes, rid, RC_ANY, client, access);
 +
      if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) {
  	*pClient = clients[clientIndex];
  	return Success;
diff-tree 3f9adb18f127318d054f30a57e3a77176e14c692 (from d06099b38e8445e6e31f5178ffefcc31a71080ef)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Mon Jun 11 15:19:27 2007 -0400

    Port a few forgotten fbSolidFillmmx()'es to fbFillmmx(). Use pixman_blt() instead of fbBltmmx()
    in fbCopyNToN().

diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index 74ff358..a430203 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -60,17 +60,17 @@ fbCopyNtoN (DrawablePtr	pSrcDrawable,
 
     while (nbox--)
     {
-#ifdef USE_MMX
+#ifndef FB_ACCESS_WRAPPER /* pixman_blt() doesn't support accessors yet */
 	if (pm == FB_ALLONES && alu == GXcopy && !reverse &&
-	    !upsidedown && fbHaveMMX())
+	    !upsidedown)
 	{
-	    if (!fbBltmmx (src, dst, srcStride, dstStride, srcBpp, dstBpp,
-			   (pbox->x1 + dx + srcXoff),
-			   (pbox->y1 + dy + srcYoff),
-			   (pbox->x1 + srcXoff),
-			   (pbox->y1 + srcYoff),
-			   (pbox->x2 - pbox->x1),
-			   (pbox->y2 - pbox->y1)))
+	    if (!pixman_blt ((uint32_t *)src, (uint32_t *)dst, srcStride, dstStride, srcBpp, dstBpp,
+			     (pbox->x1 + dx + srcXoff),
+			     (pbox->y1 + dy + srcYoff),
+			     (pbox->x1 + srcXoff),
+			     (pbox->y1 + srcYoff),
+			     (pbox->x2 - pbox->x1),
+			     (pbox->y2 - pbox->y1)))
 		goto fallback;
 	    else
 		goto next;
@@ -94,7 +94,7 @@ fbCopyNtoN (DrawablePtr	pSrcDrawable,
 	       
 	       reverse,
 	       upsidedown);
-#ifdef USE_MMX
+#ifndef FB_ACCESS_WRAPPER
     next:
 #endif
 	pbox++;
diff --git a/fb/fbfill.c b/fb/fbfill.c
index 35e4427..4f13a02 100644
--- a/fb/fbfill.c
+++ b/fb/fbfill.c
@@ -221,13 +221,13 @@ fbSolidBoxClipped (DrawablePtr	pDrawable
 #ifdef USE_MMX
 	if (!and && fbHaveMMX())
 	{
-		if (fbSolidFillmmx (pDrawable,
-		                    partX1, partY1,
-				    (partX2 - partX1), (partY2 - partY1),
-				    xor)) {
-			fbFinishAccess (pDrawable);
-			return;
-		}
+	    if (fbFillmmx (dst, dstStride, dstBpp,
+			   partX1 + dstXoff, partX2 + dstYoff, (partX2 - partX1), (partY2 - partY1),
+			   xor))
+	    {
+		fbFinishAccess (pDrawable);
+		return;
+	    }
 	}
 #endif
 	fbSolid (dst + (partY1 + dstYoff) * dstStride,
diff --git a/fb/fbwindow.c b/fb/fbwindow.c
index cac662c..5b3f446 100644
--- a/fb/fbwindow.c
+++ b/fb/fbwindow.c
@@ -233,26 +233,27 @@ fbFillRegionSolid (DrawablePtr	pDrawable
     while (n--)
     {
 #ifdef USE_MMX
-        if (!has_mmx || !fbSolidFillmmx (pDrawable,
-	                                pbox->x1,
-					pbox->y1,
-					(pbox->x2 - pbox->x1),
-					(pbox->y2 - pbox->y1), xor)) {
+	if (!has_mmx || !fbFillmmx (dst, dstStride, dstBpp,
+				    pbox->x1 + dstXoff, pbox->y1 + dstYoff,
+				    (pbox->x2 - pbox->x1),
+				    (pbox->y2 - pbox->y1),
+				    xor))
+	{
 #endif
-	fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
-		 dstStride,
-		 (pbox->x1 + dstXoff) * dstBpp,
-		 dstBpp,
-		 (pbox->x2 - pbox->x1) * dstBpp,
-		 pbox->y2 - pbox->y1,
-		 and, xor);
+	    fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
+		     dstStride,
+		     (pbox->x1 + dstXoff) * dstBpp,
+		     dstBpp,
+		     (pbox->x2 - pbox->x1) * dstBpp,
+		     pbox->y2 - pbox->y1,
+		     and, xor);
 #ifdef USE_MMX
 	}
 #endif
 	fbValidateDrawable (pDrawable);
 	pbox++;
     }
-
+    
     fbFinishAccess (pDrawable);
 }
 
diff-tree d06099b38e8445e6e31f5178ffefcc31a71080ef (from d4a034370c8ae71b2cc4fe824ceee58b19624f35)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Mon Jun 11 13:28:24 2007 -0400

    Remove fbCopyAreammx() and fbSolidFillmmx()

diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index 6a593ff..3522a00 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -202,26 +202,6 @@ fbFillmmx (FbBits *bits,
 }
 
 Bool
-fbSolidFillmmx (DrawablePtr	pDraw,
-		int		x,
-		int		y,
-		int		width,
-		int		height,
-		FbBits		xor)
-{ 
-    FbStride	stride;
-    int		bpp;
-    FbBits      *bits;
-    int		xoff, yoff;
-    
-    CHECKPOINT();
-    
-    fbGetDrawable(pDraw, bits, stride, bpp, xoff, yoff);
-
-    return fbFillmmx (bits, stride, bpp, x + xoff, y + yoff, width, height, xor);
-}
-
-Bool
 fbBltmmx (FbBits *src_bits,
 	  FbBits *dst_bits,
 	  FbStride src_stride,
@@ -357,36 +337,5 @@ fbBltmmx (FbBits *src_bits,
     return TRUE;
 }
 
-Bool
-fbCopyAreammx (DrawablePtr	pSrc,
-	       DrawablePtr	pDst,
-	       int		src_x,
-	       int		src_y,
-	       int		dst_x,
-	       int		dst_y,
-	       int		width,
-	       int		height)
-{
-    FbBits *	src_bits;
-    FbStride	src_stride;
-    int		src_bpp;
-    int		src_xoff;
-    int		src_yoff;
-
-    FbBits *	dst_bits;
-    FbStride	dst_stride;
-    int		dst_bpp;
-    int		dst_xoff;
-    int		dst_yoff;
-    
-    fbGetDrawable(pSrc, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
-    fbGetDrawable(pDst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff);
-
-    return fbBltmmx (src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
-		     src_x + src_xoff, src_y + src_yoff,
-		     dst_x + dst_xoff, dst_y + dst_yoff,
-		     width, height);
-}
-
 #endif /* RENDER */
 #endif /* USE_MMX */
diff --git a/fb/fbmmx.h b/fb/fbmmx.h
index dda395a..7d32a38 100644
--- a/fb/fbmmx.h
+++ b/fb/fbmmx.h
@@ -53,14 +53,6 @@ Bool fbBltmmx (FbBits *src_bits,
 	       int src_x, int src_y,
 	       int dst_x, int dst_y,
 	       int width, int height);
-Bool fbCopyAreammx (DrawablePtr	pSrc,
-		    DrawablePtr	pDst,
-		    int		src_x,
-		    int		src_y,
-		    int		dst_x,
-		    int		dst_y,
-		    int		width,
-		    int		height);
 Bool fbFillmmx (FbBits *bits,
 		FbStride stride,
 		int bpp,
@@ -69,11 +61,4 @@ Bool fbFillmmx (FbBits *bits,
 		int width,
 		int height,
 		FbBits xor);
-Bool fbSolidFillmmx (DrawablePtr	pDraw,
-		     int		x,
-		     int		y,
-		     int		width,
-		     int		height,
-		     FbBits		xor);
-
 #endif /* USE_MMX */
diff-tree d4a034370c8ae71b2cc4fe824ceee58b19624f35 (from 3210902a7334f3d8d6c18a34a3cb3f55803b0043)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Mon Jun 11 13:26:24 2007 -0400

    Split fbSolidFillmmx() into a new FbFillmmx() function. Call that from fbFill().

diff --git a/fb/fbfill.c b/fb/fbfill.c
index 7ef3a70..35e4427 100644
--- a/fb/fbfill.c
+++ b/fb/fbfill.c
@@ -49,10 +49,13 @@ fbFill (DrawablePtr pDrawable,
     case FillSolid:
 #ifdef USE_MMX
 	if (!pPriv->and && fbHaveMMX())
-	    if (fbSolidFillmmx (pDrawable, x, y, width, height, pPriv->xor)) {
+	{
+	    if (fbFillmmx (dst, dstStride, dstBpp, x + dstXoff, y + dstYoff, width, height, pPriv->xor))
+	    {
 		fbFinishAccess (pDrawable);
 		return;
 	    }
+	}
 #endif	    
 	fbSolid (dst + (y + dstYoff) * dstStride, 
 		 dstStride, 
diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index 7fb4b15..6a593ff 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -74,29 +74,23 @@ typedef __m64 mmxdatafield;
 #endif
 
 Bool
-fbSolidFillmmx (DrawablePtr	pDraw,
-		int		x,
-		int		y,
-		int		width,
-		int		height,
-		FbBits		xor)
-{ 
-    FbStride	stride;
-    int		bpp;
+fbFillmmx (FbBits *bits,
+	   FbStride stride,
+	   int bpp,
+	   int x,
+	   int y,
+	   int width,
+	   int height,
+	   FbBits xor)
+{
     ullong	fill;
     __m64	vfill;
     CARD32	byte_width;
     CARD8	*byte_line;
-    FbBits      *bits;
-    int		xoff, yoff;
 #ifdef __GNUC__
     __m64	v1, v2, v3, v4, v5, v6, v7;
 #endif
     
-    CHECKPOINT();
-    
-    fbGetDrawable(pDraw, bits, stride, bpp, xoff, yoff);
-    
     if (bpp == 16 && (xor >> 16 != (xor & 0xffff)))
 	return FALSE;
     
@@ -106,14 +100,14 @@ fbSolidFillmmx (DrawablePtr	pDraw,
     if (bpp == 16)
     {
 	stride = stride * sizeof (FbBits) / 2;
-	byte_line = (CARD8 *)(((CARD16 *)bits) + stride * (y + yoff) + (x + xoff));
+	byte_line = (CARD8 *)(((CARD16 *)bits) + stride * y + x);
 	byte_width = 2 * width;
 	stride *= 2;
     }
     else
     {
 	stride = stride * sizeof (FbBits) / 4;
-	byte_line = (CARD8 *)(((CARD32 *)bits) + stride * (y + yoff) + (x + xoff));
+	byte_line = (CARD8 *)(((CARD32 *)bits) + stride * y + x);
 	byte_width = 4 * width;
 	stride *= 4;
     }
@@ -208,6 +202,26 @@ fbSolidFillmmx (DrawablePtr	pDraw,
 }
 
 Bool
+fbSolidFillmmx (DrawablePtr	pDraw,
+		int		x,
+		int		y,
+		int		width,
+		int		height,
+		FbBits		xor)
+{ 
+    FbStride	stride;
+    int		bpp;
+    FbBits      *bits;
+    int		xoff, yoff;
+    
+    CHECKPOINT();
+    
+    fbGetDrawable(pDraw, bits, stride, bpp, xoff, yoff);
+
+    return fbFillmmx (bits, stride, bpp, x + xoff, y + yoff, width, height, xor);
+}
+
+Bool
 fbBltmmx (FbBits *src_bits,
 	  FbBits *dst_bits,
 	  FbStride src_stride,
diff --git a/fb/fbmmx.h b/fb/fbmmx.h
index a529526..dda395a 100644
--- a/fb/fbmmx.h
+++ b/fb/fbmmx.h
@@ -61,6 +61,14 @@ Bool fbCopyAreammx (DrawablePtr	pSrc,
 		    int		dst_y,
 		    int		width,
 		    int		height);
+Bool fbFillmmx (FbBits *bits,
+		FbStride stride,
+		int bpp,
+		int x,
+		int y,
+		int width,
+		int height,
+		FbBits xor);
 Bool fbSolidFillmmx (DrawablePtr	pDraw,
 		     int		x,
 		     int		y,
diff-tree 3210902a7334f3d8d6c18a34a3cb3f55803b0043 (from 8d5f4368eac1b259db3e61f877a4cc10f04efa2f)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Mon Jun 11 13:14:50 2007 -0400

    Split fbCopyAreammx() into a new fbBltmmx() function; call this
    
    function from fbCopyNToN().

diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index 164cd3d..74ff358 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -64,17 +64,13 @@ fbCopyNtoN (DrawablePtr	pSrcDrawable,
 	if (pm == FB_ALLONES && alu == GXcopy && !reverse &&
 	    !upsidedown && fbHaveMMX())
 	{
-	    if (!fbCopyAreammx (pSrcDrawable,
-				pDstDrawable,
-				
-				(pbox->x1 + dx),
-				(pbox->y1 + dy),
-				
-				(pbox->x1),
-				(pbox->y1),
-				
-				(pbox->x2 - pbox->x1),
-				(pbox->y2 - pbox->y1)))
+	    if (!fbBltmmx (src, dst, srcStride, dstStride, srcBpp, dstBpp,
+			   (pbox->x1 + dx + srcXoff),
+			   (pbox->y1 + dy + srcYoff),
+			   (pbox->x1 + srcXoff),
+			   (pbox->y1 + srcYoff),
+			   (pbox->x2 - pbox->x1),
+			   (pbox->y2 - pbox->y1)))
 		goto fallback;
 	    else
 		goto next;
diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index b2fe94b..7fb4b15 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -208,34 +208,20 @@ fbSolidFillmmx (DrawablePtr	pDraw,
 }
 
 Bool
-fbCopyAreammx (DrawablePtr	pSrc,
-	       DrawablePtr	pDst,
-	       int		src_x,
-	       int		src_y,
-	       int		dst_x,
-	       int		dst_y,
-	       int		width,
-	       int		height)
+fbBltmmx (FbBits *src_bits,
+	  FbBits *dst_bits,
+	  FbStride src_stride,
+	  FbStride dst_stride,
+	  int src_bpp,
+	  int dst_bpp,
+	  int src_x, int src_y,
+	  int dst_x, int dst_y,
+	  int width, int height)
 {
-    FbBits *	src_bits;
-    FbStride	src_stride;
-    int		src_bpp;
-    int		src_xoff;
-    int		src_yoff;
-
-    FbBits *	dst_bits;
-    FbStride	dst_stride;
-    int		dst_bpp;
-    int		dst_xoff;
-    int		dst_yoff;
-
     CARD8 *	src_bytes;
     CARD8 *	dst_bytes;
     int		byte_width;
     
-    fbGetDrawable(pSrc, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
-    fbGetDrawable(pDst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff);
-
     if (src_bpp != dst_bpp)
 	return FALSE;
     
@@ -243,16 +229,16 @@ fbCopyAreammx (DrawablePtr	pSrc,
     {
 	src_stride = src_stride * sizeof (FbBits) / 2;
 	dst_stride = dst_stride * sizeof (FbBits) / 2;
-	src_bytes = (CARD8 *)(((CARD16 *)src_bits) + src_stride * (src_y + src_yoff) + (src_x + src_xoff));
-	dst_bytes = (CARD8 *)(((CARD16 *)dst_bits) + dst_stride * (dst_y + dst_yoff) + (dst_x + dst_xoff));
+	src_bytes = (CARD8 *)(((CARD16 *)src_bits) + src_stride * (src_y) + (src_x));
+	dst_bytes = (CARD8 *)(((CARD16 *)dst_bits) + dst_stride * (dst_y) + (dst_x));
 	byte_width = 2 * width;
 	src_stride *= 2;
 	dst_stride *= 2;
     } else if (src_bpp == 32) {
 	src_stride = src_stride * sizeof (FbBits) / 4;
 	dst_stride = dst_stride * sizeof (FbBits) / 4;
-	src_bytes = (CARD8 *)(((CARD32 *)src_bits) + src_stride * (src_y + src_yoff) + (src_x + src_xoff));
-	dst_bytes = (CARD8 *)(((CARD32 *)dst_bits) + dst_stride * (dst_y + dst_yoff) + (dst_x + dst_xoff));
+	src_bytes = (CARD8 *)(((CARD32 *)src_bits) + src_stride * (src_y) + (src_x));
+	dst_bytes = (CARD8 *)(((CARD32 *)dst_bits) + dst_stride * (dst_y) + (dst_x));
 	byte_width = 4 * width;
 	src_stride *= 4;
 	dst_stride *= 4;
@@ -353,8 +339,40 @@ fbCopyAreammx (DrawablePtr	pSrc,
     }
     
     _mm_empty();
+
     return TRUE;
 }
 
+Bool
+fbCopyAreammx (DrawablePtr	pSrc,
+	       DrawablePtr	pDst,
+	       int		src_x,
+	       int		src_y,
+	       int		dst_x,
+	       int		dst_y,
+	       int		width,
+	       int		height)
+{
+    FbBits *	src_bits;
+    FbStride	src_stride;
+    int		src_bpp;
+    int		src_xoff;
+    int		src_yoff;
+
+    FbBits *	dst_bits;
+    FbStride	dst_stride;
+    int		dst_bpp;
+    int		dst_xoff;
+    int		dst_yoff;
+    
+    fbGetDrawable(pSrc, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
+    fbGetDrawable(pDst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff);
+
+    return fbBltmmx (src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
+		     src_x + src_xoff, src_y + src_yoff,
+		     dst_x + dst_xoff, dst_y + dst_yoff,
+		     width, height);
+}
+
 #endif /* RENDER */
 #endif /* USE_MMX */
diff --git a/fb/fbmmx.h b/fb/fbmmx.h
index 4796438..a529526 100644
--- a/fb/fbmmx.h
+++ b/fb/fbmmx.h
@@ -44,6 +44,15 @@ Bool fbHaveMMX(void);
 
 #ifdef USE_MMX
 
+Bool fbBltmmx (FbBits *src_bits,
+	       FbBits *dst_bits,
+	       FbStride src_stride,
+	       FbStride dst_stride,
+	       int src_bpp,
+	       int dst_bpp,
+	       int src_x, int src_y,
+	       int dst_x, int dst_y,
+	       int width, int height);
 Bool fbCopyAreammx (DrawablePtr	pSrc,
 		    DrawablePtr	pDst,
 		    int		src_x,
diff-tree 8d5f4368eac1b259db3e61f877a4cc10f04efa2f (from 54e023cec07aa7e392da36e11d0a4667b8341370)
Author: Clark Rawlins <clark.rawlins at escient.com>
Date:   Mon Jun 11 16:53:38 2007 +0200

    Really make sure BUILD_TIME doesn't have a leading zero.
    
    date +'%k%M%S' still gives a leading zero in the hour after midnight...
    
    Add a leading 1 and remove it in xf86PrintBanner().

diff --git a/configure.ac b/configure.ac
index f7f2e6e..a5160a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1948,7 +1948,7 @@ AM_CONDITIONAL(SUN_KBD_MODE, [test x$KBD
 
 BUILD_DATE="$(date +'%Y%m%d')"
 AC_SUBST([BUILD_DATE])
-BUILD_TIME="$(date +'%k%M%S')"
+BUILD_TIME="$(date +'1%H%M%S')"
 AC_SUBST([BUILD_TIME])
 
 DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 8423fca..16162b7 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1733,7 +1733,7 @@ xf86PrintBanner()
 #if defined(BUILD_TIME)
     t.tm_sec = BUILD_TIME % 100;
     t.tm_min = (BUILD_TIME / 100) % 100;
-    t.tm_hour = (BUILD_TIME / 10000);
+    t.tm_hour = (BUILD_TIME / 10000) % 100;
     if (strftime(buf, sizeof(buf), "%d %B %Y  %I:%M:%s%p", &t))
        ErrorF("Build Date: %s\n", buf);
 #else
diff-tree 54e023cec07aa7e392da36e11d0a4667b8341370 (from 5cbec267b6426960c90f6bcff1d051af5084538c)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Mon Jun 11 09:16:46 2007 -0400

    Don't pass regions to pixman_image_composite() anymore.

diff --git a/configure.ac b/configure.ac
index 0fd473a..f7f2e6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -626,7 +626,7 @@ XEXT_INC='-I$(top_srcdir)/Xext'
 XEXT_LIB='$(top_builddir)/Xext/libXext.la'
 XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
 
-PIXMAN="[pixman >= 0.9.0]"
+PIXMAN="[pixman >= 0.9.1]"
 
 dnl Core modules for most extensions, et al.
 REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto [xproto >= 7.0.9] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4.2] [kbproto >= 1.0.3]"
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 68c0e63..0a42f12 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -38,122 +38,6 @@
 #include "fbpict.h"
 #include "fbmmx.h"
 
-static pixman_image_t *
-create_solid_fill_image (PicturePtr pict)
-{
-    PictSolidFill *solid = &pict->pSourcePict->solidFill;
-    pixman_color_t color;
-    CARD32 a, r, g, b;
-    
-    a = (solid->color & 0xff000000) >> 24;
-    r = (solid->color & 0x00ff0000) >> 16;
-    g = (solid->color & 0x0000ff00) >>  8;
-    b = (solid->color & 0x000000ff) >>  0;
-    
-    color.alpha = (a << 8) | a;
-    color.red =   (r << 8) | r;
-    color.green = (g << 8) | g;
-    color.blue =  (b << 8) | b;
-    
-    return pixman_image_create_solid_fill (&color);
-}
-
-static pixman_image_t *
-create_linear_gradient_image (PictGradient *gradient)
-{
-    PictLinearGradient *linear = (PictLinearGradient *)gradient;
-    pixman_point_fixed_t p1;
-    pixman_point_fixed_t p2;
-    
-    p1.x = linear->p1.x;
-    p1.y = linear->p1.y;
-    p2.x = linear->p2.x;
-    p2.y = linear->p2.y;
-    
-    return pixman_image_create_linear_gradient (
-	&p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
-}
-
-static pixman_image_t *
-create_radial_gradient_image (PictGradient *gradient)
-{
-    PictRadialGradient *radial = (PictRadialGradient *)gradient;
-    pixman_point_fixed_t c1;
-    pixman_point_fixed_t c2;
-    
-    c1.x = radial->c1.x;
-    c1.y = radial->c1.y;
-    c2.x = radial->c2.x;
-    c2.y = radial->c2.y;
-    
-    return pixman_image_create_radial_gradient (
-	&c1, &c2, radial->c1.radius,
-	radial->c2.radius,
-	(pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
-}
-
-static pixman_image_t *
-create_conical_gradient_image (PictGradient *gradient)
-{
-    PictConicalGradient *conical = (PictConicalGradient *)gradient;
-    pixman_point_fixed_t center;
-    
-    center.x = conical->center.x;
-    center.y = conical->center.y;
-    
-    return pixman_image_create_conical_gradient (
-	&center, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
-	gradient->nstops);
-}
-
-static pixman_image_t *
-create_bits_picture (PicturePtr pict,
-		     Bool       has_clip)
-{
-    FbBits *bits;
-    FbStride stride;
-    int bpp, xoff, yoff;
-    pixman_image_t *image;
-    
-    fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
-    
-    bits += yoff * stride + xoff;
-    
-    image = pixman_image_create_bits (
-	pict->format,
-	pict->pDrawable->width, pict->pDrawable->height,
-	(uint32_t *)bits, stride * sizeof (FbStride));
-    
-    
-#ifdef FB_ACCESS_WRAPPER
-#if FB_SHIFT==5
-    
-    pixman_image_set_accessors (image,
-				(pixman_read_memory_func_t)wfbReadMemory,
-				(pixman_write_memory_func_t)wfbWriteMemory);
-    
-#else
-    
-#error The pixman library only works when FbBits is 32 bits wide
-    
-#endif
-#endif
-    
-    /* pCompositeClip is undefined for source pictures, so
-     * only set the clip region for pictures with drawables
-     */
-    if (has_clip)
-	pixman_image_set_clip_region (image, pict->pCompositeClip);
-    
-    /* Indexed table */
-    if (pict->pFormat->index.devPrivate)
-	pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
-    
-    fbFinishAccess (pict->pDrawable);
-
-    return image;
-}
-
 #define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
 
 void
@@ -274,7 +158,6 @@ fbComposite (CARD8      op,
 	     CARD16     width,
 	     CARD16     height)
 {
-    pixman_region16_t region;
     pixman_image_t *src, *mask, *dest;
     
     xDst += pDst->pDrawable->x;
@@ -290,10 +173,10 @@ fbComposite (CARD8      op,
 	yMask += pMask->pDrawable->y;
     }
 
-    if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst, xSrc, ySrc,
-				   xMask, yMask, xDst, yDst, width, height))
-        return;
-
+    miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height);
+    if (pMask)
+	miCompositeSourceValidate (pMask, xMask, yMask, width, height);
+    
     src = image_from_pict (pSrc, TRUE);
     mask = image_from_pict (pMask, TRUE);
     dest = image_from_pict (pDst, TRUE);
@@ -302,11 +185,10 @@ fbComposite (CARD8      op,
     {
 	pixman_image_composite (op, src, mask, dest,
 				xSrc, ySrc, xMask, yMask, xDst, yDst,
-				width, height, &region);
+				width, height);
+	    
     }
     
-    pixman_region_fini (&region);
-    
     if (src)
 	pixman_image_unref (src);
     if (mask)
@@ -336,27 +218,125 @@ fbCompositeGeneral (CARD8	op,
 
 #endif /* RENDER */
 
-Bool
-fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+static pixman_image_t *
+create_solid_fill_image (PicturePtr pict)
 {
+    PictSolidFill *solid = &pict->pSourcePict->solidFill;
+    pixman_color_t color;
+    CARD32 a, r, g, b;
+    
+    a = (solid->color & 0xff000000) >> 24;
+    r = (solid->color & 0x00ff0000) >> 16;
+    g = (solid->color & 0x0000ff00) >>  8;
+    b = (solid->color & 0x000000ff) >>  0;
+    
+    color.alpha = (a << 8) | a;
+    color.red =   (r << 8) | r;
+    color.green = (g << 8) | g;
+    color.blue =  (b << 8) | b;
+    
+    return pixman_image_create_solid_fill (&color);
+}
 
-#ifdef RENDER
+static pixman_image_t *
+create_linear_gradient_image (PictGradient *gradient)
+{
+    PictLinearGradient *linear = (PictLinearGradient *)gradient;
+    pixman_point_fixed_t p1;
+    pixman_point_fixed_t p2;
+    
+    p1.x = linear->p1.x;
+    p1.y = linear->p1.y;
+    p2.x = linear->p2.x;
+    p2.y = linear->p2.y;
+    
+    return pixman_image_create_linear_gradient (
+	&p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
+}
 
-    PictureScreenPtr    ps;
+static pixman_image_t *
+create_radial_gradient_image (PictGradient *gradient)
+{
+    PictRadialGradient *radial = (PictRadialGradient *)gradient;
+    pixman_point_fixed_t c1;
+    pixman_point_fixed_t c2;
+    
+    c1.x = radial->c1.x;
+    c1.y = radial->c1.y;
+    c2.x = radial->c2.x;
+    c2.y = radial->c2.y;
+    
+    return pixman_image_create_radial_gradient (
+	&c1, &c2, radial->c1.radius,
+	radial->c2.radius,
+	(pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
+}
 
-    if (!miPictureInit (pScreen, formats, nformats))
-	return FALSE;
-    ps = GetPictureScreen(pScreen);
-    ps->Composite = fbComposite;
-    ps->Glyphs = miGlyphs;
-    ps->CompositeRects = miCompositeRects;
-    ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
-    ps->AddTraps = fbAddTraps;
-    ps->AddTriangles = fbAddTriangles;
+static pixman_image_t *
+create_conical_gradient_image (PictGradient *gradient)
+{
+    PictConicalGradient *conical = (PictConicalGradient *)gradient;
+    pixman_point_fixed_t center;
+    
+    center.x = conical->center.x;
+    center.y = conical->center.y;
+    
+    return pixman_image_create_conical_gradient (
+	&center, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
+	gradient->nstops);
+}
 
-#endif /* RENDER */
+static pixman_image_t *
+create_bits_picture (PicturePtr pict,
+		     Bool       has_clip)
+{
+    FbBits *bits;
+    FbStride stride;
+    int bpp, xoff, yoff;
+    pixman_image_t *image;
+    
+    fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+    
+    bits += yoff * stride + xoff;
+    
+    image = pixman_image_create_bits (
+	pict->format,
+	pict->pDrawable->width, pict->pDrawable->height,
+	(uint32_t *)bits, stride * sizeof (FbStride));
+    
+    
+#ifdef FB_ACCESS_WRAPPER
+#if FB_SHIFT==5
+    
+    pixman_image_set_accessors (image,
+				(pixman_read_memory_func_t)wfbReadMemory,
+				(pixman_write_memory_func_t)wfbWriteMemory);
+    
+#else
+    
+#error The pixman library only works when FbBits is 32 bits wide
+    
+#endif
+#endif
+    
+    /* pCompositeClip is undefined for source pictures, so
+     * only set the clip region for pictures with drawables
+     */
+    if (has_clip)
+    {
+	if (pict->clientClipType != CT_NONE)
+	    pixman_image_set_has_client_clip (image, TRUE);
+	
+	pixman_image_set_clip_region (image, pict->pCompositeClip);
+    }
+    
+    /* Indexed table */
+    if (pict->pFormat->index.devPrivate)
+	pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
+    
+    fbFinishAccess (pict->pDrawable);
 
-    return TRUE;
+    return image;
 }
 
 static void
@@ -428,7 +408,7 @@ set_image_properties (pixman_image_t *im
 
 pixman_image_t *
 image_from_pict (PicturePtr pict,
-		 Bool       has_clip)
+		 Bool has_clip)
 {
     pixman_image_t *image = NULL;
 
@@ -466,8 +446,28 @@ image_from_pict (PicturePtr pict,
     return image;
 }
 
+Bool
+fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+{
 
+#ifdef RENDER
 
+    PictureScreenPtr    ps;
+
+    if (!miPictureInit (pScreen, formats, nformats))
+	return FALSE;
+    ps = GetPictureScreen(pScreen);
+    ps->Composite = fbComposite;
+    ps->Glyphs = miGlyphs;
+    ps->CompositeRects = miCompositeRects;
+    ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
+    ps->AddTraps = fbAddTraps;
+    ps->AddTriangles = fbAddTriangles;
+
+#endif /* RENDER */
+
+    return TRUE;
+}
 
 #ifdef USE_MMX
 /* The CPU detection code needs to be in a file not compiled with
diff --git a/render/mipict.c b/render/mipict.c
index dff7f5e..87dccbb 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -266,19 +266,19 @@ miChangePictureFilter (PicturePtr pPictu
 
 #define BOUND(v)	(INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v))
 
-static __inline Bool
-miClipPictureReg (RegionPtr	pRegion,
-		  RegionPtr	pClip,
+static inline pixman_bool_t
+miClipPictureReg (pixman_region16_t *	pRegion,
+		  pixman_region16_t *	pClip,
 		  int		dx,
 		  int		dy)
 {
-    if (REGION_NUM_RECTS(pRegion) == 1 &&
-	REGION_NUM_RECTS(pClip) == 1)
+    if (pixman_region_n_rects(pRegion) == 1 &&
+	pixman_region_n_rects(pClip) == 1)
     {
-	BoxPtr  pRbox = REGION_RECTS(pRegion);
-	BoxPtr  pCbox = REGION_RECTS(pClip);
+	pixman_box16_t *  pRbox = pixman_region_rectangles(pRegion, NULL);
+	pixman_box16_t *  pCbox = pixman_region_rectangles(pClip, NULL);
 	int	v;
-
+	
 	if (pRbox->x1 < (v = pCbox->x1 + dx))
 	    pRbox->x1 = BOUND(v);
 	if (pRbox->x2 > (v = pCbox->x2 + dx))
@@ -290,23 +290,23 @@ miClipPictureReg (RegionPtr	pRegion,
 	if (pRbox->x1 >= pRbox->x2 ||
 	    pRbox->y1 >= pRbox->y2)
 	{
-	    REGION_EMPTY(pScreen, pRegion);
+	    pixman_region_init (pRegion);
 	}
     }
-    else if (!REGION_NOTEMPTY (pScreen, pClip))
+    else if (!pixman_region_not_empty (pClip))
 	return FALSE;
     else
     {
 	if (dx || dy)
-	    REGION_TRANSLATE(pScreen, pRegion, -dx, -dy);
-	if (!REGION_INTERSECT (pScreen, pRegion, pRegion, pClip))
+	    pixman_region_translate (pRegion, -dx, -dy);
+	if (!pixman_region_intersect (pRegion, pRegion, pClip))
 	    return FALSE;
 	if (dx || dy)
-	    REGION_TRANSLATE(pScreen, pRegion, dx, dy);
+	    pixman_region_translate(pRegion, dx, dy);
     }
-    return REGION_NOTEMPTY(pScreen, pRegion);
+    return pixman_region_not_empty(pRegion);
 }
-		  
+
 static __inline Bool
 miClipPictureSrc (RegionPtr	pRegion,
 		  PicturePtr	pPicture,
@@ -320,13 +320,13 @@ miClipPictureSrc (RegionPtr	pRegion,
     {
 	if (pPicture->clientClipType != CT_NONE)
 	{
-	    REGION_TRANSLATE(pScreen, pRegion, 
+	    pixman_region_translate ( pRegion, 
 			     dx - pPicture->clipOrigin.x,
 			     dy - pPicture->clipOrigin.y);
 	    if (!REGION_INTERSECT (pScreen, pRegion, pRegion, 
-				   (RegionPtr) pPicture->clientClip))
+				   (RegionPtr) pPicture->pCompositeClip)) // clientClip))
 		return FALSE;
-	    REGION_TRANSLATE(pScreen, pRegion, 
+	    pixman_region_translate ( pRegion, 
 			     - (dx - pPicture->clipOrigin.x),
 			     - (dy - pPicture->clipOrigin.y));
 	}
@@ -341,7 +341,7 @@ miClipPictureSrc (RegionPtr	pRegion,
     }
 }
 
-static void
+void
 miCompositeSourceValidate (PicturePtr	pPicture,
 			   INT16	x,
 			   INT16	y,
@@ -417,6 +417,7 @@ miComputeCompositeRegion (RegionPtr	pReg
 			  CARD16	width,
 			  CARD16	height)
 {
+    
     int		v;
 
     pRegion->extents.x1 = xDst;
@@ -430,13 +431,13 @@ miComputeCompositeRegion (RegionPtr	pReg
     if (pRegion->extents.x1 >= pRegion->extents.x2 ||
 	pRegion->extents.y1 >= pRegion->extents.y2)
     {
-	REGION_EMPTY (pDst->pDrawable->pScreen, pRegion);
+	pixman_region_init (pRegion);
 	return FALSE;
     }
     /* clip against dst */
     if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0))
     {
-	REGION_UNINIT (pScreen, pRegion);
+	pixman_region_fini (pRegion);
 	return FALSE;
     }
     if (pDst->alphaMap)
@@ -445,14 +446,14 @@ miComputeCompositeRegion (RegionPtr	pReg
 			       -pDst->alphaOrigin.x,
 			       -pDst->alphaOrigin.y))
 	{
-	    REGION_UNINIT (pScreen, pRegion);
+	    pixman_region_fini (pRegion);
 	    return FALSE;
 	}
     }
     /* clip against src */
     if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
     {
-	REGION_UNINIT (pScreen, pRegion);
+	pixman_region_fini (pRegion);
 	return FALSE;
     }
     if (pSrc->alphaMap)
@@ -461,7 +462,7 @@ miComputeCompositeRegion (RegionPtr	pReg
 			       xDst - (xSrc + pSrc->alphaOrigin.x),
 			       yDst - (ySrc + pSrc->alphaOrigin.y)))
 	{
-	    REGION_UNINIT (pScreen, pRegion);
+	    pixman_region_fini (pRegion);
 	    return FALSE;
 	}
     }
@@ -470,7 +471,7 @@ miComputeCompositeRegion (RegionPtr	pReg
     {
 	if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
 	{
-	    REGION_UNINIT (pScreen, pRegion);
+	    pixman_region_fini (pRegion);
 	    return FALSE;
 	}	
 	if (pMask->alphaMap)
@@ -479,14 +480,17 @@ miComputeCompositeRegion (RegionPtr	pReg
 				   xDst - (xMask + pMask->alphaOrigin.x),
 				   yDst - (yMask + pMask->alphaOrigin.y)))
 	    {
-		REGION_UNINIT (pScreen, pRegion);
+		pixman_region_fini (pRegion);
 		return FALSE;
 	    }
 	}
     }
+
+    
     miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height);
     if (pMask)
 	miCompositeSourceValidate (pMask, xMask, yMask, width, height);
+
     return TRUE;
 }
 
diff --git a/render/mipict.h b/render/mipict.h
index eef155f..bd7c23f 100644
--- a/render/mipict.h
+++ b/render/mipict.h
@@ -88,6 +88,12 @@ miClipPicture (RegionPtr    pRegion,
 	       INT16	    xPict,
 	       INT16	    yPict);
 
+void
+miCompositeSourceValidate (PicturePtr	pPicture,
+			   INT16	x,
+			   INT16	y,
+			   CARD16	width,
+			   CARD16	height);
 Bool
 miComputeCompositeRegion (RegionPtr	pRegion,
 			  PicturePtr	pSrc,
diff --git a/render/picturestr.h b/render/picturestr.h
index 9c41fc1..06530e2 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -661,6 +661,10 @@ AddTraps (PicturePtr	pPicture,
 	  int		ntraps,
 	  xTrap		*traps);
 
+pixman_image_t *
+PixmanImageFromPicture (PicturePtr pPict,
+			Bool hasClip);
+
 PicturePtr
 CreateSolidPicture (Picture pid,
                     xRenderColor *color,
diff-tree 5cbec267b6426960c90f6bcff1d051af5084538c (from 1aceec61ff203848576c47a1eab13f90a67d7176)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Jun 11 12:38:41 2007 +0200

    Make sure BUILD_TIME doesn't have a leading zero.
    
    It causes the compiler to treat it as an octal constant instead of decimal as
    intended, which could even cause a build failure in the cases of 08 and 09.
    
    Thanks to Clark Rawlins for pointing out the problem.

diff --git a/configure.ac b/configure.ac
index ad934a2..0fd473a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1948,7 +1948,7 @@ AM_CONDITIONAL(SUN_KBD_MODE, [test x$KBD
 
 BUILD_DATE="$(date +'%Y%m%d')"
 AC_SUBST([BUILD_DATE])
-BUILD_TIME="$(date +'%H%M%S')"
+BUILD_TIME="$(date +'%k%M%S')"
 AC_SUBST([BUILD_TIME])
 
 DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
diff-tree 1aceec61ff203848576c47a1eab13f90a67d7176 (from 5d896e43fd056d935935b4eb66562791edc247a1)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Jun 11 09:23:19 2007 +0200

    DRI: Clip cliprects obtained from DRIGetDrawableInfo to screen dimensions.
    
    This is to avoid issues with redirected windows which are located partly or
    fully outside of a screen edge, resulting in unusual cliprects which the 3D
    drivers generally can't handle. The symptoms in such cases would be incorrect
    rendering or even crashes or hangs.

diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index 156e846..efa02f8 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -886,8 +886,32 @@ getDrawableInfo(__DRInativeDisplay *dpy,
     if (*numClipRects > 0) {
 	size = sizeof (drm_clip_rect_t) * *numClipRects;
 	*ppClipRects = xalloc (size);
-	if (*ppClipRects != NULL)
-	    memcpy (*ppClipRects, pClipRects, size);
+
+	/* Clip cliprects to screen dimensions (redirected windows) */
+	if (*ppClipRects != NULL) {
+	    ScreenPtr pScreen = screenInfo.screens[screen];
+	    int i, j;
+
+	    for (i = 0, j = 0; i < *numClipRects; i++) {
+	        (*ppClipRects)[j].x1 = max(pClipRects[i].x1, 0);
+		(*ppClipRects)[j].y1 = max(pClipRects[i].y1, 0);
+		(*ppClipRects)[j].x2 = min(pClipRects[i].x2, pScreen->width);
+		(*ppClipRects)[j].y2 = min(pClipRects[i].y2, pScreen->height);
+
+		if ((*ppClipRects)[j].x1 < (*ppClipRects)[j].x2 &&
+		    (*ppClipRects)[j].y1 < (*ppClipRects)[j].y2) {
+		    j++;
+		}
+	    }
+
+	    if (*numClipRects != j) {
+		*numClipRects = j;
+		*ppClipRects = xrealloc (*ppClipRects,
+					 sizeof (drm_clip_rect_t) *
+					 *numClipRects);
+	    }
+	} else
+	    *numClipRects = 0;
     }
     else {
       *ppClipRects = NULL;
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index d153c09..dbc1690 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1518,13 +1518,18 @@ DRIGetDrawableInfo(ScreenPtr pScreen,
 	       if (x1 > pScreen->width) x1 = pScreen->width;
 	       if (y1 > pScreen->height) y1 = pScreen->height;
 
-	       pDRIPriv->private_buffer_rect.x1 = x0;
-	       pDRIPriv->private_buffer_rect.y1 = y0;
-	       pDRIPriv->private_buffer_rect.x2 = x1;
-	       pDRIPriv->private_buffer_rect.y2 = y1;
-
-	       *numBackClipRects = 1;
-	       *pBackClipRects = &(pDRIPriv->private_buffer_rect);
+	       if (y0 >= y1 || x0 >= x1) {
+		    *numBackClipRects = 0;
+		    *pBackClipRects = NULL;
+	       } else {
+		    pDRIPriv->private_buffer_rect.x1 = x0;
+		    pDRIPriv->private_buffer_rect.y1 = y0;
+		    pDRIPriv->private_buffer_rect.x2 = x1;
+		    pDRIPriv->private_buffer_rect.y2 = y1;
+
+		    *numBackClipRects = 1;
+		    *pBackClipRects = &(pDRIPriv->private_buffer_rect);
+	       }
 	    } else {
 	       /* Use the frontbuffer cliprects for back buffers.  */
 	       *numBackClipRects = 0;
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 933cd3e..9690e88 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -452,7 +452,7 @@ ProcXF86DRIGetDrawableInfo(
     xXF86DRIGetDrawableInfoReply	rep;
     DrawablePtr pDrawable;
     int X, Y, W, H;
-    drm_clip_rect_t * pClipRects;
+    drm_clip_rect_t * pClipRects, *pClippedRects;
     drm_clip_rect_t * pBackClipRects;
     int backX, backY, rc;
 
@@ -502,8 +502,35 @@ ProcXF86DRIGetDrawableInfo(
     if (rep.numBackClipRects) 
        rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;    
 
-    if (rep.numClipRects) 
+    pClippedRects = pClipRects;
+
+    if (rep.numClipRects) {
+       /* Clip cliprects to screen dimensions (redirected windows) */
+       pClippedRects = xalloc(rep.numClipRects * sizeof(drm_clip_rect_t));
+
+       if (pClippedRects) {
+	    ScreenPtr pScreen = screenInfo.screens[stuff->screen];
+	    int i, j;
+
+	    for (i = 0, j = 0; i < rep.numClipRects; i++) {
+		pClippedRects[j].x1 = max(pClipRects[i].x1, 0);
+		pClippedRects[j].y1 = max(pClipRects[i].y1, 0);
+		pClippedRects[j].x2 = min(pClipRects[i].x2, pScreen->width);
+		pClippedRects[j].y2 = min(pClipRects[i].y2, pScreen->height);
+
+		if (pClippedRects[j].x1 < pClippedRects[j].x2 &&
+		    pClippedRects[j].y1 < pClippedRects[j].y2) {
+		    j++;
+		}
+	    }
+
+	    rep.numClipRects = j;
+       } else {
+	    rep.numClipRects = 0;
+       }
+
        rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
+    }
     
     rep.length = ((rep.length + 3) & ~3) >> 2;
 
@@ -512,7 +539,8 @@ ProcXF86DRIGetDrawableInfo(
     if (rep.numClipRects) {
 	WriteToClient(client,  
 		      sizeof(drm_clip_rect_t) * rep.numClipRects,
-		      (char *)pClipRects);
+		      (char *)pClippedRects);
+	xfree(pClippedRects);
     }
 
     if (rep.numBackClipRects) {
diff-tree 5d896e43fd056d935935b4eb66562791edc247a1 (from 0fb44c6f9a0415184818ba8357a21ff920e907dc)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Jun 11 09:23:19 2007 +0200

    DRITreeTraversal: Stop walking tree when we've seen all DRI windows.

diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index fae0b43..d153c09 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1863,11 +1863,15 @@ DRITreeTraversal(WindowPtr pWin, pointer
     if(pDRIDrawablePriv) {
         ScreenPtr pScreen = pWin->drawable.pScreen;
         DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
-        RegionPtr reg = (RegionPtr)data;
 
-        REGION_UNION(pScreen, reg, reg, &(pWin->clipList));
+	if(REGION_NUM_RECTS(&(pWin->clipList)) > 0) {
+	   RegionPtr reg = (RegionPtr)data;
 
-        if(pDRIPriv->nrWindows == 1)
+	   REGION_UNION(pScreen, reg, reg, &(pWin->clipList));
+	   pDRIPriv->nrWalked++;
+	}
+
+	if(pDRIPriv->nrWindows == pDRIPriv->nrWalked)
 	   return WT_STOPWALKING;
     }
     return WT_WALKCHILDREN;
@@ -1885,6 +1889,7 @@ DRICopyWindow(WindowPtr pWin, DDXPointRe
        RegionRec reg;
 
        REGION_NULL(pScreen, &reg);
+       pDRIPriv->nrWalked = 0;
        TraverseTree(pWin, DRITreeTraversal, (pointer)(&reg));
 
        if(REGION_NOTEMPTY(pScreen, &reg)) {
diff-tree 0fb44c6f9a0415184818ba8357a21ff920e907dc (from 644f7ddc0cb029e2ebca43742fd8a46a1a3f4c9f)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Jun 11 09:23:19 2007 +0200

    DRI: Fix build warning.

diff --git a/hw/xfree86/dri/drimodule.c b/hw/xfree86/dri/drimodule.c
index 0e3d84e..3aa9245 100644
--- a/hw/xfree86/dri/drimodule.c
+++ b/hw/xfree86/dri/drimodule.c
@@ -88,6 +88,6 @@ driSetup(pointer module, pointer opts, i
     drmSetServerInfo(&DRIDRMServerInfo);
 
     /* Need a non-NULL return value to indicate success */
-    return 1;
+    return (pointer)1;
 }
 
diff-tree 644f7ddc0cb029e2ebca43742fd8a46a1a3f4c9f (from 30a3297fed9af3a594aba0875a8f58a0a38b33fc)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Jun 11 09:23:18 2007 +0200

    dixLookupClient: Use access parameter.

diff --git a/dix/dixutils.c b/dix/dixutils.c
index 30327d3..c1e30ff 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -265,7 +265,7 @@ _X_EXPORT int
 dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
 {
     pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY,
-						    DixReadAccess);
+						    access);
     int clientIndex = CLIENT_ID(rid);
     client->errorValue = rid;
 
diff-tree 30a3297fed9af3a594aba0875a8f58a0a38b33fc (from c1a49a9269f14b6975a1a2c751bb179757373f11)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Jun 11 09:23:18 2007 +0200

    mieq queue handling cleanups.
    
    In particular, fix handling of wraparounds in mieqEnqueue.

diff --git a/mi/mieq.c b/mi/mieq.c
index a03fff1..f64e540 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -108,7 +108,8 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e
     HWEventQueueType       oldtail = miEventQueue.tail, newtail;
     int                    isMotion = 0;
     deviceValuator         *v = (deviceValuator *) e;
-    EventPtr               laste = &miEventQueue.events[oldtail - 1];
+    EventPtr               laste = &miEventQueue.events[(oldtail - 1) %
+							QUEUE_SIZE];
     deviceKeyButtonPointer *lastkbp = (deviceKeyButtonPointer *)
                                       &laste->event[0];
 
@@ -139,14 +140,10 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e
 
     if (isMotion && isMotion == miEventQueue.lastMotion &&
         oldtail != miEventQueue.head) {
-	if (oldtail == 0)
-	    oldtail = QUEUE_SIZE;
-	oldtail = oldtail - 1;
+	oldtail = (oldtail - 1) % QUEUE_SIZE;
     }
     else {
-    	newtail = oldtail + 1;
-    	if (newtail == QUEUE_SIZE)
-	    newtail = 0;
+    	newtail = (oldtail + 1) % QUEUE_SIZE;
     	/* Toss events which come in late.  Usually this means your server's
          * stuck in an infinite loop somewhere, but SIGIO is still getting
          * handled. */
@@ -214,22 +211,15 @@ mieqProcessInputEvents(void)
 
         e = &miEventQueue.events[miEventQueue.head];
         /* Assumption - screen switching can only occur on motion events. */
+        miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE;
+
         if (e->pScreen != miEventQueue.pDequeueScreen) {
             miEventQueue.pDequeueScreen = e->pScreen;
             x = e->event[0].u.keyButtonPointer.rootX;
             y = e->event[0].u.keyButtonPointer.rootY;
-            if (miEventQueue.head == QUEUE_SIZE - 1)
-                miEventQueue.head = 0;
-            else
-                ++miEventQueue.head;
             NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
         }
         else {
-            if (miEventQueue.head == QUEUE_SIZE - 1)
-                miEventQueue.head = 0;
-            else
-                ++miEventQueue.head;
-
             /* If someone's registered a custom event handler, let them
              * steal it. */
             if (miEventQueue.handlers[e->event->u.u.type]) {
diff-tree c1a49a9269f14b6975a1a2c751bb179757373f11 (from 67a0a4da1a225ee3bd6bbd1846f8141fe333c884)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Sun Jun 10 22:14:57 2007 -0400

    GNU is wrong and ` is not left-quote.

diff --git a/configure.ac b/configure.ac
index 979615f..ad934a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -165,20 +165,20 @@ AC_CHECK_FUNCS([geteuid getuid link memm
 AC_FUNC_ALLOCA
 dnl Old HAS_* names used in os/*.c.
 AC_CHECK_FUNC([getdtablesize],
-	AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the `getdtablesize' function.]))
+	AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.]))
 AC_CHECK_FUNC([getifaddrs],
-	AC_DEFINE(HAS_GETIFADDRS, 1, [Have the `getifaddrs' function.]))
+	AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.]))
 AC_CHECK_FUNC([getpeereid],
-	AC_DEFINE(HAS_GETPEEREID, 1, [Have the `getpeereid' function.]))
+	AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.]))
 AC_CHECK_FUNC([getpeerucred],
-	AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the `getpeerucred' function.]))
+	AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.]))
 AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no)
 AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno])	
 
 AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno])
 
 dnl Check for mmap support for Xvfb
-AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the `mmap' function.]))
+AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the 'mmap' function.]))
 
 dnl Find the math libary
 AC_CHECK_LIB(m, sqrt)
@@ -878,7 +878,7 @@ XKB_LIB='$(top_builddir)/xkb/libxkb.la'
 XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
 
 AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
-                                        [Do not have `strcasecmp'.]))
+                                        [Do not have 'strcasecmp'.]))
 
 if test "x$NULL_ROOT_CURSOR" = xyes; then
         AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
diff-tree 67a0a4da1a225ee3bd6bbd1846f8141fe333c884 (from c079cce9d884ab03f305b3fba4a4e1247c023480)
Author: Dave Airlie <airlied at linux.ie>
Date:   Mon Jun 11 11:55:11 2007 +1000

    update xproto dependency to at least 7.0.9

diff --git a/configure.ac b/configure.ac
index 1f94556..979615f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -629,7 +629,7 @@ XEXTXORG_LIB='$(top_builddir)/Xext/libXe
 PIXMAN="[pixman >= 0.9.0]"
 
 dnl Core modules for most extensions, et al.
-REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4.2] [kbproto >= 1.0.3]"
+REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto [xproto >= 7.0.9] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4.2] [kbproto >= 1.0.3]"
 REQUIRED_LIBS="xfont xau fontenc $PIXMAN"
 
 if test "x$DBUS" = xauto; then
diff-tree c079cce9d884ab03f305b3fba4a4e1247c023480 (from 9c47b86bd9a4633fda5fd305a09ac8623187efa0)
Author: Daniel Ciocea <daniel.ciocea at eosystems.ro>
Date:   Fri Jun 8 18:12:21 2007 -0700

    Fix sync polarity on Samsung SyncMaster 205BW monitor.
    
    need to use standard VESA sync polarity instead of the
    EDID provided -hsync -vsync values.

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 46cb6c4..a9f9ddc 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -71,7 +71,11 @@ static Bool quirk_dt_sync_hm_vp (int scr
     if (memcmp (DDC->vendor.name, "VSC", 4) == 0 &&
 	DDC->vendor.prod_id == 58653)
 	return TRUE;
-
+    /* Samsung SyncMaster 205BW */
+    if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
+	DDC->vendor.prod_id == 541)
+	return TRUE;
+     
     return FALSE;
 }
 
diff-tree 9c47b86bd9a4633fda5fd305a09ac8623187efa0 (from 567b5bf765254a4ae9cc7711bb6acfa89a9fd61c)
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Thu Jun 7 13:57:12 2007 -0700

    Add new fb symbols to wfbrename.h.
    
    Avoids crashes when wfbComposite calls the wrong image_from_pict.

diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index 8f875c8..952512e 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -184,9 +184,11 @@
 #define fbUnmapWindow wfbUnmapWindow
 #define fbUnrealizeFont wfbUnrealizeFont
 #define fbValidateGC wfbValidateGC
+#define fbWalkCompositeRegion wfbWalkCompositeRegion
 #define fbWinPrivateIndex wfbWinPrivateIndex
 #define fbZeroLine wfbZeroLine
 #define fbZeroSegment wfbZeroSegment
+#define image_from_pict wfb_image_from_pict
 #define xxScrPrivateIndex wfbxxScrPrivateIndex
 #define xxGCPrivateIndex wfbxxGCPrivateIndex
 #define xxColormapPrivateIndex wfbxxColormapPrivateIndex
diff-tree 567b5bf765254a4ae9cc7711bb6acfa89a9fd61c (from 49ed31c0b323dd8c5887a803c199875e6f2330d8)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Tue Jun 5 20:26:49 2007 -0400

    Delete fbCompositeCopyAreammx()

diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index 2e240c1..b2fe94b 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -356,29 +356,5 @@ fbCopyAreammx (DrawablePtr	pSrc,
     return TRUE;
 }
 
-void
-fbCompositeCopyAreammx (CARD8		op,
-			PicturePtr	pSrc,
-			PicturePtr	pMask,
-			PicturePtr	pDst,
-			INT16		xSrc,
-			INT16		ySrc,
-			INT16		xMask,
-			INT16		yMask,
-			INT16		xDst,
-			INT16		yDst,
-			CARD16		width,
-			CARD16		height)
-{
-    fbCopyAreammx (pSrc->pDrawable,
-		   pDst->pDrawable,
-		   xSrc, ySrc,
-		   xDst, yDst,
-		   width, height);
-}
-
-
-
-
 #endif /* RENDER */
 #endif /* USE_MMX */
diff --git a/fb/fbmmx.h b/fb/fbmmx.h
index 43079e9..4796438 100644
--- a/fb/fbmmx.h
+++ b/fb/fbmmx.h
@@ -52,18 +52,6 @@ Bool fbCopyAreammx (DrawablePtr	pSrc,
 		    int		dst_y,
 		    int		width,
 		    int		height);
-void fbCompositeCopyAreammx (CARD8	op,
-			     PicturePtr	pSrc,
-			     PicturePtr	pMask,
-			     PicturePtr	pDst,
-			     INT16	xSrc,
-			     INT16      ySrc,
-			     INT16      xMask,
-			     INT16      yMask,
-			     INT16      xDst,
-			     INT16      yDst,
-			     CARD16     width,
-			     CARD16     height);
 Bool fbSolidFillmmx (DrawablePtr	pDraw,
 		     int		x,
 		     int		y,
diff-tree 49ed31c0b323dd8c5887a803c199875e6f2330d8 (from dfbe32b5b828cc4e3da36a0e2e6ad641164eaa5e)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Tue Jun 5 17:44:21 2007 -0400

    Remove most of the fast-path MMX operations from fbmmx. fbCopyAreammx
    
    and fbSolidFillmmx are still needed by other code.

diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index 53459a0..2e240c1 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -62,2663 +62,149 @@
 #define CHECKPOINT()
 #endif
 
-/* Notes about writing mmx code
- *
- * give memory operands as the second operand. If you give it as the
- * first, gcc will first load it into a register, then use that
- * register
- *
- *   ie. use
- *
- *         _mm_mullo_pi16 (x, mmx_constant);
- *
- *   not
- *
- *         _mm_mullo_pi16 (mmx_constant, x);
- *
- * Also try to minimize dependencies. i.e. when you need a value, try
- * to calculate it from a value that was calculated as early as
- * possible.
- */
 
-/* --------------- MMX primitivess ------------------------------------ */
-
-typedef unsigned long long ullong;
-
-#ifdef __GNUC__
-typedef ullong mmxdatafield;
-#endif
-#ifdef _MSC_VER
-typedef unsigned __int64 ullong;
-typedef __m64 mmxdatafield;
-#endif
-
-typedef struct
-{
-    mmxdatafield mmx_4x00ff;
-    mmxdatafield mmx_4x0080;
-    mmxdatafield mmx_565_rgb;
-    mmxdatafield mmx_565_unpack_multiplier;
-    mmxdatafield mmx_565_r;
-    mmxdatafield mmx_565_g;
-    mmxdatafield mmx_565_b;
-    mmxdatafield mmx_mask_0;
-    mmxdatafield mmx_mask_1;
-    mmxdatafield mmx_mask_2;
-    mmxdatafield mmx_mask_3;
-    mmxdatafield mmx_full_alpha;
-    mmxdatafield mmx_ffff0000ffff0000;
-    mmxdatafield mmx_0000ffff00000000;
-    mmxdatafield mmx_000000000000ffff;
-} MMXData;
-
-static const MMXData c =
-{
-#ifdef __GNUC__
-    .mmx_4x00ff =			0x00ff00ff00ff00ffULL,
-    .mmx_4x0080 =			0x0080008000800080ULL,
-    .mmx_565_rgb =			0x000001f0003f001fULL,
-    .mmx_565_unpack_multiplier =	0x0000008404100840ULL,
-    .mmx_565_r =			0x000000f800000000ULL,
-    .mmx_565_g =			0x0000000000fc0000ULL,
-    .mmx_565_b =			0x00000000000000f8ULL,
-    .mmx_mask_0 =			0xffffffffffff0000ULL,
-    .mmx_mask_1 =			0xffffffff0000ffffULL,
-    .mmx_mask_2 =			0xffff0000ffffffffULL,
-    .mmx_mask_3 =			0x0000ffffffffffffULL,
-    .mmx_full_alpha =			0x00ff000000000000ULL,
-    .mmx_ffff0000ffff0000 =		0xffff0000ffff0000ULL,
-    .mmx_0000ffff00000000 =		0x0000ffff00000000ULL,
-    .mmx_000000000000ffff =		0x000000000000ffffULL,
-#endif
-#ifdef _MSC_VER
-    { 0x00ff00ff00ff00ffUI64 },
-    { 0x0080008000800080UI64 },
-    { 0x000001f0003f001fUI64 },
-    { 0x0000008404100840UI64 },
-    { 0x000000f800000000UI64 },
-    { 0x0000000000fc0000UI64 },
-    { 0x00000000000000f8UI64 },
-    { 0xffffffffffff0000UI64 },
-    { 0xffffffff0000ffffUI64 },
-    { 0xffff0000ffffffffUI64 },
-    { 0x0000ffffffffffffUI64 },
-    { 0x00ff000000000000UI64 },
-    { 0xffff0000ffff0000UI64 },
-    { 0x0000ffff00000000UI64 },
-    { 0x000000000000ffffUI64 },
-#endif
-};
-
-#ifdef _MSC_VER
-#undef inline
-#define inline __forceinline
-#endif
-
-#ifdef __GNUC__
-#define MC(x) ((__m64) c.mmx_##x)
-#endif
-#ifdef _MSC_VER
-#define MC(x) c.mmx_##x
-#endif
-
-static inline __m64
-shift (__m64 v, int s)
-{
-    if (s > 0)
-	return _mm_slli_si64 (v, s);
-    else if (s < 0)
-	return _mm_srli_si64 (v, -s);
-    else
-	return v;
-}
-
-static inline __m64
-negate (__m64 mask)
-{
-    return _mm_xor_si64 (mask, MC(4x00ff));
-}
-
-static inline __m64
-pix_multiply (__m64 a, __m64 b)
-{
-    __m64 res;
-    
-    res = _mm_mullo_pi16 (a, b);
-    res = _mm_adds_pu16 (res, MC(4x0080));
-    res = _mm_adds_pu16 (res, _mm_srli_pi16 (res, 8));
-    res = _mm_srli_pi16 (res, 8);
-    
-    return res;
-}
-
-static inline __m64
-pix_add (__m64 a, __m64 b)
-{
-    return  _mm_adds_pu8 (a, b);
-}
-
-#ifdef USE_SSE
-
-static inline __m64
-expand_alpha (__m64 pixel)
-{
-    return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE(3, 3, 3, 3));
-}
-
-static inline __m64
-expand_alpha_rev (__m64 pixel)
-{
-    return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE(0, 0, 0, 0));
-}    
-
-static inline __m64
-invert_colors (__m64 pixel)
-{
-    return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE(3, 0, 1, 2));
-}
-
-#else
-
-static inline __m64
-expand_alpha (__m64 pixel)
-{
-    __m64 t1, t2;
-    
-    t1 = shift (pixel, -48);
-    t2 = shift (t1, 16);
-    t1 = _mm_or_si64 (t1, t2);
-    t2 = shift (t1, 32);
-    t1 = _mm_or_si64 (t1, t2);
-
-    return t1;
-}
-
-static inline __m64
-expand_alpha_rev (__m64 pixel)
-{
-    __m64 t1, t2;
-
-    /* move alpha to low 16 bits and zero the rest */
-    t1 = shift (pixel,  48);
-    t1 = shift (t1, -48);
-
-    t2 = shift (t1, 16);
-    t1 = _mm_or_si64 (t1, t2);
-    t2 = shift (t1, 32);
-    t1 = _mm_or_si64 (t1, t2);
-
-    return t1;
-}
-
-static inline __m64
-invert_colors (__m64 pixel)
-{
-    __m64 x, y, z;
-
-    x = y = z = pixel;
-
-    x = _mm_and_si64 (x, MC(ffff0000ffff0000));
-    y = _mm_and_si64 (y, MC(000000000000ffff));
-    z = _mm_and_si64 (z, MC(0000ffff00000000));
-
-    y = shift (y, 32);
-    z = shift (z, -32);
-
-    x = _mm_or_si64 (x, y);
-    x = _mm_or_si64 (x, z);
-
-    return x;
-}
-
-#endif
-
-static inline __m64
-over (__m64 src, __m64 srca, __m64 dest)
-{
-    return  _mm_adds_pu8 (src, pix_multiply(dest, negate(srca)));
-}
-
-static inline __m64
-over_rev_non_pre (__m64 src, __m64 dest)
-{
-    __m64 srca = expand_alpha (src);
-    __m64 srcfaaa = _mm_or_si64 (srca, MC(full_alpha));
-    
-    return over(pix_multiply(invert_colors(src), srcfaaa), srca, dest);
-}
-
-static inline __m64
-in (__m64 src,
-    __m64 mask)
-{
-    return pix_multiply (src, mask);
-}
-
-static inline __m64
-in_over_full_src_alpha (__m64 src, __m64 mask, __m64 dest)
-{
-    src = _mm_or_si64 (src, MC(full_alpha));
-
-    return over(in (src, mask), mask, dest);
-}
-
-#ifndef _MSC_VER
-static inline __m64
-in_over (__m64 src,
-	 __m64 srca,
-	 __m64 mask,
-	 __m64 dest)
-{
-    return over(in(src, mask), pix_multiply(srca, mask), dest);
-}
-#else
-#define in_over(src, srca, mask, dest) over(in(src, mask), pix_multiply(srca, mask), dest)
-#endif
-
-static inline __m64
-load8888 (CARD32 v)
-{
-    return _mm_unpacklo_pi8 (_mm_cvtsi32_si64 (v), _mm_setzero_si64());
-}
-
-static inline __m64
-pack8888 (__m64 lo, __m64 hi)
-{
-    return _mm_packs_pu16 (lo, hi);
-}
-
-static inline CARD32
-store8888 (__m64 v)
-{
-    return _mm_cvtsi64_si32(pack8888(v, _mm_setzero_si64()));
-}
-
-/* Expand 16 bits positioned at @pos (0-3) of a mmx register into
- *
- *    00RR00GG00BB
- * 
- * --- Expanding 565 in the low word ---
- * 
- * m = (m << (32 - 3)) | (m << (16 - 5)) | m;
- * m = m & (01f0003f001f);
- * m = m * (008404100840);
- * m = m >> 8;
- * 
- * Note the trick here - the top word is shifted by another nibble to
- * avoid it bumping into the middle word
- */
-static inline __m64
-expand565 (__m64 pixel, int pos)
-{
-    __m64 p = pixel;
-    __m64 t1, t2;
-    
-    /* move pixel to low 16 bit and zero the rest */
-    p = shift (shift (p, (3 - pos) * 16), -48); 
-    
-    t1 = shift (p, 36 - 11);
-    t2 = shift (p, 16 - 5);
-    
-    p = _mm_or_si64 (t1, p);
-    p = _mm_or_si64 (t2, p);
-    p = _mm_and_si64 (p, MC(565_rgb));
-    
-    pixel = _mm_mullo_pi16 (p, MC(565_unpack_multiplier));
-    return _mm_srli_pi16 (pixel, 8);
-}
-
-static inline __m64
-expand8888 (__m64 in, int pos)
-{
-    if (pos == 0)
-	return _mm_unpacklo_pi8 (in, _mm_setzero_si64());
-    else
-	return _mm_unpackhi_pi8 (in, _mm_setzero_si64());
-}
-
-static inline __m64
-pack565 (__m64 pixel, __m64 target, int pos)
-{
-    __m64 p = pixel;
-    __m64 t = target;
-    __m64 r, g, b;
-    
-    r = _mm_and_si64 (p, MC(565_r));
-    g = _mm_and_si64 (p, MC(565_g));
-    b = _mm_and_si64 (p, MC(565_b));
-    
-    r = shift (r, - (32 - 8) + pos * 16);
-    g = shift (g, - (16 - 3) + pos * 16);
-    b = shift (b, - (0  + 3) + pos * 16);
-    
-    if (pos == 0)
-	t = _mm_and_si64 (t, MC(mask_0));
-    else if (pos == 1)
-	t = _mm_and_si64 (t, MC(mask_1));
-    else if (pos == 2)
-	t = _mm_and_si64 (t, MC(mask_2));
-    else if (pos == 3)
-	t = _mm_and_si64 (t, MC(mask_3));
-    
-    p = _mm_or_si64 (r, t);
-    p = _mm_or_si64 (g, p);
-    
-    return _mm_or_si64 (b, p);
-}
-
-#ifndef _MSC_VER
-static inline __m64
-pix_add_mul (__m64 x, __m64 a, __m64 y, __m64 b)
-{
-    x = _mm_mullo_pi16 (x, a);
-    y = _mm_mullo_pi16 (y, b);
-    x = _mm_adds_pu16 (x, MC(4x0080));
-    x = _mm_adds_pu16 (x, y);
-    x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8));
-    x = _mm_srli_pi16 (x, 8);
-
-    return x;
-}
-#else
-#define pix_add_mul(x, a, y, b) \
-( x = _mm_mullo_pi16 (x, a), \
-  y = _mm_mullo_pi16 (y, b), \
-  x = _mm_adds_pu16 (x, MC(4x0080)), \
-  x = _mm_adds_pu16 (x, y), \
-  x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8)), \
-  _mm_srli_pi16 (x, 8) )
-#endif
-
-/* --------------- MMX code patch for fbcompose.c --------------------- */
-
-static FASTCALL void
-mmxCombineMaskU (CARD32 *src, const CARD32 *mask, int width)
-{
-    const CARD32 *end = mask + width;
-    while (mask < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        a = expand_alpha(a);
-        s = pix_multiply(s, a);
-        *src = store8888(s);
-        ++src;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-
-static FASTCALL void
-mmxCombineOverU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-
-    while (dest < end) {
-        __m64 s, sa;
-	s = load8888(*src);
-	sa = expand_alpha(s);
-	*dest = store8888(over(s, sa, load8888(*dest)));
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineOverReverseU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-
-    while (dest < end) {
-	__m64 d, da;
-	d = load8888(*dest);
-	da = expand_alpha(d);
-	*dest = store8888(over (d, da, load8888(*src)));
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineInU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-
-    while (dest < end) {
-        __m64 x, a;
-        x = load8888(*src);
-        a = load8888(*dest);
-        a = expand_alpha(a);
-        x = pix_multiply(x, a);
-        *dest = store8888(x);
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineInReverseU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-
-    while (dest < end) {
-        __m64 x, a;
-        x = load8888(*dest);
-        a = load8888(*src);
-        a = expand_alpha(a);
-        x = pix_multiply(x, a);
-        *dest = store8888(x);
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineOutU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-
-    while (dest < end) {
-        __m64 x, a;
-        x = load8888(*src);
-        a = load8888(*dest);
-        a = expand_alpha(a);
-        a = negate(a);
-        x = pix_multiply(x, a);
-        *dest = store8888(x);
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineOutReverseU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-
-    while (dest < end) {
-        __m64 x, a;
-        x = load8888(*dest);
-        a = load8888(*src);
-        a = expand_alpha(a);
-        a = negate(a);
-        x = pix_multiply(x, a);
-        *dest = store8888(x);
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineAtopU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-
-    while (dest < end) {
-        __m64 s, da, d, sia;
-        s = load8888(*src);
-        d = load8888(*dest);
-        sia = expand_alpha(s);
-        sia = negate(sia);
-        da = expand_alpha(d);
-        s = pix_add_mul (s, da, d, sia);
-        *dest = store8888(s);
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineAtopReverseU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end;
-
-    end = dest + width;
-
-    while (dest < end) {
-        __m64 s, dia, d, sa;
-        s = load8888(*src);
-        d = load8888(*dest);
-        sa = expand_alpha(s);
-        dia = expand_alpha(d);
-        dia = negate(dia);
-	s = pix_add_mul (s, dia, d, sa);
-        *dest = store8888(s);
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineXorU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-
-    while (dest < end) {
-        __m64 s, dia, d, sia;
-        s = load8888(*src);
-        d = load8888(*dest);
-        sia = expand_alpha(s);
-        dia = expand_alpha(d);
-        sia = negate(sia);
-        dia = negate(dia);
-	s = pix_add_mul (s, dia, d, sia);
-        *dest = store8888(s);
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineAddU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-    while (dest < end) {
-        __m64 s, d;
-        s = load8888(*src);
-        d = load8888(*dest);
-        s = pix_add(s, d);
-        *dest = store8888(s);
-        ++dest;
-        ++src;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineSaturateU (CARD32 *dest, const CARD32 *src, int width)
-{
-    const CARD32 *end = dest + width;
-    while (dest < end) {
-        CARD32 s = *src;
-        CARD32 d = *dest;
-        __m64 ms = load8888(s);
-        __m64 md = load8888(d);
-        CARD32 sa = s >> 24;
-        CARD32 da = ~d >> 24;
-
-        if (sa > da) {
-            __m64 msa = load8888(FbIntDiv(da, sa) << 24);
-            msa = expand_alpha(msa);
-            ms = pix_multiply(ms, msa);
-        }
-        md = pix_add(md, ms);
-        *dest = store8888(md);
-        ++src;
-        ++dest;
-    }
-    _mm_empty();
-}
-
-
-static FASTCALL void
-mmxCombineSrcC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        s = pix_multiply(s, a);
-        *dest = store8888(s);
-        ++src;
-        ++mask;
-        ++dest;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        __m64 sa = expand_alpha(s);
-	
-	*dest = store8888(in_over (s, sa, a, d));
-	
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineOverReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        __m64 da = expand_alpha(d);
-
-	*dest = store8888(over (d, da, in (s, a)));
-	
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-
-static FASTCALL void
-mmxCombineInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        __m64 da = expand_alpha(d);
-        s = pix_multiply(s, a);
-        s = pix_multiply(s, da);
-        *dest = store8888(s);
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        __m64 sa = expand_alpha(s);
-        a = pix_multiply(a, sa);
-        d = pix_multiply(d, a);
-        *dest = store8888(d);
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        __m64 da = expand_alpha(d);
-        da = negate(da);
-        s = pix_multiply(s, a);
-        s = pix_multiply(s, da);
-        *dest = store8888(s);
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        __m64 sa = expand_alpha(s);
-        a = pix_multiply(a, sa);
-        a = negate(a);
-        d = pix_multiply(d, a);
-        *dest = store8888(d);
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        __m64 da = expand_alpha(d);
-        __m64 sa = expand_alpha(s); 
-        s = pix_multiply(s, a);
-        a = pix_multiply(a, sa);
-        a = negate(a);
-	d = pix_add_mul (d, a, s, da);
-        *dest = store8888(d);
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineAtopReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        __m64 da = expand_alpha(d);
-        __m64 sa = expand_alpha(s);
-        s = pix_multiply(s, a);
-        a = pix_multiply(a, sa);
-        da = negate(da);
-	d = pix_add_mul (d, a, s, da);
-        *dest = store8888(d);
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        __m64 da = expand_alpha(d);
-        __m64 sa = expand_alpha(s);
-        s = pix_multiply(s, a);
-        a = pix_multiply(a, sa);
-        da = negate(da);
-        a = negate(a);
-	d = pix_add_mul (d, a, s, da);
-        *dest = store8888(d);
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-static FASTCALL void
-mmxCombineAddC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
-{
-    const CARD32 *end = src + width;
-    while (src < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        __m64 d = load8888(*dest);
-        s = pix_multiply(s, a);
-        d = pix_add(s, d);
-        *dest = store8888(d);
-        ++src;
-        ++dest;
-        ++mask;
-    }
-    _mm_empty();
-}
-
-#if 0
-/* FIXME: this should be reinstated after adding fbmmx to pixman */
-extern FbComposeFunctions composeFunctions;
-#endif
-
-void fbComposeSetupMMX(void)
-{
-#if 0
-/* FIXME: this should be reinstated after adding fbmmx to pixman */
-    /* check if we have MMX support and initialize accordingly */
-    if (fbHaveMMX()) {
-        composeFunctions.combineU[PictOpOver] = mmxCombineOverU;
-        composeFunctions.combineU[PictOpOverReverse] = mmxCombineOverReverseU;
-        composeFunctions.combineU[PictOpIn] = mmxCombineInU;
-        composeFunctions.combineU[PictOpInReverse] = mmxCombineInReverseU;
-        composeFunctions.combineU[PictOpOut] = mmxCombineOutU;
-        composeFunctions.combineU[PictOpOutReverse] = mmxCombineOutReverseU;
-        composeFunctions.combineU[PictOpAtop] = mmxCombineAtopU;
-        composeFunctions.combineU[PictOpAtopReverse] = mmxCombineAtopReverseU;
-        composeFunctions.combineU[PictOpXor] = mmxCombineXorU;
-        composeFunctions.combineU[PictOpAdd] = mmxCombineAddU;
-        composeFunctions.combineU[PictOpSaturate] = mmxCombineSaturateU;
-
-        composeFunctions.combineC[PictOpSrc] = mmxCombineSrcC;
-        composeFunctions.combineC[PictOpOver] = mmxCombineOverC;
-        composeFunctions.combineC[PictOpOverReverse] = mmxCombineOverReverseC;
-        composeFunctions.combineC[PictOpIn] = mmxCombineInC;
-        composeFunctions.combineC[PictOpInReverse] = mmxCombineInReverseC;
-        composeFunctions.combineC[PictOpOut] = mmxCombineOutC;
-        composeFunctions.combineC[PictOpOutReverse] = mmxCombineOutReverseC;
-        composeFunctions.combineC[PictOpAtop] = mmxCombineAtopC;
-        composeFunctions.combineC[PictOpAtopReverse] = mmxCombineAtopReverseC;
-        composeFunctions.combineC[PictOpXor] = mmxCombineXorC;
-        composeFunctions.combineC[PictOpAdd] = mmxCombineAddC;
-
-        composeFunctions.combineMaskU = mmxCombineMaskU;
-    } 
-#endif
-}
-
-
-/* ------------------ MMX code paths called from fbpict.c ----------------------- */
-
-void
-fbCompositeSolid_nx8888mmx (CARD8	op,
-			    PicturePtr pSrc,
-			    PicturePtr pMask,
-			    PicturePtr pDst,
-			    INT16	xSrc,
-			    INT16	ySrc,
-			    INT16	xMask,
-			    INT16	yMask,
-			    INT16	xDst,
-			    INT16	yDst,
-			    CARD16	width,
-			    CARD16	height)
-{
-    CARD32	src;
-    CARD32	*dstLine, *dst;
-    CARD16	w;
-    FbStride	dstStride;
-    __m64	vsrc, vsrca;
-    
-    CHECKPOINT();
-    
-    fbComposeGetSolid(pSrc, src, pDst->format);
-    
-    if (src >> 24 == 0)
-	return;
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-    
-    vsrc = load8888 (src);
-    vsrca = expand_alpha (vsrc);
-    
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	w = width;
-	
-	CHECKPOINT();
-	
-	while (w && (unsigned long)dst & 7)
-	{
-	    *dst = store8888(over(vsrc, vsrca, load8888(*dst)));
-	    
-	    w--;
-	    dst++;
-	}
-	
-	while (w >= 2)
-	{
-	    __m64 vdest;
-	    __m64 dest0, dest1;
-	    
-	    vdest = *(__m64 *)dst;
-	    
-	    dest0 = over(vsrc, vsrca, expand8888(vdest, 0));
-	    dest1 = over(vsrc, vsrca, expand8888(vdest, 1));
-	    
-	    *(__m64 *)dst = pack8888(dest0, dest1);
-	    
-	    dst += 2;
-	    w -= 2;
-	}
-	
-	CHECKPOINT();
-	
-	while (w)
-	{
-	    *dst = store8888(over(vsrc, vsrca, load8888(*dst)));
-	    
-	    w--;
-	    dst++;
-	}
-    }
-    
-    _mm_empty();
-}
-
-void
-fbCompositeSolid_nx0565mmx (CARD8	op,
-			    PicturePtr pSrc,
-			    PicturePtr pMask,
-			    PicturePtr pDst,
-			    INT16	xSrc,
-			    INT16	ySrc,
-			    INT16	xMask,
-			    INT16	yMask,
-			    INT16	xDst,
-			    INT16	yDst,
-			    CARD16	width,
-			    CARD16	height)
-{
-    CARD32	src;
-    CARD16	*dstLine, *dst;
-    CARD16	w;
-    FbStride	dstStride;
-    __m64	vsrc, vsrca;
-    
-    CHECKPOINT();
-    
-    fbComposeGetSolid(pSrc, src, pDst->format);
-    
-    if (src >> 24 == 0)
-	return;
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
-    
-    vsrc = load8888 (src);
-    vsrca = expand_alpha (vsrc);
-    
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	w = width;
-	
-	CHECKPOINT();
-	
-	while (w && (unsigned long)dst & 7)
-	{
-	    ullong d = *dst;
-	    __m64 vdest = expand565 ((__m64)d, 0);
-	    vdest = pack565(over(vsrc, vsrca, vdest), vdest, 0);
-	    *dst = (ullong)vdest;
-	    
-	    w--;
-	    dst++;
-	}
-	
-	while (w >= 4)
-	{
-	    __m64 vdest;
-	    
-	    vdest = *(__m64 *)dst;
-	    
-	    vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 0)), vdest, 0);
-	    vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 1)), vdest, 1);
-	    vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 2)), vdest, 2);
-	    vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 3)), vdest, 3);
-	    
-	    *(__m64 *)dst = vdest;
-	    
-	    dst += 4;
-	    w -= 4;
-	}
-	
-	CHECKPOINT();
-	
-	while (w)
-	{
-	    ullong d = *dst;
-	    __m64 vdest = expand565 ((__m64)d, 0);
-	    vdest = pack565(over(vsrc, vsrca, vdest), vdest, 0);
-	    *dst = (ullong)vdest;
-	    
-	    w--;
-	    dst++;
-	}
-    }
-    
-    _mm_empty();
-}
-
-void
-fbCompositeSolidMask_nx8888x8888Cmmx (CARD8	op,
-				      PicturePtr pSrc,
-				      PicturePtr pMask,
-				      PicturePtr pDst,
-				      INT16	xSrc,
-				      INT16	ySrc,
-				      INT16	xMask,
-				      INT16	yMask,
-				      INT16	xDst,
-				      INT16	yDst,
-				      CARD16	width,
-				      CARD16	height)
-{
-    CARD32	src, srca;
-    CARD32	*dstLine;
-    CARD32	*maskLine;
-    FbStride	dstStride, maskStride;
-    __m64	vsrc, vsrca;
-    
-    CHECKPOINT();
-    
-    fbComposeGetSolid(pSrc, src, pDst->format);
-    
-    srca = src >> 24;
-    if (srca == 0)
-	return;
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-    fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1);
-    
-    vsrc = load8888(src);
-    vsrca = expand_alpha(vsrc);
-    
-    while (height--)
-    {
-	int twidth = width;
-	CARD32 *p = (CARD32 *)maskLine;
-	CARD32 *q = (CARD32 *)dstLine;
-	
-	while (twidth && (unsigned long)q & 7)
-	{
-	    CARD32 m = *(CARD32 *)p;
-	    
-	    if (m)
-	    {
-		__m64 vdest = load8888(*q);
-		vdest = in_over(vsrc, vsrca, load8888(m), vdest);
-		*q = store8888(vdest);
-	    }
-	    
-	    twidth--;
-	    p++;
-	    q++;
-	}
-	
-	while (twidth >= 2)
-	{
-	    CARD32 m0, m1;
-	    m0 = *p;
-	    m1 = *(p + 1);
-	    
-	    if (m0 | m1)
-	    {
-		__m64 dest0, dest1;
-		__m64 vdest = *(__m64 *)q;
-		
-		dest0 = in_over(vsrc, vsrca, load8888(m0),
-				expand8888 (vdest, 0));
-		dest1 = in_over(vsrc, vsrca, load8888(m1),
-				expand8888 (vdest, 1));
-		
-		*(__m64 *)q = pack8888(dest0, dest1);
-	    }
-	    
-	    p += 2;
-	    q += 2;
-	    twidth -= 2;
-	}
-	
-	while (twidth)
-	{
-	    CARD32 m = *(CARD32 *)p;
-	    
-	    if (m)
-	    {
-		__m64 vdest = load8888(*q);
-		vdest = in_over(vsrc, vsrca, load8888(m), vdest);
-		*q = store8888(vdest);
-	    }
-	    
-	    twidth--;
-	    p++;
-	    q++;
-	}
-	
-	dstLine += dstStride;
-	maskLine += maskStride;
-    }
-    
-    _mm_empty();
-}
-
-void
-fbCompositeSrc_8888x8x8888mmx (CARD8	op,
-			       PicturePtr pSrc,
-			       PicturePtr pMask,
-			       PicturePtr pDst,
-			       INT16	xSrc,
-			       INT16	ySrc,
-			       INT16      xMask,
-			       INT16      yMask,
-			       INT16      xDst,
-			       INT16      yDst,
-			       CARD16     width,
-			       CARD16     height)
-{
-    CARD32	*dstLine, *dst;
-    CARD32	*srcLine, *src;
-    CARD32	mask;
-    __m64	vmask;
-    FbStride	dstStride, srcStride;
-    CARD16	w;
-    __m64  srca;
-
-    CHECKPOINT();
-
-    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-    fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-
-    fbComposeGetSolid (pMask, mask, pDst->format);
-    mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
-    vmask = load8888 (mask);
-    srca = MC(4x00ff);
-
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	src = srcLine;
-	srcLine += srcStride;
-	w = width;
-
-	while (w && (unsigned long)dst & 7)
-	{
-	    __m64 s = load8888 (*src);
-	    __m64 d = load8888 (*dst);
-
-	    *dst = store8888 (in_over (s, expand_alpha (s), vmask, d));
-
-	    w--;
-	    dst++;
-	    src++;
-	}
-
-	while (w >= 2)
-	{
-	    __m64 vs = *(__m64 *)src;
-	    __m64 vd = *(__m64 *)dst;
-	    __m64 vsrc0 = expand8888 (vs, 0);
-	    __m64 vsrc1 = expand8888 (vs, 1);
-
-	    *(__m64 *)dst = pack8888 (
-		in_over (vsrc0, expand_alpha (vsrc0), vmask, expand8888 (vd, 0)),
-		in_over (vsrc1, expand_alpha (vsrc1), vmask, expand8888 (vd, 1)));
-
-	    w -= 2;
-	    dst += 2;
-	    src += 2;
-	}
-
-	while (w)
-	{
-	    __m64 s = load8888 (*src);
-	    __m64 d = load8888 (*dst);
-
-	    *dst = store8888 (in_over (s, expand_alpha (s), vmask, d));
-
-	    w--;
-	    dst++;
-	    src++;
-	}
-    }
-
-    _mm_empty();
-}
-
-void
-fbCompositeSrc_x888x8x8888mmx (CARD8	op,
-			       PicturePtr pSrc,
-			       PicturePtr pMask,
-			       PicturePtr pDst,
-			       INT16	xSrc,
-			       INT16	ySrc,
-			       INT16      xMask,
-			       INT16      yMask,
-			       INT16      xDst,
-			       INT16      yDst,
-			       CARD16     width,
-			       CARD16     height)
-{
-    CARD32	*dstLine, *dst;
-    CARD32	*srcLine, *src;
-    CARD32	mask;
-    __m64	vmask;
-    FbStride	dstStride, srcStride;
-    CARD16	w;
-    __m64  srca;
-
-    CHECKPOINT();
-
-    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-    fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-    fbComposeGetSolid (pMask, mask, pDst->format);
-
-    mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
-    vmask = load8888 (mask);
-    srca = MC(4x00ff);
-
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	src = srcLine;
-	srcLine += srcStride;
-	w = width;
-
-	while (w && (unsigned long)dst & 7)
-	{
-	    __m64 s = load8888 (*src | 0xff000000);
-	    __m64 d = load8888 (*dst);
-
-	    *dst = store8888 (in_over (s, srca, vmask, d));
-
-	    w--;
-	    dst++;
-	    src++;
-	}
-
-	while (w >= 2)
-	{
-	    
-	    __m64 vd0 = *(__m64 *)(dst);
-	    __m64 vs0 = *(__m64 *)(src);
-
-	    vd0 = pack8888 (
-		in_over_full_src_alpha (expand8888 (vs0, 0), vmask, expand8888 (vd0, 0)),
-		in_over_full_src_alpha (expand8888 (vs0, 1), vmask, expand8888 (vd0, 1)));
-
-	    *(__m64 *)(dst) = vd0;
-
-	    w -= 2;
-	    dst += 2;
-	    src += 2;
-	}
-
-	while (w)
-	{
-	    __m64 s = load8888 (*src | 0xff000000);
-	    __m64 d = load8888 (*dst);
-
-	    *dst = store8888 (in_over (s, srca, vmask, d));
-
-	    w--;
-	    dst++;
-	    src++;
-	}
-    }
-
-    _mm_empty();
-}
-
-void
-fbCompositeSrc_8888x8888mmx (CARD8	op,
-			     PicturePtr pSrc,
-			     PicturePtr pMask,
-			     PicturePtr pDst,
-			     INT16	xSrc,
-			     INT16	ySrc,
-			     INT16      xMask,
-			     INT16      yMask,
-			     INT16      xDst,
-			     INT16      yDst,
-			     CARD16     width,
-			     CARD16     height)
-{
-    CARD32	*dstLine, *dst;
-    CARD32	*srcLine, *src;
-    FbStride	dstStride, srcStride;
-    CARD16	w;
-    __m64  srca;
-    
-    CHECKPOINT();
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-    fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-
-    srca = MC (4x00ff);
-    
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	src = srcLine;
-	srcLine += srcStride;
-	w = width;
-
-	while (w && (unsigned long)dst & 7)
-	{
-	    __m64 s = load8888 (*src);
-	    __m64 d = load8888 (*dst);
-	    
-	    *dst = store8888 (over (s, expand_alpha (s), d));
-	    
-	    w--;
-	    dst++;
-	    src++;
-	}
-
-	while (w >= 2)
-	{
-	    __m64 vd = *(__m64 *)(dst + 0);
-	    __m64 vs = *(__m64 *)(src + 0);
-	    __m64 vs0 = expand8888 (vs, 0);
-	    __m64 vs1 = expand8888 (vs, 1);
-
-	    *(__m64 *)dst = (__m64)pack8888 (
-		over (vs0, expand_alpha (vs0), expand8888 (vd, 0)),
-		over (vs1, expand_alpha (vs1), expand8888 (vd, 1)));
-	    
-	    w -= 2;
-	    dst += 2;
-	    src += 2;
-	}
-	
-	while (w)
-	{
-	    __m64 s = load8888 (*src);
-	    __m64 d = load8888 (*dst);
-	    
-	    *dst = store8888 (over (s, expand_alpha (s), d));
-	    
-	    w--;
-	    dst++;
-	    src++;
-	}
-    }
-
-    _mm_empty(); 
-}
-
-void
-fbCompositeSrc_8888x0565mmx (CARD8      op,
-			     PicturePtr pSrc,
-			     PicturePtr pMask,
-			     PicturePtr pDst,
-			     INT16      xSrc,
-			     INT16      ySrc,
-			     INT16      xMask,
-			     INT16      yMask,
-			     INT16      xDst,
-			     INT16      yDst,
-			     CARD16     width,
-			     CARD16     height)
-{
-    CARD16	*dstLine, *dst;
-    CARD32	*srcLine, *src;
-    FbStride	dstStride, srcStride;
-    CARD16	w;
-    
-    CHECKPOINT();
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
-    fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-    
-    assert (pSrc->pDrawable == pMask->pDrawable);
-    
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	src = srcLine;
-	srcLine += srcStride;
-	w = width;
-	
-	CHECKPOINT();
-	
-	while (w && (unsigned long)dst & 7)
-	{
-	    __m64 vsrc = load8888 (*src);
-	    ullong d = *dst;
-	    __m64 vdest = expand565 ((__m64)d, 0);
-	    
-	    vdest = pack565(over(vsrc, expand_alpha(vsrc), vdest), vdest, 0);
-	    
-	    *dst = (ullong)vdest;
-	    
-	    w--;
-	    dst++;
-	    src++;
-	}
-	
-	CHECKPOINT();
-	
-	while (w >= 4)
-	{
-	    __m64 vsrc0, vsrc1, vsrc2, vsrc3;
-	    __m64 vdest;
-
-	    vsrc0 = load8888(*(src + 0));
-	    vsrc1 = load8888(*(src + 1));
-	    vsrc2 = load8888(*(src + 2));
-	    vsrc3 = load8888(*(src + 3));
-
-	    vdest = *(__m64 *)dst;
-	    
-	    vdest = pack565(over(vsrc0, expand_alpha(vsrc0), expand565(vdest, 0)), vdest, 0);
-	    vdest = pack565(over(vsrc1, expand_alpha(vsrc1), expand565(vdest, 1)), vdest, 1);
-	    vdest = pack565(over(vsrc2, expand_alpha(vsrc2), expand565(vdest, 2)), vdest, 2);
-	    vdest = pack565(over(vsrc3, expand_alpha(vsrc3), expand565(vdest, 3)), vdest, 3);
-	    
-	    *(__m64 *)dst = vdest;
-
-	    w -= 4;
-	    dst += 4;
-	    src += 4;
-	}
-
-	CHECKPOINT();
-	
-	while (w)
-	{
-	    __m64 vsrc = load8888 (*src);
-	    ullong d = *dst;
-	    __m64 vdest = expand565 ((__m64)d, 0);
-	    
-	    vdest = pack565(over(vsrc, expand_alpha(vsrc), vdest), vdest, 0);
-	    
-	    *dst = (ullong)vdest;
-	    
-	    w--;
-	    dst++;
-	    src++;
-	}
-    }
-    
-    _mm_empty();
-}
-
-void
-fbCompositeSolidMask_nx8x8888mmx (CARD8      op,
-				  PicturePtr pSrc,
-				  PicturePtr pMask,
-				  PicturePtr pDst,
-				  INT16      xSrc,
-				  INT16      ySrc,
-				  INT16      xMask,
-				  INT16      yMask,
-				  INT16      xDst,
-				  INT16      yDst,
-				  CARD16     width,
-				  CARD16     height)
-{
-    CARD32	src, srca;
-    CARD32	*dstLine, *dst;
-    CARD8	*maskLine, *mask;
-    FbStride	dstStride, maskStride;
-    CARD16	w;
-    __m64	vsrc, vsrca;
-    ullong	srcsrc;
-    
-    CHECKPOINT();
-    
-    fbComposeGetSolid(pSrc, src, pDst->format);
-    
-    srca = src >> 24;
-    if (srca == 0)
-	return;
-    
-    srcsrc = (unsigned long long)src << 32 | src;
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-    fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
-    
-    vsrc = load8888 (src);
-    vsrca = expand_alpha (vsrc);
-    
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	mask = maskLine;
-	maskLine += maskStride;
-	w = width;
-	
-	CHECKPOINT();
-	
-	while (w && (unsigned long)dst & 7)
-	{
-	    ullong m = *mask;
-	    
-	    if (m)
-	    {
-		__m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), load8888(*dst));
-		*dst = store8888(vdest);
-	    }
-	    
-	    w--;
-	    mask++;
-	    dst++;
-	}
-	
-	CHECKPOINT();
-	
-	while (w >= 2)
-	{
-	    ullong m0, m1;
-	    m0 = *mask;
-	    m1 = *(mask + 1);
-	    
-	    if (srca == 0xff && (m0 & m1) == 0xff)
-	    {
-		*(unsigned long long *)dst = srcsrc;
-	    }
-	    else if (m0 | m1)
-	    {
-		__m64 vdest;
-		__m64 dest0, dest1;
-		
-		vdest = *(__m64 *)dst;
-		
-		dest0 = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m0), expand8888(vdest, 0));
-		dest1 = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m1), expand8888(vdest, 1));
-		
-		*(__m64 *)dst = pack8888(dest0, dest1);
-	    }
-	    
-	    mask += 2;
-	    dst += 2;
-	    w -= 2;
-	}
-	
-	CHECKPOINT();
-	
-	while (w)
-	{
-	    ullong m = *mask;
-	    
-	    if (m)
-	    {
-		__m64 vdest = load8888(*dst);
-		vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), vdest);
-		*dst = store8888(vdest);
-	    }
-	    
-	    w--;
-	    mask++;
-	    dst++;
-	}
-    }
-    
-    _mm_empty();
-}
-
-
-Bool
-fbSolidFillmmx (DrawablePtr	pDraw,
-		int		x,
-		int		y,
-		int		width,
-		int		height,
-		FbBits		xor)
-{ 
-    FbStride	stride;
-    int		bpp;
-    ullong	fill;
-    __m64	vfill;
-    CARD32	byte_width;
-    CARD8	*byte_line;
-    FbBits      *bits;
-    int		xoff, yoff;
-#ifdef __GNUC__
-    __m64	v1, v2, v3, v4, v5, v6, v7;
-#endif
-    
-    CHECKPOINT();
-    
-    fbGetDrawable(pDraw, bits, stride, bpp, xoff, yoff);
-    
-    if (bpp == 16 && (xor >> 16 != (xor & 0xffff)))
-	return FALSE;
-    
-    if (bpp != 16 && bpp != 32)
-	return FALSE;
-    
-    if (bpp == 16)
-    {
-	stride = stride * sizeof (FbBits) / 2;
-	byte_line = (CARD8 *)(((CARD16 *)bits) + stride * (y + yoff) + (x + xoff));
-	byte_width = 2 * width;
-	stride *= 2;
-    }
-    else
-    {
-	stride = stride * sizeof (FbBits) / 4;
-	byte_line = (CARD8 *)(((CARD32 *)bits) + stride * (y + yoff) + (x + xoff));
-	byte_width = 4 * width;
-	stride *= 4;
-    }
-    
-    fill = ((ullong)xor << 32) | xor;
-    vfill = (__m64)fill;
-    
-#ifdef __GNUC__
-    __asm__ (
-	"movq		%7,	%0\n"
-	"movq		%7,	%1\n"
-	"movq		%7,	%2\n"
-	"movq		%7,	%3\n"
-	"movq		%7,	%4\n"
-	"movq		%7,	%5\n"
-	"movq		%7,	%6\n"
-	: "=y" (v1), "=y" (v2), "=y" (v3),
-	  "=y" (v4), "=y" (v5), "=y" (v6), "=y" (v7)
-	: "y" (vfill));
-#endif
-    
-    while (height--)
-    {
-	int w;
-	CARD8 *d = byte_line;
-	byte_line += stride;
-	w = byte_width;
-	
-	while (w >= 2 && ((unsigned long)d & 3))
-	{
-	    *(CARD16 *)d = xor;
-	    w -= 2;
-	    d += 2;
-	}
-	
-	while (w >= 4 && ((unsigned long)d & 7))
-	{
-	    *(CARD32 *)d = xor;
-	    
-	    w -= 4;
-	    d += 4;
-	}
-
-	while (w >= 64)
-	{
-#ifdef __GNUC__
-	    __asm__ (
-		"movq	%1,	  (%0)\n"
-		"movq	%2,	 8(%0)\n"
-		"movq	%3,	16(%0)\n"
-		"movq	%4,	24(%0)\n"
-		"movq	%5,	32(%0)\n"
-		"movq	%6,	40(%0)\n"
-		"movq	%7,	48(%0)\n"
-		"movq	%8,	56(%0)\n"
-		:
-		: "r" (d),
-		  "y" (vfill), "y" (v1), "y" (v2), "y" (v3),
-		  "y" (v4), "y" (v5), "y" (v6), "y" (v7)
-		: "memory");
-#else
-	    *(__m64*) (d +  0) = vfill;
-	    *(__m64*) (d +  8) = vfill;
-	    *(__m64*) (d + 16) = vfill;
-	    *(__m64*) (d + 24) = vfill;
-	    *(__m64*) (d + 32) = vfill;
-	    *(__m64*) (d + 40) = vfill;
-	    *(__m64*) (d + 48) = vfill;
-	    *(__m64*) (d + 56) = vfill;
-#endif    
-	    w -= 64;
-	    d += 64;
-	}
-	
-	while (w >= 4)
-	{
-	    *(CARD32 *)d = xor;
-	    
-	    w -= 4;
-	    d += 4;
-	}
-	if (w >= 2)
-	{
-	    *(CARD16 *)d = xor;
-	    w -= 2;
-	    d += 2;
-	}
-    }
-    
-    _mm_empty();
-    return TRUE;
-}
-
-void
-fbCompositeSolidMaskSrc_nx8x8888mmx (CARD8      op,
-				     PicturePtr pSrc,
-				     PicturePtr pMask,
-				     PicturePtr pDst,
-				     INT16      xSrc,
-				     INT16      ySrc,
-				     INT16      xMask,
-				     INT16      yMask,
-				     INT16      xDst,
-				     INT16      yDst,
-				     CARD16     width,
-				     CARD16     height)
-{
-    CARD32	src, srca;
-    CARD32	*dstLine, *dst;
-    CARD8	*maskLine, *mask;
-    FbStride	dstStride, maskStride;
-    CARD16	w;
-    __m64	vsrc, vsrca;
-    ullong	srcsrc;
-
-    CHECKPOINT();
-
-    fbComposeGetSolid(pSrc, src, pDst->format);
-
-    srca = src >> 24;
-    if (srca == 0)
-    {
-	fbSolidFillmmx (pDst->pDrawable, xDst, yDst, width, height, 0);
-	return;
-    }
-
-    srcsrc = (ullong)src << 32 | src;
-
-    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-    fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
-
-    vsrc = load8888 (src);
-    vsrca = expand_alpha (vsrc);
-
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	mask = maskLine;
-	maskLine += maskStride;
-	w = width;
-
-	CHECKPOINT();
-
-	while (w && (unsigned long)dst & 7)
-	{
-	    ullong m = *mask;
-
-	    if (m)
-	    {
-		__m64 vdest = in(vsrc, expand_alpha_rev ((__m64)m));
-		*dst = store8888(vdest);
-	    }
-	    else
-	    {
-		*dst = 0;
-	    }
-
-	    w--;
-	    mask++;
-	    dst++;
-	}
-
-	CHECKPOINT();
-
-	while (w >= 2)
-	{
-	    ullong m0, m1;
-	    m0 = *mask;
-	    m1 = *(mask + 1);
-
-	    if (srca == 0xff && (m0 & m1) == 0xff)
-	    {
-		*(ullong *)dst = srcsrc;
-	    }
-	    else if (m0 | m1)
-	    {
-		__m64 vdest;
-		__m64 dest0, dest1;
-
-		vdest = *(__m64 *)dst;
-
-		dest0 = in(vsrc, expand_alpha_rev ((__m64)m0));
-		dest1 = in(vsrc, expand_alpha_rev ((__m64)m1));
-
-		*(__m64 *)dst = pack8888(dest0, dest1);
-	    }
-	    else
-	    {
-		*(ullong *)dst = 0;
-	    }
-
-	    mask += 2;
-	    dst += 2;
-	    w -= 2;
-	}
-
-	CHECKPOINT();
-
-	while (w)
-	{
-	    ullong m = *mask;
-
-	    if (m)
-	    {
-		__m64 vdest = load8888(*dst);
-		vdest = in(vsrc, expand_alpha_rev ((__m64)m));
-		*dst = store8888(vdest);
-	    }
-	    else
-	    {
-		*dst = 0;
-	    }
-
-	    w--;
-	    mask++;
-	    dst++;
-	}
-    }
-
-    _mm_empty();
-}
-
-void
-fbCompositeSolidMask_nx8x0565mmx (CARD8      op,
-				  PicturePtr pSrc,
-				  PicturePtr pMask,
-				  PicturePtr pDst,
-				  INT16      xSrc,
-				  INT16      ySrc,
-				  INT16      xMask,
-				  INT16      yMask,
-				  INT16      xDst,
-				  INT16      yDst,
-				  CARD16     width,
-				  CARD16     height)
-{
-    CARD32	src, srca;
-    CARD16	*dstLine, *dst;
-    CARD8	*maskLine, *mask;
-    FbStride	dstStride, maskStride;
-    CARD16	w;
-    __m64	vsrc, vsrca;
-    unsigned long long srcsrcsrcsrc, src16;
-    
-    CHECKPOINT();
-    
-    fbComposeGetSolid(pSrc, src, pDst->format);
-    
-    srca = src >> 24;
-    if (srca == 0)
-	return;
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
-    fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
-    
-    vsrc = load8888 (src);
-    vsrca = expand_alpha (vsrc);
-    
-    src16 = (ullong)pack565(vsrc, _mm_setzero_si64(), 0);
-    
-    srcsrcsrcsrc = (ullong)src16 << 48 | (ullong)src16 << 32 |
-	(ullong)src16 << 16 | (ullong)src16;
-    
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	mask = maskLine;
-	maskLine += maskStride;
-	w = width;
-	
-	CHECKPOINT();
-	
-	while (w && (unsigned long)dst & 7)
-	{
-	    ullong m = *mask;
-	    
-	    if (m)
-	    {
-		ullong d = *dst;
-		__m64 vd = (__m64)d;
-		__m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), expand565(vd, 0));
-		*dst = (ullong)pack565(vdest, _mm_setzero_si64(), 0);
-	    }
-	    
-	    w--;
-	    mask++;
-	    dst++;
-	}
-	
-	CHECKPOINT();
-	
-	while (w >= 4)
-	{
-	    ullong m0, m1, m2, m3;
-	    m0 = *mask;
-	    m1 = *(mask + 1);
-	    m2 = *(mask + 2);
-	    m3 = *(mask + 3);
-	    
-	    if (srca == 0xff && (m0 & m1 & m2 & m3) == 0xff)
-	    {
-		*(unsigned long long *)dst = srcsrcsrcsrc;
-	    }
-	    else if (m0 | m1 | m2 | m3)
-	    {
-		__m64 vdest;
-		__m64 vm0, vm1, vm2, vm3;
-		
-		vdest = *(__m64 *)dst;
-		
-		vm0 = (__m64)m0;
-		vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm0), expand565(vdest, 0)), vdest, 0);
-		vm1 = (__m64)m1;
-		vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm1), expand565(vdest, 1)), vdest, 1);
-		vm2 = (__m64)m2;
-		vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm2), expand565(vdest, 2)), vdest, 2);
-		vm3 = (__m64)m3;
-		vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm3), expand565(vdest, 3)), vdest, 3);
-		
-		*(__m64 *)dst = vdest;
-	    }
-	    
-	    w -= 4;
-	    mask += 4;
-	    dst += 4;
-	}
-	
-	CHECKPOINT();
-	
-	while (w)
-	{
-	    ullong m = *mask;
-	    
-	    if (m)
-	    {
-		ullong d = *dst;
-		__m64 vd = (__m64)d;
-		__m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), expand565(vd, 0));
-		*dst = (ullong)pack565(vdest, _mm_setzero_si64(), 0);
-	    }
-	    
-	    w--;
-	    mask++;
-	    dst++;
-	}
-    }
-    
-    _mm_empty();
-}
-
-void
-fbCompositeSrc_8888RevNPx0565mmx (CARD8      op,
-				  PicturePtr pSrc,
-				  PicturePtr pMask,
-				  PicturePtr pDst,
-				  INT16      xSrc,
-				  INT16      ySrc,
-				  INT16      xMask,
-				  INT16      yMask,
-				  INT16      xDst,
-				  INT16      yDst,
-				  CARD16     width,
-				  CARD16     height)
-{
-    CARD16	*dstLine, *dst;
-    CARD32	*srcLine, *src;
-    FbStride	dstStride, srcStride;
-    CARD16	w;
-    
-    CHECKPOINT();
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
-    fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-    
-    assert (pSrc->pDrawable == pMask->pDrawable);
-    
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	src = srcLine;
-	srcLine += srcStride;
-	w = width;
-	
-	CHECKPOINT();
-	
-	while (w && (unsigned long)dst & 7)
-	{
-	    __m64 vsrc = load8888 (*src);
-	    ullong d = *dst;
-	    __m64 vdest = expand565 ((__m64)d, 0);
-	    
-	    vdest = pack565(over_rev_non_pre(vsrc, vdest), vdest, 0);
-	    
-	    *dst = (ullong)vdest;
-	    
-	    w--;
-	    dst++;
-	    src++;
-	}
-	
-	CHECKPOINT();
-	
-	while (w >= 4)
-	{
-	    CARD32 s0, s1, s2, s3;
-	    unsigned char a0, a1, a2, a3;
-	    
-	    s0 = *src;
-	    s1 = *(src + 1);
-	    s2 = *(src + 2);
-	    s3 = *(src + 3);
-	    
-	    a0 = (s0 >> 24);
-	    a1 = (s1 >> 24);
-	    a2 = (s2 >> 24);
-	    a3 = (s3 >> 24);
-	    
-	    if ((a0 & a1 & a2 & a3) == 0xFF)
-	    {
-		__m64 vdest;
-		vdest = pack565(invert_colors(load8888(s0)), _mm_setzero_si64(), 0);
-		vdest = pack565(invert_colors(load8888(s1)), vdest, 1);
-		vdest = pack565(invert_colors(load8888(s2)), vdest, 2);
-		vdest = pack565(invert_colors(load8888(s3)), vdest, 3);
-		
-		*(__m64 *)dst = vdest;
-	    }
-	    else if (a0 | a1 | a2 | a3)
-	    {
-		__m64 vdest = *(__m64 *)dst;
-		
-		vdest = pack565(over_rev_non_pre(load8888(s0), expand565(vdest, 0)), vdest, 0);
-	        vdest = pack565(over_rev_non_pre(load8888(s1), expand565(vdest, 1)), vdest, 1);
-		vdest = pack565(over_rev_non_pre(load8888(s2), expand565(vdest, 2)), vdest, 2);
-		vdest = pack565(over_rev_non_pre(load8888(s3), expand565(vdest, 3)), vdest, 3);
-		
-		*(__m64 *)dst = vdest;
-	    }
-	    
-	    w -= 4;
-	    dst += 4;
-	    src += 4;
-	}
-	
-	CHECKPOINT();
-	
-	while (w)
-	{
-	    __m64 vsrc = load8888 (*src);
-	    ullong d = *dst;
-	    __m64 vdest = expand565 ((__m64)d, 0);
-	    
-	    vdest = pack565(over_rev_non_pre(vsrc, vdest), vdest, 0);
-	    
-	    *dst = (ullong)vdest;
-	    
-	    w--;
-	    dst++;
-	    src++;
-	}
-    }
-    
-    _mm_empty();
-}
-
-/* "8888RevNP" is GdkPixbuf's format: ABGR, non premultiplied */
+typedef unsigned long long ullong;
 
-void
-fbCompositeSrc_8888RevNPx8888mmx (CARD8      op,
-				  PicturePtr pSrc,
-				  PicturePtr pMask,
-				  PicturePtr pDst,
-				  INT16      xSrc,
-				  INT16      ySrc,
-				  INT16      xMask,
-				  INT16      yMask,
-				  INT16      xDst,
-				  INT16      yDst,
-				  CARD16     width,
-				  CARD16     height)
-{
-    CARD32	*dstLine, *dst;
-    CARD32	*srcLine, *src;
-    FbStride	dstStride, srcStride;
-    CARD16	w;
-    
-    CHECKPOINT();
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-    fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-    
-    assert (pSrc->pDrawable == pMask->pDrawable);
-    
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	src = srcLine;
-	srcLine += srcStride;
-	w = width;
-	
-	while (w && (unsigned long)dst & 7)
-	{
-	    __m64 s = load8888 (*src);
-	    __m64 d = load8888 (*dst);
-	    
-	    *dst = store8888 (over_rev_non_pre (s, d));
-	    
-	    w--;
-	    dst++;
-	    src++;
-	}
-	
-	while (w >= 2)
-	{
-	    ullong s0, s1;
-	    unsigned char a0, a1;
-	    __m64 d0, d1;
-	    
-	    s0 = *src;
-	    s1 = *(src + 1);
-	    
-	    a0 = (s0 >> 24);
-	    a1 = (s1 >> 24);
-	    
-	    if ((a0 & a1) == 0xFF)
-	    {
-		d0 = invert_colors(load8888(s0));
-		d1 = invert_colors(load8888(s1));
-		
-		*(__m64 *)dst = pack8888 (d0, d1);
-	    }
-	    else if (a0 | a1)
-	    {
-		__m64 vdest = *(__m64 *)dst;
-		
-		d0 = over_rev_non_pre (load8888(s0), expand8888 (vdest, 0));
-		d1 = over_rev_non_pre (load8888(s1), expand8888 (vdest, 1));
-		
-		*(__m64 *)dst = pack8888 (d0, d1);
-	    }
-	    
-	    w -= 2;
-	    dst += 2;
-	    src += 2;
-	}
-	
-	while (w)
-	{
-	    __m64 s = load8888 (*src);
-	    __m64 d = load8888 (*dst);
-	    
-	    *dst = store8888 (over_rev_non_pre (s, d));
-	    
-	    w--;
-	    dst++;
-	    src++;
-	}
-    }
-    
-    _mm_empty();
-}
+#ifdef __GNUC__
+typedef ullong mmxdatafield;
+#endif
+#ifdef _MSC_VER
+typedef unsigned __int64 ullong;
+typedef __m64 mmxdatafield;
+#endif
 
-void
-fbCompositeSolidMask_nx8888x0565Cmmx (CARD8      op,
-				      PicturePtr pSrc,
-				      PicturePtr pMask,
-				      PicturePtr pDst,
-				      INT16      xSrc,
-				      INT16      ySrc,
-				      INT16      xMask,
-				      INT16      yMask,
-				      INT16      xDst,
-				      INT16      yDst,
-				      CARD16     width,
-				      CARD16     height)
-{
-    CARD32	src, srca;
-    CARD16	*dstLine;
-    CARD32	*maskLine;
-    FbStride	dstStride, maskStride;
-    __m64  vsrc, vsrca;
+Bool
+fbSolidFillmmx (DrawablePtr	pDraw,
+		int		x,
+		int		y,
+		int		width,
+		int		height,
+		FbBits		xor)
+{ 
+    FbStride	stride;
+    int		bpp;
+    ullong	fill;
+    __m64	vfill;
+    CARD32	byte_width;
+    CARD8	*byte_line;
+    FbBits      *bits;
+    int		xoff, yoff;
+#ifdef __GNUC__
+    __m64	v1, v2, v3, v4, v5, v6, v7;
+#endif
     
     CHECKPOINT();
     
-    fbComposeGetSolid(pSrc, src, pDst->format);
-    
-    srca = src >> 24;
-    if (srca == 0)
-	return;
-    
-    fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
-    fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1);
+    fbGetDrawable(pDraw, bits, stride, bpp, xoff, yoff);
     
-    vsrc = load8888 (src);
-    vsrca = expand_alpha (vsrc);
+    if (bpp == 16 && (xor >> 16 != (xor & 0xffff)))
+	return FALSE;
     
-    while (height--)
-    {
-	int twidth = width;
-	CARD32 *p = (CARD32 *)maskLine;
-	CARD16 *q = (CARD16 *)dstLine;
-	
-	while (twidth && ((unsigned long)q & 7))
-	{
-	    CARD32 m = *(CARD32 *)p;
-	    
-	    if (m)
-	    {
-		ullong d = *q;
-		__m64 vdest = expand565 ((__m64)d, 0);
-		vdest = pack565 (in_over (vsrc, vsrca, load8888 (m), vdest), vdest, 0);
-		*q = (ullong)vdest;
-	    }
-	    
-	    twidth--;
-	    p++;
-	    q++;
-	}
-	
-	while (twidth >= 4)
-	{
-	    CARD32 m0, m1, m2, m3;
-	    
-	    m0 = *p;
-	    m1 = *(p + 1);
-	    m2 = *(p + 2);
-	    m3 = *(p + 3);
-	    
-	    if ((m0 | m1 | m2 | m3))
-	    {
-		__m64 vdest = *(__m64 *)q;
-		
-		vdest = pack565(in_over(vsrc, vsrca, load8888(m0), expand565(vdest, 0)), vdest, 0);
-		vdest = pack565(in_over(vsrc, vsrca, load8888(m1), expand565(vdest, 1)), vdest, 1);
-		vdest = pack565(in_over(vsrc, vsrca, load8888(m2), expand565(vdest, 2)), vdest, 2);
-		vdest = pack565(in_over(vsrc, vsrca, load8888(m3), expand565(vdest, 3)), vdest, 3);
-		
-		*(__m64 *)q = vdest;
-	    }
-	    twidth -= 4;
-	    p += 4;
-	    q += 4;
-	}
-	
-	while (twidth)
-	{
-	    CARD32 m;
-	    
-	    m = *(CARD32 *)p;
-	    if (m)
-	    {
-		ullong d = *q;
-		__m64 vdest = expand565((__m64)d, 0);
-		vdest = pack565 (in_over(vsrc, vsrca, load8888(m), vdest), vdest, 0);
-		*q = (ullong)vdest;
-	    }
-	    
-	    twidth--;
-	    p++;
-	    q++;
-	}
-	
-	maskLine += maskStride;
-	dstLine += dstStride;
-    }
+    if (bpp != 16 && bpp != 32)
+	return FALSE;
     
-    _mm_empty ();
-}
-
-void
-fbCompositeIn_nx8x8mmx (CARD8	op,
-			PicturePtr pSrc,
-			PicturePtr pMask,
-			PicturePtr pDst,
-			INT16      xSrc,
-			INT16      ySrc,
-			INT16      xMask,
-			INT16      yMask,
-			INT16      xDst,
-			INT16      yDst,
-			CARD16     width,
-			CARD16     height)
-{
-    CARD8	*dstLine, *dst;
-    CARD8	*maskLine, *mask;
-    FbStride	dstStride, maskStride;
-    CARD16	w;
-    CARD32	src;
-    CARD8	sa;
-    __m64	vsrc, vsrca;
-
-    fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1);
-    fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
-
-    fbComposeGetSolid(pSrc, src, pDst->format);
-
-    sa = src >> 24;
-    if (sa == 0)
-	return;
-
-    vsrc = load8888(src);
-    vsrca = expand_alpha(vsrc);
-
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	mask = maskLine;
-	maskLine += maskStride;
-	w = width;
-
-	if ((((unsigned long)pDst & 3) == 0) &&
-	    (((unsigned long)pSrc & 3) == 0))
-	{
-	    while (w >= 4)
-	    {
-		CARD32 m;
-		__m64 vmask;
-		__m64 vdest;
-
-		m = 0;
-
-		vmask = load8888 (*(CARD32 *)mask);
-		vdest = load8888 (*(CARD32 *)dst);
-
-		*(CARD32 *)dst = store8888 (in (in (vsrca, vmask), vdest));
-
-		dst += 4;
-		mask += 4;
-		w -= 4;
-	    }
-	}
-
-	while (w--)
-	{
-	    CARD16	tmp;
-	    CARD8	a;
-	    CARD32	m, d;
-	    CARD32	r;
-
-	    a = *mask++;
-	    d = *dst;
-
-	    m = FbInU (sa, 0, a, tmp);
-	    r = FbInU (m, 0, d, tmp);
-
-	    *dst++ = r;
-	}
-    }
-
-    _mm_empty();
-}
-
-void
-fbCompositeIn_8x8mmx (CARD8	op,
-		      PicturePtr pSrc,
-		      PicturePtr pMask,
-		      PicturePtr pDst,
-		      INT16      xSrc,
-		      INT16      ySrc,
-		      INT16      xMask,
-		      INT16      yMask,
-		      INT16      xDst,
-		      INT16      yDst,
-		      CARD16     width,
-		      CARD16     height)
-{
-    CARD8	*dstLine, *dst;
-    CARD8	*srcLine, *src;
-    FbStride	srcStride, dstStride;
-    CARD16	w;
-
-    fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1);
-    fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1);
-
-    while (height--)
+    if (bpp == 16)
     {
-	dst = dstLine;
-	dstLine += dstStride;
-	src = srcLine;
-	srcLine += srcStride;
-	w = width;
-
-	if ((((unsigned long)pDst & 3) == 0) &&
-	    (((unsigned long)pSrc & 3) == 0))
-	{
-	    while (w >= 4)
-	    {
-		CARD32 *s = (CARD32 *)src;
-		CARD32 *d = (CARD32 *)dst;
-
-		*d = store8888 (in (load8888 (*s), load8888 (*d)));
-
-		w -= 4;
-		dst += 4;
-		src += 4;
-	    }
-	}
-
-	while (w--)
-	{
-	    CARD8 s, d;
-	    CARD16 tmp;
-
-	    s = *src;
-	    d = *dst;
-
-	    *dst = FbInU (s, 0, d, tmp);
-
-	    src++;
-	    dst++;
-	}
+	stride = stride * sizeof (FbBits) / 2;
+	byte_line = (CARD8 *)(((CARD16 *)bits) + stride * (y + yoff) + (x + xoff));
+	byte_width = 2 * width;
+	stride *= 2;
     }
-
-    _mm_empty ();
-}
-
-void
-fbCompositeSrcAdd_8888x8x8mmx (CARD8   op,
-			       PicturePtr pSrc,
-			       PicturePtr pMask,
-			       PicturePtr pDst,
-			       INT16      xSrc,
-			       INT16      ySrc,
-			       INT16      xMask,
-			       INT16      yMask,
-			       INT16      xDst,
-			       INT16      yDst,
-			       CARD16     width,
-			       CARD16     height)
-{
-    CARD8	*dstLine, *dst;
-    CARD8	*maskLine, *mask;
-    FbStride	dstStride, maskStride;
-    CARD16	w;
-    CARD32	src;
-    CARD8	sa;
-    __m64	vsrc, vsrca;
-
-    fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1);
-    fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
-
-    fbComposeGetSolid(pSrc, src, pDst->format);
-
-    sa = src >> 24;
-    if (sa == 0)
-	return;
-
-    vsrc = load8888(src);
-    vsrca = expand_alpha(vsrc);
-
-    while (height--)
+    else
     {
-	dst = dstLine;
-	dstLine += dstStride;
-	mask = maskLine;
-	maskLine += maskStride;
-	w = width;
-
-	if ((((unsigned long)pMask & 3) == 0) &&
-	    (((unsigned long)pDst  & 3) == 0))
-	{
-	    while (w >= 4)
-	    {
-		__m64 vmask = load8888 (*(CARD32 *)mask);
-		__m64 vdest = load8888 (*(CARD32 *)dst);
-
-		*(CARD32 *)dst = store8888 (_mm_adds_pu8 (in (vsrca, vmask), vdest));
-
-		w -= 4;
-		dst += 4;
-		mask += 4;
-	    }
-	}
-
-	while (w--)
-	{
-	    CARD16	tmp;
-	    CARD16	a;
-	    CARD32	m, d;
-	    CARD32	r;
-
-	    a = *mask++;
-	    d = *dst;
-
-	    m = FbInU (sa, 0, a, tmp);
-	    r = FbAdd (m, d, 0, tmp);
-
-	    *dst++ = r;
-	}
+	stride = stride * sizeof (FbBits) / 4;
+	byte_line = (CARD8 *)(((CARD32 *)bits) + stride * (y + yoff) + (x + xoff));
+	byte_width = 4 * width;
+	stride *= 4;
     }
-
-    _mm_empty();
-}
-
-void
-fbCompositeSrcAdd_8000x8000mmx (CARD8	op,
-				PicturePtr pSrc,
-				PicturePtr pMask,
-				PicturePtr pDst,
-				INT16      xSrc,
-				INT16      ySrc,
-				INT16      xMask,
-				INT16      yMask,
-				INT16      xDst,
-				INT16      yDst,
-				CARD16     width,
-				CARD16     height)
-{
-    CARD8	*dstLine, *dst;
-    CARD8	*srcLine, *src;
-    FbStride	dstStride, srcStride;
-    CARD16	w;
-    CARD8	s, d;
-    CARD16	t;
     
-    CHECKPOINT();
+    fill = ((ullong)xor << 32) | xor;
+    vfill = (__m64)fill;
     
-    fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1);
-    fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1);
+#ifdef __GNUC__
+    __asm__ (
+	"movq		%7,	%0\n"
+	"movq		%7,	%1\n"
+	"movq		%7,	%2\n"
+	"movq		%7,	%3\n"
+	"movq		%7,	%4\n"
+	"movq		%7,	%5\n"
+	"movq		%7,	%6\n"
+	: "=y" (v1), "=y" (v2), "=y" (v3),
+	  "=y" (v4), "=y" (v5), "=y" (v6), "=y" (v7)
+	: "y" (vfill));
+#endif
     
     while (height--)
     {
-	dst = dstLine;
-	dstLine += dstStride;
-	src = srcLine;
-	srcLine += srcStride;
-	w = width;
-	
-	while (w && (unsigned long)dst & 7)
-	{
-	    s = *src;
-	    d = *dst;
-	    t = d + s;
-	    s = t | (0 - (t >> 8));
-	    *dst = s;
-	    
-	    dst++;
-	    src++;
-	    w--;
-	}
+	int w;
+	CARD8 *d = byte_line;
+	byte_line += stride;
+	w = byte_width;
 	
-	while (w >= 8)
+	while (w >= 2 && ((unsigned long)d & 3))
 	{
-	    *(__m64*)dst = _mm_adds_pu8(*(__m64*)src, *(__m64*)dst);
-	    dst += 8;
-	    src += 8;
-	    w -= 8;
+	    *(CARD16 *)d = xor;
+	    w -= 2;
+	    d += 2;
 	}
 	
-	while (w)
+	while (w >= 4 && ((unsigned long)d & 7))
 	{
-	    s = *src;
-	    d = *dst;
-	    t = d + s;
-	    s = t | (0 - (t >> 8));
-	    *dst = s;
+	    *(CARD32 *)d = xor;
 	    
-	    dst++;
-	    src++;
-	    w--;
+	    w -= 4;
+	    d += 4;
 	}
-    }
-    
-    _mm_empty();
-}
 
-void
-fbCompositeSrcAdd_8888x8888mmx (CARD8		op,
-				PicturePtr	pSrc,
-				PicturePtr	pMask,
-				PicturePtr	 pDst,
-				INT16		 xSrc,
-				INT16      ySrc,
-				INT16      xMask,
-				INT16      yMask,
-				INT16      xDst,
-				INT16      yDst,
-				CARD16     width,
-				CARD16     height)
-{
-    CARD32	*dstLine, *dst;
-    CARD32	*srcLine, *src;
-    FbStride	dstStride, srcStride;
-    CARD16	w;
-    
-    CHECKPOINT();
-    
-    fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
-    
-    while (height--)
-    {
-	dst = dstLine;
-	dstLine += dstStride;
-	src = srcLine;
-	srcLine += srcStride;
-	w = width;
-	
-	while (w && (unsigned long)dst & 7)
+	while (w >= 64)
 	{
-	    *dst = _mm_cvtsi64_si32(_mm_adds_pu8(_mm_cvtsi32_si64(*src),
-						 _mm_cvtsi32_si64(*dst)));
-	    dst++;
-	    src++;
-	    w--;
+#ifdef __GNUC__
+	    __asm__ (
+		"movq	%1,	  (%0)\n"
+		"movq	%2,	 8(%0)\n"
+		"movq	%3,	16(%0)\n"
+		"movq	%4,	24(%0)\n"
+		"movq	%5,	32(%0)\n"
+		"movq	%6,	40(%0)\n"
+		"movq	%7,	48(%0)\n"
+		"movq	%8,	56(%0)\n"
+		:
+		: "r" (d),
+		  "y" (vfill), "y" (v1), "y" (v2), "y" (v3),
+		  "y" (v4), "y" (v5), "y" (v6), "y" (v7)
+		: "memory");
+#else
+	    *(__m64*) (d +  0) = vfill;
+	    *(__m64*) (d +  8) = vfill;
+	    *(__m64*) (d + 16) = vfill;
+	    *(__m64*) (d + 24) = vfill;
+	    *(__m64*) (d + 32) = vfill;
+	    *(__m64*) (d + 40) = vfill;
+	    *(__m64*) (d + 48) = vfill;
+	    *(__m64*) (d + 56) = vfill;
+#endif    
+	    w -= 64;
+	    d += 64;
 	}
 	
-	while (w >= 2)
+	while (w >= 4)
 	{
-	    *(ullong*)dst = (ullong) _mm_adds_pu8(*(__m64*)src, *(__m64*)dst);
-	    dst += 2;
-	    src += 2;
-	    w -= 2;
+	    *(CARD32 *)d = xor;
+	    
+	    w -= 4;
+	    d += 4;
 	}
-	
-	if (w)
+	if (w >= 2)
 	{
-	    *dst = _mm_cvtsi64_si32(_mm_adds_pu8(_mm_cvtsi32_si64(*src),
-						 _mm_cvtsi32_si64(*dst)));
-	    
+	    *(CARD16 *)d = xor;
+	    w -= 2;
+	    d += 2;
 	}
     }
     
     _mm_empty();
+    return TRUE;
 }
 
 Bool
diff --git a/fb/fbmmx.h b/fb/fbmmx.h
index ca9c7e7..43079e9 100644
--- a/fb/fbmmx.h
+++ b/fb/fbmmx.h
@@ -44,226 +44,6 @@ Bool fbHaveMMX(void);
 
 #ifdef USE_MMX
 
-void fbComposeSetupMMX(void);
-
-void fbCompositeSolidMask_nx8888x0565Cmmx (CARD8      op,
-					   PicturePtr pSrc,
-					   PicturePtr pMask,
-					   PicturePtr pDst,
-					   INT16      xSrc,
-					   INT16      ySrc,
-					   INT16      xMask,
-					   INT16      yMask,
-					   INT16      xDst,
-					   INT16      yDst,
-					   CARD16     width,
-					   CARD16     height);
-void fbCompositeSrcAdd_8888x8888mmx (CARD8	op,
-				     PicturePtr	pSrc,
-				     PicturePtr	pMask,
-				     PicturePtr	pDst,
-				     INT16	xSrc,
-				     INT16      ySrc,
-				     INT16      xMask,
-				     INT16      yMask,
-				     INT16      xDst,
-				     INT16      yDst,
-				     CARD16     width,
-				     CARD16     height);
-void fbCompositeSrc_8888x8888mmx (CARD8		op,
-				  PicturePtr	pSrc,
-				  PicturePtr	pMask,
-				  PicturePtr	pDst,
-				  INT16		xSrc,
-				  INT16		ySrc,
-				  INT16		xMask,
-				  INT16		yMask,
-				  INT16		xDst,
-				  INT16		yDst,
-				  CARD16	width,
-				  CARD16	height);
-void
-fbCompositeSolidMaskSrc_nx8x8888mmx (CARD8      op,
-				     PicturePtr pSrc,
-				     PicturePtr pMask,
-				     PicturePtr pDst,
-				     INT16      xSrc,
-				     INT16      ySrc,
-				     INT16      xMask,
-				     INT16      yMask,
-				     INT16      xDst,
-				     INT16      yDst,
-				     CARD16     width,
-				     CARD16     height);
-void
-fbCompositeSrc_x888x8x8888mmx (CARD8	op,
-			       PicturePtr pSrc,
-			       PicturePtr pMask,
-			       PicturePtr pDst,
-			       INT16	xSrc,
-			       INT16	ySrc,
-			       INT16      xMask,
-			       INT16      yMask,
-			       INT16      xDst,
-			       INT16      yDst,
-			       CARD16     width,
-			       CARD16     height);
-void fbCompositeSolidMask_nx8888x8888Cmmx (CARD8	op,
-					   PicturePtr	pSrc,
-					   PicturePtr	pMask,
-					   PicturePtr	pDst,
-					   INT16	xSrc,
-					   INT16	ySrc,
-					   INT16	xMask,
-					   INT16	yMask,
-					   INT16	xDst,
-					   INT16	yDst,
-					   CARD16	width,
-					   CARD16	height);
-void fbCompositeSolidMask_nx8x8888mmx (CARD8      op,
-				       PicturePtr pSrc,
-				       PicturePtr pMask,
-				       PicturePtr pDst,
-				       INT16      xSrc,
-				       INT16      ySrc,
-				       INT16      xMask,
-				       INT16      yMask,
-				       INT16      xDst,
-				       INT16      yDst,
-				       CARD16     width,
-				       CARD16     height);
-void fbCompositeIn_nx8x8mmx (CARD8	op,
-			PicturePtr pSrc,
-			PicturePtr pMask,
-			PicturePtr pDst,
-			INT16      xSrc,
-			INT16      ySrc,
-			INT16      xMask,
-			INT16      yMask,
-			INT16      xDst,
-			INT16      yDst,
-			CARD16     width,
-			CARD16     height);
-void fbCompositeIn_8x8mmx (CARD8	op,
-		      PicturePtr pSrc,
-		      PicturePtr pMask,
-		      PicturePtr pDst,
-		      INT16      xSrc,
-		      INT16      ySrc,
-		      INT16      xMask,
-		      INT16      yMask,
-		      INT16      xDst,
-		      INT16      yDst,
-		      CARD16     width,
-		      CARD16     height);
-void fbCompositeSrcAdd_8888x8x8mmx (CARD8   op,
-			       PicturePtr pSrc,
-			       PicturePtr pMask,
-			       PicturePtr pDst,
-			       INT16      xSrc,
-			       INT16      ySrc,
-			       INT16      xMask,
-			       INT16      yMask,
-			       INT16      xDst,
-			       INT16      yDst,
-			       CARD16     width,
-			       CARD16     height);
-void fbCompositeSrcAdd_8000x8000mmx (CARD8	op,
-				     PicturePtr pSrc,
-				     PicturePtr pMask,
-				     PicturePtr pDst,
-				     INT16      xSrc,
-				     INT16      ySrc,
-				     INT16      xMask,
-				     INT16      yMask,
-				     INT16      xDst,
-				     INT16      yDst,
-				     CARD16     width,
-				     CARD16     height);
-void fbCompositeSrc_8888RevNPx8888mmx (CARD8      op,
-				       PicturePtr pSrc,
-				       PicturePtr pMask,
-				       PicturePtr pDst,
-				       INT16      xSrc,
-				       INT16      ySrc,
-				       INT16      xMask,
-				       INT16      yMask,
-				       INT16      xDst,
-				       INT16      yDst,
-				       CARD16     width,
-				       CARD16     height);
-void fbCompositeSrc_8888x0565mmx (CARD8      op,
-				  PicturePtr pSrc,
-				  PicturePtr pMask,
-				  PicturePtr pDst,
-				  INT16      xSrc,
-				  INT16      ySrc,
-				  INT16      xMask,
-				  INT16      yMask,
-				  INT16      xDst,
-				  INT16      yDst,
-				  CARD16     width,
-				  CARD16     height);
-void fbCompositeSrc_8888RevNPx0565mmx (CARD8      op,
-				       PicturePtr pSrc,
-				       PicturePtr pMask,
-				       PicturePtr pDst,
-				       INT16      xSrc,
-				       INT16      ySrc,
-				       INT16      xMask,
-				       INT16      yMask,
-				       INT16      xDst,
-				       INT16      yDst,
-				       CARD16     width,
-				       CARD16     height);
-void fbCompositeSolid_nx8888mmx (CARD8		op,
-				 PicturePtr	pSrc,
-				 PicturePtr	pMask,
-				 PicturePtr	pDst,
-				 INT16		xSrc,
-				 INT16		ySrc,
-				 INT16		xMask,
-				 INT16		yMask,
-				 INT16		xDst,
-				 INT16		yDst,
-				 CARD16		width,
-				 CARD16		height);
-void fbCompositeSolid_nx0565mmx (CARD8		op,
-				 PicturePtr	pSrc,
-				 PicturePtr	pMask,
-				 PicturePtr	pDst,
-				 INT16		xSrc,
-				 INT16		ySrc,
-				 INT16		xMask,
-				 INT16		yMask,
-				 INT16		xDst,
-				 INT16		yDst,
-				 CARD16		width,
-				 CARD16		height);
-void fbCompositeSolidMask_nx8x0565mmx (CARD8      op,
-				       PicturePtr pSrc,
-				       PicturePtr pMask,
-				       PicturePtr pDst,
-				       INT16      xSrc,
-				       INT16      ySrc,
-				       INT16      xMask,
-				       INT16      yMask,
-				       INT16      xDst,
-				       INT16      yDst,
-				       CARD16     width,
-				       CARD16     height);
-void fbCompositeSrc_8888x8x8888mmx (CARD8	op,
-				    PicturePtr  pSrc,
-				    PicturePtr  pMask,
-				    PicturePtr  pDst,
-				    INT16	xSrc,
-				    INT16	ySrc,
-				    INT16       xMask,
-				    INT16       yMask,
-				    INT16       xDst,
-				    INT16       yDst,
-				    CARD16      width,
-				    CARD16      height);
 Bool fbCopyAreammx (DrawablePtr	pSrc,
 		    DrawablePtr	pDst,
 		    int		src_x,
diff --git a/render/mipict.c b/render/mipict.c
index 3d6c1ae..dff7f5e 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -1,4 +1,4 @@
- /*
+/*
  *
  * Copyright © 1999 Keith Packard
  *
diff-tree dfbe32b5b828cc4e3da36a0e2e6ad641164eaa5e (from 75dece08fb72803d5116e6776e9f1534ff20e37b)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Mon Jun 4 18:07:00 2007 -0400

    Remove the old Kerberos 5 authentication code.
    
    Before you complain, this code hasn't seen material change since at least
    X11R6.  It certainly does not build with any modern version of Kerberos.
    Anybody wanting krb5 auth to their X server should probably be using
    GSSAPI instead of internal krb5 API anyway.

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 6aba9db..c313796 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -996,10 +996,6 @@ ProcGetAtomName(ClientPtr client)
     }
 }
 
-#ifdef K5AUTH
-extern int k5_bad();
-#endif
-
 int
 ProcSetSelectionOwner(ClientPtr client)
 {
@@ -3541,12 +3537,6 @@ InitProcVectors(void)
             ProcVector[i] = SwappedProcVector[i] = ProcBadRequest;
 	    ReplySwapVector[i] = ReplyNotSwappd;
 	}
-#ifdef K5AUTH
-	if (!k5_Vector[i])
-	{
-	    k5_Vector[i] = k5_bad;
-	}
-#endif
     }
     for(i = LASTEvent; i < 128; i++)
     {
diff --git a/dix/tables.c b/dix/tables.c
index 258ac03..2200e3c 100644
--- a/dix/tables.c
+++ b/dix/tables.c
@@ -61,11 +61,6 @@ SOFTWARE.
 #include "swaprep.h"
 #include "swapreq.h"
 
-#ifdef K5AUTH
-extern int
-    k5_stage1(), k5_stage2(), k5_stage3(), k5_bad();
-#endif
-
 int (* InitialVector[3]) (
 	ClientPtr /* client */
     ) =
@@ -515,13 +510,3 @@ _X_EXPORT ReplySwapPtr ReplySwapVector[2
     ReplyNotSwappd,				/* NoOperation */
     ReplyNotSwappd
 };
-
-#ifdef K5AUTH
-int (*k5_Vector[256])() =
-{
-    k5_bad,
-    k5_stage1,
-    k5_bad,
-    k5_stage3
-};
-#endif
diff --git a/include/dixstruct.h b/include/dixstruct.h
index b5ffcca..dd6347f 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -207,10 +207,6 @@ extern int (* ProcVector[256]) (ClientPt
 
 extern int (* SwappedProcVector[256]) (ClientPtr /*client*/);
 
-#ifdef K5AUTH
-extern int (*k5_Vector[256])(ClientPtr /*client*/);
-#endif
-
 extern ReplySwapPtr ReplySwapVector[256];
 
 extern int ProcBadRequest(ClientPtr /*client*/);
diff --git a/os/Makefile.am b/os/Makefile.am
index d8d1405..c5e7b03 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -3,7 +3,6 @@ noinst_LTLIBRARIES = libos.la libcwrappe
 AM_CFLAGS = $(DIX_CFLAGS)
 
 # FIXME: Add support for these in configure.ac
-K5AUTH_SRCS = k5auth.c
 SECURERPC_SRCS = rpcauth.c
 INTERNALMALLOC_SRCS = xalloc.c
 
@@ -48,7 +47,7 @@ libcwrapper_la_CFLAGS = \
 	-I$(top_srcdir)/hw/xfree86/os-support \
 	$(AM_CFLAGS)
 
-EXTRA_DIST = $(K5AUTH_SRCS) $(SECURERPC_SRCS) $(INTERNALMALLOC_SRCS) \
+EXTRA_DIST = $(SECURERPC_SRCS) $(INTERNALMALLOC_SRCS) \
      $(XCSECURITY_SRCS) $(XDMCP_SRCS) $(STRLCAT_SRCS)
 
 if XSERVER_DTRACE
diff --git a/os/access.c b/os/access.c
index 221b8cb..2de0ead 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1169,10 +1169,6 @@ ResetHosts (char *display)
     struct nodeent 	*np;
     struct dn_naddr 	dnaddr, *dnaddrp, *dnet_addr();
 #endif
-#ifdef K5AUTH
-    krb5_principal      princ;
-    krb5_data		kbuf;
-#endif
     int			family = 0;
     pointer		addr;
     int 		len;
@@ -1252,13 +1248,6 @@ ResetHosts (char *display)
 	    hostname = ohostname + 4;
 	}
 #endif
-#ifdef K5AUTH
-	else if (!strncmp("krb:", lhostname, 4))
-	{
-	    family = FamilyKrb5Principal;
-	    hostname = ohostname + 4;
-	}
-#endif
 	else if (!strncmp("si:", lhostname, 3))
 	{
 	    family = FamilyServerInterpreted;
@@ -1301,16 +1290,6 @@ ResetHosts (char *display)
     	}
 	else
 #endif /* DNETCONN */
-#ifdef K5AUTH
-	if (family == FamilyKrb5Principal)
-	{
-            krb5_parse_name(hostname, &princ);
-	    XauKrb5Encode(princ, &kbuf);
-	    (void) NewHost(FamilyKrb5Principal, kbuf.data, kbuf.length, FALSE);
-	    krb5_free_principal(princ);
-        }
-	else
-#endif
 #ifdef SECURE_RPC
 	if ((family == FamilyNetname) || (strchr(hostname, '@')))
 	{
@@ -1552,11 +1531,6 @@ AddHost (ClientPtr	client,
 	len = length;
 	LocalHostEnabled = TRUE;
 	break;
-#ifdef K5AUTH
-    case FamilyKrb5Principal:
-        len = length;
-        break;
-#endif
 #ifdef SECURE_RPC
     case FamilyNetname:
 	len = length;
@@ -1655,11 +1629,6 @@ RemoveHost (
 	len = length;
 	LocalHostEnabled = FALSE;
 	break;
-#ifdef K5AUTH
-    case FamilyKrb5Principal:
-        len = length;
-	break;
-#endif
 #ifdef SECURE_RPC
     case FamilyNetname:
 	len = length;
diff --git a/os/auth.c b/os/auth.c
index b06333e..b2a145f 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -35,9 +35,6 @@ from The Open Group.
 #include <dix-config.h>
 #endif
 
-#ifdef K5AUTH
-# include   <krb5/krb5.h>
-#endif
 # include   <X11/X.h>
 # include   <X11/Xauth.h>
 # include   "misc.h"
@@ -92,15 +89,6 @@ static struct protocol   protocols[] = {
 #endif
 },
 #endif
-#ifdef K5AUTH
-{   (unsigned short) 14, "MIT-KERBEROS-5",
-		K5Add, K5Check, K5Reset,
-		K5ToID, K5FromID, K5Remove,
-#ifdef XCSECURITY
-		NULL
-#endif
-},
-#endif
 #ifdef XCSECURITY
 {   (unsigned short) XSecurityAuthorizationNameLen,
 	XSecurityAuthorizationName,
diff --git a/os/k5auth.c b/os/k5auth.c
deleted file mode 100644
index 7bc0ce8..0000000
--- a/os/k5auth.c
+++ /dev/null
@@ -1,799 +0,0 @@
-/*
-
-Copyright 1993, 1994, 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.
-
-*/
-
-/*
- * Kerberos V5 authentication scheme
- * Author: Tom Yu <tlyu at MIT.EDU>
- *
- * Mostly snarfed wholesale from the user_user demo in the
- * krb5 distribution. (At least the checking part)
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#ifdef TCPCONN
-#include <netinet/in.h>
-#endif
-#ifdef DNETCONN
-#include <netdnet/dn.h>
-#endif
-#include <arpa/inet.h>
-#include <krb5/krb5.h>
-/* 9/93: krb5.h leaks some symbols */
-#undef BITS32
-#undef xfree
-#include <krb5/los-proto.h>
-#include <X11/X.h>
-#include "os.h"
-#include "osdep.h"
-#include <X11/Xproto.h>
-#include <X11/Xfuncs.h>
-#include "dixstruct.h"
-#include <com_err.h>
-#include "Xauth.h"
-
-extern int (*k5_Vector[256])();
-extern int SendConnSetup();
-extern char *display;		/* need this to generate rcache name */
-
-static XID krb5_id = ~0L;
-static krb5_principal srvname = NULL; /* service name */
-static char *ccname = NULL;
-static char *ktname = NULL;	/* key table name */
-static char kerror[256];
-
-/*
- * tgt_keyproc:
- *
- * extract session key from a credentials struct
- */
-krb5_error_code tgt_keyproc(keyprocarg, principal, vno, key)
-    krb5_pointer keyprocarg;
-    krb5_principal principal;
-    krb5_kvno vno;
-    krb5_keyblock **key;
-{
-    krb5_creds *creds = (krb5_creds *)keyprocarg;
-    
-    return krb5_copy_keyblock(&creds->keyblock, key);
-}
-
-/*
- * k5_cmpenc:
- *
- * compare "encoded" principals
- */
-Bool k5_cmpenc(pname, plen, buf)
-    unsigned char *pname;
-    short plen;
-    krb5_data *buf;
-{
-    return (plen == buf->length &&
-	    memcmp(pname, buf->data, plen) == 0);
-}
-
-/*
- * K5Check:
- *
- * This is stage 0 of the krb5 authentication protocol.  It
- * goes through the current credentials cache and extracts the
- * primary principal and tgt to send to the client, or as
- * appropriate, extracts from a keytab.
- *
- * The packet sent to the client has the following format:
- *
- * CARD8	reqType	= 2
- * CARD8	data	= 0
- * CARD16	length	= total length of packet (in 32 bit units)
- * CARD16	plen	= length of encoded principal following
- * STRING8	princ	= encoded principal
- * STRING8	ticket	= server tgt
- *
- * For client-server authentication, the packet is as follows:
- *
- * CARD8	reqType	= 3
- * CARD8	data	= 0
- * CARD16	length	= total length
- * STRING8	princ	= encoded principal of server
- */
-XID K5Check(data_length, data, client, reason)
-    unsigned short data_length;
-    char *data;
-    ClientPtr client;
-    char **reason;
-{
-    krb5_error_code retval;
-    CARD16 tlen;
-    krb5_principal sprinc, cprinc;
-    krb5_ccache cc;
-    krb5_creds *creds;
-    char *outbuf, *cp;
-    krb5_data princ;
-    register char n;
-    xReq prefix;
-
-    if (krb5_id == ~0L)
-	return ~0L;
-    if (!ccname && !srvname)
-	return ~0L;
-    if (ccname)
-    {
-	if ((creds = (krb5_creds *)malloc(sizeof(krb5_creds))) == NULL)
-	    return ~0L;
-	if (retval = krb5_cc_resolve(ccname, &cc))
-	    return ~0L;
-	bzero((char*)creds, sizeof (krb5_creds));
-	if (retval = krb5_cc_get_principal(cc, &cprinc))
-	{
-	    krb5_free_creds(creds);
-	    krb5_cc_close(cc);
-	    return ~0L;
-	}
-	creds->client = cprinc;
-	if (retval =
-	    krb5_build_principal_ext(&sprinc, 
-				     krb5_princ_realm(creds->client)->length,
-				     krb5_princ_realm(creds->client)->data,
-				     6, "krbtgt",
-				     krb5_princ_realm(creds->client)->length,
-				     krb5_princ_realm(creds->client)->data,
-				     0))
-	{
-	    krb5_free_creds(creds);
-	    krb5_cc_close(cc);
-	    return ~0L;
-	}
-	creds->server = sprinc;
-	retval = krb5_get_credentials(KRB5_GC_CACHED, cc, creds);
-	krb5_cc_close(cc);
-	if (retval)
-	{
-	    krb5_free_creds(creds);
-	    return ~0L;
-	}
-	if (retval = XauKrb5Encode(cprinc, &princ))
-	{
-	    krb5_free_creds(creds);
-	    return ~0L;
-	}
-	tlen = sz_xReq + 2 + princ.length + creds->ticket.length;
-	prefix.reqType = 2;	/* opcode = authenticate user-to-user */
-    }
-    else if (srvname)
-    {
-	if (retval = XauKrb5Encode(srvname, &princ))
-	{
-	    return ~0L;
-	}
-	tlen = sz_xReq + princ.length;
-	prefix.reqType = 3;	/* opcode = authenticate client-server */
-    }
-    prefix.data = 0;		/* stage = 0 */
-    prefix.length = (tlen + 3) >> 2; /* round up to nearest multiple
-					of 4 bytes */
-    if (client->swapped)
-    {
-	swaps(&prefix.length, n);
-    }
-    if ((cp = outbuf = (char *)malloc(tlen)) == NULL)
-    {
-	if (ccname)
-	{
-	    krb5_free_creds(creds);
-	}
-	free(princ.data);
-	return ~0L;
-    }
-    memcpy(cp, &prefix, sz_xReq);
-    cp += sz_xReq;
-    if (ccname)
-    {
-	memcpy(cp, &princ.length, 2);
-	if (client->swapped)
-	{
-	    swaps((CARD16 *)cp, n);
-	}
-	cp += 2;
-    }
-    memcpy(cp, princ.data, princ.length);
-    cp += princ.length;
-    free(princ.data);		/* we don't need that anymore */
-    if (ccname)
-	memcpy(cp, creds->ticket.data, creds->ticket.length);
-    WriteToClient(client, tlen, outbuf);
-    free(outbuf);
-    client->requestVector = k5_Vector; /* hack in our dispatch vector */
-    client->clientState = ClientStateAuthenticating;
-    if (ccname)
-    {
-	((OsCommPtr)client->osPrivate)->authstate.srvcreds = (pointer)creds; /* save tgt creds */
-	((OsCommPtr)client->osPrivate)->authstate.ktname = NULL;
-	((OsCommPtr)client->osPrivate)->authstate.srvname = NULL;
-    }
-    if (srvname)
-    {
-	((OsCommPtr)client->osPrivate)->authstate.srvcreds = NULL;
-	((OsCommPtr)client->osPrivate)->authstate.ktname = (pointer)ktname;
-	((OsCommPtr)client->osPrivate)->authstate.srvname = (pointer)srvname;
-    }
-    ((OsCommPtr)client->osPrivate)->authstate.stageno = 1; /* next stage is 1 */
-    return krb5_id;
-}
-
-/*
- * k5_stage1:
- *
- * This gets called out of the dispatcher after K5Check frobs with the
- * client->requestVector.  It accepts the ap_req from the client and verifies
- * it.  In addition, if the client has set AP_OPTS_MUTUAL_REQUIRED, it then
- * sends an ap_rep to the client to achieve mutual authentication.
- *
- * client stage1 packet format is as follows:
- *
- * CARD8	reqType	= 1
- * CARD8	data	= ignored
- * CARD16	length	= total length
- * STRING8	data	= the actual ap_req
- *
- * stage2 packet sent back to client for mutual authentication:
- *
- * CARD8	reqType	= 2
- * CARD8	data	= 2
- * CARD16	length	= total length
- * STRING8	data	= the ap_rep
- */
-int k5_stage1(client)
-    register ClientPtr client;
-{
-    long addrlen;
-    krb5_error_code retval, retval2;
-    register char n;
-    struct sockaddr cli_net_addr;
-    xReq prefix;
-    krb5_principal cprinc;
-    krb5_data buf;
-    krb5_creds *creds = (krb5_creds *)((OsCommPtr)client->osPrivate)->authstate.srvcreds;
-    krb5_keyblock *skey;
-    krb5_address cli_addr, **localaddrs = NULL;
-    krb5_tkt_authent *authdat;
-    krb5_ap_rep_enc_part rep;
-    krb5_int32 ctime, cusec;
-    krb5_rcache rcache = NULL;
-    char *cachename = NULL, *rc_type = NULL, *rc_base = "rcX", *kt = NULL;
-    REQUEST(xReq);
-
-    if (((OsCommPtr)client->osPrivate)->authstate.stageno != 1)
-    {
-	if (creds)
-	    krb5_free_creds(creds);
-	return(SendConnSetup(client, "expected Krb5 stage1 packet"));
-    }
-    addrlen = sizeof (cli_net_addr);
-    if (getpeername(((OsCommPtr)client->osPrivate)->fd,
-		    &cli_net_addr, &addrlen) == -1)
-    {
-	if (creds)
-	    krb5_free_creds(creds);
-	return(SendConnSetup(client, "Krb5 stage1: getpeername failed"));
-    }
-    if (cli_net_addr.sa_family == AF_UNSPEC
-#if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
-	|| cli_net_addr.sa_family == AF_UNIX
-#endif
-	)			/* assume local host */
-    {
-	krb5_os_localaddr(&localaddrs);
-	if (!localaddrs || !localaddrs[0])
-	{
-	    if (creds)
-		krb5_free_creds(creds);
-	    return(SendConnSetup(client, "Krb5 failed to get localaddrs"));
-	}
-	cli_addr.addrtype = localaddrs[0]->addrtype;
-	cli_addr.length = localaddrs[0]->length;
-	cli_addr.contents = localaddrs[0]->contents;
-    }
-    else
-    {
-	cli_addr.addrtype = cli_net_addr.sa_family; /* the values
-						       are compatible */
-	switch (cli_net_addr.sa_family)
-	{
-#ifdef TCPCONN
-	case AF_INET:
-	    cli_addr.length = sizeof (struct in_addr);
-	    cli_addr.contents =
-		(krb5_octet *)&((struct sockaddr_in *)&cli_net_addr)->sin_addr;
-	    break;
-#endif
-#ifdef DNETCONN
-	case AF_DECnet:
-	    cli_addr.length = sizeof (struct dn_naddr);
-	    cli_addr.contents =
-		(krb5_octet *)&((struct sockaddr_dn *)&cli_net_addr)->sdn_add;
-	    break;
-#endif
-	default:
-	    if (localaddrs)
-		krb5_free_addresses(localaddrs);
-	    if (creds)
-		krb5_free_creds(creds);
-	    sprintf(kerror, "Krb5 stage1: unknown address family %d from getpeername",
-		    cli_net_addr.sa_family);    
-	    return(SendConnSetup(client, kerror));
-	}
-    }
-    if ((rcache = (krb5_rcache)malloc(sizeof(*rcache))) == NULL)
-    {
-	if (localaddrs)
-	    krb5_free_addresses(localaddrs);
-	if (creds)
-	    krb5_free_creds(creds);
-	return(SendConnSetup(client, "malloc bombed for krb5_rcache"));
-    }
-    if ((rc_type = krb5_rc_default_type()) == NULL)
-	rc_type = "dfl";
-    if (retval = krb5_rc_resolve_type(&rcache, rc_type))
-    {
-	if (localaddrs)
-	    krb5_free_addresses(localaddrs);
-	if (creds)
-	    krb5_free_creds(creds);
-	free(rcache);
-	strcpy(kerror, "krb5_rc_resolve_type failed: ");
-	strncat(kerror, error_message(retval), 231);
-	return(SendConnSetup(client, kerror));
-    }
-    if ((cachename = (char *)malloc(strlen(rc_base) + strlen(display) + 1))
-	== NULL)
-    {
-	if (localaddrs)
-	    krb5_free_addresses(localaddrs);
-	if (creds)
-	    krb5_free_creds(creds);
-	free(rcache);
-	return(SendConnSetup(client, "Krb5: malloc bombed for cachename"));
-    }
-    strcpy(cachename, rc_base);
-    strcat(cachename, display);
-    if (retval = krb5_rc_resolve(rcache, cachename))
-    {
-	if (localaddrs)
-	    krb5_free_addresses(localaddrs);
-	if (creds)
-	    krb5_free_creds(creds);
-	free(rcache);
-	free(cachename);
-	strcpy(kerror, "krb5_rc_resolve failed: ");
-	strncat(kerror, error_message(retval), 236);
-	return(SendConnSetup(client, kerror));
-    }
-    free(cachename);
-    if (krb5_rc_recover(rcache))
-    {
-	extern krb5_deltat krb5_clockskew;
-	if (retval = krb5_rc_initialize(rcache, krb5_clockskew))
-	{
-	    if (localaddrs)
-		krb5_free_addresses(localaddrs);
-	    if (creds)
-		krb5_free_creds(creds);
-	    if (retval2 = krb5_rc_close(rcache))
-	    {
-		strcpy(kerror, "krb5_rc_close failed: ");
-		strncat(kerror, error_message(retval2), 238);
-		return(SendConnSetup(client, kerror));
-	    }
-	    free(rcache);
-	    strcpy(kerror, "krb5_rc_initialize failed: ");
-	    strncat(kerror, error_message(retval), 233);
-	    return(SendConnSetup(client, kerror));
-	}
-    }
-    buf.length = (stuff->length << 2) - sz_xReq;
-    buf.data = (char *)stuff + sz_xReq;
-    if (creds)
-    {
-	retval = krb5_rd_req(&buf,
-			     NULL, /* don't bother with server name */
-			     &cli_addr,
-			     NULL, /* no fetchfrom */
-			     tgt_keyproc,
-			     creds, /* credentials as arg to
-				       keyproc */
-			     rcache,
-			     &authdat);
-	krb5_free_creds(creds);
-    }
-    else if (kt = (char *)((OsCommPtr)client->osPrivate)->authstate.ktname)
-    {
-	retval = krb5_rd_req(&buf, srvname, &cli_addr, kt, NULL, NULL,
-			     rcache, &authdat);
-	((OsCommPtr)client->osPrivate)->authstate.ktname = NULL;
-    }
-    else
-    {
-	if (localaddrs)
-	    krb5_free_addresses(localaddrs);
-	return(SendConnSetup(client, "Krb5: neither srvcreds nor ktname set"));
-    }
-    if (localaddrs)
-	krb5_free_addresses(localaddrs);
-    if (rcache)
-    {
-	if (retval2 = krb5_rc_close(rcache))
-	{
-	    strcpy(kerror, "krb5_rc_close failed (2): ");
-	    strncat(kerror, error_message(retval2), 230);
-	    return(SendConnSetup(client, kerror));
-	}
-	free(rcache);
-    }
-    if (retval)
-    {
-	strcpy(kerror, "Krb5: Bad application request: ");
-	strncat(kerror, error_message(retval), 224);
-	return(SendConnSetup(client, kerror));
-    }
-    cprinc = authdat->ticket->enc_part2->client;
-    skey = authdat->ticket->enc_part2->session;
-    if (XauKrb5Encode(cprinc, &buf))
-    {
-	krb5_free_tkt_authent(authdat);
-	return(SendConnSetup(client, "XauKrb5Encode bombed"));
-    }
-    /*
-     * Now check to see if the principal we got is one that we want to let in
-     */
-    if (ForEachHostInFamily(FamilyKrb5Principal, k5_cmpenc, (pointer)&buf))
-    {
-	free(buf.data);
-	/*
-	 * The following deals with sending an ap_rep to the client to
-	 * achieve mutual authentication.  The client sends back a stage 3
-	 * packet if all is ok.
-	 */
-	if (authdat->ap_options | AP_OPTS_MUTUAL_REQUIRED)
-	{
-	    /*
-	     * stage 2: send ap_rep to client
-	     */
-	    if (retval = krb5_us_timeofday(&ctime, &cusec))
-	    {
-		krb5_free_tkt_authent(authdat);
-		strcpy(kerror, "error in krb5_us_timeofday: ");
-		strncat(kerror, error_message(retval), 234);
-		return(SendConnSetup(client, kerror));
-	    }
-	    rep.ctime = ctime;
-	    rep.cusec = cusec;
-	    rep.subkey = NULL;
-	    rep.seq_number = 0;
-	    if (retval = krb5_mk_rep(&rep, skey, &buf))
-	    {
-		krb5_free_tkt_authent(authdat);
-		strcpy(kerror, "error in krb5_mk_rep: ");
-		strncat(kerror, error_message(retval), 238);
-		return(SendConnSetup(client, kerror));
-	    }
-	    prefix.reqType = 2;	/* opcode = authenticate */
-	    prefix.data = 2;	/* stage = 2 */
-	    prefix.length = (buf.length + sz_xReq + 3) >> 2;
-	    if (client->swapped)
-	    {
-		swaps(&prefix.length, n);
-	    }
-	    WriteToClient(client, sz_xReq, (char *)&prefix);
-	    WriteToClient(client, buf.length, buf.data);
-	    free(buf.data);
-	    krb5_free_tkt_authent(authdat);
-	    ((OsCommPtr)client->osPrivate)->authstate.stageno = 3; /* expect stage3 packet */
-	    return(Success);
-	}
-	else
-	{
-	    free(buf.data);
-	    krb5_free_tkt_authent(authdat);
-	    return(SendConnSetup(client, NULL)); /* success! */
-	}
-    }
-    else
-    {
-	char *kname;
-	
-	krb5_free_tkt_authent(authdat);
-	free(buf.data);
-	retval = krb5_unparse_name(cprinc, &kname);
-	if (retval == 0)
-	{
-	    sprintf(kerror, "Principal \"%s\" is not authorized to connect",
-		    kname);
-	    if (kname)
-		free(kname);
-	    return(SendConnSetup(client, kerror));
-	}
-	else
-	    return(SendConnSetup(client,"Principal is not authorized to connect to Server"));
-    }
-}
-
-/*
- * k5_stage3:
- *
- * Get the short ack packet from the client.  This packet can conceivably
- * be expanded to allow for switching on end-to-end encryption.
- *
- * stage3 packet format:
- *
- * CARD8	reqType	= 3
- * CARD8	data	= ignored (for now)
- * CARD16	length	= should be zero
- */
-int k5_stage3(client)
-    register ClientPtr client;
-{
-    REQUEST(xReq);
-
-    if (((OsCommPtr)client->osPrivate)->authstate.stageno != 3)
-    {
-	return(SendConnSetup(client, "expected Krb5 stage3 packet"));
-    }
-    else
-	return(SendConnSetup(client, NULL)); /* success! */
-}
-
-k5_bad(client)
-    register ClientPtr client;
-{
-    if (((OsCommPtr)client->osPrivate)->authstate.srvcreds)
-	krb5_free_creds((krb5_creds *)((OsCommPtr)client->osPrivate)->authstate.srvcreds);
-    sprintf(kerror, "unrecognized Krb5 auth packet %d, expecting %d",
-	    ((xReq *)client->requestBuffer)->reqType,
-	    ((OsCommPtr)client->osPrivate)->authstate.stageno);
-    return(SendConnSetup(client, kerror));
-}
-
-/*
- * K5Add:
- *
- * Takes the name of a credentials cache and resolves it.  Also adds the
- * primary principal of the ccache to the acl.
- *
- * Now will also take a service name.
- */
-int K5Add(data_length, data, id)
-    unsigned short data_length;
-    char *data;
-    XID id;
-{
-    krb5_principal princ;
-    krb5_error_code retval;
-    krb5_keytab_entry tmp_entry;
-    krb5_keytab keytab;
-    krb5_kvno kvno = 0;
-    krb5_ccache cc;
-    char *nbuf, *cp;
-    krb5_data kbuf;
-    int i, ktlen;
-    
-    krb5_init_ets();		/* can't think of a better place to put it */
-    krb5_id = ~0L;
-    if (data_length < 3)
-	return 0;
-    if ((nbuf = (char *)malloc(data_length - 2)) == NULL)
-	return 0;
-    memcpy(nbuf, data + 3, data_length - 3);
-    nbuf[data_length - 3] = '\0';
-    if (ccname)
-    {
-	free(ccname);
-	ccname = NULL;
-    }
-    if (srvname)
-    {
-	krb5_free_principal(srvname);
-	srvname = NULL;
-    }
-    if (ktname)
-    {
-	free(ktname);
-	ktname = NULL;
-    }
-    if (!strncmp(data, "UU:", 3))
-    {
-	if (retval = krb5_cc_resolve(nbuf, &cc))
-	{
-	    ErrorF("K5Add: krb5_cc_resolve of \"%s\" failed: %s\n",
-		   nbuf, error_message(retval));
-	    free(nbuf);
-	    return 0;
-	}
-	if (cc && !(retval = krb5_cc_get_principal(cc, &princ)))
-	{
-	    if (XauKrb5Encode(princ, &kbuf))
-	    {
-		free(nbuf);
-		krb5_free_principal(princ);
-		krb5_cc_close(cc);
-		return 0;
-	    }
-	    if (krb5_cc_close(cc))
-		return 0;
-	    AddHost(NULL, FamilyKrb5Principal, kbuf.length, kbuf.data);
-	    krb5_free_principal(princ);
-	    free(kbuf.data);
-	    ccname = nbuf;
-	    krb5_id = id;
-	    return 1;
-	}
-	else
-	{
-	    ErrorF("K5Add: getting principal from cache \"%s\" failed: %s\n",
-		   nbuf, error_message(retval));
-	}
-    }
-    else if (!strncmp(data, "CS:", 3))
-    {
-	if ((cp = strchr(nbuf, ',')) == NULL)
-	{
-	    free(nbuf);
-	    return 0;
-	}
-	*cp = '\0';		/* gross but it works :-) */
-	ktlen = strlen(cp + 1);
-	if ((ktname = (char *)malloc(ktlen + 1)) == NULL)
-	{
-	    free(nbuf);
-	    return 0;
-	}
-	strcpy(ktname, cp + 1);
-	retval = krb5_sname_to_principal(NULL, /* NULL for hostname uses
-						  local host name*/
-					 nbuf, KRB5_NT_SRV_HST,
-					 &srvname);
-	free(nbuf);
-	if (retval)
-	{
-	    free(ktname);
-	    ktname = NULL;
-	    return 0;
-	}
-	if (retval = krb5_kt_resolve(ktname, &keytab))
-	{
-	    free(ktname);
-	    ktname = NULL;
-	    krb5_free_principal(srvname);
-	    srvname = NULL;
-	    return 0;
-	}
-	retval = krb5_kt_get_entry(keytab, srvname, kvno, &tmp_entry);
-	krb5_kt_free_entry(&tmp_entry);
-	if (retval)
-	{
-	    free(ktname);
-	    ktname = NULL;
-	    krb5_free_principal(srvname);
-	    srvname = NULL;
-	    return 0;
-	}
-	if (XauKrb5Encode(srvname, &kbuf))
-	{
-	    free(ktname);
-	    ktname = NULL;
-	    krb5_free_principal(srvname);
-	    srvname = NULL;
-	    return 0;
-	}
-	AddHost(NULL, FamilyKrb5Principal, kbuf.length, kbuf.data);
-	krb5_id = id;
-	return 1;
-    }
-    else
-    {
-	ErrorF("K5Add: credentials cache name \"%.*s\" in auth file: unknown type\n",
-	       data_length, data);
-    }
-    return 0;
-}
-
-/*
- * K5Reset:
- *
- * Reset krb5_id, also nuke the current principal from the acl.
- */
-int K5Reset()
-{
-    krb5_principal princ;
-    krb5_error_code retval;
-    krb5_ccache cc;
-    krb5_data kbuf;
-    int i;
-    
-    if (ccname)
-    {
-	if (retval = krb5_cc_resolve(ccname, &cc))
-	{
-	    free(ccname);
-	    ccname = NULL;
-	}
-	if (cc && !(retval = krb5_cc_get_principal(cc, &princ)))
-	{
-	    if (XauKrb5Encode(princ, &kbuf))
-		return 1;
-	    RemoveHost(NULL, FamilyKrb5Principal, kbuf.length, kbuf.data);
-	    krb5_free_principal(princ);
-	    free(kbuf.data);
-	    if (krb5_cc_close(cc))
-		return 1;
-	    free(ccname);
-	    ccname = NULL;
-	}
-    }
-    if (srvname)
-    {
-	if (XauKrb5Encode(srvname, &kbuf))
-	    return 1;
-	RemoveHost(NULL, FamilyKrb5Principal, kbuf.length, kbuf.data);
-	krb5_free_principal(srvname);
-	free(kbuf.data);
-	srvname = NULL;
-    }
-    if (ktname)
-    {
-	free(ktname);
-	ktname = NULL;
-    }
-    krb5_id = ~0L;
-    return 0;
-}
-
-XID K5ToID(data_length, data)
-    unsigned short data_length;
-    char *data;
-{
-    return krb5_id;
-}
-
-int K5FromID(id, data_lenp, datap)
-    XID id;
-    unsigned short *data_lenp;
-    char **datap;
-{
-    return 0;
-}
-
-int K5Remove(data_length, data)
-    unsigned short data_length;
-    char *data;
-{
-    return 0;
-}
diff --git a/os/osdep.h b/os/osdep.h
index 0984d51..04e88ea 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -145,16 +145,6 @@ typedef struct _connectionOutput {
     int count;
 } ConnectionOutput, *ConnectionOutputPtr;
 
-#ifdef K5AUTH
-typedef struct _k5_state {
-    int		stageno;	/* current stage of auth protocol */
-    pointer	srvcreds;	/* server credentials */
-    pointer	srvname;	/* server principal name */
-    pointer	ktname;		/* key table: principal-key pairs */
-    pointer	skey;		/* session key */
-}           k5_state;
-#endif
-
 struct _osComm;
 
 #define AuthInitArgs void
@@ -190,9 +180,6 @@ typedef struct _osComm {
     ConnectionInputPtr input;
     ConnectionOutputPtr output;
     XID	auth_id;		/* authorization id */
-#ifdef K5AUTH
-    k5_state	authstate;	/* state of setup auth conversation */
-#endif
     CARD32 conn_time;		/* timestamp if not established, else 0  */
     struct _XtransConnInfo *trans_conn; /* transport connection object */
 } OsCommRec, *OsCommPtr;
@@ -273,16 +260,6 @@ extern int  SecureRPCRemove   (AuthRemCA
 extern int  SecureRPCReset    (AuthRstCArgs);
 #endif
 
-/* in k5auth.c */
-#ifdef K5AUTH
-extern XID  K5Check           (AuthCheckArgs);
-extern XID  K5ToID            (AuthToIDArgs);
-extern int  K5Add             (AuthAddCArgs);
-extern int  K5FromID          (AuthFromIDArgs);
-extern int  K5Remove          (AuthRemCArgs);
-extern int  K5Reset           (AuthRstCArgs);
-#endif
-
 /* in secauth.c */
 extern XID AuthSecurityCheck (AuthCheckArgs);
 
diff-tree 75dece08fb72803d5116e6776e9f1534ff20e37b (from fbb9b203950e9d0e82574cde5b3e006b0e6b404f)
Author: Zephaniah E. Hull <warp at agamemnon.b5>
Date:   Mon Jun 4 09:09:20 2007 -0400

    xf86PostMotionEvents[P] calls xf86SendDragEvents, xf86SendDragEvents
    unconditionally checks device->button->buttonsDown.
    
    Let's make it possible to have a device with motion, but no buttons.
    
    Without segfaulting.

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 207e792..5430020 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -101,7 +101,7 @@ xf86SendDragEvents(DeviceIntPtr	device)
 {
     LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
     
-    if (device->button->buttonsDown > 0)
+    if (device->button && device->button->buttonsDown > 0)
         return (local->flags & XI86_SEND_DRAG_EVENTS);
     else
         return (TRUE);
diff-tree fbb9b203950e9d0e82574cde5b3e006b0e6b404f (from 3f4295e643ca56c40f33af7966e8efd367ef8749)
Author: Zephaniah E. Hull <warp at agamemnon.b5>
Date:   Mon Jun 4 06:59:42 2007 -0400

    Let's not do a calloc and a free on every call to xf86PostMotionEvents.

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 91e5fec..207e792 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -463,9 +463,18 @@ xf86PostMotionEvent(DeviceIntPtr	device,
 {
     va_list var;
     int i = 0;
-    int *valuators = NULL;
-    
-    valuators = xcalloc(sizeof(int), num_valuators);
+    static int *valuators = NULL;
+    static int n_valuators = 0;
+
+    if (num_valuators > n_valuators) {
+	xfree (valuators);
+	valuators = NULL;
+    }
+
+    if (!valuators) {
+	valuators = xcalloc(sizeof(int), num_valuators);
+	n_valuators = num_valuators;
+    }
 
     va_start(var, num_valuators);
     for (i = 0; i < num_valuators; i++)
@@ -473,7 +482,6 @@ xf86PostMotionEvent(DeviceIntPtr	device,
     va_end(var);
 
     xf86PostMotionEventP(device, is_absolute, first_valuator, num_valuators, valuators);
-    xfree(valuators);
 }
 
 _X_EXPORT void
diff-tree 3f4295e643ca56c40f33af7966e8efd367ef8749 (from a4f3473c88370b8411e016ebab619cffd33e58f9)
Author: Zephaniah E. Hull <warp at agamemnon.b5>
Date:   Mon Jun 4 06:48:06 2007 -0400

    Add xf86PostMotionEventP, takes a pointer instead of a variable number of
    arguments.
    
    Bump input ABI to 1.1 since we export this.

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 8e644c4..cdf3d1b 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -85,7 +85,7 @@ typedef enum {
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 3)
 #define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(2, 0)
-#define ABI_XINPUT_VERSION	SET_ABI_VERSION(1, 0)
+#define ABI_XINPUT_VERSION	SET_ABI_VERSION(1, 1)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(0, 3)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 5)
 
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 7a47276..91e5fec 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -462,25 +462,38 @@ xf86PostMotionEvent(DeviceIntPtr	device,
                     ...)
 {
     va_list var;
+    int i = 0;
+    int *valuators = NULL;
+    
+    valuators = xcalloc(sizeof(int), num_valuators);
+
+    va_start(var, num_valuators);
+    for (i = 0; i < num_valuators; i++)
+        valuators[i] = va_arg(var, int);
+    va_end(var);
+
+    xf86PostMotionEventP(device, is_absolute, first_valuator, num_valuators, valuators);
+    xfree(valuators);
+}
+
+_X_EXPORT void
+xf86PostMotionEventP(DeviceIntPtr	device,
+                    int			is_absolute,
+                    int			first_valuator,
+                    int			num_valuators,
+                    int			*valuators)
+{
     int i = 0, nevents = 0;
     int dx, dy;
     Bool drag = xf86SendDragEvents(device);
-    int *valuators = NULL;
-    int flags = 0;
     xEvent *xE = NULL;
     int index;
+    int flags = 0;
 
     if (is_absolute)
         flags = POINTER_ABSOLUTE;
     else
         flags = POINTER_RELATIVE | POINTER_ACCELERATE;
-    
-    valuators = xcalloc(sizeof(int), num_valuators);
-
-    va_start(var, num_valuators);
-    for (i = 0; i < num_valuators; i++)
-        valuators[i] = va_arg(var, int);
-    va_end(var);
 
 #if XFreeXDGA
     if (first_valuator == 0 && num_valuators >= 2) {
@@ -495,7 +508,7 @@ xf86PostMotionEvent(DeviceIntPtr	device,
                 dy = valuators[1];
             }
             if (DGAStealMotionEvent(index, dx, dy))
-                goto out;
+                return;
         }
     }
 #endif
@@ -517,9 +530,6 @@ xf86PostMotionEvent(DeviceIntPtr	device,
             mieqEnqueue(device, xf86Events + i);
         }
     }
-
-out:
-    xfree(valuators);
 }
 
 _X_EXPORT void
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 7ef28ed..f882b26 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -163,6 +163,8 @@ extern InputInfoPtr xf86InputDevs;
 void InitExtInput(void);
 void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
 			 int first_valuator, int num_valuators, ...);
+void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
+			 int first_valuator, int num_valuators, int *valuators);
 void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
 			    int first_valuator, int num_valuators, ...);
 void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
diff-tree a4f3473c88370b8411e016ebab619cffd33e58f9 (from 0cbc3a4da2ddb6e4f30f60d2bc7f405d31aa554a)
Author: Zephaniah E. Hull <warp at agamemnon.b5>
Date:   Mon Jun 4 06:39:02 2007 -0400

    Fully init the AbsoluteClassRec in InitAbsoluteClassDeviceStruct.
    (Specificly, we were missing the screen field.)

diff --git a/dix/devices.c b/dix/devices.c
index da6e590..6c69454 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -901,6 +901,7 @@ InitAbsoluteClassDeviceStruct(DeviceIntP
     abs->width = -1;
     abs->height = -1;
     abs->following = 0;
+    abs->screen = 0;
 
     dev->absolute = abs;
 
diff-tree 0cbc3a4da2ddb6e4f30f60d2bc7f405d31aa554a (from 9a7aaeb3f6ff79af60fde91cd0575a54ba0b9587)
Author: Zephaniah E. Hull <warp at agamemnon.b5>
Date:   Mon Jun 4 02:03:44 2007 -0400

    Print the build time as well as the date if we can.

diff --git a/configure.ac b/configure.ac
index 350245e..1f94556 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1948,6 +1948,8 @@ AM_CONDITIONAL(SUN_KBD_MODE, [test x$KBD
 
 BUILD_DATE="$(date +'%Y%m%d')"
 AC_SUBST([BUILD_DATE])
+BUILD_TIME="$(date +'%H%M%S')"
+AC_SUBST([BUILD_TIME])
 
 DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
 
diff --git a/hw/xfree86/common/xf86Build.h.in b/hw/xfree86/common/xf86Build.h.in
index 3f25413..a4f56b0 100644
--- a/hw/xfree86/common/xf86Build.h.in
+++ b/hw/xfree86/common/xf86Build.h.in
@@ -1 +1,2 @@
 #define BUILD_DATE @BUILD_DATE@
+#define BUILD_TIME @BUILD_TIME@
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 221ab9a..8423fca 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1730,8 +1730,16 @@ xf86PrintBanner()
     t.tm_mday = BUILD_DATE % 100;
     t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
     t.tm_year = BUILD_DATE / 10000 - 1900;
+#if defined(BUILD_TIME)
+    t.tm_sec = BUILD_TIME % 100;
+    t.tm_min = (BUILD_TIME / 100) % 100;
+    t.tm_hour = (BUILD_TIME / 10000);
+    if (strftime(buf, sizeof(buf), "%d %B %Y  %I:%M:%s%p", &t))
+       ErrorF("Build Date: %s\n", buf);
+#else
     if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
        ErrorF("Build Date: %s\n", buf);
+#endif
   }
 #endif
 #if defined(CLOG_DATE) && (CLOG_DATE > 19000000)
diff-tree 9a7aaeb3f6ff79af60fde91cd0575a54ba0b9587 (from 94361cbba7f866144691f6f5e9251a550e0e0cb8)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon May 28 13:54:16 2007 +0300

    XFree86: Input: Assume core events per default
    
    Assume that a device will be sending core events, unless explicitly
    specified otherwise.

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 5eede08..7a47276 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -119,10 +119,12 @@ _X_EXPORT void
 xf86ProcessCommonOptions(LocalDevicePtr local,
                          pointer	list)
 {
-    if (!xf86SetBoolOption(list, "AlwaysCore", 0) ||
-        xf86SetBoolOption(list, "SendCoreEvents", 0) ||
-        xf86SetBoolOption(list, "CorePointer", 0) ||
-        xf86SetBoolOption(list, "CoreKeyboard", 0)) {
+    if (xf86SetBoolOption(list, "AlwaysCore", 0) ||
+        !xf86SetBoolOption(list, "SendCoreEvents", 1) ||
+        !xf86SetBoolOption(list, "CorePointer", 1) ||
+        !xf86SetBoolOption(list, "CoreKeyboard", 1)) {
+        xf86Msg(X_CONFIG, "%s: doesn't report core events\n", local->name);
+    } else {
         local->flags |= XI86_ALWAYS_CORE;
         xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
     }
diff-tree 94361cbba7f866144691f6f5e9251a550e0e0cb8 (from e5ce982381c4092252d6b55fcefcc9a3cd21e656)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon May 28 13:54:47 2007 +0300

    XFree86: Input: Perform case-insensitive comparisons on option names

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 2d0a376..5eede08 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -329,7 +329,7 @@ NewInputDeviceRequest (InputOption *opti
         return BadAlloc;
 
     for (option = options; option; option = option->next) {
-        if (strcmp(option->key, "driver") == 0) {
+        if (strcasecmp(option->key, "driver") == 0) {
             if (idev->driver) {
                 rval = BadRequest;
                 goto unwind;
@@ -352,8 +352,8 @@ NewInputDeviceRequest (InputOption *opti
                 goto unwind;
             }
         }
-        if (strcmp(option->key, "name") == 0 ||
-            strcmp(option->key, "identifier") == 0) {
+        if (strcasecmp(option->key, "name") == 0 ||
+            strcasecmp(option->key, "identifier") == 0) {
             if (idev->identifier) {
                 rval = BadRequest;
                 goto unwind;
diff-tree e5ce982381c4092252d6b55fcefcc9a3cd21e656 (from 90eb22656c34d2d08a8dccaf05e6d081c56bd7f3)
Author: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Date:   Sun Jun 3 09:40:37 2007 +1000

    Include pixman.h from fb.h or compile of some files will fail
    
    Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>

diff --git a/fb/fb.h b/fb/fb.h
index 7d94886..655d5ae 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -26,6 +26,8 @@
 #define _FB_H_
 
 #include <X11/X.h>
+#include <pixman/pixman.h>
+
 #include "scrnintstr.h"
 #include "pixmap.h"
 #include "pixmapstr.h"
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 00dde61..68c0e63 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -30,7 +30,6 @@
 #include <string.h>
 
 #include "fb.h"
-#include <pixman/pixman.h>
 
 #ifdef RENDER
 
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 07b4fbb..8313068 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -30,8 +30,6 @@
 
 #ifdef RENDER
 
-#include <pixman/pixman.h>
-
 #include "picturestr.h"
 #include "mipict.h"
 #include "renderedge.h"
diff-tree 90eb22656c34d2d08a8dccaf05e6d081c56bd7f3 (from f6a983533bdc84752562ef0be25b320678bf08a1)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Sat Jun 2 16:49:26 2007 -0400

    Minor cleanup/robustification to config parsing.

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 877ea62..8e58bef 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -131,9 +131,9 @@ static Bool configInput(IDevPtr inputp, 
 static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
 static Bool addDefaultModes(MonPtr monitorp);
 #ifdef XF86DRI
-static Bool configDRI(XF86ConfDRIPtr drip);
+static void configDRI(XF86ConfDRIPtr drip);
 #endif
-static Bool configExtensions(XF86ConfExtensionsPtr conf_ext);
+static void configExtensions(XF86ConfExtensionsPtr conf_ext);
 
 /*
  * xf86GetPathElem --
@@ -598,7 +598,7 @@ xf86ConfigError(char *msg, ...)
     return;
 }
 
-static Bool
+static void
 configFiles(XF86ConfFilesPtr fileconf)
 {
   MessageType pathFrom = X_DEFAULT;
@@ -2228,7 +2228,7 @@ configDevice(GDevPtr devicep, XF86ConfDe
 }
 
 #ifdef XF86DRI
-static Bool
+static void
 configDRI(XF86ConfDRIPtr drip)
 {
     int                count = 0;
@@ -2269,12 +2269,10 @@ configDRI(XF86ConfDRIPtr drip)
 	    xf86ConfigDRI.bufs[i].flags = 0;
 	}
     }
-
-    return TRUE;
 }
 #endif
 
-static Bool
+static void
 configExtensions(XF86ConfExtensionsPtr conf_ext)
 {
     XF86OptionPtr o;
@@ -2309,11 +2307,9 @@ configExtensions(XF86ConfExtensionsPtr c
 		       xf86NameCmp(val, "false") == 0) {
 		enable = !enable;
 	    } else {
-		xf86Msg(X_ERROR,
-			"%s is not a valid value for the Extension option\n",
-			val);
+		xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val);
 		xfree(n);
-		return FALSE;
+		continue;
 	    }
 
 	    if (EnableDisableExtension(name, enable)) {
@@ -2326,8 +2322,6 @@ configExtensions(XF86ConfExtensionsPtr c
 	    xfree(n);
 	}
     }
-
-    return TRUE;
 }
 
 static Bool
@@ -2510,19 +2504,17 @@ xf86HandleConfigFile(Bool autoconfig)
     }
 
     /* Now process everything else */
-
-    if (!configServerFlags(xf86configptr->conf_flags,
-			   xf86ConfigLayout.options) ||
-         !configFiles(xf86configptr->conf_files) ||
-	!configExtensions(xf86configptr->conf_extensions)
-#ifdef XF86DRI
-	|| !configDRI(xf86configptr->conf_dri)
-#endif
-       ) {
+    if (!configServerFlags(xf86configptr->conf_flags,xf86ConfigLayout.options)){
              ErrorF ("Problem when converting the config data structures\n");
              return CONFIG_PARSE_ERROR;
     }
 
+    configFiles(xf86configptr->conf_files);
+    configExtensions(xf86configptr->conf_extensions);
+#ifdef XF86DRI
+    configDRI(xf86configptr->conf_dri);
+#endif
+
     checkInput(&xf86ConfigLayout);
 
     /*
diff-tree f6a983533bdc84752562ef0be25b320678bf08a1 (from 21e8f4eb02842f877336db08c332d8ee4a381ee0)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Sat Jun 2 16:37:39 2007 -0400

    Don't warn about default behaviour when autoconfigging.

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 67e8af4..877ea62 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -615,7 +615,7 @@ configFiles(XF86ConfFilesPtr fileconf)
       pathFrom = X_CONFIG;
       if (*f) {
         if (xf86Info.useDefaultFontPath) {
-          xf86Msg(X_WARNING, "Including the default font path %s.\n", defaultFontPath);
+          xf86Msg(X_DEFAULT, "Including the default font path %s.\n", defaultFontPath);
           char *g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
           strcpy(g, f);
           strcat(g, ",");
@@ -632,7 +632,7 @@ configFiles(XF86ConfFilesPtr fileconf)
       }
     } 
    } else {
-      xf86Msg(X_WARNING,
+      xf86Msg(X_DEFAULT,
 	    "No FontPath specified.  Using compiled-in default.\n");
       pathFrom = X_DEFAULT;
    }
@@ -1474,13 +1474,13 @@ checkCoreInputDevices(serverLayoutPtr se
     }
 
     if (pointerMsg) {
-	xf86Msg(X_WARNING, "The core pointer device wasn't specified "
+	xf86Msg(X_DEFAULT, "The core pointer device wasn't specified "
 		"explicitly in the layout.\n"
 		"\tUsing the %s.\n", pointerMsg);
     }
 
     if (keyboardMsg) {
-	xf86Msg(X_WARNING, "The core keyboard device wasn't specified "
+	xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified "
 		"explicitly in the layout.\n"
 		"\tUsing the %s.\n", keyboardMsg);
     }
@@ -1937,7 +1937,7 @@ configScreen(confScreenPtr screenp, XF86
     }
 
     if (defaultMonitor) {
-	xf86Msg(X_WARNING, "No monitor specified for screen \"%s\".\n"
+	xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n"
 		"\tUsing a default monitor configuration.\n", screenp->id);
     }
     return TRUE;
@@ -2457,7 +2457,7 @@ xf86HandleConfigFile(Bool autoconfig)
 
     if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
 	if (xf86ScreenName == NULL) {
-	    xf86Msg(X_WARNING,
+	    xf86Msg(X_DEFAULT,
 		    "No Layout section.  Using the first Screen section.\n");
 	}
 	if (!configImpliedLayout(&xf86ConfigLayout,
diff-tree 21e8f4eb02842f877336db08c332d8ee4a381ee0 (from 0e1384d8318637f75d04d3d1b7600f7cad40117e)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Sat Jun 2 16:13:01 2007 -0400

    Don't print lack of DRI support as an error in AIGLX init.

diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index d93d460..156e846 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -1001,13 +1001,10 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     size_t buffer_size;
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
 
-    if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable")) {
-	LogMessage(X_ERROR, "AIGLX: DRI module not loaded\n");
-	return NULL;
-    }
-
-    if (!DRIQueryDirectRenderingCapable(pScreen, &isCapable) || !isCapable) {
-	LogMessage(X_ERROR,
+    if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
+	!DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
+	!isCapable) {
+	LogMessage(X_INFO,
 		   "AIGLX: Screen %d is not DRI capable\n", pScreen->myNum);
 	return NULL;
     }
diff-tree 0e1384d8318637f75d04d3d1b7600f7cad40117e (from 66702f3c1c6c884e83744c72da173cc32f22b2f4)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Sat Jun 2 16:07:20 2007 -0400

    Delete VDIF support; it was never used anyway.

diff --git a/hw/xfree86/ddc/Makefile.am b/hw/xfree86/ddc/Makefile.am
index 04d3e44..cd146c5 100644
--- a/hw/xfree86/ddc/Makefile.am
+++ b/hw/xfree86/ddc/Makefile.am
@@ -1,9 +1,9 @@
-sdk_HEADERS = edid.h vdif.h xf86DDC.h
+sdk_HEADERS = edid.h xf86DDC.h
 
 noinst_LIBRARIES = libddc.a
 
 libddc_a_SOURCES = xf86DDC.c edid.c interpret_edid.c print_edid.c \
-                   interpret_vdif.c print_vdif.c ddcProperty.c
+                   ddcProperty.c
 
 INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
 
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index 37efb5b..6ff0726 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -35,7 +35,6 @@
 
 #define EDID1_ATOM_NAME         "XFree86_DDC_EDID1_RAWDATA"
 #define EDID2_ATOM_NAME         "XFree86_DDC_EDID2_RAWDATA"
-#define VDIF_ATOM_NAME          "XFree86_DDC_VDIF_RAWDATA"
 
 static void
 addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
@@ -103,16 +102,6 @@ addRootWindowProperties(ScrnInfoPtr pScr
 	xf86RegisterRootWindowProperty(scrnIndex, EDID2Atom, XA_INTEGER, 8,
 		256, (unsigned char *)EDID2rawdata);
     }
-
-#if 0
-    if (DDC->vdif) {
-#define VDIF_DUMMY_STRING "setting dummy VDIF property - please insert correct values\n"
-
-	VDIFAtom = MakeAtom(VDIF_ATOM_NAME, sizeof(VDIF_ATOM_NAME), TRUE);
-	xf86RegisterRootWindowProperty(scrnIndex, VDIFAtom, XA_STRING, 8,
-		strlen(VDIF_DUMMY_STRING), VDIF_DUMMY_STRING);
-    }
-#endif
 }
 
 Bool
diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index 30499a6..0b6a15a 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -12,8 +12,6 @@
 #ifndef _EDID_H_
 #define _EDID_H_ 
 
-#include "vdif.h"
-
 /* read complete EDID record */
 #define EDID1_LEN 128
 #define BITS_PER_BYTE 9
@@ -453,7 +451,7 @@ typedef struct {
   struct established_timings timings1;
   struct std_timings timings2[8];
   struct detailed_monitor_section det_mon[4];
-  xf86vdifPtr vdif;
+  void *vdif; /* unused */
   int no_sections;
   Uchar *rawData;
 } xf86Monitor, *xf86MonPtr;
diff --git a/hw/xfree86/ddc/interpret_vdif.c b/hw/xfree86/ddc/interpret_vdif.c
deleted file mode 100644
index 3a17e2f..0000000
--- a/hw/xfree86/ddc/interpret_vdif.c
+++ /dev/null
@@ -1,132 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/Xarch.h>
-#include "xf86DDC.h"
-#include "vdif.h"
-
-static xf86VdifLimitsPtr* get_limits(CARD8 *c);
-static xf86VdifGammaPtr* get_gamma(CARD8 *c);
-static xf86VdifTimingPtr* get_timings(CARD8 *c);
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-static CARD32 swap_byte_order(CARD32 c);
-#endif
-
-xf86vdifPtr
-xf86InterpretVdif(CARD8 *c)
-{
-    xf86VdifPtr p = (xf86VdifPtr)c;
-    xf86vdifPtr vdif;
-    int i;
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-    int length;
-#endif
-    unsigned long l = 0;
-
-    if (c == NULL) return NULL;
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-    length = swap_byte_order(p->FileLength);
-    for (i = 0; i < (length >>2); i++) 
-	((CARD32*)c)[i] = swap_byte_order(((CARD32*)c)[i]) ;
-#endif  
-    if (p->VDIFId[0] != 'V' || p->VDIFId[1] != 'D' || p->VDIFId[2] != 'I'
-	|| p->VDIFId[3] != 'F') return NULL;
-    for ( i = 12; i < p->FileLength; i++) 
-	l += c[i];
-    if ( l != p->Checksum) return NULL;
-    vdif = xalloc(sizeof(xf86vdif));  
-    vdif->vdif = p;
-    vdif->limits = get_limits(c);
-    vdif->timings = get_timings(c);
-    vdif->gamma = get_gamma(c);
-    vdif->strings = VDIF_STRING(((xf86VdifPtr)c),0);
-    xfree(c);
-    return vdif;
-}
-
-static xf86VdifLimitsPtr*
-get_limits(CARD8 *c)
-{ 
-    int num, i, j;
-    xf86VdifLimitsPtr *pp;
-    xf86VdifLimitsPtr p;
-
-    num = ((xf86VdifPtr)c)->NumberOperationalLimits;
-    pp = xalloc(sizeof(xf86VdifLimitsPtr) * (num+1));
-    p = VDIF_OPERATIONAL_LIMITS(((xf86VdifPtr)c));
-    j = 0;
-    for ( i = 0; i<num; i++) {
-	if (p->Header.ScnTag == VDIF_OPERATIONAL_LIMITS_TAG)
-	    pp[j++] = p;
-	VDIF_NEXT_OPERATIONAL_LIMITS(p);
-    }
-    pp[j] = NULL;
-    return pp;
-}
-
-static xf86VdifGammaPtr*
-get_gamma(CARD8 *c)
-{ 
-    int num, i, j;
-    xf86VdifGammaPtr *pp;
-    xf86VdifGammaPtr p;
-
-    num = ((xf86VdifPtr)c)->NumberOptions;
-    pp = xalloc(sizeof(xf86VdifGammaPtr) * (num+1));
-    p = (xf86VdifGammaPtr)VDIF_OPTIONS(((xf86VdifPtr)c));
-    j = 0;
-    for ( i = 0; i<num; i++)
-    {
-	if (p->Header.ScnTag == VDIF_GAMMA_TABLE_TAG)
-	    pp[j++] = p;
-	VDIF_NEXT_OPTIONS(p);
-    }
-    pp[j] = NULL;
-    return pp;
-}
-
-static xf86VdifTimingPtr*
-get_timings(CARD8 *c)
-{
-    int num, num_limits;
-    int i,j,k;
-    xf86VdifLimitsPtr lp;
-    xf86VdifTimingPtr *pp;
-    xf86VdifTimingPtr p;
-  
-    num = ((xf86VdifPtr)c)->NumberOperationalLimits;
-    lp = VDIF_OPERATIONAL_LIMITS(((xf86VdifPtr)c));
-    num_limits = 0;
-    for (i = 0; i < num; i++) {
-	if (lp->Header.ScnTag == VDIF_OPERATIONAL_LIMITS_TAG)
-	    num_limits += lp->NumberPreadjustedTimings;
-	VDIF_NEXT_OPERATIONAL_LIMITS(lp);
-    }
-    pp = xalloc(sizeof(xf86VdifTimingPtr) 
-				      * (num_limits+1));
-    j = 0;
-    lp = VDIF_OPERATIONAL_LIMITS(((xf86VdifPtr) c));
-    for (i = 0; i < num; i++) {
-	p = VDIF_PREADJUSTED_TIMING(lp);
-	for (k = 0; k < lp->NumberPreadjustedTimings; k++) {
-	    if (p->Header.ScnTag == VDIF_PREADJUSTED_TIMING_TAG)
-		pp[j++] = p;
-	    VDIF_NEXT_PREADJUSTED_TIMING(p);
-	}
-	VDIF_NEXT_OPERATIONAL_LIMITS(lp);
-    }
-    pp[j] = NULL;
-    return pp;
-}
-
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-static CARD32
-swap_byte_order(CARD32 c)
-{
-    return ((c & 0xFF000000) >> 24) | ((c & 0xFF0000) >> 8)
-	| ((c & 0xFF00) << 8) | ((c & 0xFF) << 24);
-}
-
-#endif
diff --git a/hw/xfree86/ddc/print_vdif.c b/hw/xfree86/ddc/print_vdif.c
deleted file mode 100644
index 13cd3ab..0000000
--- a/hw/xfree86/ddc/print_vdif.c
+++ /dev/null
@@ -1,225 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "vdif.h"
-#include "misc.h"
-#include "xf86DDC.h"
-
-static void print_vdif(xf86VdifPtr l, char *s);
-static void print_timings(xf86VdifTimingPtr *pt);
-static void print_limits(xf86VdifLimitsPtr *pl);
-static void print_gamma(xf86VdifGammaPtr *pg);
-static void print_type(CARD8 c);
-static void print_polarity(CARD8 c);
-
-void
-xf86print_vdif(xf86vdifPtr v)
-{
-    print_vdif(v->vdif,v->strings);
-    print_limits(v->limits);
-    print_timings(v->timings);
-    print_gamma(v->gamma);
-}
-
-static void
-print_vdif(xf86VdifPtr l, char *s)
-{
-    ErrorF("Version %i.%i",l->VDIFVersion,l->VDIFRevision);
-    ErrorF(" Date: %i/%i/%i, Manufactured: %i/%i/%i\n",l->Date[0],
-	   l->Date[1],l->Date[2],l->DateManufactured[0],
-	   l->DateManufactured[1],l->DateManufactured[2]);
-    ErrorF("File Revision: %i",l->FileRevision);
-    ErrorF("Manufacturer: %s\n",s + l->Manufacturer);
-    ErrorF("ModelNumber: %s\n",s + l->ModelNumber);
-    ErrorF("VDIFIndex: %s\n",s +l->MinVDIFIndex);
-    ErrorF("Version: %s\n",s + l->Version);
-    ErrorF("SerialNumber %s\n",s + l->SerialNumber);
-    ErrorF("MonitorType: ");
-    switch (l->MonitorType) {
-    case VDIF_MONITOR_MONOCHROME:
-	ErrorF("Mono\n");
-	break;
-    case VDIF_MONITOR_COLOR:
-	ErrorF("Color\n");
-	break;
-    }
-    ErrorF("CRT Size: %i inches\n",l->CRTSize);
-    switch (l->MonitorType) {
-    case VDIF_MONITOR_MONOCHROME:
-	ErrorF("Border:  %i percent\n",
-	       l->BorderRed);
-	ErrorF("Phosphor Decay: 1: %i,",l->RedPhosphorDecay);
-	if (l->GreenPhosphorDecay !=0)
-	    ErrorF(" 2: %i,",l->GreenPhosphorDecay);
-	if (l->BluePhosphorDecay !=0)
-	    ErrorF(" 3: %i",l->BluePhosphorDecay);
-	ErrorF(" ms\n");
-	if (l->RedChromaticity_x)
-	    ErrorF("Chromaticity: 1: x:%f, y:%f;  ",
-		   l->RedChromaticity_x/1000.0,l->RedChromaticity_y/1000.0);
-	if (l->GreenChromaticity_x)
-	    ErrorF("Chromaticity: 2: x:%f, y:%f;  ",
-		   l->GreenChromaticity_x/1000.0,l->GreenChromaticity_y/1000.0);
-	if (l->BlueChromaticity_x)
-	    ErrorF("Chromaticity: 3: x:%f, y:%f  ",
-		   l->BlueChromaticity_x/1000.0,l->BlueChromaticity_y/1000.0);
-	ErrorF("\n");
-	ErrorF("Gamma: %f\n",l->RedGamma/1000.0);
-	break;
-    case VDIF_MONITOR_COLOR:
-	ErrorF("Border: Red: %i Green: %i Blue: %i percent\n",
-	       l->BorderRed,l->BorderGreen,l->BorderBlue);
-	ErrorF("Phosphor Decay: Red: %i, Green: %i, Blue: %i ms\n",
-	       l->RedPhosphorDecay,l->GreenPhosphorDecay,l->BluePhosphorDecay);
-	ErrorF("Chromaticity: Red: x:%f, y:%f;  Green: x:%f, y:%f;  "
-	       "Blue: x:%f, y:%f\n",
-	       l->RedChromaticity_x/1000.0,l->RedChromaticity_y/1000.0,
-	       l->GreenChromaticity_x/1000.0,l->GreenChromaticity_y/1000.0,
-	       l->BlueChromaticity_x/1000.0,l->BlueChromaticity_y/1000.0);
-	ErrorF("Gamma: Red:%f, Green:%f, Blue:%f\n",l->RedGamma/1000.0,
-	       l->GreenGamma/1000.0,l->BlueGamma/1000.0);
-	break;
-    }
-    ErrorF("White Point: x: %f y: %f Y: %f\n",l->WhitePoint_x/1000.0,
-	   l->WhitePoint_y/1000.0,l->WhitePoint_Y/1000.0);
-}
-
-static void 
-print_limits(xf86VdifLimitsPtr *pl)
-{
-    int i = 0;
-    xf86VdifLimitsPtr l;
-
-    while((l = pl[i]) != NULL) {
-	ErrorF("Max display resolution: %i x %i pixel\n",l->MaxHorPixel,
-	       l->MaxVerPixel);
-	ErrorF("Size of active area: %i x %i millimeters\n",l->MaxHorActiveLength,
-	       l->MaxVerActiveHeight);
-	ErrorF("Video Type: ");
-	print_type(l->VideoType);
-	ErrorF("Sync Type: ");
-	print_type(l->SyncType);
-	ErrorF("Sync Configuration ");
-	switch (l->SyncConfiguration) {
-	case VDIF_SYNC_SEPARATE:
-	    ErrorF("separate\n");
-	    break;
-	case VDIF_SYNC_C:
-	    ErrorF("composite C\n");
-	    break;
-	case VDIF_SYNC_CP:
-	    ErrorF("composite CP\n");
-	    break;
-	case VDIF_SYNC_G:
-	    ErrorF("composite G\n");
-	    break;
-	case VDIF_SYNC_GP:
-	    ErrorF("composite GP\n");
-	    break;
-	case VDIF_SYNC_OTHER:
-	    ErrorF("other\n");
-	    break;
-	}
-	ErrorF("Termination Resistance: %i\n",l->TerminationResistance);
-	ErrorF("Levels: white: %i, black: %i, blank: %i, sync: %i mV\n",
-	       l->WhiteLevel,l->BlackLevel,l->BlankLevel,l->SyncLevel);
-	ErrorF("Max. Pixel Clock: %f MHz\n",l->MaxPixelClock/1000.0);
-	ErrorF("Freq. Range: Hor.: %f - %f kHz, Ver.: %f - %f Hz\n",
-	       l->MaxHorFrequency/1000.0,l->MinHorFrequency/1000.0,
-	       l->MaxVerFrequency/1000.0,l->MinVerFrequency/1000.0);
-	ErrorF("Retrace time: Hor: %f us,  Ver: %f ms\n",l->MinHorRetrace/1000.0,
-	       l->MinVerRetrace/1000.0);
-    }
-}
-
-static void 
-print_timings(xf86VdifTimingPtr *pt)
-{
-    int i = 0;
-    xf86VdifTimingPtr t;
-
-    while((t = pt[i]) != NULL) {
-	ErrorF("SVGA / SVPMI mode number: %i\n",t->PreadjustedTimingName);
-	ErrorF("Mode %i x %i\n",t->HorPixel,t->VerPixel);
-	ErrorF("Size: %i x %i mm\n",t->HorAddrLength,t->VerAddrHeight);
-	ErrorF("Ratios: %i/%i\n",t->PixelWidthRatio,t->PixelHeightRatio);
-	ErrorF("Character width: %i",t->CharacterWidth);
-	ErrorF("Clock: %f MHz HFreq.: %f kHz, VFreq: %f Hz\n",t->PixelClock/1000.0,
-	       t->HorFrequency/1000.0,t->VerFrequency/1000.0);
-	ErrorF("Htotal: %f us, Vtotal %f ms\n", t->HorTotalTime/1000.0,
-	       t->VerTotalTime/1000.0);
-	ErrorF("HDisp: %f, HBlankStart: %f, HBlankLength: %f, "
-	       "HSyncStart: %f HSyncEnd: %f us\n",t->HorAddrTime/1000.0,
-	       t->HorBlankStart/1000.0,t->HorBlankTime/1000.0,
-	       t->HorSyncStart/1000.0,t->HorSyncTime/1000.0);
-	ErrorF("VDisp: %f, VBlankStart: %f, VBlankLength: %f, "
-	       "VSyncStart: %f VSyncEnd: %f us\n",t->VerAddrTime/1000.0,
-	       t->VerBlankStart/1000.0,t->VerBlankTime/1000.0,
-	       t->VerSyncStart/1000.0,t->VerSyncTime/1000.0);
-	ErrorF("Scan Type: ");
-	switch (t->ScanType) {
-	case VDIF_SCAN_INTERLACED:
-	    ErrorF("interlaced   ");
-	    break;
-	case VDIF_SCAN_NONINTERLACED:
-	    ErrorF("non interlaced   ");
-	    break;
-	case VDIF_SCAN_OTHER:
-	    ErrorF("other   ");
-	    break;
-	}
-	ErrorF("Polarity: H: ");
-	print_polarity(t->HorSyncPolarity);
-	ErrorF("V: ");
-	print_polarity(t->VerSyncPolarity);
-	ErrorF("\n");
-    }
-}
-
-static void
-print_gamma(xf86VdifGammaPtr *pg)
-{
-    int i = 0;
-    xf86VdifGammaPtr g;
-
-    while((g = pg[i]) != NULL) {
-	ErrorF("Gamma Table Entries: %i\n",g->GammaTableEntries);
-    }
-}
-
-static void
-print_type(CARD8 c)
-{
-    switch (c) {
-    case VDIF_VIDEO_TTL :
-	ErrorF("TTL\n");
-	break;
-    case VDIF_VIDEO_ANALOG :
-	ErrorF("Analog\n");
-	break;
-    case VDIF_VIDEO_ECL:
-	ErrorF("ECL\n");
-	break;
-    case VDIF_VIDEO_DECL:
-	ErrorF("DECL\n");
-	break;
-    case VDIF_VIDEO_OTHER:
-	ErrorF("other\n");
-	break;
-    }
-}
-
-static void
-print_polarity(CARD8 c)
-{
-    switch (c) {
-    case VDIF_POLARITY_NEGATIVE:
-	ErrorF(" Neg.");
-	break;
-    case VDIF_POLARITY_POSITIVE:
-	ErrorF(" Pos.");
-	break;
-    }
-}
diff --git a/hw/xfree86/ddc/vdif.h b/hw/xfree86/ddc/vdif.h
deleted file mode 100644
index 1777b68..0000000
--- a/hw/xfree86/ddc/vdif.h
+++ /dev/null
@@ -1,174 +0,0 @@
-
-#ifndef _VDIF_H
-#define _VDIF_H
-
-#define VDIF_MONITOR_MONOCHROME 0
-#define VDIF_MONITOR_COLOR 1
-#define VDIF_VIDEO_TTL 0
-#define VDIF_VIDEO_ANALOG 1
-#define VDIF_VIDEO_ECL 2
-#define VDIF_VIDEO_DECL 3
-#define VDIF_VIDEO_OTHER 4
-#define VDIF_SYNC_SEPARATE 0
-#define VDIF_SYNC_C 1
-#define VDIF_SYNC_CP 2
-#define VDIF_SYNC_G 3
-#define VDIF_SYNC_GP 4
-#define VDIF_SYNC_OTHER 5
-#define VDIF_SCAN_NONINTERLACED 0
-#define VDIF_SCAN_INTERLACED 1
-#define VDIF_SCAN_OTHER 2
-#define VDIF_POLARITY_NEGATIVE 0
-#define VDIF_POLARITY_POSITIVE 1
-
-#include <X11/Xmd.h>
-
-#undef  CARD32
-#define CARD32 unsigned int	/* ... on all supported platforms */
-
-typedef struct _VDIF { /* Monitor Description: */
-    CARD8 VDIFId[4]; /* alway "VDIF" */
-    CARD32 FileLength; /* lenght of the whole file */
-    CARD32 Checksum; /* sum of all bytes in the file after*/
-    /* this field */
-    CARD16 VDIFVersion; /* structure version number */
-    CARD16 VDIFRevision; /* structure revision number */
-    CARD16 Date[3]; /* file date Year/Month/Day */
-    CARD16 DateManufactured[3]; /* date Year/Month/Day */
-    CARD32 FileRevision; /* file revision string */
-    CARD32 Manufacturer; /* ASCII ID of the manufacturer */
-    CARD32 ModelNumber; /* ASCII ID of the model */
-    CARD32 MinVDIFIndex; /* ASCII ID of Minimum VDIF index */
-    CARD32 Version; /* ASCII ID of the model version */
-    CARD32 SerialNumber; /* ASCII ID of the serial number */
-    CARD8 MonitorType; /* Monochrome or Color */
-    CARD8 CRTSize; /* inches */
-    CARD8 BorderRed; /* percent */
-    CARD8 BorderGreen; /* percent */
-    CARD8 BorderBlue; /* percent */
-    CARD8 Reserved1; /* padding */
-    CARD16 Reserved2; /* padding */
-    CARD32 RedPhosphorDecay; /* microseconds */
-    CARD32 GreenPhosphorDecay; /* microseconds */
-    CARD32 BluePhosphorDecay; /* microseconds */
-    CARD16 WhitePoint_x; /* WhitePoint in CIExyY (scale 1000) */
-    CARD16 WhitePoint_y;
-    CARD16 WhitePoint_Y;
-    CARD16 RedChromaticity_x; /* Red chromaticity in x,y */
-    CARD16 RedChromaticity_y;
-    CARD16 GreenChromaticity_x; /* Green chromaticity in x,y */
-    CARD16 GreenChromaticity_y;
-    CARD16 BlueChromaticity_x; /* Blue chromaticity in x,y */
-    CARD16 BlueChromaticity_y;
-    CARD16 RedGamma; /* Gamme curve exponent (scale 1000) */
-    CARD16 GreenGamma;
-    CARD16 BlueGamma;
-    CARD32 NumberOperationalLimits;
-    CARD32 OffsetOperationalLimits;
-    CARD32 NumberOptions; /* optinal sections (gamma table) */
-    CARD32 OffsetOptions;
-    CARD32 OffsetStringTable;
-} xf86VdifRec, *xf86VdifPtr;
-
-typedef enum { /* Tags for section identification */
-    VDIF_OPERATIONAL_LIMITS_TAG = 1,
-    VDIF_PREADJUSTED_TIMING_TAG,
-    VDIF_GAMMA_TABLE_TAG
-} VDIFScnTag;
-
-typedef struct _VDIFScnHdr { /* Generic Section Header: */
-    CARD32 ScnLength; /* lenght of section */
-    CARD32 ScnTag; /* tag for section identification */
-} VDIFScnHdrRec, *VDIFScnHdrPtr;
-
-typedef struct _VDIFLimits { /* Operational Limits: */
-    VDIFScnHdrRec Header; /* common section info */
-    CARD16 MaxHorPixel; /* pixels */
-    CARD16 MaxVerPixel; /* lines */
-    CARD16 MaxHorActiveLength; /* millimeters */
-    CARD16 MaxVerActiveHeight; /* millimeters */
-    CARD8 VideoType; /* TTL / Analog / ECL / DECL */
-    CARD8 SyncType; /* TTL / Analog / ECL / DECL */
-    CARD8 SyncConfiguration; /* separate / composite / other */
-    CARD8 Reserved1; /* padding */
-    CARD16 Reserved2; /* padding */
-    CARD16 TerminationResistance; /* */
-    CARD16 WhiteLevel; /* millivolts */
-    CARD16 BlackLevel; /* millivolts */
-    CARD16 BlankLevel; /* millivolts */
-    CARD16 SyncLevel; /* millivolts */
-    CARD32 MaxPixelClock; /* kiloHertz */
-    CARD32 MinHorFrequency; /* Hertz */
-    CARD32 MaxHorFrequency; /* Hertz */
-    CARD32 MinVerFrequency; /* milliHertz */
-    CARD32 MaxVerFrequency; /* milliHertz */
-    CARD16 MinHorRetrace; /* nanoseconds */
-    CARD16 MinVerRetrace; /* microseconds */
-    CARD32 NumberPreadjustedTimings;
-    CARD32 OffsetNextLimits;
-} xf86VdifLimitsRec, *xf86VdifLimitsPtr;
-
-typedef struct _VDIFTiming { /* Preadjusted Timing: */
-    VDIFScnHdrRec Header; /* common section info */
-    CARD32 PreadjustedTimingName; /* SVGA/SVPMI mode number */
-    CARD16 HorPixel; /* pixels */
-    CARD16 VerPixel; /* lines */
-    CARD16 HorAddrLength; /* millimeters */
-    CARD16 VerAddrHeight; /* millimeters */
-    CARD8 PixelWidthRatio; /* gives H:V */
-    CARD8 PixelHeightRatio;
-    CARD8 Reserved1; /* padding */
-    CARD8 ScanType; /* noninterlaced / interlaced / other*/
-    CARD8 HorSyncPolarity; /* negative / positive */
-    CARD8 VerSyncPolarity; /* negative / positive */
-    CARD16 CharacterWidth; /* pixels */
-    CARD32 PixelClock; /* kiloHertz */
-    CARD32 HorFrequency; /* Hertz */
-    CARD32 VerFrequency; /* milliHertz */
-    CARD32 HorTotalTime; /* nanoseconds */
-    CARD32 VerTotalTime; /* microseconds */
-    CARD16 HorAddrTime; /* nanoseconds */
-    CARD16 HorBlankStart; /* nanoseconds */
-    CARD16 HorBlankTime; /* nanoseconds */
-    CARD16 HorSyncStart; /* nanoseconds */
-    CARD16 HorSyncTime; /* nanoseconds */
-    CARD16 VerAddrTime; /* microseconds */
-    CARD16 VerBlankStart; /* microseconds */
-    CARD16 VerBlankTime; /* microseconds */
-    CARD16 VerSyncStart; /* microseconds */
-    CARD16 VerSyncTime; /* microseconds */
-} xf86VdifTimingRec, *xf86VdifTimingPtr; 
-
-typedef struct _VDIFGamma { /* Gamma Table: */
-    VDIFScnHdrRec Header; /* common section info */
-    CARD16 GammaTableEntries; /* count of grays or RGB 3-tuples */
-    CARD16 Unused1;
-} xf86VdifGammaRec, *xf86VdifGammaPtr;
-
-/* access macros */
-#define VDIF_OPERATIONAL_LIMITS(vdif) \
-((xf86VdifLimitsPtr)((char*)(vdif) + (vdif)->OffsetOperationalLimits))
-#define VDIF_NEXT_OPERATIONAL_LIMITS(limits) limits = \
-     ((xf86VdifLimitsPtr)((char*)(limits) + (limits)->OffsetNextLimits))
-#define VDIF_PREADJUSTED_TIMING(limits) \
-((xf86VdifTimingPtr)((char*)(limits) + (limits)->Header.ScnLength))
-#define VDIF_NEXT_PREADJUSTED_TIMING(timing) timing = \
-     ((xf86VdifTimingPtr)((char*)(timing) + (timing)->Header.ScnLength))
-#define VDIF_OPTIONS(vdif) \
-     ((VDIFScnHdrPtr)((char*)(vdif) + (vdif)->OffsetOptions))
-#define VDIF_NEXT_OPTIONS(options) options = \
-     ((xf86VdifGammaPtr)((char*)(options) + (options)->Header.ScnLength))
-#define VDIF_STRING(vdif, string) \
-     ((char*)((char*)vdif + vdif->OffsetStringTable + (string)))
-
-typedef struct  _vdif {
-    xf86VdifPtr vdif;
-    xf86VdifLimitsPtr *limits;
-    xf86VdifTimingPtr *timings;
-    xf86VdifGammaPtr *gamma;
-    char * strings;
-} xf86vdif, *xf86vdifPtr;
-
-#undef CARD32
-
-#endif
diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c
index 21984bc..e47b8b8 100644
--- a/hw/xfree86/ddc/xf86DDC.c
+++ b/hw/xfree86/ddc/xf86DDC.c
@@ -38,12 +38,6 @@ static unsigned char* EDID1Read_DDC2(
     I2CBusPtr pBus
 );
 
-static unsigned char * VDIFRead(
-    int scrnIndex, 
-    I2CBusPtr pBus, 
-    int start
-);
-
 static unsigned char * DDCRead_DDC2(
     int scrnIndex,
     I2CBusPtr pBus, 
@@ -138,7 +132,6 @@ xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr
 {
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     unsigned char *EDID_block = NULL;
-    unsigned char *VDIF_Block = NULL;
     xf86MonPtr tmp = NULL;
     /* Default DDC and DDC2 to enabled. */
     Bool noddc = FALSE, noddc2 = FALSE;
@@ -171,11 +164,6 @@ xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr
     else
         ErrorF("Sections to follow: %i\n",tmp->no_sections);
 #endif
-    if (tmp) {
-        VDIF_Block = 
-            VDIFRead(scrnIndex, pBus, EDID1_LEN * (tmp->no_sections + 1));    
-        tmp->vdif = xf86InterpretVdif(VDIF_Block);
-    }
     
     return tmp;
 }
@@ -253,35 +241,6 @@ EDID1Read_DDC2(int scrnIndex, I2CBusPtr 
     return  DDCRead_DDC2(scrnIndex, pBus, 0, EDID1_LEN);
 }
 
-static unsigned char*
-VDIFRead(int scrnIndex, I2CBusPtr pBus, int start)
-{
-    unsigned char * Buffer, *v_buffer = NULL, *v_bufferp = NULL;
-    int i, num = 0;
-
-    /* read VDIF length in 64 byte blocks */
-    Buffer = DDCRead_DDC2(scrnIndex, pBus,start,64);
-    if (Buffer == NULL)
-	return NULL;
-#ifdef DEBUG
-    ErrorF("number of 64 bit blocks: %i\n",Buffer[0]);
-#endif
-    if ((num = Buffer[0]) > 0)
-	v_buffer = v_bufferp = xalloc(sizeof(unsigned char) * 64 * num);
-
-    for (i = 0; i < num; i++) {
-	Buffer = DDCRead_DDC2(scrnIndex, pBus,start,64);
-	if (Buffer == NULL) {
-	    xfree (v_buffer);
-	    return NULL;
-	}
-	memcpy(v_bufferp,Buffer,63); /* 64th byte is checksum */
-	xfree(Buffer);
-	v_bufferp += 63;
-    }
-    return v_buffer;
-}
-
 static unsigned char *
 DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len)
 {
diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h
index 7799471..3b072dd 100644
--- a/hw/xfree86/ddc/xf86DDC.h
+++ b/hw/xfree86/ddc/xf86DDC.h
@@ -43,10 +43,6 @@ extern xf86MonPtr xf86InterpretEDID(
     int screenIndex, Uchar *block
 );
 
-extern xf86vdifPtr xf86InterpretVdif(
-    CARD8 *c
-);
-
 extern void 
 xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC);
 
@@ -55,10 +51,6 @@ extern Bool xf86SetDDCproperties(
     xf86MonPtr DDC
 );
 
-extern void xf86print_vdif(
-    xf86vdifPtr v
-);
-
 DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
 
 #endif
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 6535e4c..b4ae42f 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -1236,8 +1236,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
     SYMFUNC(xf86DoEDID_DDC2)
     SYMFUNC(xf86InterpretEDID)
     SYMFUNC(xf86PrintEDID)
-    SYMFUNC(xf86InterpretVdif)
-    SYMFUNC(xf86print_vdif)
     SYMFUNC(xf86DDCMonitorSet)
     SYMFUNC(xf86SetDDCproperties)
 
diff-tree 66702f3c1c6c884e83744c72da173cc32f22b2f4 (from fa877d7ff25c4ec45288e1fea70d4f5e1baf3ef3)
Author: Henry Zhao <henryz at localhost.localdomain>
Date:   Fri Jun 1 23:55:40 2007 -0700

    Need to use minPitch in miScanLineWidth() to get the shrinked
    linePitch.

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index fc905df..b343788 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -1890,7 +1890,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
 		       virtX, virtY, vx, vy);
 	    virtX = vx;
 	    virtY = vy;
-	    linePitch = miScanLineWidth(vx, vy, linePitch, apertureSize,
+	    linePitch = miScanLineWidth(vx, vy, minPitch, apertureSize,
 					BankFormat, pitchInc);
 	}
     }
diff-tree fa877d7ff25c4ec45288e1fea70d4f5e1baf3ef3 (from 99eae8bea6724a24477375ad5b2d31cc4883cf6b)
Author: Alan Hourihane <alanh at fairlite.demon.co.uk>
Date:   Wed May 30 13:06:45 2007 +0100

    Fix mode validation against the maximum X/Y values configured
    at server startup, and not against the virtual X/Y parameters
    as they can change.
    
    This fixes an issue when canGrow is TRUE and modes get dropped
    when using the virtual X/Y parameters.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 88c31af..d20a3a3 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1217,8 +1217,15 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, 
     xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn);
     int			o;
 
-    if (maxX == 0 || maxY == 0)
-	xf86RandR12GetOriginalVirtualSize (scrn, &maxX, &maxY);
+    /* When canGrow was TRUE in the initial configuration we have to
+     * compare against the maximum values so that we don't drop modes.
+     * When canGrow was FALSE, the maximum values would have been clamped
+     * anyway.
+     */
+    if (maxX == 0 || maxY == 0) {
+	maxX = config->maxWidth;
+	maxY = config->maxHeight;
+    }
 
     /* Elide duplicate modes before defaulting code uses them */
     xf86PruneDuplicateMonitorModes (scrn->monitor);
diff-tree 99eae8bea6724a24477375ad5b2d31cc4883cf6b (from 3c6f1428489c1f71acd41066ea73ef4ae7c60f17)
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date:   Tue May 29 22:04:36 2007 -0400

    I/O enable/disable update for the Hurd

diff --git a/hw/xfree86/os-support/hurd/hurd_video.c b/hw/xfree86/os-support/hurd/hurd_video.c
index 45e9a09..b889283 100644
--- a/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/hw/xfree86/os-support/hurd/hurd_video.c
@@ -117,49 +117,29 @@ xf86LinearVidMem()
 /**************************************************************************
  * I/O Permissions section                                                 
  ***************************************************************************/
-mach_port_t io_port;
+
+/*
+ * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
+ * this.
+ */
+extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on);
 
 Bool
 xf86EnableIO()
 {
-    mach_port_t device;
-    kern_return_t err;
-
-    err = get_privileged_ports(NULL, &device);
-    if( err )
-    {
-	errno = err;
-	FatalError("xf86EnableIO() can't get_privileged_ports. (%s)\n",strerror(errno));
-    }
-    err = device_open(device,D_READ|D_WRITE,"io",&io_port);
-    mach_port_deallocate(mach_task_self(), device);
-    if( err )
-    {
-	errno = err;
-	FatalError("xf86EnableIO() can't device_open. (%s)\n",strerror(errno));
-    }
-
-    err = i386_io_port_add(mach_thread_self (), io_port);
-    if( err )
-    {
-	errno = err;
-	FatalError("xf86EnableIO() can't i386_io_port_add.(io_port) (%s)\n",strerror(errno));
+    if (ioperm(0, 0xffff, 1)) {
+	FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno));
+	return FALSE;
     }
+    ioperm(0x40,4,0); /* trap access to the timer chip */
+    ioperm(0x60,4,0); /* trap access to the keyboard controller */
     return TRUE;
 }
 	
 void
 xf86DisableIO()
 {
-    kern_return_t err;
-
-    err = i386_io_port_remove(mach_thread_self (), io_port);
-    if( err )
-    {
-	errno = err;
-	FatalError("xf86DisableIO() can't i386_io_port_remove.(io_port) (%s)\n",strerror(errno));
-    }
-    mach_port_deallocate(mach_task_self(), io_port);
+    ioperm(0,0xffff,0);
     return;
 }
 
diff-tree 3c6f1428489c1f71acd41066ea73ef4ae7c60f17 (from ee20c481eede0954f4a8bef5113979b101863c32)
Author: Julien Cristau <jcristau at debian.org>
Date:   Tue May 29 22:01:30 2007 -0400

    Make sure that the ramdac symbols are present in the server
    
    The former ramdac module is now built into the server, so its symbols need to
    be explicitly exported to drivers (Debian #423129).

diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 5175f01..6535e4c 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -96,6 +96,11 @@
 #endif
 #include "xf86DDC.h"
 #include "edid.h"
+#include "xf86Cursor.h"
+#include "xf86RamDac.h"
+#include "BT.h"
+#include "IBM.h"
+#include "TI.h"
 
 #ifndef HAS_GLIBC_SIGSETJMP
 #if defined(setjmp) && defined(__GNU_LIBRARY__) && \
@@ -1255,4 +1260,50 @@ _X_HIDDEN void *xfree86LookupTab[] = {
     SYMFUNC(xf86I2CWriteRead)
     SYMFUNC(xf86I2CWriteVec)
     SYMFUNC(xf86I2CWriteWord)
+
+    /* ramdac/xf86RamDac.c */
+    SYMFUNC(RamDacCreateInfoRec)
+    SYMFUNC(RamDacHelperCreateInfoRec)
+    SYMFUNC(RamDacDestroyInfoRec)
+    SYMFUNC(RamDacHelperDestroyInfoRec)
+    SYMFUNC(RamDacInit)
+    SYMFUNC(RamDacHandleColormaps)
+    SYMFUNC(RamDacFreeRec)
+    SYMFUNC(RamDacGetHWIndex)
+    SYMVAR(RamDacHWPrivateIndex)
+    SYMVAR(RamDacScreenPrivateIndex)
+
+    /* ramdac/xf86Cursor.c */
+    SYMFUNC(xf86InitCursor)
+    SYMFUNC(xf86CreateCursorInfoRec)
+    SYMFUNC(xf86DestroyCursorInfoRec)
+    SYMFUNC(xf86ForceHWCursor)
+
+    /* ramdac/BT.c */
+    SYMFUNC(BTramdacProbe)
+    SYMFUNC(BTramdacSave)
+    SYMFUNC(BTramdacRestore)
+    SYMFUNC(BTramdacSetBpp)
+
+    /* ramdac/IBM.c */
+    SYMFUNC(IBMramdacProbe)
+    SYMFUNC(IBMramdacSave)
+    SYMFUNC(IBMramdacRestore)
+    SYMFUNC(IBMramdac526SetBpp)
+    SYMFUNC(IBMramdac640SetBpp)
+    SYMFUNC(IBMramdac526CalculateMNPCForClock)
+    SYMFUNC(IBMramdac640CalculateMNPCForClock)
+    SYMFUNC(IBMramdac526HWCursorInit)
+    SYMFUNC(IBMramdac640HWCursorInit)
+    SYMFUNC(IBMramdac526SetBppWeak)
+
+    /* ramdac/TI.c */
+    SYMFUNC(TIramdacCalculateMNPForClock)
+    SYMFUNC(TIramdacProbe)
+    SYMFUNC(TIramdacSave)
+    SYMFUNC(TIramdacRestore)
+    SYMFUNC(TIramdac3026SetBpp)
+    SYMFUNC(TIramdac3030SetBpp)
+    SYMFUNC(TIramdacHWCursorInit)
+    SYMFUNC(TIramdacLoadPalette)
 };
diff-tree ee20c481eede0954f4a8bef5113979b101863c32 (from 60de6c7ef9bdcee043f63e8e0d493e6feba6a9d0)
Author: Matthieu Herrb <matthieu at deville.herrb.com>
Date:   Tue May 29 14:54:27 2007 -0600

    Remove wscons keyboard handling stuff that doesn't belong there anymore.

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 3610c17..4da74e5 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -1208,31 +1208,3 @@ _X_EXPORT void
 DDXRingBell(int volume, int pitch, int duration) {
     xf86OSRingBell(volume, pitch, duration);
 }
-
-#ifdef WSCONS_SUPPORT
-
-/* XXX Currently XKB is mandatory. */
-
-extern int WSKbdToKeycode(int);
-
-void
-xf86PostWSKbdEvent(struct wscons_event *event)
-{
-  int type = event->type;
-  int value = event->value;
-  unsigned int keycode;
-  int blocked;
-
-  if (type == WSCONS_EVENT_KEY_UP || type == WSCONS_EVENT_KEY_DOWN) {
-    Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE);
-
-    /* map the scancodes to standard XFree86 scancode */  	
-    keycode = WSKbdToKeycode(value);
-    if (!down) keycode |= 0x80;
-    /* It seems better to block SIGIO there */
-    blocked = xf86BlockSIGIO();
-    xf86PostKbdEvent(keycode);
-    xf86UnblockSIGIO(blocked);
-  }
-}
-#endif /* WSCONS_SUPPORT */
diff-tree 60de6c7ef9bdcee043f63e8e0d493e6feba6a9d0 (from parents)
Merge: 3a6549a163aba26bf4ac58b050c493fba0df14c6 2f13b7c113c17239e382dd3640e9c29201d8ab1f
Author: Matthieu Herrb <matthieu at deville.herrb.com>
Date:   Tue May 29 12:14:49 2007 -0600

    Merge branch 'master' of ssh://herrb@git.freedesktop.org/git/xorg/xserver

diff-tree 3a6549a163aba26bf4ac58b050c493fba0df14c6 (from 047bf3349bb697c73c95729a8bbf15f72605901f)
Author: Matthieu Herrb <matthieu at deville.herrb.com>
Date:   Tue May 29 12:14:23 2007 -0600

    Make this build on OpenBSD

diff --git a/hw/xfree86/os-support/bsd/bsd_bell.c b/hw/xfree86/os-support/bsd/bsd_bell.c
index b7a0c48..0d24201 100644
--- a/hw/xfree86/os-support/bsd/bsd_bell.c
+++ b/hw/xfree86/os-support/bsd/bsd_bell.c
@@ -27,7 +27,7 @@
 #include <xorg-config.h>
 #endif
 
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+#if defined (SYSCONS_SUPPORT)
 #include <sys/kbio.h>
 #endif
 
@@ -77,7 +77,7 @@ xf86OSRingBell(int loudness, int pitch, 
                         wsb.pitch = pitch;
                         wsb.period = duration;
                         wsb.volume = loudness;
-                        ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL,
+                        ioctl(xf86Info.consoleFd, WSKBDIO_COMPLEXBELL,
                                       &wsb);
                         break;
 #endif
diff-tree 2f13b7c113c17239e382dd3640e9c29201d8ab1f (from ba0b7d47ab0c24d5a29228f8af583044060464bd)
Author: Drew Parsons <dparsons at debian.org>
Date:   Wed May 30 02:13:36 2007 +1000

    Update Xprint build for pixman.
    
    Xprt links libfb, which now uses pixman.  Update configure.ac to
    require module $PIXMAN for XPRINT.
    Also, use $(top_builddir) to reference libfb.la and other local
    libraries, rather than using the relative reference ../..

diff --git a/configure.ac b/configure.ac
index 7ff712f..350245e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1600,7 +1600,7 @@ AC_MSG_CHECKING([whether to build Xprint
 AC_MSG_RESULT([$XPRINT])
 
 if test "x$XPRINT" = xyes; then
-	PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
+	PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau $PIXMAN])
 	XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
 	XPRINT_LIBS="$DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS"
 	AC_SUBST([XPRINT_CFLAGS])
diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am
index 45168b1..dc8764a 100644
--- a/hw/xprint/Makefile.am
+++ b/hw/xprint/Makefile.am
@@ -10,9 +10,9 @@ Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAG
 
 Xprt_LDFLAGS = -L$(top_srcdir)
 Xprt_LDADD = @XPRINT_LIBS@ ps/libps.la raster/libraster.la  \
-	pcl/libpcl.la pcl-mono/libpcl.la ../../fb/libfb.la \
-	../../render/librender.la ../../mi/libmi.la ../../Xext/libXext.la \
-	@FREETYPE_LIBS@
+	pcl/libpcl.la pcl-mono/libpcl.la $(top_builddir)/fb/libfb.la \
+	$(top_builddir)/render/librender.la $(top_builddir)/mi/libmi.la \
+	$(top_builddir)/Xext/libXext.la  @FREETYPE_LIBS@
 
 miinitext-wrapper.c:
 	echo "#include \"$(top_srcdir)/mi/miinitext.c\"" >> $@
diff-tree ba0b7d47ab0c24d5a29228f8af583044060464bd (from 2267bf48b385c93243e26c3bb84ebb04c7fdb39f)
Author: David Nusinow <dnusinow at debian.org>
Date:   Mon May 28 21:57:04 2007 -0400

    Fix for GNU/kFreeBSD

diff --git a/hw/kdrive/linux/agp.c b/hw/kdrive/linux/agp.c
index c2ae625..4fb0cb3 100644
--- a/hw/kdrive/linux/agp.c
+++ b/hw/kdrive/linux/agp.c
@@ -65,7 +65,7 @@ of the copyright holder.
 
 #include <linux/agpgart.h>
 
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include <sys/ioctl.h>
 #include <sys/agpio.h>
 #endif
diff-tree 2267bf48b385c93243e26c3bb84ebb04c7fdb39f (from 857ddbb660a21cad1c16f4fb2dc8a904d6655304)
Author: Bastian Blank <waldi at debian.org>
Date:   Mon May 28 21:55:05 2007 -0400

    Fixes for s390

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index ea995ed..becd3da 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1365,7 +1365,7 @@ do {									\
 #    define write_mem_barrier()   /* NOP */
 
 #    if !defined(__SUNPRO_C)
-#    if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__)
+#    if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__)
 #     ifdef GCCUSESGAS
 
 /*
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 4b58046..02a1310 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -567,7 +567,7 @@ xf86EnableIO(void)
 #endif
 	}
 	close(fd);
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__)
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__)
         if (ioperm(0, 1024, 1) || iopl(3)) {
                 if (errno == ENODEV)
                         ErrorF("xf86EnableIOPorts: no I/O ports found\n");
diff-tree 857ddbb660a21cad1c16f4fb2dc8a904d6655304 (from 78d01d1008973899d931ef44b47d5f0b5f220b0d)
Author: Eugene Konev <ejka at imfi.kspu.ru>
Date:   Mon May 28 21:53:02 2007 -0400

    Allow configurable serverconfigdir for security policy location
    Allow the location of the SERVERCONFIGdir variable to be defined at
    compile-time. This allows us to specify where the security policy will be
    located (Debian uses this to put it in /etc). The default is to the
    previous location.

diff --git a/Xext/Makefile.am b/Xext/Makefile.am
index 6ea3d74..d0d23b7 100644
--- a/Xext/Makefile.am
+++ b/Xext/Makefile.am
@@ -34,7 +34,6 @@ MODULE_SRCS =			\
 	xcmisc.c
 
 # Extra configuration files ship with some extensions
-SERVERCONFIGdir = $(libdir)/xserver
 SERVERCONFIG_DATA =
 
 # Optional sources included if extension enabled by configure.ac rules
diff --git a/configure.ac b/configure.ac
index 37199cf..7ff712f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -465,6 +465,9 @@ AC_ARG_WITH(xkb-output,       AS_HELP_ST
 AC_ARG_WITH(rgb-path,         AS_HELP_STRING([--with-rgb-path=PATH], [Path to RGB database (default: ${datadir}/X11/rgb)]),
 				[ RGBPATH="$withval" ],
 				[ RGBPATH="${datadir}/X11/rgb" ])
+AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH], [Path to server config (default: ${libdir}/xserver)]),
+				[ SERVERCONFIG="$withval" ],
+				[ SERVERCONFIG="${libdir}/xserver" ])
 APPLE_APPLICATIONS_DIR="${bindir}/Applications"
 AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: ${bindir}/Applications)]),
                                [ APPLE_APPLICATIONS_DIR="${withval}" ].
@@ -938,6 +941,7 @@ VENDOR_MAN_VERSION="Version ${VENDOR_VER
 
 AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
 AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
+AC_DEFINE_DIR(SERVERCONFIGdir, SERVERCONFIG, [Server config path])
 AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
 AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
 AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name])
diff-tree 78d01d1008973899d931ef44b47d5f0b5f220b0d (from d98bd4bf908c2c51fcfd3a4c3230de17f2567244)
Author: Gerhard Tonn <gt at debian.org>
Date:   Mon May 28 21:48:58 2007 -0400

    Miscellaneous fixes for S/390.

diff --git a/include/servermd.h b/include/servermd.h
index e6ca11e..4f32a9d 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -515,7 +515,15 @@ SOFTWARE.
 #define GLYPHPADBYTES		4
 #define GETLEFTBITS_ALIGNMENT	1
 #endif
- 
+
+/* linux on IBM S/390 */
+#if defined (linux) && defined (__s390__)
+#define IMAGE_BYTE_ORDER	MSBFirst
+#define BITMAP_BIT_ORDER	MSBFirst
+#define GLYPHPADBYTES		4
+#define GETLEFTBITS_ALIGNMENT	1
+#endif /* linux/s390 */ 
+
 /* size of buffer to use with GetImage, measured in bytes. There's obviously
  * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
  * you) used and the number of times the ddx routine has to be called.
diff-tree d98bd4bf908c2c51fcfd3a4c3230de17f2567244 (from 6bf8d5019313ee2251a44dfb7ad3435a3c6db7eb)
Author: Branden Robinson <branden at debian.org>
Date:   Mon May 28 21:44:59 2007 -0400

    Overhaul xorg.conf manpage
    
    Major stylistic cleanups, greatly expanded cross-reference ("SEE ALSO")
    section and some typo fixes.
    
    This patch by Branden Robinson. Forward-ported by Fabio M. Di Nitto.

diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index f2cb5ef..4103974 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -3,7 +3,7 @@
 .ds q \N'34'
 .TH __xconfigfile__ __filemansuffix__ __vendorversion__
 .SH NAME
-__xconfigfile__ - Configuration File for __xservername__
+__xconfigfile__ \- configuration File for __xservername__ X server
 .SH INTRODUCTION
 .B __xservername__
 supports several mechanisms for supplying/obtaining configuration and
@@ -21,9 +21,10 @@ manual page.
 .SH DESCRIPTION
 .B __xservername__
 uses a configuration file called
-.B __xconfigfile__
-for its initial setup.  This configuration file is searched for in the
-following places when the server is started as a normal user:
+.I __xconfigfile__
+for its initial setup.
+This configuration file is searched for in the following places when the
+server is started as a normal user:
 .PP
 .RS 4
 .nf
@@ -31,30 +32,31 @@ following places when the server is star
 .IR __projectroot__/etc/X11/ <cmdline>
 .IB /etc/X11/ $XORGCONFIG
 .IB __projectroot__/etc/X11/ $XORGCONFIG
-.I /etc/X11/__xconfigfile__-4
+.I /etc/X11/__xconfigfile__\-4
 .I /etc/X11/__xconfigfile__
 .I /etc/__xconfigfile__
 .IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
-.I __projectroot__/etc/X11/__xconfigfile__-4
+.I __projectroot__/etc/X11/__xconfigfile__\-4
 .I __projectroot__/etc/X11/__xconfigfile__
 .IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
-.I __projectroot__/lib/X11/__xconfigfile__-4
+.I __projectroot__/lib/X11/__xconfigfile__\-4
 .I __projectroot__/lib/X11/__xconfigfile__
 .fi
 .RE
 .PP
 where
 .I <cmdline>
-is a relative path (with no ".." components) specified with the
+is a relative path (with no \(lq..\(rq components) specified with the
 .B \-config
 command line option,
 .B $XORGCONFIG
-is the relative path (with no ".." components) specified by that
+is the relative path (with no \(lq..\(rq components) specified by that
 environment variable, and
 .I <hostname>
-is the machine's hostname as reported by gethostname(3).
+is the machine's hostname as reported by
+.BR gethostname (__oslibmansuffix__).
 .PP
-When the __xservername__ server is started by the "root" user, the config file
+When the __xservername__ server is started by the \(lqroot\(rq user, the config file
 search locations are as follows:
 .PP
 .RS 4
@@ -66,14 +68,14 @@ search locations are as follows:
 .IB /etc/X11/ $XORGCONFIG
 .IB __projectroot__/etc/X11/ $XORGCONFIG
 .BI $HOME /__xconfigfile__
-.I /etc/X11/__xconfigfile__-4
+.I /etc/X11/__xconfigfile__\-4
 .I /etc/X11/__xconfigfile__
 .I /etc/__xconfigfile__
 .IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
-.I __projectroot__/etc/X11/__xconfigfile__-4
+.I __projectroot__/etc/X11/__xconfigfile__\-4
 .I __projectroot__/etc/X11/__xconfigfile__
 .IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
-.I __projectroot__/lib/X11/__xconfigfile__-4
+.I __projectroot__/lib/X11/__xconfigfile__\-4
 .I __projectroot__/lib/X11/__xconfigfile__
 .fi
 .RE
@@ -90,13 +92,13 @@ environment variable (absolute or relati
 is the path specified by that environment variable (usually the home
 directory), and
 .I <hostname>
-is the machine's hostname as reported by gethostname(3).
+is the machine's hostname as reported by
+.BR gethostname (__oslibmansuffix__).
 .PP
 The
-.B __xconfigfile__
-file is composed of a number of sections which may be present in any
-order.  Each section has
-the form:
+.I __xconfigfile__
+file is composed of a number of sections which may be present in any order.
+Each section has the form:
 .PP
 .RS 4
 .nf
@@ -121,13 +123,14 @@ The section names are:
 .BR "Modes          " "Video modes descriptions"
 .BR "Screen         " "Screen configuration"
 .BR "ServerLayout   " "Overall layout"
-.BR "DRI            " "DRI-specific configuration"
-.BR "Vendor         " "Vendor-specific configuration"
+.BR "DRI            " "DRI\-specific configuration"
+.BR "Vendor         " "Vendor\-specific configuration"
 .fi
 .RE
 .PP
 The following obsolete section names are still recognised for compatibility
-purposes.  In new config files, the
+purposes.
+In new config files, the
 .B InputDevice
 section should be used instead.
 .PP
@@ -144,35 +147,38 @@ section is no longer recognised.
 .PP
 The
 .B ServerLayout
-sections are at the highest level.  They bind together the input and
-output devices that will be used in a session.  The input devices
-are described in the
+sections are at the highest level.  
+They bind together the input and output devices that will be used in a session.  
+The input devices are described in the
 .B InputDevice
-sections.  Output devices usually consist of multiple independent
-components (e.g., a graphics board and a monitor).  These multiple
-components are bound together in the
+sections.  
+Output devices usually consist of multiple independent components (e.g.,
+a graphics board and a monitor).  
+These multiple components are bound together in the
 .B Screen
 sections, and it is these that are referenced by the
 .B ServerLayout
-section.  Each
+section.  
+Each
 .B Screen
-section binds together a graphics board and a monitor.  The graphics
-boards are described in the
+section binds together a graphics board and a monitor.  
+The graphics boards are described in the
 .B Device
 sections, and the monitors are described in the
 .B Monitor
 sections.
 .PP
-Config file keywords are case-insensitive, and "_" characters are
-ignored.  Most strings (including
+Config file keywords are case\-insensitive, and \(lq_\(rq characters are
+ignored.  
+Most strings (including
 .B Option
 names) are also case-insensitive, and insensitive to white space and
-"_" characters.
+\(lq_\(rq characters.
 .PP
-Each config file entry usually takes up a single line in the file.
-They consist of a keyword, which is possibly followed by one or
-more arguments, with the number and types of the arguments depending
-on the keyword.  The argument types are:
+Each config file entry usually takes up a single line in the file.  They 
+consist of a keyword, which is possibly followed by one or more arguments, 
+with the number and types of the arguments depending on the keyword.  
+The argument types are:
 .PP
 .RS 4
 .nf
@@ -182,17 +188,18 @@ on the keyword.  The argument types are:
 .fi
 .RE
 .PP
-Note: hex integer values must be prefixed with "0x", and octal values
-with "0".
+Note: hex integer values must be prefixed with \(lq0x\(rq, and octal values
+with \(lq0\(rq.
 .PP
 A special keyword called
 .B Option
-may be used to provide free-form data to various components of the server.
+may be used to provide free\-form data to various components of the server.
 The
 .B Option
-keyword takes either one or two string arguments.  The first is the option
-name, and the optional second argument is the option value.  Some commonly
-used option value types include:
+keyword takes either one or two string arguments.
+The first is the option name, and the optional second argument is the
+option value.
+Some commonly used option value types include:
 .PP
 .RS 4
 .nf
@@ -209,8 +216,8 @@ Note that
 .B Option
 values, not just strings, must be enclosed in quotes.
 .PP
-Boolean options may optionally have a value specified.  When no value
-is specified, the option's value is
+Boolean options may optionally have a value specified.
+When no value is specified, the option's value is
 .BR TRUE .
 The following boolean option values are recognised as
 .BR TRUE :
@@ -263,30 +270,35 @@ When the unit name is omitted, the corre
 the value and the expectations of the appropriate range of the value.
 It is recommended that the units always be specified when using frequency
 option values to avoid any errors in determining the value.
-.SH FILES SECTION
+.SH "FILES SECTION"
 The
 .B Files
 section is used to specify some path names required by the server.
-Some of these paths can also be set from the command line (see Xserver(__appmansuffix__)
-and __xservername__(__appmansuffix__)).  The command line settings override the values specified
-in the config file.  The
+Some of these paths can also be set from the command line (see
+.BR Xserver (__appmansuffix__)
+and
+.BR __xservername__ (__appmansuffix__)).
+The command line settings override the values specified in the config
+file.
+The
 .B Files
 section is optional, as are all of the entries that may appear in it.
 .PP
 The entries that can appear in this section are:
 .TP 7
 .BI "FontPath \*q" path \*q
-sets the search path for fonts.  This path is a comma separated list of
-font path elements which the __xservername__ server searches for font databases.
+sets the search path for fonts.
+This path is a comma separated list of font path elements which the __xservername__
+server searches for font databases.
 Multiple
 .B FontPath
 entries may be specified, and they will be concatenated to build up the
 fontpath used by the server.  Font path elements may be either absolute
-directory paths, or a font server identifier.  Font server identifiers
-have the form:
+directory paths, or a font server identifier.
+Font server identifiers have the form:
 .PP
 .RS 11
-.IR <trans> / <hostname> : <port-number>
+.IR <trans> / <hostname> : <port\-number>
 .RE
 .PP
 .RS 7
@@ -294,16 +306,16 @@ where
 .I <trans>
 is the transport type to use to connect to the font server (e.g.,
 .B unix
-for UNIX-domain sockets or
+for UNIX\-domain sockets or
 .B tcp
 for a TCP/IP connection),
 .I <hostname>
 is the hostname of the machine running the font server, and
-.I <port-number>
+.I <port\-number>
 is the port number that the font server is listening on (usually 7100).
 .PP
 When this entry is not specified in the config file, the server falls back
-to the compiled-in default font path, which contains the following
+to the compiled\-in default font path, which contains the following
 font path elements:
 .PP
 .RS 4
@@ -338,7 +350,7 @@ font path when the server starts up.
 .BI "RGBPath \*q" path \*q
 sets the path name for the RGB color database.
 When this entry is not specified in the config file, the server falls back
-to the compiled-in default RGB path, which is:
+to the compiled\-in default RGB path, which is:
 .PP
 .RS 11
 .I __projectroot__/share/X11/rgb
@@ -350,9 +362,10 @@ is added to this path if the server was 
 binary format RGB color databases.
 .TP 7
 .BI "ModulePath \*q" path \*q
-sets the search path for loadable __xservername__ server modules.  This path is
-a comma separated list of directories which the __xservername__ server searches
-for loadable modules loading in the order specified.  Multiple
+sets the search path for loadable __xservername__ server modules.
+This path is a comma separated list of directories which the __xservername__ server
+searches for loadable modules loading in the order specified.
+Multiple
 .B ModulePath
 entries may be specified, and they will be concatenated to build the
 module search path used by the server.
@@ -360,8 +373,8 @@ module search path used by the server.
 .ig
 .TP 7
 .BI "LogFile \*q" path \*q
-sets the name of the __xservername__ server log file.  The default log file name
-is
+sets the name of the __xservername__ server log file.
+The default log file name is
 .PP
 .RS 11
 .RI __logdir__/__xservername__. <n> .log
@@ -372,15 +385,18 @@ where
 .I <n>
 is the display number for the __xservername__ server.
 ..
-.SH SERVERFLAGS SECTION
+.SH "SERVERFLAGS SECTION"
 In addition to options specific to this section (described below), the
 .B ServerFlags
 section is used to specify some global
-__xservername__ server options.  All of the entries in this section are
+__xservername__ server options.  
+All of the entries in this section are
 .BR Options ,
 although for compatibility purposes some of the old style entries are
-still recognised.  Those old style entries are not documented here, and
-using them is discouraged.  The
+still recognised.  
+Those old style entries are not documented here, and using them is 
+discouraged.  
+The
 .B ServerFlags
 section is optional, as are the entries that may be specified in it.
 .PP
@@ -392,11 +408,12 @@ may be overridden by
 .B Options
 specified in the active
 .B ServerLayout
-section.  Options with command line equivalents are overridden when their
-command line equivalent is used.  The options recognised by this section
-are:
+section.
+Options with command line equivalents are overridden when their command
+line equivalent is used.
+The options recognised by this section are:
 .TP 7
-.BI "Option \*qDefaultServerLayout\*q  \*q" layout-id \*q
+.BI "Option \*qDefaultServerLayout\*q  \*q" layout\-id \*q
 This specifies the default
 .B ServerLayout
 section to use in the absence of the
@@ -404,148 +421,185 @@ section to use in the absence of the
 command line option.
 .TP 7
 .BI "Option \*qNoTrapSignals\*q  \*q" boolean \*q
-This prevents the __xservername__ server from trapping a range of unexpected
-fatal signals and exiting cleanly.  Instead, the __xservername__ server will die
-and drop core where the fault occurred.  The default behaviour is
-for the __xservername__ server to exit cleanly, but still drop a core file.  In
-general you never want to use this option unless you are debugging
-an __xservername__ server problem and know how to deal with the consequences.
+This prevents the __xservername__ server from trapping a range of unexpected fatal
+signals and exiting cleanly.
+Instead, the __xservername__ server will die and drop core where the fault occurred.
+The default behaviour is for the __xservername__ server to exit cleanly, but still drop a
+core file.
+In general you never want to use this option unless you are debugging an __xservername__
+server problem and know how to deal with the consequences.
 .TP 7
 .BI "Option \*qDontVTSwitch\*q  \*q" boolean \*q
 This disallows the use of the
 .BI Ctrl+Alt+F n
 sequence (where
 .RI F n
-refers to one of the numbered function keys).  That sequence is normally
-used to switch to another \*qvirtual terminal\*q on operating systems
-that have this feature.  When this option is enabled, that key sequence has
-no special meaning and is passed to clients.  Default: off.
+refers to one of the numbered function keys).
+That sequence is normally used to switch to another \*qvirtual terminal\*q
+on operating systems that have this feature.
+When this option is enabled, that key sequence has no special meaning and
+is passed to clients.
+Default: off.
 .TP 7
 .BI "Option \*qDontZap\*q  \*q" boolean \*q
 This disallows the use of the
 .B Ctrl+Alt+Backspace
-sequence.  That sequence is normally used to terminate the __xservername__ server.
-When this option is enabled, that key sequence has no special meaning
-and is passed to clients.  Default: off.
+sequence.
+That sequence is normally used to terminate the __xservername__ server.
+When this option is enabled, that key sequence has no special meaning and
+is passed to clients.
+Default: off.
 .TP 7
 .BI "Option \*qDontZoom\*q  \*q" boolean \*q
 This disallows the use of the
-.B Ctrl+Alt+Keypad-Plus
+.B Ctrl+Alt+Keypad\-Plus
 and
-.B Ctrl+Alt+Keypad-Minus
-sequences.  These sequences allows you to switch between video modes.
+.B Ctrl+Alt+Keypad\-Minus
+sequences.
+These sequences allows you to switch between video modes.
 When this option is enabled, those key sequences have no special meaning
-and are passed to clients.  Default: off.
+and are passed to clients.
+Default: off.
 .TP 7
 .BI "Option \*qDisableVidModeExtension\*q  \*q" boolean \*q
 This disables the parts of the VidMode extension used by the xvidtune client
-that can be used to change the video modes.  Default: the VidMode extension
-is enabled.
+that can be used to change the video modes.
+Default: the VidMode extension is enabled.
 .TP 7
 .BI "Option \*qAllowNonLocalXvidtune\*q  \*q" boolean \*q
 This allows the xvidtune client (and other clients that use the VidMode
-extension) to connect from another host.  Default: off.
+extension) to connect from another host.
+Default: off.
 .TP 7
 .BI "Option \*qDisableModInDev\*q  \*q" boolean \*q
-This disables the parts of the __xservername__-Misc extension that can be used to
-modify the input device settings dynamically.  Default: that functionality
-is enabled.
+This disables the parts of the __xservername__\-Misc extension that can be used to
+modify the input device settings dynamically.
+Default: that functionality is enabled.
 .TP 7
 .BI "Option \*qAllowNonLocalModInDev\*q  \*q" boolean \*q
 This allows a client to connect from another host and change keyboard
-and mouse settings in the running server.  Default: off.
+and mouse settings in the running server.
+Default: off.
 .TP 7
 .BI "Option \*qAllowMouseOpenFail\*q  \*q" boolean \*q
 This allows the server to start up even if the mouse device can't be
-opened/initialised.  Default: false.
+opened/initialised.
+Default: false.
 .TP 7
 .BI "Option \*qVTInit\*q  \*q" command \*q
 Runs
 .I command
 after the VT used by the server has been opened.
-The command string is passed to "/bin/sh -c", and is run with the
-real user's id with stdin and stdout set to the VT.  The purpose
-of this option is to allow system dependent VT initialisation
-commands to be run.  This option should rarely be needed.  Default: not set.
+The command string is passed to \*q/bin/sh \-c\*q, and is run with the real
+user's id with stdin and stdout set to the VT.
+The purpose of this option is to allow system dependent VT initialisation
+commands to be run.
+This option should rarely be needed.
+Default: not set.
 .TP 7
 .BI "Option \*qVTSysReq\*q  \*q" boolean \*q
-enables the SYSV-style VT switch sequence for non-SYSV systems
-which support VT switching.  This sequence is
-.B Alt-SysRq
-followed
-by a function key
+enables the SYSV\-style VT switch sequence for non\-SYSV systems
+which support VT switching.
+This sequence is
+.B Alt\-SysRq
+followed by a function key
 .RB ( Fn ).
 This prevents the __xservername__ server trapping the
 keys used for the default VT switch sequence, which means that clients can
-access them.  Default: off.
+access them.
+Default: off.
 .TP 7
 .BI "Option \*qXkbDisable\*q \*q" boolean \*q
-disable/enable the XKEYBOARD extension.  The \-kb command line
-option overrides this config file option.  Default: XKB is enabled.
+disable/enable the XKEYBOARD extension.
+The \-kb command line option overrides this config file option.
+Default: XKB is enabled.
 .\" The following four options are "undocumented".
 .ig
 .TP 7
 .BI "Option \*qPciProbe1\*q"
-Use PCI probe method 1.  Default: set.
+Use PCI probe method 1.
+Default: set.
 .TP 7
 .BI "Option \*qPciProbe2\*q"
-Use PCI probe method 2.  Default: not set.
+Use PCI probe method 2.
+Default: not set.
 .TP 7
 .BI "Option \*qPciForceConfig1\*q"
-Force the use PCI config type 1.  Default: not set.
+Force the use PCI config type 1.
+Default: not set.
 .TP 7
 .BI "Option \*qPciForceConfig2\*q"
-Force the use PCI config type 2.  Default: not set.
+Force the use PCI config type 2. 
+Default: not set.
 ..
 .TP 7
 .BI "Option \*qBlankTime\*q  \*q" time \*q
-sets the inactivity timeout for the blanking phase of the screensaver.
+sets the inactivity timeout for the
+.B blank
+phase of the screensaver.
 .I time
-is in minutes.  This is equivalent to the __xservername__ server's `-s' flag,
-and the value can be changed at run-time with xset(__appmansuffix__).  Default: 10
-minutes.
+is in minutes.
+This is equivalent to the __xservername__ server's
+.B \-s
+flag, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 10 minutes.
 .TP 7
 .BI "Option \*qStandbyTime\*q  \*q" time \*q
-sets the inactivity timeout for the "standby" phase of DPMS mode.
+sets the inactivity timeout for the
+.B standby
+phase of DPMS mode.
 .I time
-is in minutes, and the value can be changed at run-time with xset(__appmansuffix__).
-Default: 20 minutes.  This is only suitable for VESA DPMS compatible
-monitors, and may not be supported by all video drivers.  It is only
-enabled for screens that have the
+is in minutes, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 20 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.
+It is only enabled for screens that have the
 .B \*qDPMS\*q
 option set (see the MONITOR section below).
 .TP 7
 .BI "Option \*qSuspendTime\*q  \*q" time \*q
-sets the inactivity timeout for the "suspend" phase of DPMS mode.
+sets the inactivity timeout for the
+.B suspend
+phase of DPMS mode.
 .I time
-is in minutes, and the value can be changed at run-time with xset(__appmansuffix__).
-Default: 30 minutes.  This is only suitable for VESA DPMS compatible
-monitors, and may not be supported by all video drivers.  It is only
-enabled for screens that have the
+is in minutes, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 30 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.
+It is only enabled for screens that have the
 .B \*qDPMS\*q
 option set (see the MONITOR section below).
 .TP 7
 .BI "Option \*qOffTime\*q  \*q" time \*q
-sets the inactivity timeout for the "off" phase of DPMS mode.
+sets the inactivity timeout for the
+.B off
+phase of DPMS mode.
 .I time
-is in minutes, and the value can be changed at run-time with xset(__appmansuffix__).
-Default: 40 minutes.  This is only suitable for VESA DPMS compatible
-monitors, and may not be supported by all video drivers.  It is only
-enabled for screens that have the
+is in minutes, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 40 minutes. 
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.
+It is only enabled for screens that have the
 .B \*qDPMS\*q
 option set (see the MONITOR section below).
 .TP 7
 .BI "Option \*qPixmap\*q  \*q" bpp \*q
-This sets the pixmap format to use for depth 24.  Allowed values for
+This sets the pixmap format to use for depth 24.
+Allowed values for
 .I bpp
-are 24 and 32.  Default: 32 unless driver constraints don't allow this
-(which is rare).  Note: some clients don't behave well when this value
-is set to 24.
+are 24 and 32.
+Default: 32 unless driver constraints don't allow this (which is rare).
+Note: some clients don't behave well when this value is set to 24.
 .TP 7
 .BI "Option \*qPC98\*q  \*q" boolean \*q
-Specify that the machine is a Japanese PC-98 machine.  This should not
-be enabled for anything other than the Japanese-specific PC-98
-architecture.  Default: auto-detected.
+Specify that the machine is a Japanese PC\-98 machine.
+This should not be enabled for anything other than the Japanese\-specific
+PC\-98 architecture.
+Default: auto\-detected.
 .\" Doubt this should be documented.
 .ig
 .TP 7
@@ -555,48 +609,54 @@ Default: 0.
 ..
 .TP 7
 .BI "Option \*qNoPM\*q  \*q" boolean \*q
-Disables something to do with power management events.  Default: PM
-enabled on platforms that support it.
+Disables something to do with power management events.
+Default: PM enabled on platforms that support it.
 .TP 7
 .BI "Option \*qXinerama\*q  \*q" boolean \*q
-enable or disable XINERAMA extension. Default is disabled.
+enable or disable XINERAMA extension.
+Default is disabled.
 .TP 7
 .BI "Option \*qAllowDeactivateGrabs\*q \*q" boolean \*q
 This option enables the use of the
-.B Ctrl+Alt+Keypad-Divide
-key sequence to deactivate any active keyboard and mouse grabs.  Default:
-off.
+.B Ctrl+Alt+Keypad\-Divide
+key sequence to deactivate any active keyboard and mouse grabs.
+Default: off.
 .TP 7
 .BI "Option \*qAllowClosedownGrabs\*q \*q" boolean \*q
 This option enables the use of the
-.B Ctrl+Alt+Keypad-Multiply
-key sequence to kill clients with an active keyboard or mouse grab as
-well as killing any application that may have locked the server, normally
-using the XGrabServer(__libmansuffix__) Xlib function.  Default: off.
+.B Ctrl+Alt+Keypad\-Multiply
+key sequence to kill clients with an active keyboard or mouse grab as well
+as killing any application that may have locked the server, normally using
+the
+.BR XGrabServer(__libmansuffix__)
+Xlib function.
+Default: off.
 .br
 Note that the options
-.BI AllowDeactivateGrabs
+.B AllowDeactivateGrabs
 and
-.BI AllowClosedownGrabs
+.B AllowClosedownGrabs
 will allow users to remove the grab used by screen saver/locker programs.
-An API was written to such cases. If you enable this option, make sure
-your screen saver/locker is updated.
+An API was written to such cases.
+If you enable this option, make sure your screen saver/locker is updated.
+Default: off.
 .TP 7
 .BI "Option \*qHandleSpecialKeys\*q \*q" when \*q
 This option controls when the server uses the builtin handler to process
 special key combinations (such as
 .BR Ctrl+Alt+Backspace ).
-Normally the XKEYBOARD extension keymaps will provide mappings for each
-of the special key combinations, so the builtin handler is not needed
-unless the XKEYBOARD extension is disabled.  The value of
+Normally the XKEYBOARD extension keymaps will provide mappings for each of
+the special key combinations, so the builtin handler is not needed unless
+the XKEYBOARD extension is disabled.
+The value of
 .I when
 can be
 .BR Always ,
 .BR Never ,
 or
 .BR WhenNeeded .
-Default: Use the builtin handler only if needed.  The server will scan
-the keymap for a mapping to the
+Default: Use the builtin handler only if needed.
+The server will scan the keymap for a mapping to the
 .B Terminate
 action and, if found, use XKEYBOARD for processing actions, otherwise
 the builtin handler will be used.
@@ -612,21 +672,22 @@ default.
 .BI "Option \*qIgnoreABI\*q \*q" boolean \*q
 Allow modules built for a different, potentially incompatible version of
 the X server to load. Disabled by default.
-.SH MODULE SECTION
+.SH "MODULE SECTION"
 The
 .B Module
 section is used to specify which __xservername__ server modules should be loaded.
 This section is ignored when the __xservername__ server is built in static form.
 The types of modules normally loaded in this section are __xservername__ server
-extension modules, and font rasteriser modules.  Most other module types
-are loaded automatically when they are needed via other mechanisms.
+extension modules, and font rasteriser modules.
+Most other module types are loaded automatically when they are needed via
+other mechanisms.
 The
 .B Module
 section is optional, as are all of the entries that may be specified in
 it.
 .PP
-Entries in this section may be in two forms.   The first and most commonly
-used form is an entry that uses the
+Entries in this section may be in two forms.
+The first and most commonly used form is an entry that uses the
 .B Load
 keyword, as described here:
 .TP 7
@@ -634,8 +695,9 @@ keyword, as described here:
 This instructs the server to load the module called
 .IR modulename .
 The module name given should be the module's standard name, not the
-module file name.  The standard name is case-sensitive, and does not
-include the "lib" prefix, or the ".a", ".o", or ".so" suffixes.
+module file name.
+The standard name is case\-sensitive, and does not include the \(lqlib\(rq
+prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes.
 .PP
 .RS 7
 Example: the Type 1 font rasteriser can be loaded with the following entry:
@@ -668,13 +730,13 @@ being
 that are passed to the module when it is loaded.
 .PP
 Example: the extmod module (which contains a miscellaneous group of
-server extensions) can be loaded, with the XFree86-DGA extension
+server extensions) can be loaded, with the XFree86\-DGA extension
 disabled by using the following entry:
 .PP
 .RS 4
 .nf
 .B "SubSection \*qextmod\*q"
-.B "   Option  \*qomit XFree86-DGA\*q"
+.B "   Option  \*qomit XFree86\-DGA\*q"
 .B EndSubSection
 .fi
 .RE
@@ -696,17 +758,20 @@ __projectroot__/lib/modules/extensions
 .fi
 .RE
 .PP
-The "bitmap" font modules is loaded automatically.  It is recommended
-that at very least the "extmod" extension module be loaded.  If it isn't
-some commonly used server extensions (like the SHAPE extension) will not be
-available.
-.SH INPUTDEVICE SECTION
+The \(lqbitmap\(rq font module is loaded automatically.
+It is recommended
+that at very least the \(lqextmod\(rq extension module be loaded.
+If it isn't, some commonly used server extensions (like the SHAPE
+extension) will not be available.
+.SH "INPUTDEVICE SECTION"
 The config file may have multiple
 .B InputDevice
-sections.  There will normally be at least two: one for the core (primary)
-keyboard, and one of the core pointer.  If either of these two is missing,
-a default configuration for the missing ones will be used.  Currently the
-default configuration may not work as expected on all platforms.
+sections.
+There will normally be at least two: one for the core (primary) keyboard,
+and one of the core pointer.
+If either of these two is missing, a default configuration for the missing
+ones will be used.
+Currently the default configuration may not work as expected on all platforms.
 .PP
 .B InputDevice
 sections have the following format:
@@ -728,18 +793,21 @@ and
 .B Driver
 entries are required in all
 .B InputDevice
-sections.  All other entries are optional.
+sections.
+All other entries are optional.
 .PP
 The
 .B Identifier
-entry specifies the unique name for this input device.  The
+entry specifies the unique name for this input device.
+The
 .B Driver
 entry specifies the name of the driver to use for this input device.
 When using the loadable server, the input driver module
 .RI \*q inputdriver \*q
 will be loaded for each active
 .B InputDevice
-section.  An
+section.
+An
 .B InputDevice
 section is considered active if it is referenced by an active
 .B ServerLayout
@@ -749,7 +817,10 @@ or
 .B \-pointer
 command line options, or if it is selected implicitly as the core pointer
 or keyboard device in the absence of such explicit references.
-The most commonly used input drivers are "keyboard" and "mouse".
+The most commonly used input drivers are
+.BR keyboard (__drivermansuffix__)
+and
+.BR mouse (__drivermansuffix__).
 .PP
 In the absence of an explicitly specified core input device, the first
 .B InputDevice
@@ -757,21 +828,24 @@ marked as
 .B CorePointer
 (or
 .BR CoreKeyboard )
-is used.  If there is no match there, the first
+is used.
+If there is no match there, the first
 .B InputDevice
-that uses the "mouse" (or "keyboard" or "kbd") driver is used.  The final
-fallback is to use built-in default configurations.
+that uses the \(lqmouse\(rq (or \(lqkeyboard\(rq or \(lqkbd\(rq) driver is used.
+The final fallback is to use built\-in default configurations.
 .PP
 .B InputDevice
-sections recognise some driver-independent
+sections recognise some driver\-independent
 .BR Options ,
-which are described here.  See the individual input driver manual pages
-for a description of the device-specific options.
+which are described here.
+See the individual input driver manual pages for a description of the
+device\-specific options.
 .TP 7
 .BI "Option \*qCorePointer\*q"
 When this is set, the input device is installed as the core (primary)
-pointer device.  There must be exactly one core pointer.  If this option
-is not set here, or in the
+pointer device.
+There must be exactly one core pointer.
+If this option is not set here, or in the
 .B ServerLayout
 section, or from the
 .B \-pointer
@@ -783,8 +857,9 @@ section is used.
 .TP 7
 .BI "Option \*qCoreKeyboard\*q"
 When this is set, the input device is to be installed as the core
-(primary) keyboard device.  There must be exactly one core keyboard.  If
-this option is not set here, in the
+(primary) keyboard device.
+There must be exactly one core keyboard.
+If this option is not set here, in the
 .B ServerLayout
 section, or from the
 .B \-keyboard
@@ -798,19 +873,21 @@ section is used.
 .TP 7
 .BI "Option \*qSendCoreEvents\*q  \*q" boolean \*q
 Both of these options are equivalent, and when enabled cause the
-input device to always report core events.  This can be used, for
-example, to allow an additional pointer device to generate core
-pointer events (like moving the cursor, etc).
+input device to always report core events.
+This can be used, for example, to allow an additional pointer device to
+generate core pointer events (like moving the cursor, etc).
 .TP 4
 .BI "Option \*qHistorySize\*q  \*q" number \*q
-Sets the motion history size.  Default: 0.
+Sets the motion history size.
+Default: 0.
 .TP 7
 .BI "Option \*qSendDragEvents\*q  \*q" boolean \*q
 ???
-.SH DEVICE SECTION
+.SH "DEVICE SECTION"
 The config file may have multiple
 .B Device
-sections.  There must be at least one, for the video card being used.
+sections.
+There must be at least one, for the video card being used.
 .PP
 .B Device
 sections have the following format:
@@ -836,27 +913,30 @@ sections.  All other entries are optiona
 .PP
 The
 .B Identifier
-entry specifies the unique name for this graphics device.  The
+entry specifies the unique name for this graphics device.
+The
 .B Driver
 entry specifies the name of the driver to use for this graphics device.
 When using the loadable server, the driver module
 .RI \*q driver \*q
 will be loaded for each active
 .B Device
-section.  A
+section.
+A
 .B Device
 section is considered active if it is referenced by an active
 .B Screen
 section.
 .PP
 .B Device
-sections recognise some driver-independent entries and
+sections recognise some driver\-independent entries and
 .BR Options ,
-which are described here.  Not all drivers make use of these
-driver-independent entries, and many of those that do don't require them
-to be specified because the information is auto-detected.  See the
-individual graphics driver manual pages for further information about
-this, and for a description of the device-specific options.
+which are described here.
+Not all drivers make use of these
+driver\-independent entries, and many of those that do don't require them
+to be specified because the information is auto\-detected.
+See the individual graphics driver manual pages for further information
+about this, and for a description of the device\-specific options.
 Note that most of the
 .B Options
 listed here (but not the other entries) may be specified in the
@@ -865,118 +945,133 @@ section instead of here in the
 .B Device
 section.
 .TP 7
-.BI "BusID  \*q" bus-id \*q
-This specifies the bus location of the graphics card.  For PCI/AGP cards,
+.BI "BusID  \*q" bus\-id \*q
+This specifies the bus location of the graphics card.
+For PCI/AGP cards,
 the
-.I bus-id
+.I bus\-id
 string has the form
 .BI PCI: bus : device : function
-(e.g., "PCI:1:0:0" might be appropriate for an AGP card).
+(e.g., \(lqPCI:1:0:0\(rq might be appropriate for an AGP card).
 This field is usually optional in single-head configurations when using
-the primary graphics card.  In multi-head configurations, or when using
-a secondary graphics card in a single-head configuration, this entry is
-mandatory.  Its main purpose is to make an unambiguous connection between
-the device section and the hardware it is representing.  This information
-can usually be found by running the __xservername__ server with the
+the primary graphics card.
+In multi-head configurations, or when using a secondary graphics card in a
+single-head configuration, this entry is mandatory.
+Its main purpose is to make an unambiguous connection between the device
+section and the hardware it is representing.
+This information can usually be found by running the __xservername__ server
+with the
 .B \-scanpci
 command line option.
 .TP 7
 .BI "Screen  " number
 This option is mandatory for cards where a single PCI entity can drive more
 than one display (i.e., multiple CRTCs sharing a single graphics accelerator
-and video memory).  One
+and video memory).
+One
 .B Device
 section is required for each head, and this
 parameter determines which head each of the
 .B Device
-sections applies to.  The legal values of
+sections applies to.
+The legal values of
 .I number
 range from 0 to one less than the total number of heads per entity.
 Most drivers require that the primary screen (0) be present.
 .TP 7
 .BI "Chipset  \*q" chipset \*q
 This usually optional entry specifies the chipset used on the graphics
-board.  In most cases this entry is not required because the drivers
-will probe the hardware to determine the chipset type.  Don't
-specify it unless the driver-specific documentation recommends that you
+board.
+In most cases this entry is not required because the drivers will probe the
+hardware to determine the chipset type.
+Don't specify it unless the driver-specific documentation recommends that you
 do.
 .TP 7
-.BI "Ramdac  \*q" ramdac-type \*q
+.BI "Ramdac  \*q" ramdac\-type \*q
 This optional entry specifies the type of RAMDAC used on the graphics
-board.  This is only used by a few of the drivers, and in most cases it
-is not required because the drivers will probe the hardware to determine
-the RAMDAC type where possible.  Don't specify it unless the
-driver-specific documentation recommends that you do.
+board.
+This is only used by a few of the drivers, and in most cases it is not
+required because the drivers will probe the hardware to determine the
+RAMDAC type where possible.
+Don't specify it unless the driver-specific documentation recommends that you
+do.
 .TP 7
 .BI "DacSpeed  " speed
 .TP 7
-.BI "DacSpeed  " "speed-8 speed-16 speed-24 speed-32"
+.BI "DacSpeed  " "speed\-8 speed\-16 speed\-24 speed\-32"
 This optional entry specifies the RAMDAC speed rating (which is usually
-printed on the RAMDAC chip).  The speed is in MHz.  When one value is
-given, it applies to all framebuffer pixel sizes.  When multiple values
-are give, they apply to the framebuffer pixel sizes 8, 16, 24 and 32
-respectively.  This is not used by many drivers, and only needs to be
-specified when the speed rating of the RAMDAC is different from the
-defaults built in to driver, or when the driver can't auto-detect the
-correct defaults.  Don't specify it unless the driver-specific
-documentation recommends that you do.
+printed on the RAMDAC chip).
+The speed is in MHz.
+When one value is given, it applies to all framebuffer pixel sizes.
+When multiple values are given, they apply to the framebuffer pixel sizes
+8, 16, 24 and 32 respectively.
+This is not used by many drivers, and only needs to be specified when the
+speed rating of the RAMDAC is different from the defaults built in to
+driver, or when the driver can't auto-detect the correct defaults.
+Don't specify it unless the driver-specific documentation recommends that you
+do.
 .TP 7
 .BI "Clocks  " "clock ..."
-specifies the pixel that are on your graphics board.  The clocks are in
-MHz, and may be specified as a floating point number.  The value is
-stored internally to the nearest kHz.  The ordering of the clocks is
-important.  It must match the order in which they are selected on the
-graphics board.  Multiple
+specifies the pixel that are on your graphics board.
+The clocks are in MHz, and may be specified as a floating point number.
+The value is stored internally to the nearest kHz.
+The ordering of the clocks is important.
+It must match the order in which they are selected on the graphics board.
+Multiple
 .B Clocks
-lines may be specified, and each is concatenated to form the list.  Most
-drivers do not use this entry, and it is only required for some older
-boards with non-programmable clocks.  Don't specify this entry unless
-the driver-specific documentation explicitly recommends that you do.
+lines may be specified, and each is concatenated to form the list.
+Most drivers do not use this entry, and it is only required for some older
+boards with non-programmable clocks.
+Don't specify this entry unless the driver-specific documentation explicitly
+recommends that you do.
 .TP
-.BI "ClockChip  \*q" clockchip-type \*q
+.BI "ClockChip  \*q" clockchip\-type \*q
 This optional entry is used to specify the clock chip type on graphics
-boards which have a programmable clock generator.  Only a few __xservername__
-drivers support programmable clock chips.  For details, see the appropriate
-driver manual page.
+boards which have a programmable clock generator.
+Only a few __xservername__ drivers support programmable clock chips.
+For details, see the appropriate driver manual page.
 .TP 7
 .BI "VideoRam  " "mem"
 This optional entry specifies the amount of video ram that is installed
-on the graphics board. This is measured in kBytes.  In most cases this
-is not required because the __xservername__ server probes the graphics board to
-determine this quantity.  The driver-specific documentation should
-indicate when it might be needed.
+on the graphics board.
+This is measured in kBytes.
+In most cases this is not required because the __xservername__ server probes
+the graphics board to determine this quantity.
+The driver-specific documentation should indicate when it might be needed.
 .TP 7
 .BI "BiosBase  " "baseaddress"
 This optional entry specifies the base address of the video BIOS for
-the VGA board.  This address is normally auto-detected, and should only
-be specified if the driver-specific documentation recommends it.
+the VGA board.
+This address is normally auto-detected, and should only be specified if the
+driver-specific documentation recommends it.
 .TP 7
 .BI "MemBase  " "baseaddress"
 This optional entry specifies the memory base address of a graphics
-board's linear frame buffer.  This entry is not used by many drivers,
-and it should only be specified if the driver-specific documentation
-recommends it.
+board's linear frame buffer.
+This entry is not used by many drivers, and it should only be specified if
+the driver-specific documentation recommends it.
 .TP 7
 .BI "IOBase  " "baseaddress"
-This optional entry specifies the IO base address.  This entry is not
-used by many drivers, and it should only be specified if the
-driver-specific documentation recommends it.
+This optional entry specifies the IO base address.
+This entry is not used by many drivers, and it should only be specified if
+the driver-specific documentation recommends it.
 .TP 7
 .BI "ChipID  " "id"
 This optional entry specifies a numerical ID representing the chip type.
-For PCI cards, it is usually the device ID.  This can be used to override
-the auto-detection, but that should only be done when the driver-specific
-documentation recommends it.
+For PCI cards, it is usually the device ID.
+This can be used to override the auto-detection, but that should only be done
+when the driver-specific documentation recommends it.
 .TP 7
 .BI "ChipRev  " "rev"
-This optional entry specifies the chip revision number.  This can be
-used to override the auto-detection, but that should only be done when
-the driver-specific documentation recommends it.
+This optional entry specifies the chip revision number.
+This can be used to override the auto-detection, but that should only be done
+when the driver-specific documentation recommends it.
 .TP 7
 .BI "TextClockFreq  " "freq"
 This optional entry specifies the pixel clock frequency that is used
-for the regular text mode.  The frequency is specified in MHz.  This is
-rarely used.
+for the regular text mode.
+The frequency is specified in MHz.
+This is rarely used.
 .TP 7
 .BI "Option \*qModeDebug\*q \*q" boolean \*q
 Enable printing of additional debugging information about modesetting to
@@ -989,19 +1084,22 @@ This optional entry allows an IRQ number
 .B Options
 Option flags may be specified in the
 .B Device
-sections.  These include driver-specific options and driver-independent
-options.  The former are described in the driver-specific documentation.
+sections.
+These include driver\-specific options and driver\-independent options.
+The former are described in the driver\-specific documentation.
 Some of the latter are described below in the section about the
 .B Screen
 section, and they may also be included here.
 
-.SH VIDEOADAPTOR SECTION
-Nobody wants to say how this works.  Maybe nobody knows ...
+.SH "VIDEOADAPTOR SECTION"
+Nobody wants to say how this works.
+Maybe nobody knows ...
 
-.SH MONITOR SECTION
+.SH "MONITOR SECTION"
 The config file may have multiple
 .B Monitor
-sections.  There should normally be at least one, for the monitor being used,
+sections.
+There should normally be at least one, for the monitor being used,
 but a default configuration will be created when one isn't specified.
 .PP
 .B Monitor
@@ -1025,7 +1123,8 @@ entry.
 .PP
 The
 .B Identifier
-entry specifies the unique name for this monitor.  The
+entry specifies the unique name for this monitor.
+The
 .B Monitor
 section may be used to provide information about the specifications of the
 monitor, monitor-specific
@@ -1033,8 +1132,8 @@ monitor, monitor-specific
 and information about the video modes to use with the monitor.
 .PP
 With RandR 1.2-enabled drivers, monitor sections are tied to specific outputs 
-of the video card.  Each output has a name, and the server will look for a
-Monitor named
+of the video card.
+Each output has a name, and the server will look for a Monitor named
 .B \*qMonitor-outputname\*q
 for configuration of that output (for example, 
 .B \*qMonitor-VGA\*q
@@ -1042,16 +1141,17 @@ for a VGA output)
 .PP
 Specifying video modes is optional because the server will use the DDC or other
 information provided by the monitor to automatically configure the list of
-modes available.  When modes are specified explicitly in the
+modes available.
+When modes are specified explicitly in the
 .B Monitor
 section (with the
 .BR Modes ,
 .BR ModeLine ,
 or
 .B UseModes
-keywords), built-in modes with the same names are not included.  Built-in
-modes with different names are, however, still implicitly included, when they
-meet the requirements of the monitor.
+keywords), built-in modes with the same names are not included.
+Built-in modes with different names are, however, still implicitly included,
+when they meet the requirements of the monitor.
 .PP
 The entries that may be used in
 .B Monitor
@@ -1063,69 +1163,79 @@ This optional entry specifies the monito
 .BI "ModelName  \*q" model \*q
 This optional entry specifies the monitor's model.
 .TP 7
-.BI "HorizSync  " "horizsync-range"
+.BI "HorizSync  " "horizsync\-range"
 gives the range(s) of horizontal sync frequencies supported by the
 monitor.
-.I horizsync-range
+.I horizsync\-range
 may be a comma separated list of either discrete values or ranges of
-values.  A range of values is two values separated by a dash.  By default
-the values are in units of kHz.  They may be specified in MHz or Hz if
+values.
+A range of values is two values separated by a dash.
+By default the values are in units of kHz.
+They may be specified in MHz or Hz
+if
 .B MHz
 or
 .B Hz
-is added to the end of the line.  The data given here is used by the
-__xservername__ server to determine if video modes are within the specifications
-of the monitor.  This information should be available in the monitor's
-handbook.  If this entry is omitted, a default range of 28\-33kHz is
-used.
+is added to the end of the line.
+The data given here is used by the __xservername__ server to determine if video
+modes are within the specifications of the monitor.
+This information should be available in the monitor's handbook.
+If this entry is omitted, a default range of 28\-33kHz is used.
 .TP 7
-.BI "VertRefresh  " "vertrefresh-range"
+.BI "VertRefresh  " "vertrefresh\-range"
 gives the range(s) of vertical refresh frequencies supported by the
 monitor.
-.I vertrefresh-range
+.I vertrefresh\-range
 may be a comma separated list of either discrete values or ranges of
-values.  A range of values is two values separated by a dash.  By default
-the values are in units of Hz.  They may be specified in MHz or kHz if
+values.
+A range of values is two values separated by a dash.
+By default the values are in units of Hz.
+They may be specified in MHz or kHz
+if
 .B MHz
 or
 .B kHz
-is added to the end of the line.  The data given here is used by the
-__xservername__ server to determine if video modes are within the specifications
-of the monitor.  This information should be available in the monitor's
-handbook.  If this entry is omitted, a default range of 43-72Hz is used.
+is added to the end of the line.
+The data given here is used by the __xservername__ server to determine if video
+modes are within the specifications of the monitor.
+This information should be available in the monitor's handbook.
+If this entry is omitted, a default range of 43\-72Hz is used.
 .TP 7
 .BI "DisplaySize  " "width height"
 This optional entry gives the width and height, in millimetres, of the
-picture area of the monitor. If given this is used to calculate the
-horizontal and vertical pitch (DPI) of the screen.
+picture area of the monitor.
+If given this is used to calculate the horizontal and vertical pitch (DPI) of
+the screen.
 .TP 7
-.BI "Gamma  " "gamma-value"
+.BI "Gamma  " "gamma\-value"
 .TP 7
-.BI "Gamma  " "red-gamma green-gamma blue-gamma"
+.BI "Gamma  " "red\-gamma green\-gamma blue\-gamma"
 This is an optional entry that can be used to specify the gamma correction
-for the monitor.  It may be specified as either a single value or as
-three separate RGB values.  The values should be in the range 0.1 to
-10.0, and the default is 1.0.  Not all drivers are capable of using this
-information.
+for the monitor.
+It may be specified as either a single value or as three separate RGB values.
+The values should be in the range 0.1 to 10.0, and the default is 1.0.
+Not all drivers are capable of using this information.
 .TP 7
-.BI "UseModes  \*q" modesection-id \*q
+.BI "UseModes  \*q" modesection\-id \*q
 Include the set of modes listed in the
 .B Modes
 section called
-.IR modesection-id.
+.IR modesection\-id.
 This makes all of the modes defined in that section available for use by
 this monitor.
 .TP 7
 .BI "Mode  \*q" name \*q
 This is an optional multi-line entry that can be used to provide
-definitions for video modes for the monitor.  In most cases this isn't
-necessary because the built-in set of VESA standard modes will be
-sufficient.  The
+definitions for video modes for the monitor.
+In most cases this isn't necessary because the built-in set of VESA standard
+modes will be sufficient.
+The
 .B Mode
 keyword indicates the start of a multi-line video mode description.
 The mode description is terminated with the
 .B EndMode
-keyword.  The mode description consists of the following entries:
+keyword.
+The mode description consists of the following entries:
 .RS 7
 .TP 4
 .BI "DotClock  " clock
@@ -1161,52 +1271,60 @@ and
 may be used to select the composite sync polarity.
 .TP 4
 .BI "HSkew  " hskew
-specifies the number of pixels (towards the right edge of the screen)
-by which the display enable signal is to be skewed.  Not all drivers
-use this information.  This option might become necessary to override
-the default value supplied by the server (if any).  "Roving" horizontal
-lines indicate this value needs to be increased.  If the last few pixels
-on a scan line appear on the left of the screen, this value should be
-decreased.
+specifies the number of pixels (towards the right edge of the screen) by
+which the display enable signal is to be skewed.
+Not all drivers use this information.
+This option might become necessary to override the default value supplied
+by the server (if any).
+\(lqRoving\(rq horizontal lines indicate this value needs to be increased.
+If the last few pixels on a scan line appear on the left of the screen,
+this value should be decreased.
 .TP 4
 .BI "VScan  " vscan
 specifies the number of times each scanline is painted on the screen.
-Not all drivers use this information.  Values less than 1 are treated
-as 1, which is the default.  Generally, the
+Not all drivers use this information.
+Values less than 1 are treated as 1, which is the default.
+Generally, the
 .B \*qDoubleScan\*q
 .B Flag
 mentioned above doubles this value.
 .RE
 .TP 7
-.BI "ModeLine  \*q" name \*q " mode-description"
+.BI "ModeLine  \*q" name \*q " mode\-description"
 This entry is a more compact version of the
 .B Mode
 entry, and it also can be used to specify video modes for the monitor.
-is a single line format for specifying video modes.  In most cases this
-isn't necessary because the built-in set of VESA standard modes will be
-sufficient.
+is a single line format for specifying video modes.
+In most cases this isn't necessary because the built\-in set of VESA
+standard modes will be sufficient.
 .PP
 .RS 7
 The
-.I mode-description
-is in four sections, the first three of which are mandatory.  The first
-is the dot (pixel) clock.  This is a single number specifying the pixel
-clock rate for the mode in MHz.  The second section is a list of four
-numbers specifying the horizontal timings.  These numbers are the
+.I mode\-description
+is in four sections, the first three of which are mandatory.
+The first is the dot (pixel) clock.
+This is a single number specifying the pixel clock rate for the mode in
+MHz.
+The second section is a list of four numbers specifying the horizontal
+timings.
+These numbers are the
 .IR hdisp ,
 .IR hsyncstart ,
 .IR hsyncend ,
 and
 .I htotal
-values.  The third section is a list of four numbers specifying the
-vertical timings.  These numbers are the
+values.
+The third section is a list of four numbers specifying the vertical
+timings.
+These numbers are the
 .IR vdisp ,
 .IR vsyncstart ,
 .IR vsyncend ,
 and
 .I vtotal
-values.  The final section is a list of flags specifying other
-characteristics of the mode.
+values.
+The final section is a list of flags specifying other characteristics of
+the mode.
 .B Interlace
 indicates that the mode is interlaced.
 .B DoubleScan
@@ -1225,7 +1343,8 @@ Additionally, on some hardware,
 .B +CSync
 and
 .B \-CSync
-may be used to select the composite sync polarity.  The
+may be used to select the composite sync polarity.
+The
 .B HSkew
 and
 .B VScan
@@ -1305,20 +1424,22 @@ Valid values for rotation are \*qnormal\
 \*qinverted\*q.
 (RandR 1.2-supporting drivers only)
 
-.SH MODES SECTION
+.SH "MODES SECTION"
 The config file may have multiple
 .B Modes
-sections, or none.  These sections provide a way of defining sets of
-video modes independently of the
+sections, or none.
+These sections provide a way of defining sets of video modes independently
+of the
 .B Monitor
 sections.
 .B Monitor
 sections may include the definitions provided in these sections by
 using the
 .B UseModes
-keyword.  In most cases the
+keyword.
+In most cases the
 .B Modes
-sections are not necessary because the built-in set of VESA standard modes
+sections are not necessary because the built\-in set of VESA standard modes
 will be sufficient.
 .PP
 .B Modes
@@ -1346,21 +1467,24 @@ and
 entries that are described above in the
 .B Monitor
 section.
-.SH SCREEN SECTION
+.SH "SCREEN SECTION"
 The config file may have multiple
 .B Screen
-sections.  There must be at least one, for the "screen" being used.
-A "screen" represents the binding of a graphics device
+sections.
+There must be at least one, for the \(lqscreen\(rq being used.
+A \(lqscreen\(rq represents the binding of a graphics device
 .RB ( Device
 section) and a monitor
 .RB ( Monitor
-section).  A
+section).
+A
 .B Screen
-section is considered "active" if it is referenced by an active
+section is considered \(lqactive\(rq if it is referenced by an active
 .B ServerLayout
 section or by the
 .B \-screen
-command line option.  If neither of those is present, the first
+command line option.
+If neither of those is present, the first
 .B Screen
 section found in the config file is considered the active one.
 .PP
@@ -1388,94 +1512,104 @@ The
 .B Identifier
 and
 .B Device
-entries are mandatory.  All others are optional.
+entries are mandatory.
+All others are optional.
 .PP
 The
 .B Identifier
-entry specifies the unique name for this screen.  The
+entry specifies the unique name for this screen.
+The
 .B Screen
 section provides information specific to the whole screen, including
-screen-specific
+screen\-specific
 .BR Options .
-In multi-head configurations, there will be multiple active
+In multi\-head configurations, there will be multiple active
 .B Screen
 sections, one for each head.
 The entries available
 for this section are:
 .TP 7
-.BI "Device  \*q" device-id \*q
+.BI "Device  \*q" device\-id \*q
 This mandatory entry specifies the
 .B Device
-section to be used for this screen.  This is what ties a specific
-graphics card to a screen.  The
-.I device-id
+section to be used for this screen.
+This is what ties a specific graphics card to a screen.
+The
+.I device\-id
 must match the
 .B Identifier
 of a
 .B Device
 section in the config file.
 .TP 7
-.BI "Monitor  \*q" monitor-id \*q
+.BI "Monitor  \*q" monitor\-id \*q
 specifies which monitor description is to be used for this screen.
 If a
 .B Monitor
-name is not specified, a default configuration is used.  Currently the default
-configuration may not function as expected on all platforms.
+name is not specified, a default configuration is used.
+Currently the default configuration may not function as expected on all
+platforms.
 .TP 7
-.BI "VideoAdaptor  \*q" xv-id \*q
+.BI "VideoAdaptor  \*q" xv\-id \*q
 specifies an optional Xv video adaptor description to be used with this
 screen.
 .TP 7
 .BI "DefaultDepth  " depth
-specifies which color depth the server should use by default.  The
+specifies which color depth the server should use by default.
+The
 .B \-depth
-command line option can be used to override this.  If neither is specified,
-the default depth is driver-specific, but in most cases is 8.
+command line option can be used to override this.
+If neither is specified, the default depth is driver\-specific, but in most
+cases is 8.
 .TP 7
 .BI "DefaultFbBpp  " bpp
-specifies which framebuffer layout to use by default.  The
+specifies which framebuffer layout to use by default.
+The
 .B \-fbbpp
-command line option can be used to override this.  In most cases the
-driver will chose the best default value for this.  The only case where
-there is even a choice in this value is for depth 24, where some hardware
-supports both a packed 24 bit framebuffer layout and a sparse 32 bit
-framebuffer layout.
+command line option can be used to override this.
+In most cases the driver will chose the best default value for this.
+The only case where there is even a choice in this value is for depth 24,
+where some hardware supports both a packed 24 bit framebuffer layout and a
+sparse 32 bit framebuffer layout.
 .TP 7
 .B Options
 Various
 .B Option
 flags may be specified in the
 .B Screen
-section.  Some are driver-specific and are described in the driver
-documentation.  Others are driver-independent, and will eventually be
-described here.
+section.
+Some are driver\-specific and are described in the driver documentation.
+Others are driver\-independent, and will eventually be described here.
 .\" XXX These should really be in an xaa man page.
 .TP 7
 .BI "Option \*qAccel\*q"
 Enables XAA (X Acceleration Architecture), a mechanism that makes video
-cards' 2D hardware acceleration available to the 
-__xservername__ server.  This
-option is on by default, but it may be necessary to turn it off if there
-are bugs in the driver.  There are many options to disable specific
-accelerated operations, listed below.  Note that disabling an operation
-will have no effect if the operation is not accelerated (whether due to
-lack of support in the hardware or in the driver).
+cards' 2D hardware acceleration available to the  __xservername__ server.
+This option is on by default, but it may be necessary to turn it off if
+there are bugs in the driver.
+There are many options to disable specific accelerated operations, listed
+below.
+Note that disabling an operation will have no effect if the operation is
+not accelerated (whether due to lack of support in the hardware or in the
+driver).
 .TP 7
 .BI "Option \*qBiosLocation\*q \*q" address \*q
 Set the location of the BIOS for the Int10 module. One may select a BIOS
 of another card for posting or the legacy V_BIOS range located at 0xc0000
-or an alternative address (BUS_ISA).  This is only useful under very
-special circumstances and should be used with extreme care.
+or an alternative address (BUS_ISA).
+This is only useful under very special circumstances and should be used with
+extreme care.
 .TP 7
 .BI "Option \*qInitPrimary\*q \*q" boolean \*q
-Use the Int10 module to initialize the primary graphics card. Normally,
-only secondary cards are soft-booted using the Int10 module, as the
+Use the Int10 module to initialize the primary graphics card.
+Normally, only secondary cards are soft-booted using the Int10 module, as the
 primary card has already been initialized by the BIOS at boot time.
 Default: false.
 .TP 7
 .BI "Option \*qNoInt10\*q \*q" boolean \*q
 Disables the Int10 module, a module that uses the int10 call to the BIOS
-of the graphics card to initialize it. Default: false.
+of the graphics card to initialize it.
+Default: false.
 .TP 7
 .BI "Option \*qNoMTRR\*q"
 Disables MTRR (Memory Type Range Register) support, a feature of modern
@@ -1485,14 +1619,14 @@ known to exhibit problems when MTRR's ar
 .TP 7
 .BI "Option \*qXaaNoCPUToScreenColorExpandFill\*q"
 Disables accelerated rectangular expansion blits from source patterns
-stored in system memory (using a memory-mapped aperture).
+stored in system memory (using a memory\-mapped aperture).
 .TP 7
 .BI "Option \*qXaaNoColor8x8PatternFillRect\*q"
-Disables accelerated fills of a rectangular region with a full-color
+Disables accelerated fills of a rectangular region with a full\-color
 pattern.
 .TP 7
 .BI "Option \*qXaaNoColor8x8PatternFillTrap\*q"
-Disables accelerated fills of a trapezoidal region with a full-color
+Disables accelerated fills of a trapezoidal region with a full\-color
 pattern.
 .TP 7
 .BI "Option \*qXaaNoDashedBresenhamLine\*q"
@@ -1502,8 +1636,8 @@ Disables accelerated dashed Bresenham li
 Disables accelerated dashed line draws between two arbitrary points.
 .TP 7
 .BI "Option \*qXaaNoImageWriteRect\*q"
-Disables accelerated transfers of full-color rectangular patterns from
-system memory to video memory (using a memory-mapped aperture).
+Disables accelerated transfers of full\-color rectangular patterns from
+system memory to video memory (using a memory\-mapped aperture).
 .TP 7
 .BI "Option \*qXaaNoMono8x8PatternFillRect\*q"
 Disables accelerated fills of a rectangular region with a monochrome
@@ -1524,7 +1658,7 @@ Disables accelerated rectangular expansi
 stored in system memory (one scan line at a time).
 .TP 7
 .BI "Option \*qXaaNoScanlineImageWriteRect\*q"
-Disables accelerated transfers of full-color rectangular patterns from
+Disables accelerated transfers of full\-color rectangular patterns from
 system memory to video memory (one scan line at a time).
 .TP 7
 .BI "Option \*qXaaNoScreenToScreenColorExpandFill\*q"
@@ -1539,10 +1673,10 @@ video memory to another part of video me
 Disables accelerated solid Bresenham line draws.
 .TP 7
 .BI "Option \*qXaaNoSolidFillRect\*q"
-Disables accelerated solid-color fills of rectangles.
+Disables accelerated solid\-color fills of rectangles.
 .TP 7
 .BI "Option \*qXaaNoSolidFillTrap\*q"
-Disables accelerated solid-color fills of Bresenham trapezoids.
+Disables accelerated solid\-color fills of Bresenham trapezoids.
 .TP 7
 .BI "Option \*qXaaNoSolidHorVertLine\*q"
 Disables accelerated solid horizontal and vertical line draws.
@@ -1554,27 +1688,30 @@ Each
 .B Screen
 section may optionally contain one or more
 .B Display
-subsections.  Those subsections provide depth/fbbpp specific configuration
-information, and the one chosen depends on the depth and/or fbbpp that
-is being used for the screen.  The
+subsections.
+Those subsections provide depth/fbbpp specific configuration information,
+and the one chosen depends on the depth and/or fbbpp that is being used for
+the screen.
+The
 .B Display
 subsection format is described in the section below.
 
-.SH DISPLAY SUBSECTION
+.SH "DISPLAY SUBSECTION"
 Each
 .B Screen
 section may have multiple
 .B Display
-subsections.  
-The "active"
+subsections.
+The \(lqactive\(rq
 .B Display
 subsection is the first that matches the depth and/or fbbpp values being
 used, or failing that, the first that has neither a depth or fbbpp value
-specified.  The
+specified.
+The
 .B Display
-subsections are optional.  When there isn't one that matches the depth
-and/or fbbpp values being used, all the parameters that can be specified
-here fall back to their defaults.
+subsections are optional.
+When there isn't one that matches the depth and/or fbbpp values being used,
+all the parameters that can be specified here fall back to their defaults.
 .PP
 .B Display
 subsections have the following format:
@@ -1588,78 +1725,88 @@ subsections have the following format:
 .B  "    EndSubSection"
 .fi
 .RE
-.PP
 .TP 7
 .BI "Depth  " depth
 This entry specifies what colour depth the
 .B Display
-subsection is to be used for.  This entry is usually specified,
-but it may be omitted to create a match-all
+subsection is to be used for.
+This entry is usually specified, but it may be omitted to create a match\-all
 .B Display
 subsection or when wishing to match only against the
 .B FbBpp
-parameter.  The range of
+parameter.
+The range of
 .I depth
-values that are allowed depends on the driver.  Most driver support
-8, 15, 16 and 24.  Some also support 1 and/or 4, and some may support
-other values (like 30).  Note:
+values that are allowed depends on the driver.
+Most drivers support 8, 15, 16 and 24.
+Some also support 1 and/or 4, and some may support other values (like 30).
+Note:
 .I depth
 means the number of bits in a pixel that are actually used to determine
-the pixel colour.  32 is not a valid
+the pixel colour.
+32 is not a valid
 .I depth
-value.  Most hardware that uses 32 bits per pixel only uses 24 of them
-to hold the colour information, which means that the colour depth is
-24, not 32.
+value.
+Most hardware that uses 32 bits per pixel only uses 24 of them to hold the
+colour information, which means that the colour depth is 24, not 32.
 .TP 7
 .BI "FbBpp  " bpp
 This entry specifies the framebuffer format this
 .B Display
-subsection is to be used for.  This entry is only needed when providing
-depth 24 configurations that allow a choice between a 24 bpp packed
-framebuffer format and a 32bpp sparse framebuffer format.  In most cases
-this entry should not be used.
+subsection is to be used for.
+This entry is only needed when providing depth 24 configurations that allow
+a choice between a 24 bpp packed framebuffer format and a 32bpp sparse
+framebuffer format.
+In most cases this entry should not be used.
 .TP 7
-.BI "Weight  " "red-weight green-weight blue-weight"
+.BI "Weight  " "red\-weight green\-weight blue\-weight"
 This optional entry specifies the relative RGB weighting to be used
 for a screen is being used at depth 16 for drivers that allow multiple
-formats.  This may also be specified from the command line with the
+formats.
+This may also be specified from the command line with the
 .B \-weight
-option (see __xservername__(__appmansuffix__)).
+option (see
+.BR __xservername__(__appmansuffix__)).
 .TP 7
 .BI "Virtual  " "xdim ydim"
 This optional entry specifies the virtual screen resolution to be used.
 .I xdim
 must be a multiple of either 8 or 16 for most drivers, and a multiple
-of 32 when running in monochrome mode.  The given value will be rounded
-down if this is not the case.  Video modes which are too large for the
-specified virtual size will be rejected.  If this entry is not present,
-the virtual screen resolution will be set to accommodate all the valid
-video modes given in the
+of 32 when running in monochrome mode.
+The given value will be rounded down if this is not the case.
+Video modes which are too large for the specified virtual size will be
+rejected.
+If this entry is not present, the virtual screen resolution will be set to
+accommodate all the valid video modes given in the
 .B Modes
-entry.  Some drivers/hardware combinations do not support virtual screens.
-Refer to the appropriate driver-specific documentation for details.
+entry.
+Some drivers/hardware combinations do not support virtual screens.
+Refer to the appropriate driver\-specific documentation for details.
 .TP 7
 .BI "ViewPort  " "x0 y0"
 This optional entry sets the upper left corner of the initial display.
 This is only relevant when the virtual screen resolution is different
-from the resolution of the initial video mode.  If this entry is not
-given, then the initial display will be centered in the virtual display
-area.
-.TP 7
-.BI "Modes  \*q" mode-name \*q " ..."
-This optional entry specifies the list of video modes to use.  Each
-.I mode-name
-specified must be in double quotes.  They must correspond to those
-specified or referenced in the appropriate
+from the resolution of the initial video mode.
+If this entry is not given, then the initial display will be centered in
+the virtual display area.
+.TP 7
+.BI "Modes  \*q" mode\-name \*q " ..."
+This optional entry specifies the list of video modes to use.
+Each
+.I mode\-name
+specified must be in double quotes.
+They must correspond to those specified or referenced in the appropriate
 .B Monitor
-section (including implicitly referenced built-in VESA standard modes).
+section (including implicitly referenced built\-in VESA standard modes).
 The server will delete modes from this list which don't satisfy various
-requirements.  The first valid mode in this list will be the default
-display mode for startup.  The list of valid modes is converted internally
-into a circular list.  It is possible to switch to the next mode with
-.B Ctrl+Alt+Keypad-Plus
+requirements.
+The first valid mode in this list will be the default display mode for
+startup.
+The list of valid modes is converted internally into a circular list.
+It is possible to switch to the next mode with
+.B Ctrl+Alt+Keypad\-Plus
 and to the previous mode with
-.BR Ctrl+Alt+Keypad-Minus .
+.BR Ctrl+Alt+Keypad\-Minus .
 When this entry is omitted, the valid modes referenced by the appropriate
 .B Monitor
 section will be used.  If the
@@ -1667,10 +1814,12 @@ section will be used.  If the
 section contains no modes, then the selection will be taken from the
 built-in VESA standard modes.
 .TP 7
-.BI "Visual  \*q" visual-name \*q
-This optional entry sets the default root visual type.  This may also
-be specified from the command line (see the Xserver(__appmansuffix__) man page).  The
-visual types available for depth 8 are (default is
+.BI "Visual  \*q" visual\-name \*q
+This optional entry sets the default root visual type.
+This may also be specified from the command line (see the
+.BR Xserver(__appmansuffix__)
+man page).
+The visual types available for depth 8 are (default is
 .BR PseudoColor ):
 .PP
 .RS 11
@@ -1716,43 +1865,48 @@ The visual type available for the depth 
 .RE
 .TP 7
 .BI "Black  " "red green blue"
-This optional entry allows the "black" colour to be specified.  This
-is only supported at depth 1.  The default is black.
+This optional entry allows the \(lqblack\(rq colour to be specified.
+This is only supported at depth 1.
+The default is black.
 .TP 7
 .BI "White  " "red green blue"
-This optional entry allows the "white" colour to be specified.  This
-is only supported at depth 1.  The default is white.
+This optional entry allows the \(lqwhite\(rq colour to be specified.
+This is only supported at depth 1.
+The default is white.
 .TP 7
 .B Options
 Option flags may be specified in the
 .B Display
-subsections.  These may include driver-specific options and
-driver-independent options.  The former are described in the
-driver-specific documentation.  Some of the latter are described above
-in the section about the
+subsections.
+These may include driver\-specific options and driver\-independent options.
+The former are described in the driver\-specific documentation.
+Some of the latter are described above in the section about the
 .B Screen
 section, and they may also be included here.
-.SH SERVERLAYOUT SECTION
+.SH "SERVERLAYOUT SECTION"
 The config file may have multiple
 .B ServerLayout
-sections.  
-A "server layout" represents the binding of one or more screens
+sections.
+A \(lqserver layout\(rq represents the binding of one or more screens
 .RB ( Screen
 sections) and one or more input devices
 .RB ( InputDevice
-sections) to form a complete configuration.  In multi-head configurations,
-it also specifies the relative layout of the heads.  A
+sections) to form a complete configuration.
+In multi\-head configurations, it also specifies the relative layout of the
+heads.
+A
 .B ServerLayout
-section is considered "active" if it is referenced by the
+section is considered \(lqactive\(rq if it is referenced by the
 .B \-layout
 command line option or by an
 .B "Option \*qDefaultServerLayout\*q"
 entry in the
 .B ServerFlags
-section (the former takes precedence over the latter).  If those options are
-not used, the first
+section (the former takes precedence over the latter).
+If those options are not used, the first
 .B ServerLayout
-section found in the config file is considered the active one.  If no
+section found in the config file is considered the active one.
+If no
 .B ServerLayout
 sections are present, the single active screen and two active (core)
 input devices are selected as described in the relevant sections above.
@@ -1764,9 +1918,9 @@ sections have the following format:
 .nf
 .B  "Section \*qServerLayout\*q"
 .BI "    Identifier   \*q" name \*q
-.BI "    Screen       \*q" screen-id \*q
+.BI "    Screen       \*q" screen\-id \*q
 .I  "    ..."
-.BI "    InputDevice  \*q" idev-id \*q
+.BI "    InputDevice  \*q" idev\-id \*q
 .I  "    ..."
 .I  "    options"
 .I  "    ..."
@@ -1784,10 +1938,11 @@ entry.
 .PP
 The
 .B Identifier
-entry specifies the unique name for this server layout.  The
+entry specifies the unique name for this server layout.
+The
 .B ServerLayout
 section provides information specific to the whole session, including
-session-specific
+session\-specific
 .BR Options .
 The
 .B ServerFlags
@@ -1798,21 +1953,25 @@ section.
 .PP
 The entries that may be used in this section are described here.
 .TP 7
-.BI "Screen  " "screen-num" " \*qscreen-id\*q " "position-information"
+.BI "Screen  " "screen\-num" " \*qscreen\-id\*q " "position\-information"
 One of these entries must be given for each screen being used in
-a session.  The
-.I screen-id
+a session.
+The
+.I screen\-id
 field is mandatory, and specifies the
 .B Screen
-section being referenced.  The
-.I screen-num
+section being referenced.
+The
+.I screen\-num
 field is optional, and may be used to specify the screen number
-in multi-head configurations.  When this field is omitted, the
-screens will be numbered in the order that they are listed in.
-The numbering starts from 0, and must be consecutive.  The
-.I position-information
-field describes the way multiple screens are positioned.  There are
-a number of different ways that this information can be provided:
+in multi\-head configurations.
+When this field is omitted, the screens will be numbered in the order that
+they are listed in.
+The numbering starts from 0, and must be consecutive.
+The
+.I position\-information
+field describes the way multiple screens are positioned.
+There are a number of different ways that this information can be provided:
 .RS 7
 .TP 4
 .I  "x y"
@@ -1822,48 +1981,53 @@ These both specify that the upper left c
 .RI ( x , y ).
 The
 .B Absolute
-keyword is optional.  Some older versions of __xservername__ (4.2 and earlier) don't
-recognise the
+keyword is optional.
+Some older versions of __xservername__ (4.2 and earlier) don't recognise the
 .B Absolute
 keyword, so it's safest to just specify the coordinates without it.
 .TP 4
-.BI "RightOf   \*q" screen-id \*q
+.BI "RightOf   \*q" screen\-id \*q
 .TP 4
-.BI "LeftOf    \*q" screen-id \*q
+.BI "LeftOf    \*q" screen\-id \*q
 .TP 4
-.BI "Above     \*q" screen-id \*q
+.BI "Above     \*q" screen\-id \*q
 .TP 4
-.BI "Below     \*q" screen-id \*q
+.BI "Below     \*q" screen\-id \*q
 .TP 4
-.BI "Relative  \*q" screen-id \*q " x y"
-These give the screen's location relative to another screen.  The first four
-position the screen immediately to the right, left, above or below the
-other screen.  When positioning to the right or left, the top edges are
-aligned.  When positioning above or below, the left edges are aligned.
+.BI "Relative  \*q" screen\-id \*q " x y"
+These give the screen's location relative to another screen.
+The first four position the screen immediately to the right, left, above or
+below the other screen.
+When positioning to the right or left, the top edges are aligned.
+When positioning above or below, the left edges are aligned.
 The
 .B Relative
 form specifies the offset of the screen's origin (upper left corner)
 relative to the origin of another screen.
 .RE
 .TP 7
-.BI "InputDevice  \*q" idev-id "\*q \*q" option \*q " ..."
+.BI "InputDevice  \*q" idev\-id "\*q \*q" option \*q " ..."
 One of these entries should be given for each input device being used in
-a session.  Normally at least two are required, one each for the core
-pointer and keyboard devices.  If either of those is missing, suitable
+a session.
+Normally at least two are required, one each for the core pointer and
+keyboard devices.
+If either of those is missing, suitable
 .B InputDevice
 entries are searched for using the method described above in the
 .B INPUTDEVICE
 section.  The
-.I idev-id
+.I idev\-id
 field is mandatory, and specifies the name of the
 .B InputDevice
-section being referenced.  Multiple
+section being referenced.
+Multiple
 .I option
-fields may be specified, each in double quotes.  The options permitted
-here are any that may also be given in the
+fields may be specified, each in double quotes.
+The options permitted here are any that may also be given in the
 .B InputDevice
-sections.  Normally only session-specific input device options would be
-used here.  The most commonly used options are:
+sections.
+Normally only session\-specific input device options would be used here.
+The most commonly used options are:
 .PP
 .RS 11
 .nf
@@ -1881,8 +2045,9 @@ and core keyboard devices respectively.
 .B Options
 In addition to the following, any option permitted in the
 .B ServerFlags
-section may also be specified here.  When the same option appears in both
-places, the value given here overrides the one given in the
+section may also be specified here.
+When the same option appears in both places, the value given here overrides
+the one given in the
 .B ServerFlags
 section.
 .TP 7
@@ -1895,9 +2060,11 @@ option (described in
 .BR "DEVICE SECTION" ,
 above) for the format of the
 .I bus\-id
-parameter.  This option overrides
+parameter.
+This option overrides
 .BR SingleCard ,
-if specified.  At present, only PCI devices can be isolated in this manner.
+if specified.
+At present, only PCI devices can be isolated in this manner.
 .TP 7
 .BI "Option \*qSingleCard\*q  \*q" boolean \*q
 As
@@ -1921,68 +2088,97 @@ section for a dual headed configuration 
 .B "EndSection"
 .fi
 .RE
-.SH DRI SECTION
+.SH "DRI SECTION"
 This optional section is used to provide some information for the
-Direct Rendering Infrastructure.  Details about the format of this section
-can be found on-line at
+Direct Rendering Infrastructure.  
+Details about the format of this section
+can be found in the README.DRI document, which is also available on-line at
 .IR <http://dri.freedesktop.org/> .
-.SH VENDOR SECTION
+.SH "VENDOR SECTION"
 The optional
 .B Vendor
-section may be used to provide vendor-specific configuration information.
+section may be used to provide vendor\-specific configuration information.
 Multiple
 .B Vendor
 sections may be present, and they may contain an
 .B Identifier
 entry and multiple
 .B Option
-flags.  The data therein is not used in this release.
+flags.  
+The data therein is not used in this release.
 .PP
-.SH FILES
-For an example of an __xconfigfile__ file, see the file installed as
-__projectroot__/lib/X11/__xconfigfile__.eg.
-.fi
 .SH "SEE ALSO"
-X(__miscmansuffix__),
-Xserver(__appmansuffix__),
-__xservername__(__appmansuffix__),
-apm(__drivermansuffix__),
-.\" .IR ati(__drivermansuffix__),
-chips(__drivermansuffix__),
-cirrus(__drivermansuffix__),
-cyrix(__drivermansuffix__),
-fbdev(__drivermansuffix__),
-glide(__drivermansuffix__),
-glint(__drivermansuffix__),
-i128(__drivermansuffix__),
-i740(__drivermansuffix__),
-i810(__drivermansuffix__),
-imstt(__drivermansuffix__),
-mga(__drivermansuffix__),
-neomagic(__drivermansuffix__),
-nv(__drivermansuffix__),
-r128(__drivermansuffix__),
-rendition(__drivermansuffix__),
-savage(__drivermansuffix__),
-s3virge(__drivermansuffix__),
-.\" .IR shadowfb(__drivermansuffix__),
-siliconmotion(__drivermansuffix__),
-sis(__drivermansuffix__),
-sunbw2(__drivermansuffix__),
-suncg14(__drivermansuffix__),
-suncg3(__drivermansuffix__),
-suncg6(__drivermansuffix__),
-sunffb(__drivermansuffix__),
-sunleo(__drivermansuffix__),
-suntcx(__drivermansuffix__),
-tdfx(__drivermansuffix__),
-tga(__drivermansuffix__),
-trident(__drivermansuffix__),
-tseng(__drivermansuffix__),
-v4l(__drivermansuffix__),
-vesa(__drivermansuffix__),
-vga(__drivermansuffix__),
-vmware(__drivermansuffix__),
+General:
+.BR X (__miscmansuffix__),
+.BR Xserver (__appmansuffix__),
+.BR __xservername__ (__appmansuffix__).
+.PP
+.B Not all modules or interfaces are available on all platforms.
+.PP
+Display drivers:
+.BR apm (__drivermansuffix__),
+.\" .BR ati (__drivermansuffix__),
+.BR chips (__drivermansuffix__),
+.BR cirrus (__drivermansuffix__),
+.BR cyrix (__drivermansuffix__),
+.BR fbdev (__drivermansuffix__),
+.BR glide (__drivermansuffix__),
+.BR glint (__drivermansuffix__),
+.BR i128 (__drivermansuffix__),
+.BR i740 (__drivermansuffix__),
+.BR i810 (__drivermansuffix__),
+.BR imstt (__drivermansuffix__),
+.BR mga (__drivermansuffix__),
+.BR neomagic (__drivermansuffix__),
+.BR nv (__drivermansuffix__),
+.BR r128 (__drivermansuffix__),
+.BR rendition (__drivermansuffix__),
+.BR savage (__drivermansuffix__),
+.BR s3virge (__drivermansuffix__),
+.BR siliconmotion (__drivermansuffix__),
+.BR sis (__drivermansuffix__),
+.BR sunbw2 (__drivermansuffix__),
+.BR suncg14 (__drivermansuffix__),
+.BR suncg3 (__drivermansuffix__),
+.BR suncg6 (__drivermansuffix__),
+.BR sunffb (__drivermansuffix__),
+.BR sunleo (__drivermansuffix__),
+.BR suntcx (__drivermansuffix__),
+.BR tdfx (__drivermansuffix__),
+.BR tga (__drivermansuffix__),
+.BR trident (__drivermansuffix__),
+.BR tseng (__drivermansuffix__),
+.BR vesa (__drivermansuffix__),
+.BR vga (__drivermansuffix__),
+.BR via (__drivermansuffix__),
+.BR vmware (__drivermansuffix__).
+.PP
+Input drivers:
+.\" .BR acecad (__drivermansuffix__),
+.\" .BR calcomp (__drivermansuffix__),
+.BR citron (__drivermansuffix__),
+.BR dmc (__drivermansuffix__),
+.BR dynapro (__drivermansuffix__),
+.BR elographics (__drivermansuffix__),
+.BR fpit (__drivermansuffix__),
+.BR js_x (__drivermansuffix__),
+.BR kbd (__drivermansuffix__),
+.BR keyboard (__drivermansuffix__),
+.\" .BR magictouch (__drivermansuffix__),
+.BR microtouch (__drivermansuffix__),
+.BR mouse (__drivermansuffix__),
+.BR mutouch (__drivermansuffix__),
+.BR palmax (__drivermansuffix__),
+.BR penmount (__drivermansuffix__),
+.BR tek4957 (__drivermansuffix__),
+.\" .BR ur98 (__drivermansuffix__),
+.BR void (__drivermansuffix__),
+.BR wacom (__drivermansuffix__).
+.PP
+Other modules and interfaces:
+.BR fbdevhw (__drivermansuffix__),
+.\" .BR shadowfb (__drivermansuffix__),
+.BR v4l (__drivermansuffix__).
 .br
 .SH AUTHORS
 This manual page was largely rewritten by David Dawes
diff-tree 6bf8d5019313ee2251a44dfb7ad3435a3c6db7eb (from 6fdd134a0c3e6fdde9b089100e8783705c9cc6ac)
Author: David Nusinow <dnusinow at debian.org>
Date:   Mon May 28 21:42:10 2007 -0400

    Read ROM in chunks
    This patch speeds up reads of the ROM by reading in large chunks rather
    than one byte at a time. This patch was by Dann Frazier.

diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 2aaa89c..3d8266e 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -788,8 +788,10 @@ xf86ReadDomainMemory(PCITAG Tag, ADDRESS
 	write(fd, "1", 2);
 	lseek(fd, 0, SEEK_SET);
 
+    len = min(Len, st.st_size);
+
         /* copy the ROM until we hit Len, EOF or read error */
-        for (i = 0; i < Len && read(fd, Buf, 1) > 0; Buf++, i++)
+        for (; len && (size = read(fd, Buf, len)) > 0 ; Buf+=size, len-=size)
             ;
 
 	write(fd, "0", 2);
diff-tree 6fdd134a0c3e6fdde9b089100e8783705c9cc6ac (from 6a870992d81a6bacfa9d313c15784fdb281d474f)
Author: David Nusinow <dnusinow at debian.org>
Date:   Mon May 28 21:39:12 2007 -0400

    Fix up xnest manpage
    I believe this patch was originally by Branden Robinson

diff --git a/hw/xnest/Xnest.man.pre b/hw/xnest/Xnest.man.pre
index 131c224..024d88e 100644
--- a/hw/xnest/Xnest.man.pre
+++ b/hw/xnest/Xnest.man.pre
@@ -1,6 +1,6 @@
 .\" $Xorg: Xnest.man,v 1.3 2000/08/17 19:53:28 cpqbld Exp $
 .\" Copyright (c) 1993, 1994  X Consortium
-.\" 
+.\"
 .\" 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
@@ -8,10 +8,10 @@
 .\" 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 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.
@@ -19,7 +19,7 @@
 .\" 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 X Consortium shall
 .\" not be used in advertising or otherwise to promote the sale, use or
 .\" other dealings in this Software without prior written authorization
@@ -27,238 +27,402 @@
 .\"
 .\" $XFree86: xc/programs/Xserver/hw/xnest/Xnest.man,v 1.6 2001/01/27 18:21:00 dawes Exp $
 .\"
-.TH XNEST 1 __xorgversion__
+.TH Xnest __appmansuffix__ __xorgversion__
 .SH NAME
 Xnest \- a nested X server
 .SH SYNOPSIS
 .B Xnest
-[-options]
+[
+.I options
+]
 .SH DESCRIPTION
-\fIXnest\fP is a client and a server.  \fIXnest\fP is a client of the
-real server which manages windows and graphics requests on its behalf.
-\fIXnest\fP is a server to its own clients.  \fIXnest\fP manages
-windows and graphics requests on their behalf.  To these clients
-\fIXnest\fP appears to be a conventional server.
+.B Xnest
+is both an X client and an X server.
+.B Xnest
+is a client of the real server which manages windows and graphics requests on
+its behalf.
+.B Xnest
+is a server to its own clients.
+.B Xnest
+manages windows and graphics requests on their behalf.
+To these clients,
+.B Xnest
+appears to be a conventional server.
 .SH OPTIONS
-\fIXnest\fP supports all standard options of the sample server
-implementation.  For more details, please see the manual page on your
-system for \fIXserver\fP.  The following additional arguments are
-supported as well.
-.TP 4
-.B \-display \fIstring\fP
+.B Xnest
+supports all standard options of the sample server implementation.
+For more details, please see
+.BR Xserver (__appmansuffix__).
+The following additional arguments are supported as well.
+.TP
+.BI "\-display " string
 This option specifies the display name of the real server that
-\fIXnest\fP should try to connect with.  If it is not provided on the
-command line \fIXnest\fP will read the \fIDISPLAY\fP environment
-variable in order to find out the same information.
-.TP 4
+.B Xnest
+should try to connect to.
+If it is not provided on the command line,
+.B Xnest
+will read the
+.I DISPLAY
+environment variable in order to find out this information.
+.TP
 .B \-sync
-This option tells \fIXnest\fP to synchronize its window and graphics
-operations with the real server.  This is a useful option for
-debugging, but it will slow down the performance considerably.  It
-should not be used unless absolutely necessary.
-.TP 4
+This option tells
+.B Xnest
+to synchronize its window and graphics operations with the real server.
+This is a useful option for debugging, but it will slow down
+.BR Xnest 's
+performance considerably.
+It should not be used unless absolutely necessary.
+.TP
 .B \-full
-This option tells \fIXnest\fP to utilize full regeneration of real
-server objects and reopen a new connection to the real server each
-time the nested server regenerates.  The sample server implementation
-regenerates all objects in the server when the last client of this
-server terminates.  When this happens, \fIXnest\fP by default
-maintains the same top level window and the same real server
-connection in each new generation.  If the user selects full
-regeneration, even the top level window and the connection to the real
-server will be regenerated for each server generation.
-.TP 4
-.B \-class \fIstring\fP
+This option tells
+.B Xnest
+to utilize full regeneration of real server objects and reopen a new connection
+to the real server each time the nested server regenerates.
+The sample server implementation regenerates all objects in the server when the
+last client of this server terminates.
+When this happens,
+.B Xnest
+by default maintains the same top-level window and the same real server
+connection in each new generation.
+If the user selects full regeneration, even the top-level window and the
+connection to the real server will be regenerated for each server generation.
+.TP
+.BI "\-class " string
 This option specifies the default visual class of the nested server.
-It is similar to the \fI-cc\fP option from the set of standard options
-except that it will accept a string rather than a number for the
-visual class specification.  The string must be one of the following
-six values: \fIStaticGray\fP, \fIGrayScale\fP, \fIStaticColor\fP,
-\fIPseudoColor\fP, \fITrueColor\fP, or \fIDirectColor\fP.  If both,
-\fI-class\fP and \fI-cc\fP options are specified, the last instance of
-either option assumes precedence.  The class of the default visual of
-the nested server need not be the same as the class of the default
-visual of the real server; although, it has to be supported by the
-real server.  See \fIxdpyinfo\fP for a list of supported visual
-classes on the real server before starting \fIXnest\fP.  If the user
-chooses a static class, all the colors in the default colormap will be
-preallocated.  If the user chooses a dynamic class, colors in the
-default colormap will be available to individual clients for
-allocation.
-.TP 4
-.B \-depth \fIint\fP
+It is similar to the
+.B \-cc
+option from the set of standard options except that it will accept a string
+rather than a number for the visual class specification.
+The
+.I string
+must be one of the following six values:
+.BR StaticGray ,
+.BR GrayScale ,
+.BR StaticColor ,
+.BR PseudoColor ,
+.BR TrueColor ,
+or
+.BR DirectColor .
+If both the
+.B \-class
+and
+.B \-cc
+options are specified, the last instance of either option takes precedence.
+The class of the default visual of the nested server need not be the same as the
+class of the default visual of the real server, but it must be supported by the
+real server.
+Use
+.BR xdpyinfo (__appmansuffix__)
+to obtain a list of supported visual classes on the real server before starting
+.BR Xnest .
+If the user chooses a static class, all the colors in the default color map will
+be preallocated.
+If the user chooses a dynamic class, colors in the default color map will be
+available to individual clients for allocation.
+.TP
+.BI "\-depth " int
 This option specifies the default visual depth of the nested server.
-The depth of the default visual of the nested server need not be the
-same as the depth of the default visual of the real server; although,
-it has to be supported by the real server.  See \fIxdpyinfo\fP for a
-list of supported visual depths on the real server before starting
-\fIXnest\fP.
-.TP 4
+The depth of the default visual of the nested server need not be the same as the
+depth of the default visual of the real server, but it must be supported by the
+real server.
+Use
+.BR xdpyinfo (__appmansuffix__)
+to obtain a list of supported visual depths on the real server before starting
+.BR Xnest .
+.TP
 .B \-sss
-This option tells \fIXnest\fP to use the software screen saver.  By
-default \fIXnest\fP will use the screen saver that corresponds to the
-hardware screen saver in the real server.  Of course, even this screen
-saver is software generated since \fIXnest\fP does not control any
-actual hardware.  However, it is treated as a hardware screen saver
-within the sample server code.
-.TP 4
-.B \-geometry \fIWxH+X+Y\fP
-This option specifies geometry parameters for the top level
-\fIXnest\fP windows.  These windows corresponds to the root windows of
-the nested server.  The width and height specified with this option
-will be the maximum width and height of each top level \fIXnest\fP
-window.  \fIXnest\fP will allow the user to make any top level window
-smaller, but it will not actually change the size of the nested server
-root window.  As of yet, there is no mechanism within the sample
-server implementation to change the size of the root window after
-screen initialization.  In order to do so, one would probably need to
-extend the X protocol.  Therefore, it is not likely that this will be
-available any time soon.  If this option is not specified \fIXnest\fP
-will choose width and height to be 3/4 of the dimensions of the root
-window of the real server.
-.TP 4
-.B \-bw \fIint\fP
-This option specifies the border width of the top level \fIXnest\fP
-window.  The integer parameter must be a positive number.  The default
-border width is 1.
-.TP 4
-.B \-name \fIstring\fP
-This option specifies the name of the top level \fIXnest\fP window.
+This option tells
+.B Xnest
+to use the software screen saver.
+By default,
+.B Xnest
+will use the screen saver that corresponds to the hardware screen saver in the
+real server.
+Of course, even this screen saver is software-generated since
+.B Xnest
+does not control any actual hardware.
+However, it is treated as a hardware screen saver within the sample server code.
+.TP
+.B \-geometry \fIW\fBx\fIH\fB+\fIX\fB+\fIY\fP
+This option specifies the geometry parameters for the top-level
+.B Xnest
+window.
+See \(lqGEOMETRY SPECIFICATIONS\(rq in
+.BR X (__miscmansuffix__)
+for a discusson of this option's syntax.
+This window corresponds to the root window of the nested server.
+The width
+.I W
+and height
+.I H
+specified with this option will be the maximum width and height of each
+top-level
+.B Xnest
+window.
+.B Xnest
+will allow the user to make any top-level window smaller, but it will not
+actually change the size of the nested server root window.
+.B Xnest
+does not yet support the RANDR extension for resizing, rotation, and reflection
+of the root window.
+If this option is not specified,
+.B Xnest
+will choose
+.I W
+and
+.I H
+to be 3/4ths the dimensions of the root window of the real server.
+.TP
+.BI "\-bw " int
+This option specifies the border width of the top-level
+.B Xnest
+window.
+The integer parameter
+.I int
+must be positive.
+The default border width is 1.
+.TP
+.BI "\-name " string
+This option specifies the name of the top-level
+.B Xnest
+window as
+.IR string .
 The default value is the program name.
-.TP 4
-.B \-scrns \fIint\fP
-This option specifies the number of screens to create in the nested
-server.  For each screen, \fIXnest\fP will create a separate top level
-window.  Each screen is referenced by the number after the dot in the
-client display name specification.  For example, \fIxterm -display
-:1.1\fP will open an \fIxterm\fP client in the nested server with the
-display number \fI:1\fP on the second screen.  The number of screens
-is limited by the hard coded constant in the server sample code which
-is usually 3.
-.TP 4
+.TP
+.BI "\-scrns " int
+This option specifies the number of screens to create in the nested server.
+For each screen,
+.B Xnest
+will create a separate top-level window.
+Each screen is referenced by the number after the dot in the client display name
+specification.
+For example,
+.B xterm \-display :1.1
+will open an
+.BR xterm (__appmansuffix__)
+client in the nested server with the display number
+.B :1
+on the second screen.
+The number of screens is limited by the hard-coded constant in the server sample
+code, which is usually 3.
+.TP
 .B \-install
-This option tells \fIXnest\fP to do its own colormap installation by
-bypassing the real window manager.  For it to work properly the user
-will probably have to temporarily quit the real window manager.  By
-default \fIXnest\fP will keep the nested client window whose colormap
-should be installed in the real server in the
-\fIWM\_COLORMAP\_WINDOWS\fP property of the top level \fIXnest\fP
-window.  If this colormap is of the same visual type as the root
-window of the nested server, \fIXnest\fP will associate this colormap
-with the top level \fIXnest\fP window as well.  Since this does not
-have to be the case, window managers should look primarily at the
-\fIWM\_COLORMAP\_WINDOWS\fP property rather than the colormap
-associated with the top level \fIXnest\fP window.  Unfortunately,
-window managers are not very good at doing that yet so this option
-might come in handy.
-.TP 4
-.B \-parent \fIwindow_id\fP
-This option tells \fIXnest\fP to use the \fIwindow_id\fP as the
-root window instead of creating a window. This option is used
-by the xrx xnestplugin.
-.SH USAGE 
-Starting up \fIXnest\fP is as simple as starting up \fIxclock\fP from
-a terminal emulator.  If a user wishes to run \fIXnest\fP on the same
-workstation as the real server, it is important that the nested server
-is given its own listening socket address.  Therefore, if there is a
-server already running on the user's workstation, \fIXnest\fP will
-have to be started up with a new display number.  Since there is
-usually no more than one server running on a workstation, specifying
-\fIXnest :1\fP on the command line will be sufficient for most users.
-For each server running on the workstation the display number needs to
-be incremented by one.  Thus, if you wish to start another
-\fIXnest\fP, you will need to type \fIXnest :2\fP on the command line.
-.PP
-To run clients in the nested server each client needs to be given the
-same display number as the nested server.  For example, \fIxterm
--display :1\fP will start up an \fIxterm\fP in the first nested server
-and \fIxterm -display :2\fP will start an \fIxterm\fP in the second
-nested server from the example above.  Additional clients can be
-started from these \fIxterm\fPs in each nested server.
-.SH XNEST AS A CLIENT
-\fIXnest\fP behaves and looks to the real server and other real
-clients as another real client.  It is a rather demanding client,
-however, since almost any window or graphics request from a nested
-client will result in a window or graphics request from \fIXnest\fP to
-the real server.  Therefore, it is desirable that \fIXnest\fP and the
-real server are on a local network, or even better, on the same
-machine.  As of now, \fIXnest\fP assumes that the real server supports
-the shape extension.  There is no way to turn off this assumption
-dynamically.  \fIXnest\fP can be compiled without the shape extension
-built in, and in that case the real server need not support it.  The
-dynamic shape extension selection support should be considered in
-further development of \fIXnest\fP.
-.PP
-Since \fIXnest\fP need not use the same default visual as the the real
-server, the top level window of the \fIXnest\fP client always has its
-own colormap.  This implies that other windows' colors will not be
-displayed properly while the keyboard or pointer focus is in the
-\fIXnest\fP window, unless the real server has support for more than
-one installed colormap at any time.  The colormap associated with the
-top window of the \fIXnest\fP client need not be the appropriate
-colormap that the nested server wants installed in the real server.
-In the case that a nested client attempts to install a colormap of a
-different visual from the default visual of the nested server,
-\fIXnest\fP will put the top window of this nested client and all
-other top windows of the nested clients that use the same colormap
-into the \fIWM\_COLORMAP\_WINDOWS\fP property of the top level
-\fIXnest\fP window on the real server.  Thus, it is important that the
-real window manager that manages the \fIXnest\fP top level window
-looks at the \fIWM\_COLORMAP\_WINDOWS\fP property rather than the
-colormap associated with the top level \fIXnest\fP window.  Since most
-window managers appear to not implement this convention properly as of
-yet, \fIXnest\fP can optionally do direct installation of colormaps
-into the real server bypassing the real window manager.  If the user
-chooses this option, it is usually necessary to temporarily disable
-the real window manager since it will interfere with the \fIXnest\fP
-scheme of colormap installation.
-.PP
-Keyboard and pointer control procedures of the nested server change
-the keyboard and pointer control parameters of the real server.
-Therefore, after \fIXnest\fP is started up, it will change the
-keyboard and pointer controls of the real server to its own internal
-defaults.  Perhaps there should be a command line option to tell
-\fIXnest\fP to inherit the keyboard and pointer control parameters
-from the real server rather than imposing its own.  This is a future
-consideration.
-.SH XNEST AS A SERVER
-\fIXnest\fP as a server looks exactly like a real server to its own
-clients.  For the clients there is no way of telling if they are
-running on a real or a nested server.
-.PP
-As already mentioned, \fIXnest\fP is a very user friendly server when
-it comes to customization.  \fIXnest\fP will pick up a number of
-command line arguments that can configure its default visual class and
-depth, number of screens, etc.  In the future, \fIXnest\fP should read
-a customization input file to provide even greater freedom and
-simplicity in selecting the desired layout.  Unfortunately, there is
-no support for backing store and save under as of yet, but this should
-also be considered in the future development of \fIXnest\fP.
+This option tells
+.B Xnest
+to do its own color map installation by bypassing the real window manager.
+For it to work properly, the user will probably have to temporarily quit the
+real window manager.
+By default,
+.B Xnest
+will keep the nested client window whose color map should be installed in the
+real server in the
+.I WM_COLORMAP_WINDOWS
+property of the top-level
+.B Xnest
+window.
+If this color map is of the same visual type as the root window of the nested
+server,
+.B Xnest
+will associate this color map with the top-level
+.B Xnest
+window as well.
+Since this does not have to be the case, window managers should look primarily
+at the
+.I WM_COLORMAP_WINDOWS
+property rather than the color map associated with the top-level
+.B Xnest
+window.
+.\" Is the following still true?  This sentence is several years old.
+Unfortunately, window managers are not very good at doing that yet so this
+option might come in handy.
+.TP
+.BI "\-parent " window_id
+This option tells
+.B Xnest
+to use
+.I window_id
+as the root window instead of creating a window.
+.\" XRX is dead, dead, dead.
+.\" This option is used by the xrx xnestplugin.
+.SH "EXTENDED DESCRIPTION"
+Starting up
+.B Xnest
+is just as simple as starting up
+.BR xclock (__appmansuffix__)
+from a terminal emulator.
+If a user wishes to run
+.B Xnest
+on the same
+workstation as the real server, it is important that the nested server is given
+its own listening socket address.
+Therefore, if there is a server already running on the user's workstation,
+.B Xnest
+will have to be started up with a new display number.
+Since there is usually no more than one server running on a workstation,
+specifying
+.RB \(oq "Xnest :1" \(cq
+on the command line will be sufficient for most users.
+For each server running on the workstation, the display number needs to be
+incremented by one.
+Thus, if you wish to start another
+.BR Xnest ,
+you will need to type
+.RB \(oq "Xnest :2" \(cq
+on the command line.
+.PP
+To run clients in the nested server, each client needs to be given the same
+display number as the nested server.
+For example,
+.RB \(oq "xterm \-display :1" \(cq
+will start up an
+.B xterm
+process in the first nested server
+and
+.RB \(oq "xterm \-display :2" \(cq
+will start an
+.B xterm
+in the second nested server from the example above.
+Additional clients can be started from these
+.BR xterm s
+in each nested server.
+.SS "Xnest as a client"
+.B Xnest
+behaves and looks to the real server and other real clients as another real
+client.
+It is a rather demanding client, however, since almost any window or graphics
+request from a nested client will result in a window or graphics request from
+.B Xnest
+to the real server.
+Therefore, it is desirable that
+.B Xnest
+and the real server are on a local network, or even better, on the same machine.
+.B Xnest
+assumes that the real server supports the SHAPE extension.
+There is no way to turn off this assumption dynamically.
+.B Xnest
+can be compiled without the SHAPE extension built in, in which case the real
+server need not support it.
+Dynamic SHAPE extension selection support may be considered in further
+development of
+.BR Xnest .
+.PP
+Since
+.B Xnest
+need not use the same default visual as the the real server, the top-level
+window of the
+.B Xnest
+client always has its own color map.
+This implies that other windows' colors will not be displayed properly while the
+keyboard or pointer focus is in the
+.B Xnest
+window, unless the real server has support for more than one installed color map
+at any time.
+The color map associated with the top window of the
+.B Xnest
+client need not be the appropriate color map that the nested server wants
+installed in the real server.
+In the case that a nested client attempts to install a color map of a different
+visual from the default visual of the nested server,
+.B Xnest
+will put the top window of this nested client and all other top windows of the
+nested clients that use the same color map into the
+.I WM_COLORMAP_WINDOWS
+property of the top-level
+.B Xnest
+window on the real server.
+Thus, it is important that the real window manager that manages the
+.B Xnest
+top-level window looks at the
+.I WM_COLORMAP_WINDOWS
+property rather than the color map associated with the top-level
+.B Xnest
+window.
+Since most window managers don't yet appear to implement this convention
+properly,
+.B Xnest
+can optionally do direct installation of color maps into the real server
+bypassing the real window manager.
+If the user chooses this option, it is usually necessary to temporarily disable
+the real window manager since it will interfere with the
+.B Xnest
+scheme of color map installation.
+.PP
+Keyboard and pointer control procedures of the nested server change the keyboard
+and pointer control parameters of the real server.
+Therefore, after
+.B Xnest
+is started up, it will change the keyboard and pointer controls of the real
+server to its own internal defaults.
+.SS "Xnest as a server"
+.B Xnest
+as a server looks exactly like a real server to its own clients.
+For the clients, there is no way of telling if they are running on a real or a
+nested server.
+.PP
+As already mentioned,
+.B Xnest
+is a very user-friendly server when it comes to customization.
+.B Xnest
+will pick up a number of command-line arguments that can configure its default
+visual class and depth, number of screens, etc.
 .PP
 The only apparent intricacy from the users' perspective about using
-\fIXnest\fP as a server is the selection of fonts.  \fIXnest\fP
-manages fonts by loading them locally and then passing the font name
-to the real server and asking it to load that font remotely.  This
-approach avoids the overload of sending the glyph bits across the
-network for every text operation, although it is really a bug.  The
-proper implementation of fonts should be moved into the \fIos\fP
-layer. The consequence of this approach is that the user will have to
-worry about two different font paths - a local one for the nested
-server and a remote one for the real server - since \fIXnest\fP does
-not propagate its font path to the real server.  The reason for this
-is because real and nested servers need not run on the same file
-system which makes the two font paths mutually incompatible.  Thus, if
-there is a font in the local font path of the nested server, there is
-no guarantee that this font exists in the remote font path of the real
-server.  \fIXlsfonts\fP client, if run on the nested server will list
-fonts in the local font path and if run on the real server will list
-fonts in the remote font path.  Before a font can be successfully
-opened by the nested server it has to exist in local and remote font
-paths.  It is the users' responsibility to make sure that this is the
-case.
+.B Xnest
+as a server is the selection of fonts.
+.B Xnest
+manages fonts by loading them locally and then passing the font name to the real
+server and asking it to load that font remotely.
+This approach avoids the overload of sending the glyph bits across the network
+for every text operation, although it is really a bug.
+The consequence of this approach is that the user will have to worry about two
+different font paths \(em a local one for the nested server and a remote one for
+the real server \(em since
+.B Xnest
+does not propagate its font path to the real server.
+The reason for this is because real and nested servers need not run on the same
+file system which makes the two font paths mutually incompatible.
+Thus, if there is a font in the local font path of the nested server, there is
+no guarantee that this font exists in the remote font path of the real server.
+The
+.BR xlsfonts (__appmansuffix__)
+client, if run on the nested server, will list fonts in the local font path and,
+if run on the real server, will list fonts in the remote font path.
+Before a font can be successfully opened by the nested server, it has to exist
+in local and remote font paths.
+It is the users' responsibility to make sure that this is the case.
+.SH "FUTURE DIRECTIONS"
+Make dynamic the requirement for the SHAPE extension in the real server, rather
+than having to recompile
+.B Xnest
+to turn this requirement on and off.
+.PP
+Perhaps there should be a command-line option to tell
+.B Xnest
+to inherit the keyboard and pointer control parameters from the real server
+rather than imposing its own.
+.PP
+.B Xnest
+should read a customization input file to provide even greater freedom and
+simplicity in selecting the desired layout.
+.PP
+There is no support for backing store and save unders, but this should also be
+considered.
+.PP
+.\" Is the following still true now that client-side font rendering is
+.\" considered the way to go?
+The proper implementation of fonts should be moved into the
+.I os
+layer.
 .SH BUGS
-Won't run well on servers supporting different visual depths.
-Still crashes randomly.  Probably has some memory leaks.
+Doesn't run well on servers supporting different visual depths.
+.PP
+Still crashes randomly.
+.PP
+Probably has some memory leaks.
 .SH AUTHOR
 Davor Matic, MIT X Consortium
-
+.SH "SEE ALSO"
+.BR Xserver (__appmansuffix__),
+.BR xdpyinfo (__appmansuffix__),
+.BR X (__miscmansuffix__)
diff-tree 6a870992d81a6bacfa9d313c15784fdb281d474f (from 3c982bc1a49509dda7bc469b0eced44df02755b3)
Author: Keith Packard <keithp at dulcimer.keithp.com>
Date:   Fri May 25 20:33:08 2007 -0700

    xf86XVFillKeyHelper assumed root clip never changed.
    
    When the root window changed size, xf86XVFillKeyHelper would not revalidate
    the GC, leaving the clip at the old size causing lossage (and possibly
    memory corruption if the screen and frame buffer shrank).
    
    Fixed by just using a scratch GC; saving memory, eliminating bugs and
    shrinking the code.

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 02fcde6..6abe31c 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1875,42 +1875,35 @@ xf86XVFillKeyHelperDrawable (DrawablePtr
 _X_EXPORT void
 xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
 {
-   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
    DrawablePtr root = &WindowTable[pScreen->myNum]->drawable;
    XID pval[2];
    BoxPtr pbox = REGION_RECTS(clipboxes);
    int i, nbox = REGION_NUM_RECTS(clipboxes);
    xRectangle *rects;
+   GCPtr gc;
 
    if(!xf86Screens[pScreen->myNum]->vtSema) return;
 
-   if(!ScreenPriv->videoGC) {
-       int status;
-       pval[0] = key;
-       pval[1] = IncludeInferiors;
-       ScreenPriv->videoGC = CreateGC(root, GCForeground | GCSubwindowMode,
-				      pval, &status);
-       if(!ScreenPriv->videoGC) return;
-       ValidateGC(root, ScreenPriv->videoGC);
-   } else if (key != ScreenPriv->videoGC->fgPixel){
-       pval[0] = key;
-       ChangeGC(ScreenPriv->videoGC, GCForeground, pval);
-       ValidateGC(root, ScreenPriv->videoGC);
-   }
+   gc = GetScratchGC(root->depth, pScreen);
+   pval[0] = key;
+   pval[1] = IncludeInferiors;
+   (void) ChangeGC(gc, GCForeground|GCSubwindowMode, pval);
+   ValidateGC(root, gc);
 
-   rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle));
+   rects = xalloc (nbox * sizeof(xRectangle));
 
-   for(i = 0; i < nbox; i++, pbox++) {
+   for(i = 0; i < nbox; i++, pbox++) 
+   {
       rects[i].x = pbox->x1;
       rects[i].y = pbox->y1;
       rects[i].width = pbox->x2 - pbox->x1;
       rects[i].height = pbox->y2 - pbox->y1;
    }
-
-   (*ScreenPriv->videoGC->ops->PolyFillRect)(
-			     root, ScreenPriv->videoGC, nbox, rects);
-
-   DEALLOCATE_LOCAL(rects);
+   
+   (*gc->ops->PolyFillRect)(root, gc, nbox, rects);
+   
+   xfree (rects);
+   FreeScratchGC (gc);
 }
 
 /* xf86XVClipVideoHelper -
diff-tree 3c982bc1a49509dda7bc469b0eced44df02755b3 (from 4d7469f75fadfc4a59664e88e18eb304203670f4)
Author: Luo Jie <luojie at nlsde.buaa.edu.cn>
Date:   Thu May 24 11:13:03 2007 -0700

    Reinstate an apparently mis-deleted ';' from a for loop with no body.
    
    Fixes an error returning "No core keyboard" with multiple keyboards.

diff --git a/dix/devices.c b/dix/devices.c
index e227617..da6e590 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -425,6 +425,7 @@ InitAndStartDevices(void)
     for (dev = inputInfo.devices;
 	 dev && (dev != inputInfo.keyboard);
 	 dev = dev->next)
+	;
     if (!dev || (dev != inputInfo.keyboard)) {
 	ErrorF("No core keyboard\n");
 	return BadImplementation;
diff-tree 4d7469f75fadfc4a59664e88e18eb304203670f4 (from 0b988450462ddb005311e68502357baf272e6371)
Author: Luo Jie <luojie at nlsde.buaa.edu.cn>
Date:   Thu May 24 11:04:06 2007 -0700

    Fix a typo in using memcpy in xwin.

diff --git a/hw/xwin/winmultiwindowclass.c b/hw/xwin/winmultiwindowclass.c
index d8909f0..57c4346 100755
--- a/hw/xwin/winmultiwindowclass.c
+++ b/hw/xwin/winmultiwindowclass.c
@@ -264,7 +264,7 @@ winMultiWindowGetTransientFor (WindowPtr
       if (prop->propertyName == XA_WM_TRANSIENT_FOR)
         {
           if (ppDaddy)
-            memcpy (*ppDaddy, prop->data, sizeof (WindowPtr *));
+            memcpy (*ppDaddy, prop->data, sizeof (WindowPtr));
           return 1;
         }
       else
diff-tree 0b988450462ddb005311e68502357baf272e6371 (from 1f48995d66c0072caa7e5ce2845be642221dd56d)
Author: Luo Jie <luojie at nlsde.buaa.edu.cn>
Date:   Thu May 24 11:02:28 2007 -0700

    Fix os/utils.c compile with mingw.

diff --git a/os/utils.c b/os/utils.c
index 5058285..dd5acd3 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -64,8 +64,10 @@ OR PERFORMANCE OF THIS SOFTWARE.
 #include <X11/Xos.h>
 #include <stdio.h>
 #include <time.h>
+#if !defined(WIN32) || !defined(__MINGW32__)
 #include <sys/time.h>
 #include <sys/resource.h>
+#endif
 #include "misc.h"
 #include <X11/X.h>
 #define XSERV_t
@@ -527,6 +529,13 @@ GiveUp(int sig)
     errno = olderrno;
 }
 
+#if defined WIN32 && defined __MINGW32__
+_X_EXPORT CARD32
+GetTimeInMillis (void)
+{
+  return GetTickCount ();
+}
+#else
 _X_EXPORT CARD32
 GetTimeInMillis(void)
 {
@@ -541,6 +550,7 @@ GetTimeInMillis(void)
     X_GETTIMEOFDAY(&tv);
     return(tv.tv_sec * 1000) + (tv.tv_usec / 1000);
 }
+#endif
 
 _X_EXPORT void
 AdjustWaitForDelay (pointer waitTime, unsigned long newdelay)
@@ -798,11 +808,13 @@ ProcessCommandLine(int argc, char *argv[
 	}
 	else if ( strcmp( argv[i], "-core") == 0)
 	{
-	    struct rlimit   core_limit;
 	    CoreDump = TRUE;
+#if !defined(WIN32) || !defined(__MINGW32__)
+	    struct rlimit   core_limit;
 	    getrlimit (RLIMIT_CORE, &core_limit);
 	    core_limit.rlim_cur = core_limit.rlim_max;
 	    setrlimit (RLIMIT_CORE, &core_limit);
+#endif
 	}
 	else if ( strcmp( argv[i], "-dpi") == 0)
 	{
diff-tree 1f48995d66c0072caa7e5ce2845be642221dd56d (from 8f98be7db303bc3db650054efb86843c70114451)
Author: Luo Jie <luojie at nlsde.buaa.edu.cn>
Date:   Thu May 24 11:01:15 2007 -0700

    Fix build of composite, dix, and randr when Xinerama is disabled.

diff --git a/composite/compext.c b/composite/compext.c
index ba37e7d..bea8bcf 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -696,11 +696,13 @@ 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);
     if (!CompositeClientWindowType)
diff --git a/dix/events.c b/dix/events.c
index bc6b6ae..887cbcd 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -695,6 +695,13 @@ XineramaChangeToCursor(CursorPtr cursor)
     }
 }
 
+#else
+#define SyntheticMotion(x, y) \
+     PostSyntheticMotion(x, y, \
+                         0, \
+                         syncEvents.playingEvents ? \
+                           syncEvents.time.milliseconds : \
+                           currentTime.milliseconds);
 
 #endif  /* PANORAMIX */
 
diff --git a/randr/Makefile.am b/randr/Makefile.am
index 9bf0e65..20b0f72 100644
--- a/randr/Makefile.am
+++ b/randr/Makefile.am
@@ -2,6 +2,8 @@ noinst_LTLIBRARIES = librandr.la
 
 AM_CFLAGS = $(DIX_CFLAGS)
 
+XINERAMA_SRCS = rrxinerama.c
+
 if XORG
 sdk_HEADERS = randrstr.h
 endif
@@ -18,5 +20,9 @@ librandr_la_SOURCES =	\
 	rrpointer.c	\
 	rrproperty.c	\
 	rrscreen.c	\
-	rrsdispatch.c	\
-	rrxinerama.c
+	rrsdispatch.c
+
+if XINERAMA
+librandr_la_SOURCES += ${XINERAMA_SRCS}
+endif
+
diff --git a/randr/randr.c b/randr/randr.c
index 4dd0ee5..958f9c1 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -358,8 +358,9 @@ RRExtensionInit (void)
 	SRRScreenChangeNotifyEvent;
     EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
 	SRRNotifyEvent;
-
+#ifdef PANORAMIX
     RRXineramaExtensionInit();
+#endif
 }
 
 static int
diff-tree 8f98be7db303bc3db650054efb86843c70114451 (from 9616a042855399f0ee9c6489ea824621ea5fee18)
Author: Eric Anholt <eric at anholt.net>
Date:   Thu May 24 11:00:04 2007 -0700

    Fix bswap detection on BSD (mis-added '_' in function names).

diff --git a/configure.ac b/configure.ac
index d7d00e2..37199cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,19 +123,19 @@ b = __swap16(a);
 ], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
 	AC_MSG_RESULT([$SYS_ENDIAN__SWAP])
 
-	AC_MSG_CHECKING([for bswap_16 variant of <sys/endian.h> byteswapping macros])
+	AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
 	AC_LINK_IFELSE([AC_LANG_PROGRAM([
 #include <sys/endian.h>
  ], [
 int a = 1, b;
-b = bswap_16(a);
+b = bswap16(a);
  ])
 ], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
 	AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])
 
     	if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
 		USE_SYS_ENDIAN_H=yes
-		BSWAP=bswap_
+		BSWAP=bswap
 	else	
 	    	if test "$SYS_ENDIAN__SWAP" = "yes" ; then
 			USE_SYS_ENDIAN_H=yes
diff-tree 9616a042855399f0ee9c6489ea824621ea5fee18 (from 649e7f82d8d4333443493056b81eb20d6cf022bc)
Author: Matthias Drochner <drochner at netbsd.org>
Date:   Tue Apr 10 16:15:40 2007 -0700

    Fix build on NetBSD/amd64.

diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index f4ea3f5..ae16b78 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -50,6 +50,11 @@
 #include <machine/mtrr.h>
 #include <machine/sysarch.h>
 #include <sys/queue.h>
+#ifdef __x86_64__
+#define i386_set_mtrr x86_64_set_mtrr
+#define i386_get_mtrr x86_64_get_mtrr
+#define i386_iopl x86_64_iopl
+#endif
 #endif
 
 #if defined(__OpenBSD__) && defined(__amd64__)
diff-tree 649e7f82d8d4333443493056b81eb20d6cf022bc (from 047bf3349bb697c73c95729a8bbf15f72605901f)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Thu May 24 12:10:05 2007 +0200

    Consolidate portPriv->pDraw assignments into xf86XVEnlistPortInWindow.
    
    This avoids a crash in xf86XVReputVideo and also cleans up the code slightly.

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 2b097d2..02fcde6 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -979,6 +979,9 @@ xf86XVEnlistPortInWindow(WindowPtr pWin,
 	winPriv->next = PrivRoot;
 	pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv;
    }
+
+   portPriv->pDraw = (DrawablePtr)pWin;
+
    return Success;
 }
 
@@ -1375,7 +1378,6 @@ xf86XVPutVideo(
   result =  xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
   if(result != Success) return result;
 
-  portPriv->pDraw = pDraw;
   portPriv->type = XvInputMask;
 
   /* save a copy of these parameters */
@@ -1479,7 +1481,6 @@ xf86XVPutStill(
 
      xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
      portPriv->isOn = XV_ON;
-     portPriv->pDraw = pDraw;
      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
@@ -1529,7 +1530,6 @@ xf86XVGetVideo(
   result =  xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
   if(result != Success) return result;
 
-  portPriv->pDraw = pDraw;
   portPriv->type = XvOutputMask;
 
   /* save a copy of these parameters */
@@ -1784,7 +1784,6 @@ xf86XVPutImage(
 	(portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
 
      portPriv->isOn = XV_ON;
-     portPriv->pDraw = pDraw;
      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-tree 047bf3349bb697c73c95729a8bbf15f72605901f (from 9d87ef4e0dff40ea39f1b209c67b90079fc79065)
Author: Soren Sandmann Pedersen <ssp at dhcp83-218.boston.redhat.com>
Date:   Wed May 23 16:56:05 2007 -0400

    Delete trapezoid rendering code; replace with pixman calls

diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 6e8da24..07b4fbb 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -30,77 +30,13 @@
 
 #ifdef RENDER
 
+#include <pixman/pixman.h>
+
 #include "picturestr.h"
 #include "mipict.h"
 #include "renderedge.h"
 #include "fbpict.h"
 
-#if 0
-void
-fbAddTraps (PicturePtr	pPicture,
-	    INT16	x_off,
-	    INT16	y_off,
-	    int		ntrap,
-	    xTrap	*traps)
-{
-    FbBits	*buf;
-    int		bpp;
-    int		width;
-    int		stride;
-    int		height;
-    int		pxoff, pyoff;
-
-    xFixed	x_off_fixed;
-    xFixed	y_off_fixed;
-    RenderEdge  l, r;
-    xFixed	t, b;
-    
-    fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
-
-    width = pPicture->pDrawable->width;
-    height = pPicture->pDrawable->height;
-    x_off += pxoff;
-    y_off += pyoff;
-    
-    x_off_fixed = IntToxFixed(y_off);
-    y_off_fixed = IntToxFixed(y_off);
-
-    while (ntrap--)
-    {
-	t = traps->top.y + y_off_fixed;
-	if (t < 0)
-	    t = 0;
-	t = RenderSampleCeilY (t, bpp);
-    
-	b = traps->bot.y + y_off_fixed;
-	if (xFixedToInt (b) >= height)
-	    b = IntToxFixed (height) - 1;
-	b = RenderSampleFloorY (b, bpp);
-	
-	if (b >= t)
-	{
-	    /* initialize edge walkers */
-	    RenderEdgeInit (&l, bpp, t,
-			    traps->top.l + x_off_fixed,
-			    traps->top.y + y_off_fixed,
-			    traps->bot.l + x_off_fixed,
-			    traps->bot.y + y_off_fixed);
-	
-	    RenderEdgeInit (&r, bpp, t,
-			    traps->top.r + x_off_fixed,
-			    traps->top.y + y_off_fixed,
-			    traps->bot.r + x_off_fixed,
-			    traps->bot.y + y_off_fixed);
-	    
-	    fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
-	}
-	traps++;
-    }
-
-    fbFinishAccess (pPicture->pDrawable);
-}
-#endif
-
 void
 fbAddTraps (PicturePtr	pPicture,
 	    INT16	x_off,
@@ -108,65 +44,16 @@ fbAddTraps (PicturePtr	pPicture,
 	    int		ntrap,
 	    xTrap	*traps)
 {
-    FbBits	*buf;
-    int		bpp;
-    int		width;
-    int		stride;
-    int		height;
-    int		pxoff, pyoff;
-
-    xFixed	x_off_fixed;
-    xFixed	y_off_fixed;
-    RenderEdge  l, r;
-    xFixed	t, b;
-
     pixman_image_t *image = image_from_pict (pPicture, FALSE);
-    
-    fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
-
-    width = pPicture->pDrawable->width;
-    height = pPicture->pDrawable->height;
-#if 0
-    x_off += pxoff;
-    y_off += pyoff;
-#endif
-    
-    x_off_fixed = IntToxFixed(y_off);
-    y_off_fixed = IntToxFixed(y_off);
 
-    while (ntrap--)
-    {
-	t = traps->top.y + y_off_fixed;
-	if (t < 0)
-	    t = 0;
-	t = RenderSampleCeilY (t, bpp);
+    if (!image)
+	return;
     
-	b = traps->bot.y + y_off_fixed;
-	if (xFixedToInt (b) >= height)
-	    b = IntToxFixed (height) - 1;
-	b = RenderSampleFloorY (b, bpp);
-	
-	if (b >= t)
-	{
-	    /* initialize edge walkers */
-	    RenderEdgeInit (&l, bpp, t,
-			    traps->top.l + x_off_fixed,
-			    traps->top.y + y_off_fixed,
-			    traps->bot.l + x_off_fixed,
-			    traps->bot.y + y_off_fixed);
-	
-	    RenderEdgeInit (&r, bpp, t,
-			    traps->top.r + x_off_fixed,
-			    traps->top.y + y_off_fixed,
-			    traps->bot.r + x_off_fixed,
-			    traps->bot.y + y_off_fixed);
-	    
-	    pixman_rasterize_edges (image, &l, &r, t, b);
-	}
-	traps++;
-    }
+    pixman_add_traps (image, x_off, y_off, ntrap, (pixman_trap_t *)traps);
 
     fbFinishAccess (pPicture->pDrawable);
+
+    pixman_image_unref (image);
 }
 
 void
@@ -175,58 +62,16 @@ fbRasterizeTrapezoid (PicturePtr    pPic
 		      int	    x_off,
 		      int	    y_off)
 {
-    FbBits	*buf;
-    int		bpp;
-    int		width;
-    int		stride;
-    int		height;
-    int		pxoff, pyoff;
-
-    xFixed	x_off_fixed;
-    xFixed	y_off_fixed;
-    RenderEdge	l, r;
-    xFixed	t, b;
-    pixman_image_t *image;
-    
-    if (!xTrapezoidValid (trap))
+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
+
+    if (!image)
 	return;
 
-    image = image_from_pict (pPicture, FALSE);
-    
-    fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
-
-    width = pPicture->pDrawable->width;
-    height = pPicture->pDrawable->height;
-#if 0
-    x_off += pxoff;
-    y_off += pyoff;
-#endif
-    
-    x_off_fixed = IntToxFixed(x_off);
-    y_off_fixed = IntToxFixed(y_off);
-    t = trap->top + y_off_fixed;
-    if (t < 0)
-	t = 0;
-    t = RenderSampleCeilY (t, bpp);
-
-    b = trap->bottom + y_off_fixed;
-    if (xFixedToInt (b) >= height)
-	b = IntToxFixed (height) - 1;
-    b = RenderSampleFloorY (b, bpp);
-    
-    if (b >= t)
-    {
-	/* initialize edge walkers */
-	RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off);
-	RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off);
-
-	pixman_rasterize_edges (image, &l, &r, t, b);
-#if 0
-	fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
-#endif
-    }
+    pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap, x_off, y_off);
 
     fbFinishAccess (pPicture->pDrawable);
+
+    pixman_image_unref (image);
 }
 
 static int
diff-tree 9d87ef4e0dff40ea39f1b209c67b90079fc79065 (from 2a960c442bd7560630f52b55d82ec0517542ee5a)
Author: Soren Sandmann Pedersen <ssp at dhcp83-218.boston.redhat.com>
Date:   Wed May 23 15:50:25 2007 -0400

    - Make image_from_pict() non-static
    - Delete fbedge.c and fbedgeimp.h
    - Use pixman_rasterize_edges() in fbtrap.c

diff --git a/fb/Makefile.am b/fb/Makefile.am
index 01e81da..28c0cc7 100644
--- a/fb/Makefile.am
+++ b/fb/Makefile.am
@@ -69,9 +69,7 @@ libfb_la_SOURCES = 	\
 	fbutil.c	\
 	fbwindow.c	\
 	fbpseudocolor.c \
-	fbpseudocolor.h \
-	fbedge.c	\
-	fbedgeimp.h
+	fbpseudocolor.h
 
 libwfb_la_SOURCES = $(libfb_la_SOURCES)
 
diff --git a/fb/fb.h b/fb/fb.h
index e605078..7d94886 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2146,4 +2146,8 @@ void
 fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
 
 
+pixman_image_t *image_from_pict (PicturePtr pict,
+				 Bool       has_clip);
+
 #endif /* _FB_H_ */
+
diff --git a/fb/fbedge.c b/fb/fbedge.c
deleted file mode 100644
index 70fc423..0000000
--- a/fb/fbedge.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2004 Keith Packard
- *
- * 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 name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#include <string.h>
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-
-#ifdef RENDER
-
-#include "picturestr.h"
-#include "mipict.h"
-#include "renderedge.h"
-#include "fbpict.h"
-
-/*
- * 4 bit alpha
- */
-
-#define N_BITS	4
-#define rasterizeEdges	fbRasterizeEdges4
-
-#if BITMAP_BIT_ORDER == LSBFirst
-#define Shift4(o)	((o) << 2)
-#else
-#define Shift4(o)	((1-(o)) << 2)
-#endif
-
-#define Get4(x,o)	(((x) >> Shift4(o)) & 0xf)
-#define Put4(x,o,v)	(((x) & ~(0xf << Shift4(o))) | (((v) & 0xf) << Shift4(o)))
-
-#define DefineAlpha(line,x) \
-    CARD8   *__ap = (CARD8 *) line + ((x) >> 1); \
-    int	    __ao = (x) & 1
-
-#define StepAlpha	((__ap += __ao), (__ao ^= 1))
-
-#define AddAlpha(a) {						\
-    CARD8   __o = READ(__ap);					\
-    CARD8   __a = (a) + Get4(__o, __ao);			\
-    WRITE(__ap, Put4 (__o, __ao, __a | (0 - ((__a) >> 4))));	\
-}
-
-#include "fbedgeimp.h"
-
-#undef AddAlpha
-#undef StepAlpha
-#undef DefineAlpha
-#undef rasterizeEdges
-#undef N_BITS
-
-
-/*
- * 1 bit alpha
- */
-
-#define N_BITS 1
-#define rasterizeEdges	fbRasterizeEdges1
-
-#include "fbedgeimp.h"
-
-#undef rasterizeEdges
-#undef N_BITS
-
-/*
- * 8 bit alpha
- */
-
-static INLINE CARD8
-clip255 (int x)
-{
-    if (x > 255) return 255;
-    return x;
-}
-
-static INLINE void
-add_saturate_8 (CARD8 *buf, int value, int length)
-{
-    while (length--)
-    {
-        WRITE(buf, clip255 (READ(buf) + value));
-        buf++;
-    }
-}
-
-/*
- * We want to detect the case where we add the same value to a long
- * span of pixels.  The triangles on the end are filled in while we
- * count how many sub-pixel scanlines contribute to the middle section.
- *
- *                 +--------------------------+
- *  fill_height =|   \                      /
- *                     +------------------+
- *                      |================|
- *                   fill_start       fill_end
- */
-static void
-fbRasterizeEdges8 (FbBits	*buf,
-		   int		width,
-		   int		stride,
-		   RenderEdge	*l,
-		   RenderEdge	*r,
-		   xFixed	t,
-		   xFixed	b)
-{
-    xFixed  y = t;
-    FbBits  *line;
-    int fill_start = -1, fill_end = -1;
-    int fill_size = 0;
-
-    line = buf + xFixedToInt (y) * stride;
-
-    for (;;)
-    {
-        CARD8 *ap = (CARD8 *) line;
-	xFixed	lx, rx;
-	int	lxi, rxi;
-	
-	/* clip X */
-	lx = l->x;
-	if (lx < 0)
-	    lx = 0;
-	rx = r->x;
-	if (xFixedToInt (rx) >= width)
-	    rx = IntToxFixed (width);
-	
-	/* Skip empty (or backwards) sections */
-	if (rx > lx)
-	{
-            int lxs, rxs;
-
-	    /* Find pixel bounds for span. */
-	    lxi = xFixedToInt (lx);
-	    rxi = xFixedToInt (rx);
-
-            /* Sample coverage for edge pixels */
-            lxs = RenderSamplesX (lx, 8);
-            rxs = RenderSamplesX (rx, 8);
-
-            /* Add coverage across row */
-            if (lxi == rxi)
-            {
-                WRITE(ap +lxi, clip255 (READ(ap + lxi) + rxs - lxs));
-            }
-            else
-            {
-                WRITE(ap + lxi, clip255 (READ(ap + lxi) + N_X_FRAC(8) - lxs));
-
-                /* Move forward so that lxi/rxi is the pixel span */
-                lxi++;
-
-                /* Don't bother trying to optimize the fill unless
-                 * the span is longer than 4 pixels. */
-                if (rxi - lxi > 4)
-                {
-                    if (fill_start < 0)
-                    {
-                        fill_start = lxi;
-                        fill_end = rxi;
-                        fill_size++;
-                    }
-                    else
-                    {
-                        if (lxi >= fill_end || rxi < fill_start)
-                        {
-                            /* We're beyond what we saved, just fill it */
-                            add_saturate_8 (ap + fill_start,
-                                            fill_size * N_X_FRAC(8),
-                                            fill_end - fill_start);
-                            fill_start = lxi;
-                            fill_end = rxi;
-                            fill_size = 1;
-                        }
-                        else
-                        {
-                            /* Update fill_start */
-                            if (lxi > fill_start)
-                            {
-                                add_saturate_8 (ap + fill_start,
-                                                fill_size * N_X_FRAC(8),
-                                                lxi - fill_start);
-                                fill_start = lxi;
-                            }
-                            else if (lxi < fill_start)
-                            {
-                                add_saturate_8 (ap + lxi, N_X_FRAC(8),
-                                                fill_start - lxi);
-                            }
-
-                            /* Update fill_end */
-                            if (rxi < fill_end)
-                            {
-                                add_saturate_8 (ap + rxi,
-                                                fill_size * N_X_FRAC(8),
-                                                fill_end - rxi);
-                                fill_end = rxi;
-                            }
-                            else if (fill_end < rxi)
-                            {
-                                add_saturate_8 (ap + fill_end,
-                                                N_X_FRAC(8),
-                                                rxi - fill_end);
-                            }
-                            fill_size++;
-                        }
-                    }
-                }
-                else
-                {
-                    add_saturate_8 (ap + lxi, N_X_FRAC(8), rxi - lxi);
-                }
-
-                /* Do not add in a 0 alpha here. This check is
-                 * necessary to avoid a buffer overrun, (when rx
-                 * is exactly on a pixel boundary). */
-                if (rxs)
-                    WRITE(ap + rxi, clip255 (READ(ap + rxi) + rxs));
-            }
-	}
-
-	if (y == b) {
-            /* We're done, make sure we clean up any remaining fill. */
-            if (fill_start != fill_end) {
-                if (fill_size == N_Y_FRAC(8))
-                {
-                    MEMSET_WRAPPED (ap + fill_start, 0xff, fill_end - fill_start);
-                }
-                else
-                {
-                    add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8),
-                                    fill_end - fill_start);
-                }
-            }
-	    break;
-        }
-
-	if (xFixedFrac (y) != Y_FRAC_LAST(8))
-	{
-	    RenderEdgeStepSmall (l);
-	    RenderEdgeStepSmall (r);
-	    y += STEP_Y_SMALL(8);
-	}
-	else
-	{
-	    RenderEdgeStepBig (l);
-	    RenderEdgeStepBig (r);
-	    y += STEP_Y_BIG(8);
-            if (fill_start != fill_end)
-            {
-                if (fill_size == N_Y_FRAC(8))
-                {
-                    MEMSET_WRAPPED (ap + fill_start, 0xff, fill_end - fill_start);
-                }
-                else
-                {
-                    add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8),
-                                    fill_end - fill_start);
-                }
-                fill_start = fill_end = -1;
-                fill_size = 0;
-            }
-	    line += stride;
-	}
-    }
-}
-
-void
-fbRasterizeEdges (FbBits	*buf,
-		  int		bpp,
-		  int		width,
-		  int		stride,
-		  RenderEdge	*l,
-		  RenderEdge	*r,
-		  xFixed	t,
-		  xFixed	b)
-{
-    switch (bpp) {
-    case 1:
-	fbRasterizeEdges1 (buf, width, stride, l, r, t, b);
-	break;
-    case 4:
-	fbRasterizeEdges4 (buf, width, stride, l, r, t, b);
-	break;
-    case 8:
-	fbRasterizeEdges8 (buf, width, stride, l, r, t, b);
-	break;
-    }
-}
-
-#endif /* RENDER */
diff --git a/fb/fbedgeimp.h b/fb/fbedgeimp.h
deleted file mode 100644
index 57da31a..0000000
--- a/fb/fbedgeimp.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2004 Keith Packard
- *
- * 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 name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef rasterizeSpan
-#endif
-
-static void
-rasterizeEdges (FbBits		*buf,
-		int		width,
-		int		stride,
-		RenderEdge	*l,
-		RenderEdge	*r,
-		xFixed		t,
-		xFixed		b)
-{
-    xFixed  y = t;
-    FbBits  *line;
-    
-    line = buf + xFixedToInt (y) * stride;
-    
-    for (;;)
-    {
-	xFixed	lx, rx;
-	int	lxi, rxi;
-	
-	/* clip X */
-	lx = l->x;
-	if (lx < 0)
-	    lx = 0;
-	rx = r->x;
-	if (xFixedToInt (rx) >= width)
-	    rx = IntToxFixed (width);
-	
-	/* Skip empty (or backwards) sections */
-	if (rx > lx)
-	{
-
-	    /* Find pixel bounds for span */
-	    lxi = xFixedToInt (lx);
-	    rxi = xFixedToInt (rx);
-
-#if N_BITS == 1
-	    {
-		FbBits  *a = line;
-		FbBits  startmask, endmask;
-		int	    nmiddle;
-		int	    width = rxi - lxi;
-		int	    x = lxi;
-
-		a += x >> FB_SHIFT;
-		x &= FB_MASK;
-
-		FbMaskBits (x, width, startmask, nmiddle, endmask);
-		if (startmask) {
-		    WRITE(a, READ(a) | startmask);
-		    a++;
-		}
-		while (nmiddle--)
-		    WRITE(a++, FB_ALLONES);
-		if (endmask)
-		    WRITE(a, READ(a) | endmask);
-	    }
-#else
-	    {
-		DefineAlpha(line,lxi);
-		int	    lxs, rxs;
-
-		/* Sample coverage for edge pixels */
-		lxs = RenderSamplesX (lx, N_BITS);
-		rxs = RenderSamplesX (rx, N_BITS);
-
-		/* Add coverage across row */
-		if (lxi == rxi)
-		{
-		    AddAlpha (rxs - lxs);
-		}
-		else
-		{
-		    int	xi;
-
-		    AddAlpha (N_X_FRAC(N_BITS) - lxs);
-		    StepAlpha;
-		    for (xi = lxi + 1; xi < rxi; xi++)
-		    {
-			AddAlpha (N_X_FRAC(N_BITS));
-			StepAlpha;
-		    }
-		    /* Do not add in a 0 alpha here. This check is necessary
-		     * to avoid a buffer overrun when rx is exactly on a pixel
-		     * boundary.
-		     */
-		    if (rxs != 0)
-			AddAlpha (rxs);
-		}
-	    }
-#endif
-	}
-
-	if (y == b)
-	    break;
-
-#if N_BITS > 1
-	if (xFixedFrac (y) != Y_FRAC_LAST(N_BITS))
-	{
-	    RenderEdgeStepSmall (l);
-	    RenderEdgeStepSmall (r);
-	    y += STEP_Y_SMALL(N_BITS);
-	}
-	else
-#endif
-	{
-	    RenderEdgeStepBig (l);
-	    RenderEdgeStepBig (r);
-	    y += STEP_Y_BIG(N_BITS);
-	    line += stride;
-	}
-    }
-}
-
-#undef rasterizeSpan
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 3ad4a22..00dde61 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -108,7 +108,8 @@ create_conical_gradient_image (PictGradi
 }
 
 static pixman_image_t *
-create_bits_picture (PicturePtr pict)
+create_bits_picture (PicturePtr pict,
+		     Bool       has_clip)
 {
     FbBits *bits;
     FbStride stride;
@@ -142,7 +143,8 @@ create_bits_picture (PicturePtr pict)
     /* pCompositeClip is undefined for source pictures, so
      * only set the clip region for pictures with drawables
      */
-    pixman_image_set_clip_region (image, pict->pCompositeClip);
+    if (has_clip)
+	pixman_image_set_clip_region (image, pict->pCompositeClip);
     
     /* Indexed table */
     if (pict->pFormat->index.devPrivate)
@@ -153,114 +155,6 @@ create_bits_picture (PicturePtr pict)
     return image;
 }
 
-static pixman_image_t *image_from_pict (PicturePtr pict);
-
-static void
-set_image_properties (pixman_image_t *image, PicturePtr pict)
-{
-    pixman_repeat_t repeat;
-    pixman_filter_t filter;
-    
-    if (pict->transform)
-    {
-	pixman_image_set_transform (
-	    image, (pixman_transform_t *)pict->transform);
-    }
-    
-    switch (pict->repeatType)
-    {
-    default:
-    case RepeatNone:
-	repeat = PIXMAN_REPEAT_NONE;
-	break;
-	
-    case RepeatPad:
-	repeat = PIXMAN_REPEAT_PAD;
-	break;
-	
-    case RepeatNormal:
-	repeat = PIXMAN_REPEAT_NORMAL;
-	break;
-	
-    case RepeatReflect:
-	repeat = PIXMAN_REPEAT_REFLECT;
-	break;
-    }
-    
-    pixman_image_set_repeat (image, repeat);
-    
-    if (pict->alphaMap)
-    {
-	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap);
-	
-	pixman_image_set_alpha_map (
-	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
-	
-	pixman_image_unref (alpha_map);
-    }
-    
-    pixman_image_set_component_alpha (image, pict->componentAlpha);
-
-    switch (pict->filter)
-    {
-    default:
-    case PictFilterNearest:
-    case PictFilterFast:
-	filter = PIXMAN_FILTER_NEAREST;
-	break;
-	
-    case PictFilterBilinear:
-    case PictFilterGood:
-	filter = PIXMAN_FILTER_BILINEAR;
-	break;
-	
-    case PictFilterConvolution:
-	filter = PIXMAN_FILTER_CONVOLUTION;
-	break;
-    }
-    
-    pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
-}
-
-static pixman_image_t *
-image_from_pict (PicturePtr pict)
-{
-    pixman_image_t *image = NULL;
-
-    if (!pict)
-	return NULL;
-
-    if (pict->pDrawable)
-    {
-	image = create_bits_picture (pict);
-    }
-    else if (pict->pSourcePict)
-    {
-	SourcePict *sp = pict->pSourcePict;
-	
-	if (sp->type == SourcePictTypeSolidFill)
-	{
-	    image = create_solid_fill_image (pict);
-	}
-	else
-	{
-	    PictGradient *gradient = &pict->pSourcePict->gradient;
-	    
-	    if (sp->type == SourcePictTypeLinear)
-		image = create_linear_gradient_image (gradient);
-	    else if (sp->type == SourcePictTypeRadial)
-		image = create_radial_gradient_image (gradient);
-	    else if (sp->type == SourcePictTypeConical)
-		image = create_conical_gradient_image (gradient);
-	}
-    }
-    
-    if (image)
-	set_image_properties (image, pict);
-    
-    return image;
-}
-
 #define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
 
 void
@@ -401,9 +295,9 @@ fbComposite (CARD8      op,
 				   xMask, yMask, xDst, yDst, width, height))
         return;
 
-    src = image_from_pict (pSrc);
-    mask = image_from_pict (pMask);
-    dest = image_from_pict (pDst);
+    src = image_from_pict (pSrc, TRUE);
+    mask = image_from_pict (pMask, TRUE);
+    dest = image_from_pict (pDst, TRUE);
 
     if (src && dest && !(pMask && !mask))
     {
@@ -466,6 +360,116 @@ fbPictureInit (ScreenPtr pScreen, PictFo
     return TRUE;
 }
 
+static void
+set_image_properties (pixman_image_t *image, PicturePtr pict)
+{
+    pixman_repeat_t repeat;
+    pixman_filter_t filter;
+    
+    if (pict->transform)
+    {
+	pixman_image_set_transform (
+	    image, (pixman_transform_t *)pict->transform);
+    }
+    
+    switch (pict->repeatType)
+    {
+    default:
+    case RepeatNone:
+	repeat = PIXMAN_REPEAT_NONE;
+	break;
+	
+    case RepeatPad:
+	repeat = PIXMAN_REPEAT_PAD;
+	break;
+	
+    case RepeatNormal:
+	repeat = PIXMAN_REPEAT_NORMAL;
+	break;
+	
+    case RepeatReflect:
+	repeat = PIXMAN_REPEAT_REFLECT;
+	break;
+    }
+    
+    pixman_image_set_repeat (image, repeat);
+    
+    if (pict->alphaMap)
+    {
+	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, TRUE);
+	
+	pixman_image_set_alpha_map (
+	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
+	
+	pixman_image_unref (alpha_map);
+    }
+    
+    pixman_image_set_component_alpha (image, pict->componentAlpha);
+
+    switch (pict->filter)
+    {
+    default:
+    case PictFilterNearest:
+    case PictFilterFast:
+	filter = PIXMAN_FILTER_NEAREST;
+	break;
+	
+    case PictFilterBilinear:
+    case PictFilterGood:
+	filter = PIXMAN_FILTER_BILINEAR;
+	break;
+	
+    case PictFilterConvolution:
+	filter = PIXMAN_FILTER_CONVOLUTION;
+	break;
+    }
+    
+    pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
+}
+
+pixman_image_t *
+image_from_pict (PicturePtr pict,
+		 Bool       has_clip)
+{
+    pixman_image_t *image = NULL;
+
+    if (!pict)
+	return NULL;
+
+    if (pict->pDrawable)
+    {
+	image = create_bits_picture (pict, has_clip);
+    }
+    else if (pict->pSourcePict)
+    {
+	SourcePict *sp = pict->pSourcePict;
+	
+	if (sp->type == SourcePictTypeSolidFill)
+	{
+	    image = create_solid_fill_image (pict);
+	}
+	else
+	{
+	    PictGradient *gradient = &pict->pSourcePict->gradient;
+	    
+	    if (sp->type == SourcePictTypeLinear)
+		image = create_linear_gradient_image (gradient);
+	    else if (sp->type == SourcePictTypeRadial)
+		image = create_radial_gradient_image (gradient);
+	    else if (sp->type == SourcePictTypeConical)
+		image = create_conical_gradient_image (gradient);
+	}
+    }
+    
+    if (image)
+	set_image_properties (image, pict);
+    
+    return image;
+}
+
+
+
+
 #ifdef USE_MMX
 /* The CPU detection code needs to be in a file not compiled with
  * "-mmmx -msse", as gcc would generate CMOV instructions otherwise
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 3bd0a78..b4c1dcf 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -412,18 +412,6 @@ fbCompositeGeneral (CARD8	op,
 		    CARD16	width,
 		    CARD16	height);
 
-
-/* fbedge.c */
-void
-fbRasterizeEdges (FbBits	*buf,
-		  int		bpp,
-		  int		width,
-		  int		stride,
-		  RenderEdge	*l,
-		  RenderEdge	*r,
-		  xFixed	t,
-		  xFixed	b);
-
 /* fbpict.c */
 void
 fbComposite (CARD8      op,
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 478a80f..6e8da24 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -35,6 +35,7 @@
 #include "renderedge.h"
 #include "fbpict.h"
 
+#if 0
 void
 fbAddTraps (PicturePtr	pPicture,
 	    INT16	x_off,
@@ -98,6 +99,75 @@ fbAddTraps (PicturePtr	pPicture,
 
     fbFinishAccess (pPicture->pDrawable);
 }
+#endif
+
+void
+fbAddTraps (PicturePtr	pPicture,
+	    INT16	x_off,
+	    INT16	y_off,
+	    int		ntrap,
+	    xTrap	*traps)
+{
+    FbBits	*buf;
+    int		bpp;
+    int		width;
+    int		stride;
+    int		height;
+    int		pxoff, pyoff;
+
+    xFixed	x_off_fixed;
+    xFixed	y_off_fixed;
+    RenderEdge  l, r;
+    xFixed	t, b;
+
+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
+    
+    fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
+
+    width = pPicture->pDrawable->width;
+    height = pPicture->pDrawable->height;
+#if 0
+    x_off += pxoff;
+    y_off += pyoff;
+#endif
+    
+    x_off_fixed = IntToxFixed(y_off);
+    y_off_fixed = IntToxFixed(y_off);
+
+    while (ntrap--)
+    {
+	t = traps->top.y + y_off_fixed;
+	if (t < 0)
+	    t = 0;
+	t = RenderSampleCeilY (t, bpp);
+    
+	b = traps->bot.y + y_off_fixed;
+	if (xFixedToInt (b) >= height)
+	    b = IntToxFixed (height) - 1;
+	b = RenderSampleFloorY (b, bpp);
+	
+	if (b >= t)
+	{
+	    /* initialize edge walkers */
+	    RenderEdgeInit (&l, bpp, t,
+			    traps->top.l + x_off_fixed,
+			    traps->top.y + y_off_fixed,
+			    traps->bot.l + x_off_fixed,
+			    traps->bot.y + y_off_fixed);
+	
+	    RenderEdgeInit (&r, bpp, t,
+			    traps->top.r + x_off_fixed,
+			    traps->top.y + y_off_fixed,
+			    traps->bot.r + x_off_fixed,
+			    traps->bot.y + y_off_fixed);
+	    
+	    pixman_rasterize_edges (image, &l, &r, t, b);
+	}
+	traps++;
+    }
+
+    fbFinishAccess (pPicture->pDrawable);
+}
 
 void
 fbRasterizeTrapezoid (PicturePtr    pPicture,
@@ -116,16 +186,21 @@ fbRasterizeTrapezoid (PicturePtr    pPic
     xFixed	y_off_fixed;
     RenderEdge	l, r;
     xFixed	t, b;
+    pixman_image_t *image;
     
     if (!xTrapezoidValid (trap))
 	return;
 
+    image = image_from_pict (pPicture, FALSE);
+    
     fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
 
     width = pPicture->pDrawable->width;
     height = pPicture->pDrawable->height;
+#if 0
     x_off += pxoff;
     y_off += pyoff;
+#endif
     
     x_off_fixed = IntToxFixed(x_off);
     y_off_fixed = IntToxFixed(y_off);
@@ -144,8 +219,11 @@ fbRasterizeTrapezoid (PicturePtr    pPic
 	/* initialize edge walkers */
 	RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off);
 	RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off);
-	
+
+	pixman_rasterize_edges (image, &l, &r, t, b);
+#if 0
 	fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
+#endif
     }
 
     fbFinishAccess (pPicture->pDrawable);
diff-tree 2a960c442bd7560630f52b55d82ec0517542ee5a (from 3ba3ede9bbdfc6376b6f6e0b6ce8280a05e6584d)
Author: Soren Sandmann Pedersen <ssp at dhcp83-218.boston.redhat.com>
Date:   Wed May 23 13:08:26 2007 -0400

    Port renderedge.c to pixman

diff --git a/render/renderedge.c b/render/renderedge.c
index c2ffabe..e92174f 100644
--- a/render/renderedge.c
+++ b/render/renderedge.c
@@ -36,16 +36,7 @@
 _X_EXPORT xFixed
 RenderSampleCeilY (xFixed y, int n)
 {
-    xFixed   f = xFixedFrac(y);
-    xFixed   i = xFixedFloor(y);
-    
-    f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
-    if (f > Y_FRAC_LAST(n))
-    {
-	f = Y_FRAC_FIRST(n);
-	i += xFixed1;
-    }
-    return (i | f);
+    return pixman_sample_ceil_y (y, n);
 }
 
 #define _div(a,b)    ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))
@@ -57,16 +48,7 @@ RenderSampleCeilY (xFixed y, int n)
 _X_EXPORT xFixed
 RenderSampleFloorY (xFixed y, int n)
 {
-    xFixed   f = xFixedFrac(y);
-    xFixed   i = xFixedFloor (y);
-    
-    f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
-    if (f < Y_FRAC_FIRST(n))
-    {
-	f = Y_FRAC_LAST(n);
-	i -= xFixed1;
-    }
-    return (i | f);
+    return pixman_sample_floor_y (y, n);
 }
 
 /*
@@ -75,52 +57,7 @@ RenderSampleFloorY (xFixed y, int n)
 _X_EXPORT void
 RenderEdgeStep (RenderEdge *e, int n)
 {
-    xFixed_48_16	ne;
-
-    e->x += n * e->stepx;
-    
-    ne = e->e + n * (xFixed_48_16) e->dx;
-    
-    if (n >= 0)
-    {
-	if (ne > 0)
-	{
-	    int nx = (ne + e->dy - 1) / e->dy;
-	    e->e = ne - nx * (xFixed_48_16) e->dy;
-	    e->x += nx * e->signdx;
-	}
-    }
-    else
-    {
-	if (ne <= -e->dy)
-	{
-	    int nx = (-ne) / e->dy;
-	    e->e = ne + nx * (xFixed_48_16) e->dy;
-	    e->x -= nx * e->signdx;
-	}
-    }
-}
-
-/*
- * A private routine to initialize the multi-step
- * elements of an edge structure
- */
-static void
-_RenderEdgeMultiInit (RenderEdge *e, int n, xFixed *stepx_p, xFixed *dx_p)
-{
-    xFixed	stepx;
-    xFixed_48_16	ne;
-    
-    ne = n * (xFixed_48_16) e->dx;
-    stepx = n * e->stepx;
-    if (ne > 0)
-    {
-	int nx = ne / e->dy;
-	ne -= nx * e->dy;
-	stepx += nx * e->signdx;
-    }
-    *dx_p = ne;
-    *stepx_p = stepx;
+    pixman_edge_step (e, n);
 }
 
 /*
@@ -136,35 +73,7 @@ RenderEdgeInit (RenderEdge	*e,
 		xFixed		x_bot,
 		xFixed		y_bot)
 {
-    xFixed	dx, dy;
-
-    e->x = x_top;
-    e->e = 0;
-    dx = x_bot - x_top;
-    dy = y_bot - y_top;
-    e->dy = dy;
-    e->dx = 0;
-    if (dy)
-    {
-	if (dx >= 0)
-	{
-	    e->signdx = 1;
-	    e->stepx = dx / dy;
-	    e->dx = dx % dy;
-	    e->e = -dy;
-	}
-	else
-	{
-	    e->signdx = -1;
-	    e->stepx = -(-dx / dy);
-	    e->dx = -dx % dy;
-	    e->e = 0;
-	}
-    
-	_RenderEdgeMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small);
-	_RenderEdgeMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big);
-    }
-    RenderEdgeStep (e, y_start - y_top);
+    pixman_edge_init (e, n, y_start, x_top, y_top, x_bot, y_bot);
 }
 
 /*
@@ -179,24 +88,6 @@ RenderLineFixedEdgeInit (RenderEdge *e,
 			 int	    x_off,
 			 int	    y_off)
 {
-    xFixed	x_off_fixed = IntToxFixed(x_off);
-    xFixed	y_off_fixed = IntToxFixed(y_off);
-    xPointFixed	*top, *bot;
-
-    if (line->p1.y <= line->p2.y)
-    {
-	top = &line->p1;
-	bot = &line->p2;
-    }
-    else
-    {
-	top = &line->p2;
-	bot = &line->p1;
-    }
-    RenderEdgeInit (e, n, y,
-		    top->x + x_off_fixed,
-		    top->y + y_off_fixed,
-		    bot->x + x_off_fixed,
-		    bot->y + y_off_fixed);
+    pixman_line_fixed_edge_init (e, n, y, (pixman_line_fixed_t *)line, x_off, y_off);
 }
 
diff --git a/render/renderedge.h b/render/renderedge.h
index d621d9d..38f9f09 100644
--- a/render/renderedge.h
+++ b/render/renderedge.h
@@ -50,20 +50,7 @@
  * and can be quickly stepped across small or large gaps in the
  * sample grid
  */
-
-typedef struct {
-    xFixed   x;
-    xFixed   e;
-    xFixed   stepx;
-    xFixed   signdx;
-    xFixed   dy;
-    xFixed   dx;
-
-    xFixed   stepx_small;
-    xFixed   stepx_big;
-    xFixed   dx_small;
-    xFixed   dx_big;
-} RenderEdge;
+typedef pixman_edge_t RenderEdge;
 
 /*
  * Step across a small sample grid gap
diff-tree 3ba3ede9bbdfc6376b6f6e0b6ce8280a05e6584d (from cc648e609d472472bac4a2e568eb3598b3690ba3)
Author: Soren Sandmann Pedersen <ssp at dhcp83-218.boston.redhat.com>
Date:   Wed May 23 12:56:04 2007 -0400

    Add missing offsets for window coordinates - reported by Colin Harrison

diff --git a/fb/fbpict.c b/fb/fbpict.c
index eb78ced..3ad4a22 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -384,6 +384,19 @@ fbComposite (CARD8      op,
     pixman_region16_t region;
     pixman_image_t *src, *mask, *dest;
     
+    xDst += pDst->pDrawable->x;
+    yDst += pDst->pDrawable->y;
+    if (pSrc->pDrawable)
+    {
+        xSrc += pSrc->pDrawable->x;
+        ySrc += pSrc->pDrawable->y;
+    }
+    if (pMask && pMask->pDrawable)
+    {
+	xMask += pMask->pDrawable->x;
+	yMask += pMask->pDrawable->y;
+    }
+
     if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst, xSrc, ySrc,
 				   xMask, yMask, xDst, yDst, width, height))
         return;


More information about the xorg-commit mailing list