xserver: Branch 'xorg-server-1.7-apple' - 20 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Thu Oct 1 23:37:16 PDT 2009


 Xext/shm.c                               |   43 ++++++++++---
 composite/compinit.c                     |   59 +-----------------
 configure.ac                             |    9 +-
 dix/colormap.c                           |   64 ++++++++++++++++++++
 dix/getevents.c                          |   13 ++++
 exa/exa_migration_classic.c              |   10 +--
 glx/glxscreens.c                         |   58 ------------------
 hw/kdrive/ephyr/Xephyr.man.pre           |    5 +
 hw/kdrive/ephyr/ephyrinit.c              |   16 ++++-
 hw/xfree86/common/compiler.h             |   16 +++++
 hw/xfree86/common/xf86DGA.c              |   29 +++++----
 hw/xfree86/modes/xf86Crtc.c              |    4 -
 hw/xfree86/modes/xf86Crtc.h              |    8 ++
 hw/xfree86/modes/xf86DiDGA.c             |   15 +++-
 hw/xfree86/modes/xf86EdidModes.c         |    2 
 hw/xfree86/modes/xf86Rotate.c            |   10 ---
 hw/xfree86/os-support/hurd/hurd_video.c  |    2 
 hw/xfree86/os-support/misc/SlowBcopy.c   |   52 ++++++++++++++++
 hw/xfree86/os-support/shared/bios_mmap.c |    2 
 hw/xfree86/vgahw/vgaHW.c                 |   16 ++---
 include/colormap.h                       |    5 +
 render/glyph.c                           |   97 ++++++++++++++++---------------
 render/render.c                          |    6 +
 23 files changed, 330 insertions(+), 211 deletions(-)

New commits:
commit 293c318c85deb022fdaae460a33cf57c6a1e6931
Merge: dfcfd04... 4257023...
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Thu Oct 1 23:36:26 2009 -0700

    Merge commit 'origin/server-1.7-branch' into xorg-server-1.7-apple

commit 4257023c1e40387aff096d5f00d746d3f7a521b4
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Oct 2 14:05:43 2009 +1000

    xserver 1.7.0
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index 8145c64..9425bc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.6.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2009-9-28"
+AC_INIT([xorg-server], 1.7.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2009-10-2"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE
commit 15b4faff281ad8abce6b32fe2fc855eb6da42476
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 1 21:19:11 2009 +1000

    dix: force a minimum of 0 for screen coordinates.
    
    Currently the root coordinates may fall into ]-1..0] if the subpixel
    remainder is less than 0. Screen coordinates mustn't go below 0, so use
    miPointerSetPosition to cap off the remainder if the coordinates are below
    0.
    
    This is cheating a bit, a more comprehensive solution to deal with subpixels
    correctly when crossing screens is needed. For now, this'll do.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Simon Thum <simon.thum at gmx.de>
    (cherry picked from commit 45f447dafded5adfe11b7df3325c2d8f6ae0639b)

diff --git a/dix/getevents.c b/dix/getevents.c
index 5224d31..2df32e8 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -781,6 +781,19 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
         *screeny_frac = dev->last.remainder[1];
     }
 
+    /* Hit the left screen edge? */
+    if (*screenx <= 0 && *screenx_frac < 0.0f)
+    {
+        *screenx_frac = 0.0f;
+        x_frac = 0.0f;
+    }
+    if (*screeny <= 0 && *screeny_frac < 0.0f)
+    {
+        *screeny_frac = 0.0f;
+        y_frac = 0.0f;
+    }
+
+
     old_screenx = *screenx;
     old_screeny = *screeny;
     /* This takes care of crossing screens for us, as well as clipping
commit 3788113618977bdc83e3ec1e7ca3160bad9a0d13
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Oct 2 09:34:24 2009 +1000

    configure: if xnest was requested but modules weren't found, fail.
    
    Tested-by: Xavier Chantry <shiningxc at gmail.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 64fe5784b49347e1fd27b0c463be5c16557594c9)

diff --git a/configure.ac b/configure.ac
index 9517595..8145c64 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1373,6 +1373,9 @@ AC_MSG_RESULT([$XNEST])
 AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
 
 if test "x$XNEST" = xyes; then
+	if test "x$have_xnest" = xno; then
+		AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
+	fi
 	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $MAIN_LIB $OS_LIB $CONFIG_LIB"
 	XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
 	AC_SUBST([XNEST_LIBS])
commit c3034dc3af450802dda156136d9fabbc1cc58836
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Oct 1 15:25:55 2009 +1000

    rotate: drop unwrapping inside block handler.
    
    Keith has shown half the block handlers wrappers are wrong, also
    dynamic wrapping/unwrapping from what I can see will happen after
    the drivers, so its really accidental ABI, that we can't change
    now without modifing drivers. So be safe for 1.7.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Declared-as-sane-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 3ebb82d61c2b56e8f7145443a552a4e913bbfc80)

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 9e65c99..5de6b0c 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -268,13 +268,9 @@ xf86RotateBlockHandler(int screenNum, pointer blockData,
     rotation_active = xf86RotateRedisplay(pScreen);
     pScreen->BlockHandler = xf86_config->BlockHandler;
     (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
-    if (rotation_active) {
-	/* Re-wrap if rotation is still happening */
-	xf86_config->BlockHandler = pScreen->BlockHandler;
-	pScreen->BlockHandler = xf86RotateBlockHandler;
-    } else {
-	xf86_config->BlockHandler = NULL;
-    }
+    /* cannot avoid re-wrapping until all wrapping is audited */
+    xf86_config->BlockHandler = pScreen->BlockHandler;
+    pScreen->BlockHandler = xf86RotateBlockHandler;
 }
 
 void
commit 47c0b80915d67346ec63b36b659a96b77e777a71
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 1 10:03:42 2009 +1000

    render: Fix crash in RenderAddGlyphs (#23645)
    
    This patch fixes two bugs:
    size is calculated as glyph height * padded_width. If the client submits
    garbage, this may get above INT_MAX, resulting in a negative size if size is
    unsigned. The sanity checks don't trigger for negative sizes and the server
    goes and writes into random memory locations.
    
    If the client submits glyphs with a width or height 0, the destination
    pixmap is NULL, causing a null-pointer dereference. Since there's nothing to
    composite if the width/height is 0, we might as well skip the whole thing
    anyway.
    
    Tested with Xvfb, Xephyr and Xorg.
    
    X.Org Bug 23645 <http://bugs.freedesktop.org/show_bug.cgi?id=23645>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 622fc98fd08aba98369e6933c3ab8c9ff85385d5)

diff --git a/render/render.c b/render/render.c
index a306766..a32d797 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1043,7 +1043,7 @@ ProcRenderAddGlyphs (ClientPtr client)
     CARD32	    *gids;
     xGlyphInfo	    *gi;
     CARD8	    *bits;
-    int		    size;
+    unsigned int    size;
     int		    err;
     int		    i, screen;
     PicturePtr	    pSrc = NULL, pDst = NULL;
@@ -1131,6 +1131,10 @@ ProcRenderAddGlyphs (ClientPtr client)
 		ScreenPtr   pScreen;
 		int	    error;
 
+		/* Skip work if it's invisibly small anyway */
+		if (!width || !height)
+		    break;
+
 		pScreen = screenInfo.screens[screen];
 		pSrcPix = GetScratchPixmapHeader (pScreen,
 						  width, height,
commit 30ebee3bfcadf915be98d407610c615e3e00f9c1
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 1 15:22:19 2009 +1000

    render: set the glyph picture to NULL by default.
    
    In a follow-up patch we may have glyphs with a NULL picture. To cope with
    that, always set the pictures for glyphs to NULL at creation time and cope
    with cleaning up such glyphs. Also, since compositing a NULL source doesn't
    do a lot anyway, skip trying to do so.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 758ab55d2defc78d0169fd61a7036eb9f889e9e7)

diff --git a/render/glyph.c b/render/glyph.c
index 6327c9f..7fcdfd9 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -282,7 +282,8 @@ FreeGlyphPicture(GlyphPtr glyph)
     {
         ScreenPtr pScreen = screenInfo.screens[i];
 
-        FreePicture ((pointer) GlyphPicture (glyph)[i], 0);
+        if (GlyphPicture(glyph)[i])
+            FreePicture ((pointer) GlyphPicture (glyph)[i], 0);
 
         ps = GetPictureScreenIfSet (pScreen);
         if (ps)
@@ -414,6 +415,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth)
 
     for (i = 0; i < screenInfo.numScreens; i++)
     {
+	GlyphPicture(glyph)[i] = NULL;
 	ps = GetPictureScreenIfSet (screenInfo.screens[i]);
 
 	if (ps)
@@ -721,32 +723,35 @@ miGlyphs (CARD8		op,
 	    glyph = *glyphs++;
 	    pPicture = GlyphPicture (glyph)[pScreen->myNum];
 
-	    if (maskFormat)
+	    if (pPicture)
 	    {
-		CompositePicture (PictOpAdd,
-				  pPicture,
-				  None,
-				  pMask,
-				  0, 0,
-				  0, 0,
-				  x - glyph->info.x,
-				  y - glyph->info.y,
-				  glyph->info.width,
-				  glyph->info.height);
-	    }
-	    else
-	    {
-		CompositePicture (op,
-				  pSrc,
-				  pPicture,
-				  pDst,
-				  xSrc + (x - glyph->info.x) - xDst,
-				  ySrc + (y - glyph->info.y) - yDst,
-				  0, 0,
-				  x - glyph->info.x,
-				  y - glyph->info.y,
-				  glyph->info.width,
-				  glyph->info.height);
+		if (maskFormat)
+		{
+			CompositePicture (PictOpAdd,
+					  pPicture,
+					  None,
+					  pMask,
+					  0, 0,
+					  0, 0,
+					  x - glyph->info.x,
+					  y - glyph->info.y,
+					  glyph->info.width,
+					  glyph->info.height);
+		}
+		else
+		{
+		    CompositePicture (op,
+				      pSrc,
+				      pPicture,
+				      pDst,
+				      xSrc + (x - glyph->info.x) - xDst,
+				      ySrc + (y - glyph->info.y) - yDst,
+				      0, 0,
+				      x - glyph->info.x,
+				      y - glyph->info.y,
+				      glyph->info.width,
+				      glyph->info.height);
+		}
 	    }
 
 	    x += glyph->info.xOff;
commit 8026c5a08584419be3adecd5965dd03e793ddf81
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu Oct 1 15:17:11 2009 +1000

    exa: avoid infinite loops if UTS sw fallbacks.
    
    The upload in finish access can cause an infinite loop if
    UTS returns FALSE in here.
    
    Fixes fd.o bug #24246.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit b5fcc5553eb784c9f4826936e839079c0cdee55a)

diff --git a/exa/exa_migration_classic.c b/exa/exa_migration_classic.c
index 4819af8..6d7b9f5 100644
--- a/exa/exa_migration_classic.c
+++ b/exa/exa_migration_classic.c
@@ -242,11 +242,6 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
 	pBox++;
     }
 
-    if (access_prepared)
-	exaFinishAccess(&pPixmap->drawable, fallback_index);
-    else if (need_sync && sync)
-	sync (pPixmap->drawable.pScreen);
-
     pExaPixmap->offscreen = save_offscreen;
     pPixmap->devKind = save_pitch;
 
@@ -261,6 +256,11 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
     REGION_UNION(pScreen, pValidDst, pValidDst, &CopyReg);
 
     REGION_UNINIT(pScreen, &CopyReg);
+
+    if (access_prepared)
+	exaFinishAccess(&pPixmap->drawable, fallback_index);
+    else if (need_sync && sync)
+	sync (pPixmap->drawable.pScreen);
 }
 
 /**
commit e182c1b4368c6958579732dd4ddc59de2b46359b
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Sep 30 11:40:19 2009 -0700

    Re-fix DGA removal.
    
    Removing DGA ended up breaking any drivers calling into the old
    xf86DiDGAInit function as it tried to see if DGA was already enabled
    and ended up crashing if the VT wasn't completely initialized. Oops.
    
    Also, if the driver initializes DGA itself, have the DiDGA
    initialization overwrite that information as the DiDGA code will call
    ReInit on mode detect.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit db98b26ee145f70e732e2cf4a6ac3de77fdf4adc)

diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 42b7c58..804fd37 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -120,8 +120,22 @@ DGAInit(
 
     DGAScreenKey = &DGAScreenKeyIndex;
 
-    if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec))))
-	return FALSE;
+    pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+    if (!pScreenPriv)
+    {
+	if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec))))
+	    return FALSE;
+	dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv);
+	pScreenPriv->CloseScreen = pScreen->CloseScreen;
+	pScreen->CloseScreen = DGACloseScreen;
+	pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
+	pScreen->DestroyColormap = DGADestroyColormap;
+	pScreenPriv->InstallColormap = pScreen->InstallColormap;
+	pScreen->InstallColormap = DGAInstallColormap;
+	pScreenPriv->UninstallColormap = pScreen->UninstallColormap;
+	pScreen->UninstallColormap = DGAUninstallColormap;
+    }
 
     pScreenPriv->pScrn = pScrn;
     pScreenPriv->numModes = num;
@@ -146,17 +160,6 @@ DGAInit(
 	    modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
 #endif
 
-    dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv);
-    pScreenPriv->CloseScreen = pScreen->CloseScreen;
-    pScreen->CloseScreen = DGACloseScreen;
-    pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
-    pScreen->DestroyColormap = DGADestroyColormap;
-    pScreenPriv->InstallColormap = pScreen->InstallColormap;
-    pScreen->InstallColormap = DGAInstallColormap;
-    pScreenPriv->UninstallColormap = pScreen->UninstallColormap;
-    pScreen->UninstallColormap = DGAUninstallColormap;
-
-
     return TRUE;
 }
 
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index c1e31e0..506fbb9 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -806,7 +806,7 @@ xf86CrtcScreenInit (ScreenPtr screen)
     screen->CloseScreen = xf86CrtcCloseScreen;
     
 #ifdef XFreeXDGA
-    xf86DiDGAInit(screen, 0);
+    _xf86_di_dga_init_internal(screen);
 #endif
 #ifdef RANDR_13_INTERFACE
     return RANDR_INTERFACE_VERSION;
@@ -1928,7 +1928,7 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
     scrn->currentMode = scrn->modes;
 #ifdef XFreeXDGA
     if (scrn->pScreen)
-	    xf86DiDGAReInit(scrn->pScreen);
+	    _xf86_di_dga_reinit_internal(scrn->pScreen);
 #endif
 }
 
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 69afaa5..9baa956 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -833,6 +833,10 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
 extern _X_EXPORT Bool
 xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
 
+/* this is the real function, used only internally */
+_X_INTERNAL Bool
+_xf86_di_dga_init_internal (ScreenPtr pScreen);
+
 /**
  * Re-initialize dga for this screen (as when the set of modes changes)
  */
@@ -841,6 +845,10 @@ extern _X_EXPORT Bool
 xf86DiDGAReInit (ScreenPtr pScreen);
 #endif
 
+/* This is the real function, used only internally */
+_X_INTERNAL Bool
+_xf86_di_dga_reinit_internal (ScreenPtr pScreen);
+
 /*
  * Set the subpixel order reported for the screen using
  * the information from the outputs
diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c
index 0f7b834..60fbdbf 100644
--- a/hw/xfree86/modes/xf86DiDGA.c
+++ b/hw/xfree86/modes/xf86DiDGA.c
@@ -175,6 +175,12 @@ static DGAFunctionRec xf86_dga_funcs = {
 Bool
 xf86DiDGAReInit (ScreenPtr pScreen)
 {
+    return TRUE;
+}
+
+Bool
+_xf86_di_dga_reinit_internal (ScreenPtr pScreen)
+{
     ScrnInfoPtr		scrn = xf86Screens[pScreen->myNum];
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     
@@ -190,12 +196,15 @@ xf86DiDGAReInit (ScreenPtr pScreen)
 Bool
 xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address)
 {
+    return TRUE;
+}
+
+Bool
+_xf86_di_dga_init_internal (ScreenPtr pScreen)
+{
     ScrnInfoPtr		scrn = xf86Screens[pScreen->myNum];
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
 
-    if (DGAAvailable(pScreen->myNum))
-	return TRUE;
-
     xf86_config->dga_flags = 0;
     xf86_config->dga_address = 0;
     xf86_config->dga_width = 0;
commit 369b5d526b699cd1c5cd38bb5a823ec66c5286ef
Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Sep 29 11:49:09 2009 +1000

    dix/glx/composite: consolidate visual resize in one place.
    
    The previous code was copied and in both cases incorrectly fixed
    up the colormaps after resizing the visuals, this patch consolidates
    the visual resize + colormaps fixups in one place. This version
    also consolidates the vid allocation for the DepthPtr inside the
    function.
    
    I'm not 100% sure colormap.[ch] is the correct place for this but
    visuals are mostly created in fb and I know thats not the place to
    be resizing them.
    
    Fixes fd.o bug #19470.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 6ffda5aae75272fabdc27d6f693ae827be119e95)

diff --git a/composite/compinit.c b/composite/compinit.c
index 6159e4e..96ac70f 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -248,15 +248,9 @@ static Bool
 compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
 		       CompAlternateVisual *alt)
 {
-    VisualPtr	    visual, visuals;
-    int		    i;
-    int		    numVisuals;
-    XID		    *installedCmaps;
-    ColormapPtr	    installedCmap;
-    int		    numInstalledCmaps;
+    VisualPtr	    visual;
     DepthPtr	    depth;
     PictFormatPtr   pPictFormat;
-    VisualID	    *vid;
     unsigned long   alphaMask;
 
     /*
@@ -277,54 +271,13 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
 	pPictFormat->direct.red != pScreen->visuals[0].offsetRed)
 	return FALSE;
 
-    vid = xalloc(sizeof(VisualID));
-    if (!vid)
-	return FALSE;
-
-    /* Find the installed colormaps */
-    installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
-    if (!installedCmaps) {
-	xfree(vid);
-	return FALSE;
-    }
-    numInstalledCmaps = pScreen->ListInstalledColormaps(pScreen, 
-	    installedCmaps);
-
-    /* realloc the visual array to fit the new one in place */
-    numVisuals = pScreen->numVisuals;
-    visuals = xrealloc(pScreen->visuals, (numVisuals + 1) * sizeof(VisualRec));
-    if (!visuals) {
-	xfree(vid);
-	xfree(installedCmaps);
-	return FALSE;
+    if (ResizeVisualArray(pScreen, 1, depth) == FALSE) {
+        return FALSE;
     }
 
-    /*
-     * Fix up any existing installed colormaps -- we'll assume that
-     * the only ones created so far have been installed.  If this
-     * isn't true, we'll have to walk the resource database looking
-     * for all colormaps.
-     */
-    for (i = 0; i < numInstalledCmaps; i++) {
-	int j, rc;
-
-	rc = dixLookupResourceByType((pointer *)&installedCmap,
-				     installedCmaps[i], RT_COLORMAP,
-				     serverClient, DixReadAccess);
-	if (rc != Success)
-	    continue;
-	j = installedCmap->pVisual - pScreen->visuals;
-	installedCmap->pVisual = &visuals[j];
-    }
-
-    xfree(installedCmaps);
-
-    pScreen->visuals = visuals;
-    visual = visuals + pScreen->numVisuals; /* the new one */
-    pScreen->numVisuals++;
+    visual = pScreen->visuals + (pScreen->numVisuals - 1); /* the new one */
 
     /* Initialize the visual */
-    visual->vid = FakeClientID (0);
     visual->bitsPerRGBValue = 8;
     if (PICT_FORMAT_TYPE(alt->format) == PICT_TYPE_COLOR) {
 	visual->class = PseudoColor;
@@ -357,10 +310,6 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
     /* remember the visual ID to detect auto-update windows */
     compRegisterAlternateVisuals(cs, &visual->vid, 1);
 
-    /* Fix up the depth */
-    *vid = visual->vid;
-    depth->numVids = 1;
-    depth->vids = vid;
     return TRUE;
 }
 
diff --git a/dix/colormap.c b/dix/colormap.c
index a5a006e..d702b02 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -2690,3 +2690,67 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
     xfree(pmaps);
     return (found);
 }
+
+struct colormap_lookup_data {
+    ScreenPtr pScreen;
+    VisualPtr visuals;
+};
+
+static void _colormap_find_resource(pointer value, XID id,
+				    pointer cdata)
+{
+    struct colormap_lookup_data *cmap_data = cdata;
+    VisualPtr visuals = cmap_data->visuals;
+    ScreenPtr pScreen = cmap_data->pScreen;
+    ColormapPtr cmap = value;
+    int j;
+
+    j = cmap->pVisual - pScreen->visuals;
+    cmap->pVisual = &visuals[j];
+}
+
+/* something has realloced the visuals, instead of breaking
+   ABI fix it up here - glx and compsite did this wrong */
+Bool
+ResizeVisualArray(ScreenPtr pScreen, int new_visual_count,
+		  DepthPtr depth)
+{
+    struct colormap_lookup_data cdata;
+    int numVisuals;
+    VisualPtr visuals;
+    XID *vids, vid;
+    int first_new_vid, first_new_visual, i;
+
+    first_new_vid = depth->numVids;
+    first_new_visual = pScreen->numVisuals;
+
+    vids = xrealloc(depth->vids, (depth->numVids + new_visual_count) * sizeof(XID));
+    if (!vids)
+        return FALSE;
+
+    /* its realloced now no going back if we fail the next one */
+    depth->vids = vids;
+
+    numVisuals = pScreen->numVisuals + new_visual_count;
+    visuals = xrealloc(pScreen->visuals, numVisuals * sizeof(VisualRec));
+    if (!visuals) {
+	return FALSE;
+    }
+
+    cdata.visuals = visuals;
+    cdata.pScreen = pScreen;
+    FindClientResourcesByType(serverClient, RT_COLORMAP, _colormap_find_resource, &cdata);
+
+    pScreen->visuals = visuals;
+
+    for (i = 0; i < new_visual_count; i++) {
+	vid = FakeClientID(0);
+	pScreen->visuals[first_new_visual + i].vid = vid;
+	vids[first_new_vid + i] = vid;
+    }
+
+    depth->numVids += new_visual_count;
+    pScreen->numVisuals += new_visual_count;
+
+    return TRUE;
+}
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 81faddd..7d29d31 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -250,12 +250,8 @@ GLint glxConvertToXVisualType(int visualType)
 static VisualPtr
 AddScreenVisuals(ScreenPtr pScreen, int count, int d)
 {
-    XID		*installedCmaps, *vids, vid;
-    int		 numInstalledCmaps, numVisuals, i, j;
-    VisualPtr	 visuals;
-    ColormapPtr	 installedCmap;
+    int		 i;
     DepthPtr	 depth;
-    int		 rc;
 
     depth = NULL;
     for (i = 0; i < pScreen->numDepths; i++) {
@@ -267,56 +263,8 @@ AddScreenVisuals(ScreenPtr pScreen, int count, int d)
     if (depth == NULL)
 	return NULL;
 
-    /* Find the installed colormaps */
-    installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
-    if (!installedCmaps)
-	return NULL;
-
-    numInstalledCmaps = pScreen->ListInstalledColormaps(pScreen, installedCmaps);
-
-    /* realloc the visual array to fit the new one in place */
-    numVisuals = pScreen->numVisuals;
-    visuals = xrealloc(pScreen->visuals, (numVisuals + count) * sizeof(VisualRec));
-    if (!visuals) {
-	xfree(installedCmaps);
-	return NULL;
-    }
-
-    vids = xrealloc(depth->vids, (depth->numVids + count) * sizeof(XID));
-    if (vids == NULL) {
-	xfree(installedCmaps);
-	xfree(visuals);
-	return NULL;
-    }
-
-    /*
-     * Fix up any existing installed colormaps -- we'll assume that
-     * the only ones created so far have been installed.  If this
-     * isn't true, we'll have to walk the resource database looking
-     * for all colormaps.
-     */
-    for (i = 0; i < numInstalledCmaps; i++) {
-	rc = dixLookupResourceByType((pointer *)&installedCmap,
-				     installedCmaps[i], RT_COLORMAP,
-				     serverClient, DixReadAccess);
-	if (rc != Success)
-	    continue;
-	j = installedCmap->pVisual - pScreen->visuals;
-	installedCmap->pVisual = &visuals[j];
-    }
-
-    xfree(installedCmaps);
-
-    for (i = 0; i < count; i++) {
-	vid = FakeClientID(0);
-	visuals[pScreen->numVisuals + i].vid = vid;
-	vids[depth->numVids + i] = vid;
-    }
-
-    pScreen->visuals = visuals;
-    pScreen->numVisuals += count;
-    depth->vids = vids;
-    depth->numVids += count;
+    if (ResizeVisualArray(pScreen, count, depth) == FALSE)
+        return NULL;
 
     /* Return a pointer to the first of the added visuals. */ 
     return pScreen->visuals + pScreen->numVisuals - count;
diff --git a/include/colormap.h b/include/colormap.h
index a3467c9..de48ce8 100644
--- a/include/colormap.h
+++ b/include/colormap.h
@@ -179,4 +179,9 @@ extern _X_EXPORT int IsMapInstalled(
     Colormap /*map*/,
     WindowPtr /*pWin*/);
 
+extern _X_EXPORT Bool ResizeVisualArray(
+    ScreenPtr /* pScreen */,
+    int /* new_vis_count */,
+    DepthPtr /* depth */);
+
 #endif /* CMAP_H */
commit d3ba814884154150ed3e6a71254dec7312593488
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Tue Sep 29 08:56:59 2009 +0200

    Fix ShmPutImage non-ZPixmap case.
    
    Fixes http://bugs.freedesktop.org/show_bug.cgi?id=23298 .
    (cherry picked from commit 11817a881cb93a89788105d1e575a468f2a8d27c)

diff --git a/Xext/shm.c b/Xext/shm.c
index e4f08e2..a6f804c 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -497,15 +497,40 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
 	      char *data)
 {
     PixmapPtr pPixmap;
-  
-    pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
-				     BitsPerPixel(depth),
-				     PixmapBytePad(w, depth),
-				     data);
-    if (!pPixmap)
-	return;
-    pGC->ops->CopyArea((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy);
-    FreeScratchPixmapHeader(pPixmap);
+
+    if (format == ZPixmap || depth == 1) {
+	pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
+					 BitsPerPixel(depth),
+					 PixmapBytePad(w, depth),
+					 data);
+	if (!pPixmap)
+	    return;
+	pGC->ops->CopyArea((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy);
+	FreeScratchPixmapHeader(pPixmap);
+    } else {
+	GCPtr putGC = GetScratchGC(depth, dst->pScreen);
+
+	if (!putGC)
+	    return;
+
+	pPixmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth,
+						CREATE_PIXMAP_USAGE_SCRATCH);
+	if (!pPixmap) {
+	    FreeScratchGC(putGC);
+	    return;
+	}
+	ValidateGC(&pPixmap->drawable, putGC);
+	(*putGC->ops->PutImage)(&pPixmap->drawable, putGC, depth, -sx, -sy, w, h, 0,
+				(format == XYPixmap) ? XYPixmap : ZPixmap, data);
+	FreeScratchGC(putGC);
+	if (format == XYBitmap)
+	    (void)(*pGC->ops->CopyPlane)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
+					 dx, dy, 1L);
+	else
+	    (void)(*pGC->ops->CopyArea)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
+					dx, dy);
+	(*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+    }
 }
 
 #ifdef PANORAMIX
