[compiz] Multiscreen patches

Kristian Lyngstøl kristian at beryl-project.org
Mon Apr 16 10:59:50 PDT 2007


0001-Do-not-use-shareList-for-multiple-screens.txt
This is essential to get compiz to control multiple screens. I assume
there's a better way though. We can either remove the shareList
support entirely or we should check if it's supported or not.
Improvements on this patch might be a good idea. In Beryl we chose to
leave this as an option, but that doesn't strike me as the best
approach either. Is sharing display lists across screens meant to be
possible? (If not, we don't need the code that allows it).

0002-Change-warpPointer-to-take-a-CompScreen-as-argument.txt
Without this, the pointer will warp to the same screen regardless of
where it was (whichever happens to be d->screens). Plugins not in the
compiz repo will have to adjust.

0003-Use-makeScreenCurrent-is-run-before-dealing-with-textures.txt
This makes sure we're working on the correct context before we try to
modify textures. Without it, textures will get corrupted. Fast.

This should get things started, and get compiz in a state where
multiscreen is usable. I've got a few other patches lined up (well,
more or less) when you're ready to accept these (or if you want me to
improve anything).

Ignore the mail address in the commits. I forgot to adjust commiter email.

-- 
Regards
Kristian
-------------- next part --------------
From 479a70f51d463eb857426036417a5a31f000e372 Mon Sep 17 00:00:00 2001
From: Kristian Lyngstol <kristian at sunrider.lyngstol.net>
Date: Mon, 16 Apr 2007 19:09:25 +0200
Subject: [PATCH] Do not use shareList for multiple screens

Can't share display lists across multiple screens at present time.
This is absoloutly necesarry to get multiscreen to even start up.
---
 src/screen.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/screen.c b/src/screen.c
index 062965b..af2fae1 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1657,9 +1657,12 @@ addScreen (CompDisplay *display,
 	return FALSE;
     }
 
-    if (display->screens)
-	shareList = display->screens->ctx;
+    /* This simply does not function at the time beeing. 
+     * if (display->screens)
+     * shareList = display->screens->ctx;
+     */
 
+    shareList = NULL; 
     /* try both direct and indirect rendering contexts in case one of them
        fail to support GLX_EXT_texture_from_pixmap */
     for (i = 0; i < 2; i++)
-- 
1.4.4.4
-------------- next part --------------
From 3599a1bf45ee4e5c25eacc296d0b9ece2a09e07a Mon Sep 17 00:00:00 2001
From: Kristian Lyngstol <kristian at sunrider.lyngstol.net>
Date: Mon, 16 Apr 2007 19:22:13 +0200
Subject: [PATCH] Change warpPointer() to take a CompScreen as argument

This is necesarry to avoid warping the pointer to the wrong screen, and
also fixes what is known as "crazy spinning" in rotate.
---
 include/compiz.h |    4 ++--
 plugins/move.c   |    4 ++--
 plugins/resize.c |    4 ++--
 plugins/rotate.c |   10 +++++-----
 plugins/zoom.c   |    2 +-
 src/display.c    |    4 ++--
 src/screen.c     |    2 +-
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/compiz.h b/include/compiz.h
index 17de68a..ec5bd61 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -26,7 +26,7 @@
 #ifndef _COMPIZ_H
 #define _COMPIZ_H
 
-#define ABIVERSION 20070407
+#define ABIVERSION 20070416
 
 #include <stdio.h>
 #include <sys/time.h>
@@ -1017,7 +1017,7 @@ handleSelectionClear (CompDisplay *display,
 		      XEvent      *event);
 
 void
