6662225 Composite extension should be enabled by default
authorAlan Coopersmith <Alan.Coopersmith@Sun.COM>
Thu, 21 Feb 2008 17:03:02 -0800
changeset 323 19895a0cc743
parent 322 f924bf1395e5
child 324 f645da0bdd43
6662225 Composite extension should be enabled by default
open-src/xserver/xorg/composite-7447.patch
open-src/xserver/xorg/composite-default.patch
open-src/xserver/xorg/composite-grabs.patch
open-src/xserver/xorg/patch-list
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/xserver/xorg/composite-7447.patch	Thu Feb 21 17:03:02 2008 -0800
@@ -0,0 +1,138 @@
+From f98dfec79dadb70fa7bba84e7335f92b3a73dc02 Mon Sep 17 00:00:00 2001
+From: Keith Packard <[email protected]>
+Date: Sat, 1 Sep 2007 21:14:22 -0700
+Subject: [PATCH] [COMPOSITE] Composite used for pixmap population on redirect. (Bug #7447)
+
+compNewPixmap copies bits from the parent window to the redirected child
+pixmap to populate the pixmap with reasonable data. It cannot always use
+CopyArea as that only works across matching depths. Use Composite when
+the depths do not match.
+---
+ composite/compalloc.c  |   73 ++++++++++++++++++++++++++++++++++++------------
+ composite/compint.h    |    3 ++
+ composite/compwindow.c |    2 +
+ 3 files changed, 59 insertions(+), 19 deletions(-)
+
+diff --git a/composite/compalloc.c b/composite/compalloc.c
+index f555411..006e808 100644
+--- a/composite/compalloc.c
++++ b/composite/compalloc.c
+@@ -461,7 +461,6 @@ compNewPixmap (WindowPtr pWin, int x, in
+     ScreenPtr	    pScreen = pWin->drawable.pScreen;
+     WindowPtr	    pParent = pWin->parent;
+     PixmapPtr	    pPixmap;
+-    GCPtr	    pGC;
+ 
+     pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth);
+ 
+@@ -471,25 +470,63 @@ compNewPixmap (WindowPtr pWin, int x, in
+     pPixmap->screen_x = x;
+     pPixmap->screen_y = y;
+     
+-    pGC = GetScratchGC (pWin->drawable.depth, pScreen);
+-    
+-    /*
+-     * Copy bits from the parent into the new pixmap so that it will
+-     * have "reasonable" contents in case for background None areas.
+-     */
+-    if (pGC)
++    if (pParent->drawable.depth == pWin->drawable.depth)
+     {
+-	XID val = IncludeInferiors;
++	GCPtr	pGC = GetScratchGC (pWin->drawable.depth, pScreen);
+ 	
+-	ValidateGC(&pPixmap->drawable, pGC);
+-	dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL);
+-	(*pGC->ops->CopyArea) (&pParent->drawable,
+-			       &pPixmap->drawable,
+-			       pGC,
+-			       x - pParent->drawable.x,
+-			       y - pParent->drawable.y,
+-			       w, h, 0, 0);
+-	FreeScratchGC (pGC);
++	/*
++	 * Copy bits from the parent into the new pixmap so that it will
++	 * have "reasonable" contents in case for background None areas.
++	 */
++	if (pGC)
++	{
++	    XID val = IncludeInferiors;
++	    
++	    ValidateGC(&pPixmap->drawable, pGC);
++	    dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL);
++	    (*pGC->ops->CopyArea) (&pParent->drawable,
++				   &pPixmap->drawable,
++				   pGC,
++				   x - pParent->drawable.x,
++				   y - pParent->drawable.y,
++				   w, h, 0, 0);
++	    FreeScratchGC (pGC);
++	}
++    }
++    else
++    {
++	PictFormatPtr	pSrcFormat = compWindowFormat (pParent);
++	PictFormatPtr	pDstFormat = compWindowFormat (pWin);
++	XID		inferiors = IncludeInferiors;
++	int		error;
++
++	PicturePtr	pSrcPicture = CreatePicture (None,
++						     &pParent->drawable,
++						     pSrcFormat,
++						     CPSubwindowMode,
++						     &inferiors,
++						     serverClient, &error);
++						    
++	PicturePtr	pDstPicture = CreatePicture (None,
++						     &pPixmap->drawable,
++						     pDstFormat,
++						     0, 0,
++						     serverClient, &error);
++
++	if (pSrcPicture && pDstPicture)
++	{
++	    CompositePicture (PictOpSrc,
++			      pSrcPicture,
++			      NULL,
++			      pDstPicture,
++			      x - pParent->drawable.x,
++			      y - pParent->drawable.y,
++			      0, 0, 0, 0, w, h);
++	}
++	if (pSrcPicture)
++	    FreePicture (pSrcPicture, 0);
++	if (pDstPicture)
++	    FreePicture (pDstPicture, 0);
+     }
+     return pPixmap;
+ }
+diff --git a/composite/compint.h b/composite/compint.h
+index 38b1777..f69595c 100644
+--- a/composite/compint.h
++++ b/composite/compint.h
+@@ -237,6 +237,9 @@ #else
+ #define compCheckTree(s)
+ #endif
+ 
++PictFormatPtr
++compWindowFormat (WindowPtr pWin);
++
+ void
+ compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap);
+ 
+diff --git a/composite/compwindow.c b/composite/compwindow.c
+index a4c4e6f..bfd2946 100644
+--- a/composite/compwindow.c
++++ b/composite/compwindow.c
+@@ -685,7 +685,7 @@ compGetWindowVisual (WindowPtr pWin)
+     return 0;
+ }
+ 
+-static PictFormatPtr
++PictFormatPtr
+ compWindowFormat (WindowPtr pWin)
+ {
+     ScreenPtr	pScreen = pWin->drawable.pScreen;
+-- 
+1.4.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/xserver/xorg/composite-default.patch	Thu Feb 21 17:03:02 2008 -0800
@@ -0,0 +1,162 @@
+From 8afc7e2eb3ebec48d3879bf269143259c8bc18c8 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <[email protected]>
+Date: Mon, 26 Mar 2007 15:55:38 -0700
+Subject: [PATCH] Refuse to initialize Composite if Render is not present.
+
+Composite relies on the presence of Render, in particular for the automatic
+compositing.
+---
+ composite/compext.c |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/composite/compext.c b/composite/compext.c
+index 4c25cc7..3a9f896 100644
+--- a/composite/compext.c
++++ b/composite/compext.c
+@@ -678,6 +678,12 @@ CompositeExtensionInit (void)
+     ExtensionEntry  *extEntry;
+     int		    s;
+ 
++    /* Ensure that Render is initialized on all screens. */
++    for (s = 0; s < screenInfo.numScreens; s++) {
++	if (GetPictureScreenIfSet(screenInfo.screens[s]) == NULL)
++	    return;
++    }
++
+     CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
+     if (!CompositeClientWindowType)
+ 	return;
+-- 
+1.4.1
+
+From 5e7936371c9e1ac48e19bf1e9e3f71f037fd9b5d Mon Sep 17 00:00:00 2001
+From: Eric Anholt <[email protected]>
+Date: Mon, 26 Mar 2007 20:18:18 -0700
+Subject: [PATCH] Disable Composite when the screen's visual is pseudocolor.
+
+Rendering fails badly in this case, and I don't care enough to fix it.
+---
+ composite/compext.c |   17 +++++++++++++++--
+ 1 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/composite/compext.c b/composite/compext.c
+index 3a9f896..af05b4a 100644
+--- a/composite/compext.c
++++ b/composite/compext.c
+@@ -678,9 +678,22 @@ CompositeExtensionInit (void)
+     ExtensionEntry  *extEntry;
+     int		    s;
+ 
+-    /* Ensure that Render is initialized on all screens. */
+     for (s = 0; s < screenInfo.numScreens; s++) {
+-	if (GetPictureScreenIfSet(screenInfo.screens[s]) == NULL)
++	ScreenPtr pScreen = screenInfo.screens[s];
++	VisualPtr vis;
++
++	/* Composite on 8bpp pseudocolor root windows appears to fail, so
++	 * just disable it on anything pseudocolor for safety.
++	 */
++	for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++)
++	    ;
++	if ((vis->class | DynamicClass) == PseudoColor)
++	    return;
++
++	/* Ensure that Render is initialized, which is required for automatic
++	 * compositing.
++	 */
++	if (GetPictureScreenIfSet(pScreen) == NULL)
+ 	    return;
+     }
+ 
+-- 
+1.4.1
+
+From 0bfc3cc22db94ec6867596606fe93228e315c847 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <[email protected]>
+Date: Tue, 27 Mar 2007 13:12:21 -0700
+Subject: [PATCH] Disable composite when Xinerama is active.
+
+It will likely take a decent bit of work to make that work right.
+---
+ composite/compext.c |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/composite/compext.c b/composite/compext.c
+index af05b4a..ba37e7d 100644
+--- a/composite/compext.c
++++ b/composite/compext.c
+@@ -696,6 +696,11 @@ CompositeExtensionInit (void)
+ 	if (GetPictureScreenIfSet(pScreen) == NULL)
+ 	    return;
+     }
++    /* Xinerama's rewriting of window drawing before Composite gets to it
++     * breaks Composite.
++     */
++    if (!noPanoramiXExtension)
++	return;
+ 
+     CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
+     if (!CompositeClientWindowType)
+-- 
+1.4.1
+
+From 1af2ef0b25fd8017a3271e624a5f1548f02b09f9 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <[email protected]>
+Date: Tue, 27 Mar 2007 13:13:45 -0700
+Subject: [PATCH] Enable Composite by default now that it disables itself in the known bad cases.
+---
+ os/utils.c |    5 +----
+ 1 files changed, 1 insertions(+), 4 deletions(-)
+
+diff --git a/os/utils.c b/os/utils.c
+index 2fc5cbb..e605a6c 100644
+--- a/os/utils.c
++++ b/os/utils.c
+@@ -136,10 +136,7 @@ #ifdef BIGREQS
+ _X_EXPORT Bool noBigReqExtension = FALSE;
+ #endif
+ #ifdef COMPOSITE
+- /* COMPOSITE is disabled by default for now until the
+-  * interface is stable */
+- #define COMPOSITE_DEFAULT FALSE
+-_X_EXPORT Bool noCompositeExtension = !COMPOSITE_DEFAULT;
++_X_EXPORT Bool noCompositeExtension = FALSE;
+ #endif
+ 
+ #ifdef DAMAGE
+-- 
+1.4.1
+
+From 50fa8722d35c12e5f0322cebe25faf99c39d4f50 Mon Sep 17 00:00:00 2001
+From: Aaron Plattner <[email protected]>
+Date: Thu, 20 Sep 2007 14:00:33 -0700
+Subject: [PATCH] Set noCompositeExtension to TRUE when failing to initialize the extension (e.g. when Xinerama is enabled).
+---
+ composite/compext.c |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/composite/compext.c b/composite/compext.c
+index 944f8d8..ece51d0 100644
+--- a/composite/compext.c
++++ b/composite/compext.c
+@@ -674,6 +674,9 @@ CompositeExtensionInit (void)
+     ExtensionEntry  *extEntry;
+     int		    s;
+ 
++    /* Assume initialization is going to fail */
++    noCompositeExtension = TRUE;
++
+     for (s = 0; s < screenInfo.numScreens; s++) {
+ 	ScreenPtr pScreen = screenInfo.screens[s];
+ 	VisualPtr vis;
+@@ -731,4 +734,7 @@ #endif
+ 	    return;
+     miRegisterRedirectBorderClipProc (compSetRedirectBorderClip,
+ 				      compGetRedirectBorderClip);
++
++    /* Initialization succeeded */
++    noCompositeExtension = FALSE;
+ }
+-- 
+1.4.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/xserver/xorg/composite-grabs.patch	Thu Feb 21 17:03:02 2008 -0800
@@ -0,0 +1,40 @@
+From a6a7fadbb03ee99312dfb15ac478ab3c414c1c0b Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?Kristian_H=C3=B8gsberg?= <[email protected]>
+Date: Wed, 16 Jan 2008 20:24:11 -0500
+Subject: [PATCH] Don't break grab and focus state for a window when redirecting it.
+
+Composite uses an unmap/map cycle to trigger backing pixmap allocation
+and cliprect recomputation when a window is redirected or unredirected.
+To avoid protocol visible side effects, map and unmap events are
+disabled temporarily.  However, when a window is unmapped it is also
+removed from grabs and loses focus, but these state changes are not
+disabled.
+
+This change supresses the unmap side effects during the composite
+unmap/map cycle and fixes this bug:
+
+  http://bugzilla.gnome.org/show_bug.cgi?id=488264
+
+where compiz would cause gnome-screensaver to lose its grab when
+compiz unredirects the fullscreen lock window.
+---
+ dix/window.c |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/dix/window.c b/dix/window.c
+index 33cf76b..1ccf126 100644
+--- a/dix/window.c
++++ b/dix/window.c
+@@ -2993,7 +2993,8 @@ #ifdef PANORAMIX
+ 	    } 
+ #endif
+ 	    (* Unrealize)(pChild);
+-	    DeleteWindowFromAnyEvents(pChild, FALSE);
++	    if (MapUnmapEventsEnabled(pWin))
++		DeleteWindowFromAnyEvents(pChild, FALSE);
+ 	    if (pChild->viewable)
+ 	    {
+ #ifdef DO_SAVE_UNDERS
+-- 
+1.4.1
+
--- a/open-src/xserver/xorg/patch-list	Thu Feb 21 16:16:15 2008 -0800
+++ b/open-src/xserver/xorg/patch-list	Thu Feb 21 17:03:02 2008 -0800
@@ -5,6 +5,9 @@
 ramdac-symbols.patch,-p1
 RandR-1.2-man.patch,-p1
 secure-rpc.patch,-p1
+composite-default.patch,-p1
+composite-7447.patch,-p1
+composite-grabs.patch,-p1
 sun-paths.patch
 sun-extramodes.patch
 sun-apm.patch