commit 8fc0d54cbaf791d947c7bab23f2e982cabd7c958
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Sep 28 14:18:45 2009 +1000

    ephyr: if -parent is given, check for a trailing -screen. (#24144)
    
    If -parent is given, don't open up a new window if -screen is given as well.
    The commandline option -screen allows to set the depth of the embedded
    Xephry instance, even though width and height are autoscaled on -parent.
    
    This patch checks for a -screen parameter after -parent and - if one is
    found - delays initializing the screen. The parent window id is stored
    temporarily but re-set after a -screen argument.
    The following command is thus valid:
    
    Xephyr -parent 1234 -screen 640x480 at 8 -screen 1024x768
    
    It embeds the first 8-bit screen into window 1234 and opens up a new window
    for the second screen. Multiple parent arguments are possible, the screens
    are embedded in-order.
    
    X.Org Bug 24144 <http://bugs.freedesktop.org/show_bug.cgi?id=24144>
    
    Tested-by: Vic Lee
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 19be992d9dc542b61fa3f4fd32a09071c9e64880)

diff --git a/hw/kdrive/ephyr/Xephyr.man.pre b/hw/kdrive/ephyr/Xephyr.man.pre
index 0082569..eb80b96 100644
--- a/hw/kdrive/ephyr/Xephyr.man.pre
+++ b/hw/kdrive/ephyr/Xephyr.man.pre
@@ -46,6 +46,11 @@ sets the screen size.
 .BI -parent " id"
 uses exiting window
 .I id .
