On Don, 2009-05-07 at 09:55 -0600, Brian Paul wrote: > Michel Dänzer wrote: > > From: Michel Dänzer <[email protected]> > > > > This can fail, e.g. when XLIB_SKIP_ARGB_VISUALS=1 is set. > > > > See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524794 and > > http://bugs.freedesktop.org/show_bug.cgi?id=21600 . > > --- > > src/glx/x11/glxcmds.c | 22 ++++++++++++++-------- > > 1 files changed, 14 insertions(+), 8 deletions(-) > > > > diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c > > index b9e0706..15c8ca8 100644 > > --- a/src/glx/x11/glxcmds.c > > +++ b/src/glx/x11/glxcmds.c > > @@ -1334,13 +1347,6 @@ PUBLIC XVisualInfo *glXChooseVisual(Display *dpy, > > int screen, int *attribList) > > ** and return this. > > */ > > if (best_config != NULL) { > > - XVisualInfo visualTemplate; > > - int i; > > - > > - visualTemplate.screen = screen; > > - visualTemplate.visualid = best_config->visualID; > > - visualList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask, > > - &visualTemplate, &i ); > > } > > > > return visualList; > > > I'm not too current with this code, but it seems the last part of this > patch leaves an empty-body conditional and a comment that seems to no > longer apply.
Right, I guess I meant to clean this up but then forgot about it. Below is a new version which removes the block and moves the comments up. >From 8ceca1888973204f71aa476c3ca19ac9c15cb876 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Michel=20D=C3=A4nzer?= <[email protected]> Date: Fri, 8 May 2009 08:54:30 +0200 Subject: [PATCH] glXChooseVisual: Only consider fbconfig if we can get the corresponding visual. This can fail, e.g. when XLIB_SKIP_ARGB_VISUALS=1 is set. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524794 and http://bugs.freedesktop.org/show_bug.cgi?id=21600 . --- src/glx/x11/glxcmds.c | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index b9e0706..ec3e69e 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1319,30 +1319,31 @@ PUBLIC XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList) ** Eliminate visuals that don't meet minimum requirements ** Compute a score for those that do ** Remember which visual, if any, got the highest score + ** If no visual is acceptable, return None + ** Otherwise, create an XVisualInfo list with just the selected X visual + ** and return this. */ for ( modes = psc->visuals ; modes != NULL ; modes = modes->next ) { if ( fbconfigs_compatible( & test_config, modes ) && ((best_config == NULL) || (fbconfig_compare( (const __GLcontextModes * const * const)&modes, &best_config ) < 0)) ) { - best_config = modes; + XVisualInfo visualTemplate; + XVisualInfo *newList; + int i; + + visualTemplate.screen = screen; + visualTemplate.visualid = modes->visualID; + newList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask, + &visualTemplate, &i ); + + if (newList) { + Xfree(visualList); + visualList = newList; + best_config = modes; + } } } - /* - ** If no visual is acceptable, return None - ** Otherwise, create an XVisualInfo list with just the selected X visual - ** and return this. - */ - if (best_config != NULL) { - XVisualInfo visualTemplate; - int i; - - visualTemplate.screen = screen; - visualTemplate.visualid = best_config->visualID; - visualList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask, - &visualTemplate, &i ); - } - return visualList; } -- 1.6.2.4 -- Earthling Michel Dänzer | http://www.vmware.com Libre software enthusiast | Debian, X and DRI developer ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Mesa3d-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
