[compiz] Multiscreen patches

Kristian Lyngstøl kristian at beryl-project.org
Tue Apr 17 18:02:43 PDT 2007


On 4/18/07, David Reveman <davidr at novell.com> wrote:
> I think that sharing textures and display lists between contexts on
> different screens only work with xgl. I'm not sure what the GLX spec
> says about this but it doesn't matter, lets do what's working with most
> existing servers as basic multi-screen support is all I think makes
> sense to support in compiz.
>
> Please remove the shareList stuff completely.

Done.

0001-Do-not-use-shareList.txt

Removes shareList and adds the properly formated makeScreenCurrent ()
calls necesarry.

-- 
Regards,
Kristian
-------------- next part --------------
From 94c67a2909b1e32a28e6b6f58069e7be29e836cd Mon Sep 17 00:00:00 2001
From: Kristian Lyngstol <kristian at beryl-project.org>
Date: Wed, 18 Apr 2007 02:58:59 +0200
Subject: [PATCH] Do not use shareList

Do not attempt to share across screens/contexes. Make sure the current
screen's context is current context before modifying textures.
---
 src/screen.c  |    6 +-----
 src/texture.c |    6 ++++++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/screen.c b/src/screen.c
index f80a0a0..6b75c9c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1411,7 +1411,6 @@ addScreen (CompDisplay *display,
     GLfloat		 diffuseLight[]   = { 0.9f, 0.9f,  0.9f, 0.9f };
     GLfloat		 light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f };
     CompWindow		 *w;
-    GLXContext		 shareList = 0;
 
     s = malloc (sizeof (CompScreen));
     if (!s)
@@ -1650,14 +1649,11 @@ addScreen (CompDisplay *display,
 	return FALSE;
     }
 
-    if (display->screens)
-	shareList = display->screens->ctx;
-
     /* 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++)
     {
-	s->ctx = glXCreateContext (dpy, visinfo, shareList, !indirectRendering);
+	s->ctx = glXCreateContext (dpy, visinfo, NULL, !indirectRendering);
 	if (!s->ctx)
 	{
 	    fprintf (stderr, "%s: glXCreateContext failed\n", programName);
diff --git a/src/texture.c b/src/texture.c
index 1571026..976f1b6 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