+If a 
+.BI -screen 
+argument follows a 
+.BI -parent
+argument, this screen is embedded into the given window.
 .TP 8
 .B -host-cursor
 set 'cursor acceleration':
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 22152ff..eecad7e 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -148,6 +148,7 @@ processScreenArg (char *screen_size, char *parent_id)
 int
 ddxProcessArgument (int argc, char **argv, int i)
 {
+  static char* parent = NULL;
   EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
 
   if (i == 1)
@@ -159,6 +160,18 @@ ddxProcessArgument (int argc, char **argv, int i)
     {
       if(i+1 < argc)
 	{
+	  int j;
+	  /* If parent is specified and a screen argument follows, don't do
+           * anything, let the -screen handling init the rest */
+	  for (j = i; j < argc; j++)
+	    {
+	      if (!strcmp(argv[j], "-screen"))
+		{
+		  parent = argv[i + 1];
+		  return 2;
+		}
+	    }
+
 	  processScreenArg ("100x100", argv[i+1]);
 	  return 2;
 	}
@@ -170,7 +183,8 @@ ddxProcessArgument (int argc, char **argv, int i)
     {
       if ((i+1) < argc)
 	{
-	  processScreenArg (argv[i+1], NULL);
+	  processScreenArg (argv[i+1], parent);
+	  parent = NULL;
 	  return 2;
 	}
 
commit 857ec3e6fff571398dfcd9b4728b5c38cbcd3fcb
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Sep 28 13:59:25 2009 +1000

    xfree86: use the DDC size if either width or height of DisplaySize is bogus.
    
    If either width or height of DisplaySize is invalid, assume that the
    configuration is invalid and use the DDC-reported values instead.
    
    See Comment 9, Bug 9758.
    http://bugs.freedesktop.org/show_bug.cgi?id=9758#c9
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 83023ffd09a84ff48e6b99f57ebad101a00478db)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 6e11f9a..2f80070 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -957,7 +957,7 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
 
     quirks = xf86DDCDetectQuirks(scrnIndex, DDC, FALSE);
 
-    if (Monitor->widthmm <= 0 && Monitor->heightmm <= 0) {
+    if (Monitor->widthmm <= 0 || Monitor->heightmm <= 0) {
 	Monitor->widthmm = 10 * DDC->features.hsize;
 	Monitor->heightmm = 10 * DDC->features.vsize;
     }
commit 2d4bab18c0d894619f044f29769c67c2f63b540a
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Sep 23 10:53:51 2009 +1000

    render: Plug a memory leak in AddGlyph. (#23286)
    
    AddGlyph was missing the FreePicture() call that DeleteGlyph used, resulting
    in a memory leak when more than one Glyph was added in a RenderAddGlyphs
    request.
    
    Since the code in AddGlyph and DeleteGlyph is identical, move into a static
    function to avoid such mistakes in the future.
    
    X.Org Bug 23286 <http://bugs.freedesktop.org/show_bug.cgi?id=23286>
    (cherry picked from commit f772014c435f56db56520ca13ffa39431684f122)

diff --git a/render/glyph.c b/render/glyph.c
index 7c044aa..6327c9f 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -272,13 +272,31 @@ CheckDuplicates (GlyphHashPtr hash, char *where)
 #define DuplicateRef(a,b)
 #endif
 
+static void
+FreeGlyphPicture(GlyphPtr glyph)
+{
+    PictureScreenPtr ps;
+    int i;
+
+    for (i = 0; i < screenInfo.numScreens; i++)
+    {
+        ScreenPtr pScreen = screenInfo.screens[i];
+
+        FreePicture ((pointer) GlyphPicture (glyph)[i], 0);
+
+        ps = GetPictureScreenIfSet (pScreen);
+        if (ps)
+            (*ps->UnrealizeGlyph) (pScreen, glyph);
+    }
+}
+
+
 void
 FreeGlyph (GlyphPtr glyph, int format)
 {
     CheckDuplicates (&globalGlyphs[format], "FreeGlyph");
     if (--glyph->refcnt == 0)
     {
-	PictureScreenPtr ps;
 	GlyphRefPtr      gr;
 	int	         i;
 	int	         first;
@@ -305,17 +323,7 @@ FreeGlyph (GlyphPtr glyph, int format)
 	    globalGlyphs[format].tableEntries--;
 	}
 
-	for (i = 0; i < screenInfo.numScreens; i++)
-	{
-	    ScreenPtr pScreen = screenInfo.screens[i];
-
-	    FreePicture ((pointer) GlyphPicture (glyph)[i], 0);
-
-	    ps = GetPictureScreenIfSet (pScreen);
-	    if (ps)
-		(*ps->UnrealizeGlyph) (pScreen, glyph);
-	}
-	
+	FreeGlyphPicture(glyph);
 	FreeGlyphPrivates(glyph);
 	xfree (glyph);
     }
@@ -334,15 +342,7 @@ AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id)
 		       TRUE, glyph->sha1);
     if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph)
     {
-	PictureScreenPtr ps;
-	int              i;
-	
-	for (i = 0; i < screenInfo.numScreens; i++)
-	{
-	    ps = GetPictureScreenIfSet (screenInfo.screens[i]);
-	    if (ps)
-		(*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph);
-	}
+	FreeGlyphPicture(glyph);
 	FreeGlyphPrivates(glyph);
 	xfree (glyph);
 	glyph = gr->glyph;
commit 290a9639db3e420ec4caf0e6aee9f7386724c765
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Sep 28 21:05:11 2009 +1000

    xserver 1.6.99.903 (xserver 1.7 RC3)
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index a7f5510..9517595 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.6.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2009-9-22"
+AC_INIT([xorg-server], 1.6.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2009-9-28"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE
commit 8c83457c60a4e02ca61086c7218dcd0e054926ba
Merge: 6af44db... b49dba3...
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Sep 28 16:48:46 2009 +1000

    Merge remote branch 'origin/xorg-server-1.7-apple' into server-1.7-branch

commit 6af44db315121ea24cec390d144514bf56908b2c
Author: Tilman Sauerbeck <tilman at code-monkey.de>
Date:   Thu Sep 24 12:57:02 2009 +0200

    configure: make XNEST default to auto.
    
    When we're checking whether to build Xnest, we're comparing the
    variable to auto but before it never was assigned that.
    
    Signed-off-by: Tilman Sauerbeck <tilman at code-monkey.de>
    
    [Xnest was enabled to yes to increase build exposure and catch compiler
    errors early. The requirements to Xnest are quite low and I expect most
    developers have them, so Xnext will be enabled on most boxes. Anyone
    missing those requires probably doesn't want to build Xnest anyway.]
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 3db28f92b0c810b452506abbed299a204c90ba0b)

diff --git a/configure.ac b/configure.ac
index 422ef0b..91d87af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -604,7 +604,7 @@ dnl DDXes.
 AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
 AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
 AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
-AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: yes)]), [XNEST=$enableval], [XNEST=yes])
+AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
 AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
 AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
 AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
