Set up visuals for the existing X visuals.
This makes the root visual a GLX capable visual again and adds a GLX visual for the COMPOSITE ARGB visual cleanly (as opposed to the hack we had before).
This commit is contained in:
parent
a5546a99ac
commit
692654b430
|
@ -396,38 +396,61 @@ initGlxVisual(VisualPtr visual, __GLcontextModes *config)
|
|||
visual->offsetBlue = findFirstSet(config->blueMask);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GLboolean doubleBuffer;
|
||||
GLboolean depthBuffer;
|
||||
} FBConfigTemplateRec, *FBConfigTemplatePtr;
|
||||
|
||||
static __GLcontextModes *
|
||||
pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
|
||||
for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
|
||||
if (config->visualRating != GLX_NONE)
|
||||
continue;
|
||||
if (_gl_convert_to_x_visual_type(config->visualType) != class)
|
||||
continue;
|
||||
if ((config->doubleBufferMode > 0) != template->doubleBuffer)
|
||||
continue;
|
||||
if ((config->depthBits > 0) != template->depthBuffer)
|
||||
continue;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
addMinimalSet(__GLXscreen *pGlxScreen)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
VisualPtr visuals;
|
||||
int depth;
|
||||
int i;
|
||||
FBConfigTemplateRec best = { GL_TRUE, GL_TRUE };
|
||||
FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE };
|
||||
|
||||
for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
|
||||
if (config->visualRating != GLX_NONE)
|
||||
continue;
|
||||
if (config->doubleBufferMode && config->depthBits > 0)
|
||||
break;
|
||||
}
|
||||
if (config == NULL)
|
||||
config = pGlxScreen->fbconfigs;
|
||||
|
||||
pGlxScreen->visuals = xcalloc(1, sizeof (__GLcontextModes *));
|
||||
pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals,
|
||||
sizeof (__GLcontextModes *));
|
||||
if (pGlxScreen->visuals == NULL) {
|
||||
ErrorF("Failed to allocate for minimal set of GLX visuals\n");
|
||||
return;
|
||||
}
|
||||
|
||||
depth = config->redBits + config->greenBits + config->blueBits;
|
||||
visuals = AddScreenVisuals(pGlxScreen->pScreen, 1, depth);
|
||||
if (visuals == NULL) {
|
||||
xfree(pGlxScreen->visuals);
|
||||
return;
|
||||
pGlxScreen->numVisuals = pGlxScreen->pScreen->numVisuals;
|
||||
visuals = pGlxScreen->pScreen->visuals;
|
||||
for (i = 0; i < pGlxScreen->numVisuals; i++) {
|
||||
if (visuals[i].nplanes == 32)
|
||||
config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class);
|
||||
else
|
||||
config = pickFBConfig(pGlxScreen, &best, visuals[i].class);
|
||||
if (config == NULL)
|
||||
config = pGlxScreen->fbconfigs;
|
||||
pGlxScreen->visuals[i] = config;
|
||||
config->visualID = visuals[i].vid;
|
||||
}
|
||||
|
||||
pGlxScreen->numVisuals = 1;
|
||||
pGlxScreen->visuals[0] = config;
|
||||
initGlxVisual(&visuals[0], config);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1094,7 +1094,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
|
|||
}
|
||||
|
||||
#ifdef GLXEXT
|
||||
xf86Info.glxVisuals = XF86_GlxVisualsAll;
|
||||
xf86Info.glxVisuals = XF86_GlxVisualsTypical;
|
||||
xf86Info.glxVisualsFrom = X_DEFAULT;
|
||||
if ((s = xf86GetOptValString(FlagOptions, FLAG_GLX_VISUALS))) {
|
||||
if (!xf86NameCmp(s, "minimal")) {
|
||||
|
|
|
@ -322,8 +322,6 @@ ProcXF86DRICreateContext(
|
|||
{
|
||||
xXF86DRICreateContextReply rep;
|
||||
ScreenPtr pScreen;
|
||||
VisualPtr visual;
|
||||
int i;
|
||||
|
||||
REQUEST(xXF86DRICreateContextReq);
|
||||
REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
|
||||
|
|
Loading…
Reference in New Issue
Block a user