Mesa (mesa_7_6_branch): progs/xdemos: fix some visual/ fbconfig logic in glxinfo.c

Brian Paul brianp at kemper.freedesktop.org
Fri Dec 4 07:14:51 PST 2009


Module: Mesa
Branch: mesa_7_6_branch
Commit: ca7cd3ade0f27f8f1d9532ad6281659e2522f0cf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca7cd3ade0f27f8f1d9532ad6281659e2522f0cf

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Dec  4 08:09:55 2009 -0700

progs/xdemos: fix some visual/fbconfig logic in glxinfo.c

The fbAttribSingle/Double arrays had wrong GLX_DOUBLEBUFFER values.
We only need to use the glXChooseFBConfig() code when glXChooseVisual()
fails (but I don't know when that would happen).
Other recent commits errantly removed some code in this area too.

---

 progs/xdemos/glxinfo.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c
index b182a30..23df82f 100644
--- a/progs/xdemos/glxinfo.c
+++ b/progs/xdemos/glxinfo.c
@@ -401,6 +401,10 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
 
    root = RootWindow(dpy, scrnum);
 
+   /*
+    * Find a basic GLX visual.  We'll then create a rendering context and
+    * query various info strings.
+    */
    visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
    if (!visinfo)
       visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
@@ -409,24 +413,29 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
       ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect );
 
 #ifdef GLX_VERSION_1_3
-   {
+   /* Try glXChooseFBConfig() if glXChooseVisual didn't work.
+    * XXX when would that happen?
+    */
+   if (!visinfo) {
       int fbAttribSingle[] = {
 	 GLX_RENDER_TYPE,   GLX_RGBA_BIT,
 	 GLX_RED_SIZE,      1,
 	 GLX_GREEN_SIZE,    1,
 	 GLX_BLUE_SIZE,     1,
-	 GLX_DOUBLEBUFFER,  GL_TRUE,
+	 GLX_DOUBLEBUFFER,  GL_FALSE,
 	 None };
       int fbAttribDouble[] = {
 	 GLX_RENDER_TYPE,   GLX_RGBA_BIT,
 	 GLX_RED_SIZE,      1,
 	 GLX_GREEN_SIZE,    1,
 	 GLX_BLUE_SIZE,     1,
+	 GLX_DOUBLEBUFFER,  GL_TRUE,
 	 None };
       GLXFBConfig *configs = NULL;
       int nConfigs;
 
-      if (!visinfo)
+      configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs);
+      if (!configs)
 	 configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs);
 
       if (configs) {



More information about the mesa-commit mailing list