On Wed, 2007-04-18 at 19:25 +0200, Vasek Potocek wrote:
> >> Oops, I haven't finished my e-mail... The reason why I posted just another
> >> workaround is that I consider it "less
> >> workaround" than the former fix (supposing this really was the same
> >> problem) and that it helps in more situations (like
> >> in GTK+ drag-drop, RYX said he had problems with this). But it's really
> >> hacky, it should apply depending on whether the
> >> described circumstances really happen and so, but as I said, it's
> >> temporary and only for the interested. I use it in my
> >> local clone and I actually haven't had many reasons to make it cleaner.
> >
> > OK, so a bug in the nvidia driver is causing this problem then. If the
> > change you had in your previous mail is working as a way to avoid the
> > problem, I'll be able to modify the code and make it work without having
> > it do anything wrong.
> >
Does the attached patch fix your problem?
- David
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -1689,6 +1689,7 @@ typedef struct _CompFBConfig {
int yInverted;
int mipmap;
int textureFormat;
+ int textureTargets;
} CompFBConfig;
#define NOTHING_TRANS_FILTER 0
diff --git a/src/screen.c b/src/screen.c
index 6b75c9c..e9adb31 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1875,10 +1875,11 @@ addScreen (CompDisplay *display,
{
int j, db, stencil, depth, alpha, mipmap, rgba;
- s->glxPixmapFBConfigs[i].fbConfig = NULL;
- s->glxPixmapFBConfigs[i].mipmap = 0;
- s->glxPixmapFBConfigs[i].yInverted = 0;
- s->glxPixmapFBConfigs[i].textureFormat = 0;
+ s->glxPixmapFBConfigs[i].fbConfig = NULL;
+ s->glxPixmapFBConfigs[i].mipmap = 0;
+ s->glxPixmapFBConfigs[i].yInverted = 0;
+ s->glxPixmapFBConfigs[i].textureFormat = 0;
+ s->glxPixmapFBConfigs[i].textureTargets = 0;
db = MAXSHORT;
stencil = MAXSHORT;
@@ -1991,8 +1992,16 @@ addScreen (CompDisplay *display,
&value);
s->glxPixmapFBConfigs[i].yInverted = value;
- s->glxPixmapFBConfigs[i].fbConfig = fbConfigs[j];
- s->glxPixmapFBConfigs[i].mipmap = mipmap;
+
+ (*s->getFBConfigAttrib) (dpy,
+ fbConfigs[j],
+ GLX_BIND_TO_TEXTURE_TARGETS_EXT,
+ &value);
+
+ s->glxPixmapFBConfigs[i].textureTargets = value;
+
+ s->glxPixmapFBConfigs[i].fbConfig = fbConfigs[j];
+ s->glxPixmapFBConfigs[i].mipmap = mipmap;
}
}
diff --git a/src/texture.c b/src/texture.c
index 976f1b6..3d87d06 100644
--- a/src/texture.c
+++ b/src/texture.c
@@ -233,13 +233,9 @@ bindPixmapToTexture (CompScreen *screen,
int height,
int depth)
{
- unsigned int target;
+ unsigned int target = 0;
CompFBConfig *config = &screen->glxPixmapFBConfigs[depth];
- int attribs[] = {
- GLX_TEXTURE_FORMAT_EXT, config->textureFormat,
- GLX_MIPMAP_TEXTURE_EXT, config->mipmap,
- None
- };
+ int attribs[7], i = 0;
if (!config->fbConfig)
{
@@ -249,6 +245,28 @@ bindPixmapToTexture (CompScreen *screen,
return FALSE;
}
+ attribs[i++] = GLX_TEXTURE_FORMAT_EXT;
+ attribs[i++] = config->textureFormat;
+ attribs[i++] = GLX_MIPMAP_TEXTURE_EXT;
+ attribs[i++] = config->mipmap;
+
+ /* If only one two-dimensional texture target is supported,
+ then use that target and avoid a possible round trip in
+ glXQueryDrawable. Allow the server to choose texture target
+ when it supports more than one for this fbconfig. */
+ if (!(config->textureTargets & GLX_TEXTURE_2D_BIT_EXT))
+ target = GLX_TEXTURE_RECTANGLE_EXT;
+ else if (!(config->textureTargets & GLX_TEXTURE_RECTANGLE_BIT_EXT))
+ target = GLX_TEXTURE_2D_EXT;
+
+ if (target)
+ {
+ attribs[i++] = GLX_TEXTURE_TARGET_EXT;
+ attribs[i++] = target;
+ }
+
+ attribs[i++] = None;
+
makeScreenCurrent (screen);
texture->pixmap = (*screen->createPixmap) (screen->display->display,
config->fbConfig, pixmap,
@@ -262,10 +280,12 @@ bindPixmapToTexture (CompScreen *screen,
texture->mipmap = config->mipmap;
- (*screen->queryDrawable) (screen->display->display,
- texture->pixmap,
- GLX_TEXTURE_TARGET_EXT,
- &target);
+ if (!target)
+ (*screen->queryDrawable) (screen->display->display,
+ texture->pixmap,
+ GLX_TEXTURE_TARGET_EXT,
+ &target);
+
switch (target) {
case GLX_TEXTURE_2D_EXT:
texture->target = GL_TEXTURE_2D;
_______________________________________________
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz