Blob Blame History Raw
From: Adam Jackson <ajax@redhat.com>
Date: Sun, 28 Oct 2007 09:37:52 +0100
Subject: [PATCH] Disable Composite on 8bpp displays.

---
diff --git a/composite/compext.c b/composite/compext.c
index 4c25cc7..af05b4a 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -678,6 +678,25 @@ CompositeExtensionInit (void)
     ExtensionEntry  *extEntry;
     int		    s;
 
+    for (s = 0; s < screenInfo.numScreens; s++) {
+	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;
+    }
+
     CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
     if (!CompositeClientWindowType)
 	return;