summaryrefslogtreecommitdiff
path: root/glx/glxscreens.c
diff options
context:
space:
mode:
Diffstat (limited to 'glx/glxscreens.c')
-rw-r--r--glx/glxscreens.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 536c0c495..29bacd988 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -43,6 +43,7 @@
#include "glxutil.h"
#include "glxext.h"
#include "protocol-versions.h"
+#include "compositeext.h"
static DevPrivateKeyRec glxScreenPrivateKeyRec;
@@ -277,7 +278,21 @@ pickFBConfig(__GLXscreen * pGlxScreen, VisualPtr visual)
/* Can't use the same FBconfig for multiple X visuals. I think. */
if (config->visualID != 0)
continue;
-
+#ifdef COMPOSITE
+ /* Use only duplicated configs for compIsAlternateVisuals */
+ if (!!compIsAlternateVisual(pGlxScreen->pScreen, visual->vid) !=
+ !!config->duplicatedForComp)
+ continue;
+#endif
+ /*
+ * If possible, use the same swapmethod for all built-in visual
+ * fbconfigs, to avoid getting the 32-bit composite visual when
+ * requesting, for example, a SWAP_COPY fbconfig.
+ */
+ if (config->swapMethod == GLX_SWAP_UNDEFINED_OML)
+ score += 32;
+ if (config->swapMethod == GLX_SWAP_EXCHANGE_OML)
+ score += 16;
if (config->doubleBufferMode > 0)
score += 8;
if (config->depthBits > 0)
@@ -336,6 +351,10 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
if (config) {
pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
config->visualID = visual->vid;
+#ifdef COMPOSITE
+ if (compIsAlternateVisual(pScreen, visual->vid))
+ config->visualSelectGroup++;
+#endif
}
}
@@ -355,7 +374,12 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
* set up above is for.
*/
depth = config->redBits + config->greenBits + config->blueBits;
-
+#ifdef COMPOSITE
+ if (config->duplicatedForComp) {
+ depth += config->alphaBits;
+ config->visualSelectGroup++;
+ }
+#endif
/* Make sure that our FBconfig's depth can actually be displayed
* (corresponds to an existing visual).
*/
@@ -378,6 +402,10 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
if (visual == NULL)
continue;
+#ifdef COMPOSITE
+ if (config->duplicatedForComp)
+ (void) CompositeRegisterAlternateVisuals(pScreen, &visual->vid, 1);
+#endif
pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
initGlxVisual(visual, config);
}