xserver: Branch 'server-1.5-branch'

Aaron Plattner aplattner at kemper.freedesktop.org
Mon May 12 16:44:08 PDT 2008


 Xext/panoramiX.c    |   33 +++++++++++++++++++++------------
 Xext/panoramiXsrv.h |   10 ++++++++++
 2 files changed, 31 insertions(+), 12 deletions(-)

New commits:
commit 8afd1d62f6298d43367ce52f3b5612a197e99ca0
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Sun May 4 13:45:27 2008 -0700

    Bug #14692: Allow drivers to have a say in Xinerama visual consolidation.
    
    Create a new exported global variable, XineramaVisualsEqualPtr.  Use this
    pointer to decide whether two visuals are equal during visual consolidation.
    This pointer can be wrapped, which allows drivers and extensions to control
    which visuals are consolidated.  A wrapper can reject the visuals without
    calling down, but must call down and return that result if it deems the visuals
    equal.  This ensures that all layers agree that the visuals are equal.
    
    Pass the screen of the other visual into the VisualsEqual callchain.
    
    Don't free PanoramiXVisuals since we need it for PanoramiXTranslateVisualID.
    
    Don't skip the first visual on the other screen in PanoramiXMaybeAddVisual.
    
    Skip the loop in PanoramiXTranslateVisualID if screen is 0.
    (cherry picked from commit c50b5d978981b13cdb22a9ad41c1b64f90cebe51)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index f924147..eb70689 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -87,6 +87,9 @@ _X_EXPORT unsigned long XRT_PIXMAP;
 _X_EXPORT unsigned long XRT_GC;
 _X_EXPORT unsigned long XRT_COLORMAP;
 
+static Bool VisualsEqual(VisualPtr, ScreenPtr, VisualPtr);
+_X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual;
+
 /*
  *	Function prototypes
  */
@@ -668,10 +671,10 @@ Bool PanoramiXCreateConnectionBlock(void)
 
     connSetupPrefix.length = length >> 2;
 
-    xfree(PanoramiXVisuals);
     for (i = 0; i < PanoramiXNumDepths; i++)
 	xfree(PanoramiXDepths[i].vids);
     xfree(PanoramiXDepths);
+    PanoramiXDepths = NULL;
 
     /*
      *  OK, change some dimensions so it looks as if it were one big screen
@@ -709,7 +712,7 @@ Bool PanoramiXCreateConnectionBlock(void)
  * do their own back-mapping.
  */
 static Bool
-VisualsEqual(VisualPtr a, VisualPtr b)
+VisualsEqual(VisualPtr a, ScreenPtr pScreenB, VisualPtr b)
 {
     return ((a->class == b->class) &&
 	(a->ColormapEntries == b->ColormapEntries) &&
@@ -759,7 +762,6 @@ static void
 PanoramiXMaybeAddVisual(VisualPtr pVisual)
 {
     ScreenPtr pScreen;
-    VisualPtr candidate = NULL;
     int j, k;
     Bool found = FALSE;
 
@@ -767,10 +769,10 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
 	pScreen = screenInfo.screens[j];
 	found = FALSE;
 
-	candidate = pScreen->visuals;
 	for (k = 0; k < pScreen->numVisuals; k++) {
-	    candidate++;
-	    if (VisualsEqual(pVisual, candidate)
+	    VisualPtr candidate = &pScreen->visuals[k];
+
+	    if ((*XineramaVisualsEqualPtr)(pVisual, pScreen, candidate)
 #ifdef GLXPROXY
 		&& glxMatchVisual(screenInfo.screens[0], pVisual, pScreen)
 #endif
@@ -844,8 +846,13 @@ PanoramiXConsolidate(void)
 _X_EXPORT VisualID
 PanoramiXTranslateVisualID(int screen, VisualID orig)
 {
+    ScreenPtr pOtherScreen = screenInfo.screens[screen];
     VisualPtr pVisual = NULL;
-    int i, j;
+    int i;
+
+    /* if screen is 0, orig is already the correct visual ID */
+    if (screen == 0)
+	return orig;
 
     for (i = 0; i < PanoramiXNumVisuals; i++) {
 	if (orig == PanoramiXVisuals[i].vid) {
@@ -858,11 +865,13 @@ PanoramiXTranslateVisualID(int screen, VisualID orig)
 	return 0;
 
     /* found the original, now translate it relative to the backend screen */
-    for (i = 0; i < PanoramiXNumScreens; i++)
-	for (j = 0; j < screenInfo.screens[i]->numVisuals; j++)
-	    if (VisualsEqual(pVisual, &screenInfo.screens[i]->visuals[j]))
-		return screenInfo.screens[i]->visuals[j].vid;
-    
+    for (i = 0; i < pOtherScreen->numVisuals; i++) {
+	VisualPtr pOtherVisual = &pOtherScreen->visuals[i];
+
+	if ((*XineramaVisualsEqualPtr)(pVisual, pOtherScreen, pOtherVisual))
+	    return pOtherVisual->vid;
+    }
+
     return 0;
 }
 
diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h
index 6d556e9..d5c3d98 100644
--- a/Xext/panoramiXsrv.h
+++ b/Xext/panoramiXsrv.h
@@ -30,6 +30,16 @@ extern unsigned long XRT_PIXMAP;
 extern unsigned long XRT_GC;
 extern unsigned long XRT_COLORMAP;
 
+/*
+ * Drivers are allowed to wrap this function.  Each wrapper can decide that the
+ * two visuals are unequal, but if they are deemed equal, the wrapper must call
+ * down and return FALSE if the wrapped function does.  This ensures that all
+ * layers agree that the visuals are equal.  The first visual is always from
+ * screen 0.
+ */
+typedef Bool (*XineramaVisualsEqualProcPtr)(VisualPtr, ScreenPtr, VisualPtr);
+extern XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
+
 extern void XineramaGetImageData(
     DrawablePtr *pDrawables,
     int left,


More information about the xorg-commit mailing list