commit 7e6640b55503b6ee797ab2589f7debcbfa531958
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Sep 28 12:20:03 2009 +1000

    Revert "alpha: kill xf86SlowBCopyToBus and xf86SlowBCopyFromBus"
    
    The vesa driver still uses slowbcopy_frombus and slowbcopy_tobus.
    
    This reverts commit 5ef53a94ce4e48e11de26290cd677266308640c8.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index cdb493a..a450bd6 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1211,6 +1211,8 @@ extern _X_EXPORT void (*xf86WriteMmio32)(int, void *, unsigned long);
 extern _X_EXPORT void (*xf86WriteMmioNB8)(int, void *, unsigned long);
 extern _X_EXPORT void (*xf86WriteMmioNB16)(int, void *, unsigned long);
 extern _X_EXPORT void (*xf86WriteMmioNB32)(int, void *, unsigned long);
+extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
+extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 
 /* Some macros to hide the system dependencies for MMIO accesses */
 /* Changed to kill noise generated by gcc's -Wcast-align */
@@ -1342,4 +1344,18 @@ extern _X_EXPORT void (*xf86WriteMmioNB32)(int, void *, unsigned long);
 #  define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val)
 
 # endif /* __alpha__ */
+
+/*
+ * With Intel, the version in os-support/misc/SlowBcopy.s is used.
+ * This avoids port I/O during the copy (which causes problems with
+ * some hardware).
+ */
+# ifdef __alpha__
+#  define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
+#  define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
+# else /* __alpha__ */
+#  define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
+#  define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
+# endif /* __alpha__ */
+
 #endif /* _COMPILER_H */