-warpPointer (CompDisplay *display,
+warpPointer (CompScreen *screen,
 	     int	 dx,
 	     int	 dy);
 
diff --git a/plugins/move.c b/plugins/move.c
index 4ba589c..d60d691 100644
--- a/plugins/move.c
+++ b/plugins/move.c
@@ -207,7 +207,7 @@ moveInitiate (CompDisplay     *d,
 		xRoot = w->attrib.x + (w->width  / 2);
 		yRoot = w->attrib.y + (w->height / 2);
 
-		warpPointer (d, xRoot - pointerX, yRoot - pointerY);
+		warpPointer (w->screen, xRoot - pointerX, yRoot - pointerY);
 	    }
 
 	    if (md->moveOpacity != OPAQUE)
@@ -493,7 +493,7 @@ moveHandleMotionEvent (CompScreen *s,
 			    wy  = workArea.y + (w->input.top >> 1);
 			    wy += w->sizeHints.height_inc >> 1;
 
-			    warpPointer (s->display, 0, wy - pointerY);
+			    warpPointer (s, 0, wy - pointerY);
 
 			    return;
 			}
diff --git a/plugins/resize.c b/plugins/resize.c
index b9eb42b..8c69830 100644
--- a/plugins/resize.c
+++ b/plugins/resize.c
@@ -248,7 +248,7 @@ resizeInitiate (CompDisplay     *d,
 		xRoot = w->attrib.x + (w->width  / 2);
 		yRoot = w->attrib.y + (w->height / 2);
 
-		warpPointer (d, xRoot - pointerX, yRoot - pointerY);
+		warpPointer (w->screen, xRoot - pointerX, yRoot - pointerY);
 	    }
 	}
     }
@@ -448,7 +448,7 @@ resizeHandleKeyEvent (CompScreen *s,
 		x = left + width  * (rKeys[i].dx + 1) / 2;
 		y = top  + height * (rKeys[i].dy + 1) / 2;
 
-		warpPointer (s->display, x - pointerX, y - pointerY);
+		warpPointer (s, x - pointerX, y - pointerY);
 		rd->mask = rKeys[i].resizeMask;
 		updateScreenGrab (s, rs->grabIndex, rs->cursor[i]);
 	    }
diff --git a/plugins/rotate.c b/plugins/rotate.c
index c19030b..8ce4189 100644
--- a/plugins/rotate.c
+++ b/plugins/rotate.c
@@ -997,7 +997,7 @@ rotateFlipLeft (void *closure)
 	return FALSE;
 
     warpX = pointerX + s->width;
-    warpPointer (s->display, s->width - 10, 0);
+    warpPointer (s, s->width - 10, 0);
     lastPointerX = warpX;
 
     o[0].type    = CompOptionTypeInt;
@@ -1042,7 +1042,7 @@ rotateFlipRight (void *closure)
 	return FALSE;
 
     warpX = pointerX - s->width;
-    warpPointer (s->display, 10 - s->width, 0);
+    warpPointer (s, 10 - s->width, 0);
     lastPointerX = warpX;
 
     o[0].type    = CompOptionTypeInt;
@@ -1150,7 +1150,7 @@ rotateEdgeFlip (CompScreen      *s,
 	    int warpX;
 
 	    warpX = pointerX + s->width;
-	    warpPointer (s->display, s->width - 10, 0);
+	    warpPointer (s, s->width - 10, 0);
 	    lastPointerX = warpX - pointerDx;
 
 	    o[3].value.i = -1;
@@ -1190,7 +1190,7 @@ rotateEdgeFlip (CompScreen      *s,
 	    int warpX;
 
 	    warpX = pointerX - s->width;
-	    warpPointer (s->display, 10 - s->width, 0);
+	    warpPointer (s, 10 - s->width, 0);
 	    lastPointerX = warpX - pointerDx;
 
 	    o[3].value.i = 1;
@@ -1464,7 +1464,7 @@ rotateHandleEvent (CompDisplay *d,
 			event->xmotion.x_root > s->width  - 50 ||
 			event->xmotion.y_root > s->height - 50)
 		    {
-			warpPointer (d,
+			warpPointer (s,
 				     (s->width  / 2) - pointerX,
 				     (s->height / 2) - pointerY);
 		    }
diff --git a/plugins/zoom.c b/plugins/zoom.c
index 631e6a4..f5f76be 100644
--- a/plugins/zoom.c
+++ b/plugins/zoom.c
@@ -639,7 +639,7 @@ zoomHandleEvent (CompDisplay *d,
 		    event->xmotion.x_root > s->width  - 50 ||
 		    event->xmotion.y_root > s->height - 50)
 		{
-		    warpPointer (d,
+		    warpPointer (s,
 				 (s->width  / 2) - pointerX,
 				 (s->height / 2) - pointerY);
 		}
diff --git a/src/display.c b/src/display.c
index d6486fd..fd1b633 100644
--- a/src/display.c
+++ b/src/display.c
@@ -2853,11 +2853,11 @@ handleSelectionClear (CompDisplay *display,
 }
 
 void
-warpPointer (CompDisplay *display,
+warpPointer (CompScreen *s,
 	     int	 dx,
 	     int	 dy)
 {
-    CompScreen *s = display->screens;
+    CompDisplay *display = s->display;
     XEvent     event;
 
     pointerX += dx;
diff --git a/src/screen.c b/src/screen.c
index af2fae1..3f34f17 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2460,7 +2460,7 @@ removeScreenGrab (CompScreen *s,
 	else
 	{
 	    if (restorePointer)
-		warpPointer (s->display,
+		warpPointer (s,
 			     restorePointer->x - pointerX,
 			     restorePointer->y - pointerY);
 
-- 
1.4.4.4
-------------- next part --------------
From 416e0f84caf4a4fdada0bfdcd7a8a993a5007c0a Mon Sep 17 00:00:00 2001
From: Kristian Lyngstol <kristian at sunrider.lyngstol.net>
Date: Mon, 16 Apr 2007 19:36:33 +0200
Subject: [PATCH] Use makeScreenCurrent() is run before dealing with textures

This solves random texture corruption on multiscreen setups.
---
 src/texture.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/texture.c b/src/texture.c
index 1571026..7f5df47 100644
--- a/src/texture.c
+++ b/src/texture.c
@@ -60,6 +60,7 @@ finiTexture (CompScreen  *screen,
 {
     if (texture->name)
     {
+    	makeScreenCurrent(screen);
 	releasePixmapFromTexture (screen, texture);
 	glDeleteTextures (1, &texture->name);
     }
@@ -113,6 +114,7 @@ imageToTexture (CompScreen   *screen,
 		&image[(height - i - 1) * width * 4],
 		width * 4);
 
+    makeScreenCurrent(screen);
     releasePixmapFromTexture (screen, texture);
 
     if (screen->textureNonPowerOfTwo ||
@@ -247,6 +249,7 @@ bindPixmapToTexture (CompScreen  *screen,
 	return FALSE;
     }
 
+    makeScreenCurrent(screen);
     texture->pixmap = (*screen->createPixmap) (screen->display->display,
 					       config->fbConfig, pixmap,
 					       attribs);
@@ -338,6 +341,7 @@ releasePixmapFromTexture (CompScreen  *screen,
 {
     if (texture->pixmap)
     {
+	makeScreenCurrent(screen);
 	glEnable (texture->target);
 	if (!strictBinding)
 	{
@@ -362,6 +366,7 @@ enableTexture (CompScreen	 *screen,
 	       CompTexture	 *texture,
 	       CompTextureFilter filter)
 {
+    makeScreenCurrent(screen);
     glEnable (texture->target);
     glBindTexture (texture->target, texture->name);
 
@@ -443,6 +448,7 @@ void
 disableTexture (CompScreen  *screen,
 		CompTexture *texture)
 {
+    makeScreenCurrent(screen);
     if (strictBinding)
     {
 	glBindTexture (texture->target, texture->name);
-- 
1.4.4.4


More information about the compiz mailing list