xserver: Branch 'master'
Brian Paul
brianp at kemper.freedesktop.org
Thu May 3 00:56:04 EEST 2007
GL/glx/glxcmds.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
New commits:
diff-tree c1e1d6b98a6708860e5b5f6e21d8d5b1d8ce9075 (from bd0abb2844ef9faf28703e592cfebb886004234c)
Author: Brian <brian at yutani.localnet.net>
Date: Wed May 2 15:55:40 2007 -0600
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...
diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index 6273edc..932878f 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -1019,6 +1019,7 @@ __glXCreateARGBConfig(__GLXscreen *scree
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 *scree
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,
}
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;
More information about the xorg-commit
mailing list