diff --git a/hw/xfree86/os-support/misc/SlowBcopy.c b/hw/xfree86/os-support/misc/SlowBcopy.c
index 8a5017e..182a3e6 100644
--- a/hw/xfree86/os-support/misc/SlowBcopy.c
+++ b/hw/xfree86/os-support/misc/SlowBcopy.c
@@ -1,8 +1,15 @@
+/*******************************************************************************
+  for Alpha Linux
+*******************************************************************************/
+ 
 /* 
  *   Create a dependency that should be immune from the effect of register
  *   renaming as is commonly seen in superscalar processors.  This should
  *   insert a minimum of 100-ns delays between reads/writes at clock rates
  *   up to 100 MHz---GGL
+ *   
+ *   Slowbcopy(char *src, char *dst, int count)   
+ *   
  */ 
 
 #ifdef HAVE_XORG_CONFIG_H
@@ -47,3 +54,48 @@ xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
     while(len--)
 	*dst++ = *src++;
 }
+
+#ifdef __alpha__
+
+#ifdef linux
+
+#define SPARSE (7)
+
+#else
+
+#define SPARSE 0
+
+#endif
+
+void
+xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count)
+{
+    unsigned long addr;
+    long result;
+
+    addr = (unsigned long) src;
+    while( count ){
+	result = *(volatile int *) addr;
+	result >>= ((addr>>SPARSE) & 3) * 8;
+	*dst++ = (unsigned char) (0xffUL & result);
+	addr += 1<<SPARSE;
+	count--;
+	outb(0x80, 0x00);
+    }
+}
+  
+void
+xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count)
+{
+    unsigned long addr;
+
+    addr = (unsigned long) dst;
+    while(count) {
+	*(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101;
+	src++;
+	addr += 1<<SPARSE;
+	count--;
+	outb(0x80, 0x00);
+    }
+}
+#endif
diff --git a/hw/xfree86/os-support/shared/bios_mmap.c b/hw/xfree86/os-support/shared/bios_mmap.c
index a615a1d..40afd5b 100644
--- a/hw/xfree86/os-support/shared/bios_mmap.c
+++ b/hw/xfree86/os-support/shared/bios_mmap.c
@@ -131,7 +131,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
 		return(-1);
 	}
 
