File mesa-chromium-multi-dpy.diff of Package Mesa

commit 48abc286e40bf6d68c4d175f2b5b915215197be1
Author: David Reveman <davidr@novell.com>
Date:   Mon Apr 13 15:46:22 2009 -0400

    Multi-display support.

diff --git a/src/glx/x11/dricr_glx.c b/src/glx/x11/dricr_glx.c
index b29d46a..9c0d125 100644
--- a/src/glx/x11/dricr_glx.c
+++ b/src/glx/x11/dricr_glx.c
@@ -273,19 +273,14 @@ driCreateSPUChain (Display *dpy)
     int            numSpus;
     int            *spuIds;
     char           **spuNames;
-    SPU            *spu = NULL;
+    static SPU     *spu = NULL;
     int            i;
     char           *env;
     Atom	   actual;
     int		   result, format;
     unsigned long  n, left;
-    unsigned char  *data = NULL;
-    static Display *display = 0;
-
-    if (display)
-	return NULL;
-
-    display = dpy;
+    char           *data = NULL;
+    static char    mothership[1025];
 
     env = getenv ("CRMOTHERSHIP");
     if (env)
@@ -296,17 +291,28 @@ driCreateSPUChain (Display *dpy)
 				 0L, 1024L, False,
 				 XA_STRING,
 				 &actual, &format,
-				 &n, &left, &data);
+				 &n, &left, (unsigned char **) &data);
 
     if (result == Success && n && data)
     {
-	char str[1025];
+	InfoMessageF ("Found CRMOTHERSHIP property on root window\n");
+
+	if (spu)
+	{
+	    if (strlen (mothership) != n || strncmp (mothership, data, n))
+	    {
+		ErrorMessageF ("CRMOTHERSHIP property doesn't match "
+			       "current SPU configuration");
+		return NULL;
+	    }
 
-	strncpy (str, (const char *) data, n);
-	str[n] = '\0';
+	    return spu;
+	}
 
-	InfoMessageF ("Found CRMOTHERSHIP property on root window\n");
-	setenv ("CRMOTHERSHIP", str, 1);
+	strncpy (mothership, (const char *) data, n);
+	mothership[n] = '\0';
+
+	setenv ("CRMOTHERSHIP", mothership, 1);
     }
     else
     {
openSUSE Build Service is sponsored by