summaryrefslogtreecommitdiff
path: root/glx/glxscreens.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-02-02 10:13:46 -0800
committerEric Anholt <eric@anholt.net>2009-02-02 11:07:09 -0800
commit5100d829a4d71ce4a9fbc2b81694a1fb90066ccf (patch)
treeee405cdabb3c53b970d0e5fcde4ae6ab8953bde3 /glx/glxscreens.c
parent4475ae036c3d5a06a6ce88a359ce2a9a8ae9b4f1 (diff)
glx: Don't match fbconfigs to visuals with mismatched channel masks.
This fixes at least one known bug, where the depth 32 visual would end up with a depth 24 fbconfig attached, angering compiz.
Diffstat (limited to 'glx/glxscreens.c')
-rw-r--r--glx/glxscreens.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 988a59d65..2c8432e6e 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -394,14 +394,20 @@ typedef struct {
} FBConfigTemplateRec, *FBConfigTemplatePtr;
static __GLXconfig *
-pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
+pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template,
+ VisualPtr visual)
{
__GLXconfig *config;
for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
+ if (config->redMask != visual->redMask ||
+ config->greenMask != visual->greenMask ||
+ config->blueMask != visual->blueMask ||
+ config->rgbBits != visual->nplanes)
+ continue;
if (config->visualRating != GLX_NONE)
continue;
- if (glxConvertToXVisualType(config->visualType) != class)
+ if (glxConvertToXVisualType(config->visualType) != visual->class)
continue;
if ((config->doubleBufferMode > 0) != template->doubleBuffer)
continue;
@@ -436,11 +442,11 @@ addMinimalSet(__GLXscreen *pGlxScreen)
visuals = pGlxScreen->pScreen->visuals;
for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) {
if (visuals[i].nplanes == 32)
- config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class);
+ config = pickFBConfig(pGlxScreen, &minimal, &visuals[i]);
else {
- config = pickFBConfig(pGlxScreen, &best, visuals[i].class);
+ config = pickFBConfig(pGlxScreen, &best, &visuals[i]);
if (config == NULL)
- config = pickFBConfig(pGlxScreen, &good, visuals[i].class);
+ config = pickFBConfig(pGlxScreen, &good, &visuals[i]);
}
if (config == NULL)
config = pGlxScreen->fbconfigs;