summaryrefslogtreecommitdiff
path: root/GL
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-05-02 15:55:40 -0600
committerBrian <brian@yutani.localnet.net>2007-05-02 15:56:05 -0600
commitc1e1d6b98a6708860e5b5f6e21d8d5b1d8ce9075 (patch)
tree4f47eed7b74514486159de86726f14d104324f14 /GL
parentbd0abb2844ef9faf28703e592cfebb886004234c (diff)
In __glXCreateARGBConfig(), insert the new GL mode at the _end_ of the linked list.
Previously, the new mode was added at the head of the list. This caused the positional correspondence between modes and the XMesaVisuals array to be off by one. The net result was GLX clients failing when they tried to use the last GLX mode/visual. We still have the problem of DRI drivers not being able to use the extra mode/visual introduced by __glXCreateARGBConfig(). glXCreateContext fails with BadAlloc if it's attempted. This is also the source of the often- seen warning "libGL warning: 3D driver claims to not support visual xxx" Look into fixing that someday...
Diffstat (limited to 'GL')
-rw-r--r--GL/glx/glxcmds.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index 6273edc56..932878f69 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -1019,6 +1019,7 @@ __glXCreateARGBConfig(__GLXscreen *screen)
VisualPtr visual;
int i;
+ /* search for a 32-bit visual */
visual = NULL;
for (i = 0; i < screen->pScreen->numVisuals; i++)
if (screen->pScreen->visuals[i].nplanes == 32) {
@@ -1037,8 +1038,22 @@ __glXCreateARGBConfig(__GLXscreen *screen)
if (modes == NULL)
return;
- modes->next = screen->modes;
- screen->modes = modes;
+ /* Insert this new mode at the TAIL of the linked list.
+ * Previously, the mode was incorrectly inserted at the head of the
+ * list, causing find_mesa_visual() to be off by one. This would
+ * GLX clients to blow up if they attempted to use the last mode
+ * in the list!
+ */
+ {
+ __GLcontextModes *prev = NULL, *m;
+ for (m = screen->modes; m; m = m->next)
+ prev = m;
+ if (prev)
+ prev->next = modes;
+ else
+ screen->modes = modes;
+ }
+
screen->numUsableVisuals++;
screen->numVisuals++;
@@ -1104,6 +1119,9 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
}
pGlxScreen = __glXActiveScreens[screen];
+ /* Create the "extra" 32bpp ARGB visual, if not already added.
+ * XXX This is questionable place to do so! Re-examine this someday.
+ */
__glXCreateARGBConfig(pGlxScreen);
reply.numFBConfigs = pGlxScreen->numUsableVisuals;