-	xf86SlowBcopy((unsigned char *)(base+Offset), Buf, Len);
+	xf86SlowBCopyFromBus((unsigned char *)(base+Offset), Buf, Len);
 
 	munmap((caddr_t)base, mlen);
 	close(fd);
diff --git a/hw/xfree86/vgahw/vgaHW.c b/hw/xfree86/vgahw/vgaHW.c
index 025dde2..004376b 100644
--- a/hw/xfree86/vgahw/vgaHW.c
+++ b/hw/xfree86/vgahw/vgaHW.c
@@ -793,7 +793,7 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
     if (hwp->FontInfo1) {
 	hwp->writeSeq(hwp, 0x02, 0x04);	/* write to plane 2 */
 	hwp->writeGr(hwp, 0x04, 0x02);	/* read plane 2 */
-	xf86SlowBcopy(hwp->FontInfo1, hwp->Base, FONT_AMOUNT);
+	slowbcopy_tobus(hwp->FontInfo1, hwp->Base, FONT_AMOUNT);
     }
 #endif
 
@@ -801,7 +801,7 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
     if (hwp->FontInfo2) {
 	hwp->writeSeq(hwp, 0x02, 0x08);	/* write to plane 3 */
 	hwp->writeGr(hwp, 0x04, 0x03);	/* read plane 3 */
-	xf86SlowBcopy(hwp->FontInfo2, hwp->Base, FONT_AMOUNT);
+	slowbcopy_tobus(hwp->FontInfo2, hwp->Base, FONT_AMOUNT);
     }
 #endif
 
