[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-experimental'



 Xext/shm.c                       |   43 +++++++++++++----
 composite/compinit.c             |   59 +----------------------
 configure.ac                     |    7 ++
 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/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 +---
 include/colormap.h               |    5 ++
 render/glyph.c                   |   97 ++++++++++++++++++++-------------------
 render/render.c                  |    6 ++
 18 files changed, 251 insertions(+), 200 deletions(-)

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

    xserver 1.7.0
    
    Signed-off-by: Peter Hutterer <peter.hutterer@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@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@who-t.net>
    Acked-by: Simon Thum <simon.thum@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@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@gmail.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Acked-by: Julien Cristau <jcristau@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@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@redhat.com>
    Declared-as-sane-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@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@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@who-t.net>
    Reviewed-by: Keith Packard <keithp@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@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@who-t.net>
    Reviewed-by: Keith Packard <keithp@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@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@redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@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@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@keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@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@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@redhat.com>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@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@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@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@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@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@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@who-t.net>
    Acked-by: Dave Airlie <airlied@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@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)
     {


Reply to: