Prefer glxvisuals with stencil buffer for default visuals

The first fbconfig which has a depthbuffer > 0  and doublebuf is choosen
when associating fbconfigs with the visuals, indepenent of stencil bits.
This happens to work ok on intel as there all fbconfigs with a
depthbuffer > 0 also have stencil bits.

This patch fixes this by first trying to get a fbconfig for default X visuals
with both stencilbuf, depthbuf and doublebuffering, and if that fails fallback
to trying to get one with only a depthbuf and doublebuffering.
This commit is contained in:
Hans de Goede 2008-04-23 12:28:30 -04:00 committed by Kristian Høgsberg
parent 00effad583
commit f6e22d69af

View File

@ -437,6 +437,7 @@ initGlxVisual(VisualPtr visual, __GLXconfig *config)
typedef struct { typedef struct {
GLboolean doubleBuffer; GLboolean doubleBuffer;
GLboolean depthBuffer; GLboolean depthBuffer;
GLboolean stencilBuffer;
} FBConfigTemplateRec, *FBConfigTemplatePtr; } FBConfigTemplateRec, *FBConfigTemplatePtr;
static __GLXconfig * static __GLXconfig *
@ -453,6 +454,8 @@ pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
continue; continue;
if ((config->depthBits > 0) != template->depthBuffer) if ((config->depthBits > 0) != template->depthBuffer)
continue; continue;
if ((config->stencilBits > 0) != template->stencilBuffer)
continue;
return config; return config;
} }
@ -466,8 +469,9 @@ addMinimalSet(__GLXscreen *pGlxScreen)
__GLXconfig *config; __GLXconfig *config;
VisualPtr visuals; VisualPtr visuals;
int i, j; int i, j;
FBConfigTemplateRec best = { GL_TRUE, GL_TRUE }; FBConfigTemplateRec best = { GL_TRUE, GL_TRUE, GL_TRUE };
FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE }; FBConfigTemplateRec good = { GL_TRUE, GL_TRUE, GL_FALSE };
FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE, GL_FALSE };
pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals, pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals,
sizeof (__GLXconfig *)); sizeof (__GLXconfig *));
@ -480,8 +484,11 @@ addMinimalSet(__GLXscreen *pGlxScreen)
for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) { for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) {
if (visuals[i].nplanes == 32) if (visuals[i].nplanes == 32)
config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class); config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class);
else else {
config = pickFBConfig(pGlxScreen, &best, visuals[i].class); config = pickFBConfig(pGlxScreen, &best, visuals[i].class);
if (config == NULL)
config = pickFBConfig(pGlxScreen, &good, visuals[i].class);
}
if (config == NULL) if (config == NULL)
config = pGlxScreen->fbconfigs; config = pGlxScreen->fbconfigs;
if (config == NULL) if (config == NULL)