@@ -809,10 +809,10 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
     if (hwp->TextInfo) {
 	hwp->writeSeq(hwp, 0x02, 0x01);	/* write to plane 0 */
 	hwp->writeGr(hwp, 0x04, 0x00);	/* read plane 0 */
-	xf86SlowBcopy(hwp->TextInfo, hwp->Base, TEXT_AMOUNT);
+	slowbcopy_tobus(hwp->TextInfo, hwp->Base, TEXT_AMOUNT);
 	hwp->writeSeq(hwp, 0x02, 0x02);	/* write to plane 1 */
 	hwp->writeGr(hwp, 0x04, 0x01);	/* read plane 1 */
-	xf86SlowBcopy((unsigned char *)hwp->TextInfo + TEXT_AMOUNT,
+	slowbcopy_tobus((unsigned char *)hwp->TextInfo + TEXT_AMOUNT,
 			hwp->Base, TEXT_AMOUNT);
     }
 #endif
@@ -971,24 +971,24 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
     if (hwp->FontInfo1 || (hwp->FontInfo1 = xalloc(FONT_AMOUNT))) {
 	hwp->writeSeq(hwp, 0x02, 0x04);	/* write to plane 2 */
 	hwp->writeGr(hwp, 0x04, 0x02);	/* read plane 2 */
-	xf86SlowBcopy(hwp->Base, hwp->FontInfo1, FONT_AMOUNT);
+	slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT);
     }
 #endif /* SAVE_FONT1 */
 #if SAVE_FONT2
     if (hwp->FontInfo2 || (hwp->FontInfo2 = xalloc(FONT_AMOUNT))) {
 	hwp->writeSeq(hwp, 0x02, 0x08);	/* write to plane 3 */
 	hwp->writeGr(hwp, 0x04, 0x03);	/* read plane 3 */
-	xf86SlowBcopy(hwp->Base, hwp->FontInfo2, FONT_AMOUNT);
+	slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT);
     }
 #endif /* SAVE_FONT2 */
 #if SAVE_TEXT
     if (hwp->TextInfo || (hwp->TextInfo = xalloc(2 * TEXT_AMOUNT))) {
 	hwp->writeSeq(hwp, 0x02, 0x01);	/* write to plane 0 */
 	hwp->writeGr(hwp, 0x04, 0x00);	/* read plane 0 */
-	xf86SlowBcopy(hwp->Base, hwp->TextInfo, TEXT_AMOUNT);
+	slowbcopy_frombus(hwp->Base, hwp->TextInfo, TEXT_AMOUNT);
 	hwp->writeSeq(hwp, 0x02, 0x02);	/* write to plane 1 */
 	hwp->writeGr(hwp, 0x04, 0x01);	/* read plane 1 */
-	xf86SlowBcopy(hwp->Base,
+	slowbcopy_frombus(hwp->Base,
 		(unsigned char *)hwp->TextInfo + TEXT_AMOUNT, TEXT_AMOUNT);
     }
 #endif /* SAVE_TEXT */
commit 4aeac52c495c4cf691de7ef7d9e4030e90b3c8b8
Merge: 498135f... 77099b9...
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Sep 28 09:54:53 2009 +1000

    Merge remote branch 'origin/xorg-server-1.7-apple' into server-1.7-branch

commit 498135f26e8504e103ffe4512acf6fddca8e92e8
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date:   Sun Sep 27 17:30:23 2009 +0200

    xfree86: Hurd fix
    
    I hadn't paid attention that the parameters order had changed, here is a
    trivial patch, please apply.
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 78ad6ca9a97440b74019c00a28144ea7d1e03431)

diff --git a/hw/xfree86/os-support/hurd/hurd_video.c b/hw/xfree86/os-support/hurd/hurd_video.c
index b8b00c8..4a99db3 100644
--- a/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/hw/xfree86/os-support/hurd/hurd_video.c
@@ -42,7 +42,7 @@
  * Video Memory Mapping section                                            
  ***************************************************************************/
 static pointer
-mapVidMem(int ScreenNum,int Flags, unsigned long Base, unsigned long Size)
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
 {
     mach_port_t device,iopl_dev;
     memory_object_t iopl_mem;


More information about the xorg-commit mailing list