[Mesa-dev] [PATCH] Fix glXChooseFBConfig with GLX_DRAWABLE_TYPE GLX_DONT_CARE

Alexander Monakov amonakov at gmail.com
Mon Apr 1 12:05:23 PDT 2013


https://bugs.freedesktop.org/show_bug.cgi?id=47478
https://bugs.freedesktop.org/show_bug.cgi?id=62999 (dup of the above)

I don't have commit access so please push if OK.
-------------- next part --------------
From 3e23a23ec8a3bc36e13efc7cf95229e9e31955f1 Mon Sep 17 00:00:00 2001
From: Alexander Monakov <amonakov at gmail.com>
Date: Mon, 1 Apr 2013 23:00:10 +0400
Subject: [PATCH] Honor GLX_DONT_CARE in MATCH_EXACT and MATCH_MASK

This makes MATCH_EXACT the same as MATCH_DONT_CARE, so eliminate the latter
and use the former.
---
 src/glx/glxcmds.c | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 7b62be3..992d3a5 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -886,14 +886,6 @@ init_fbconfig_for_chooser(struct glx_config * config,
    config->swapMethod = GLX_DONT_CARE;
 }
 
-#define MATCH_DONT_CARE( param )        \
-  do {                                  \
-    if ( ((int) a-> param != (int) GLX_DONT_CARE)   \
-         && (a-> param != b-> param) ) {        \
-      return False;                             \
-    }                                           \
-  } while ( 0 )
-
 #define MATCH_MINIMUM( param )                  \
   do {                                          \
     if ( ((int) a-> param != (int) GLX_DONT_CARE)	\
@@ -904,7 +896,8 @@ init_fbconfig_for_chooser(struct glx_config * config,
 
 #define MATCH_EXACT( param )                    \
   do {                                          \
-    if ( a-> param != b-> param) {              \
+    if ( ((int) a-> param != (int) GLX_DONT_CARE)	\
+         && (a-> param != b-> param) ) {        \
       return False;                             \
     }                                           \
   } while ( 0 )
@@ -912,8 +905,10 @@ init_fbconfig_for_chooser(struct glx_config * config,
 /* Test that all bits from a are contained in b */
 #define MATCH_MASK(param)			\
   do {						\
-    if ((a->param & ~b->param) != 0)		\
+    if ( ((int) a-> param != (int) GLX_DONT_CARE)	\
+         && ((a->param & ~b->param) != 0) ) {   \
       return False;				\
+    }                                           \
   } while (0);
 
 /**
@@ -926,12 +921,12 @@ static Bool
 fbconfigs_compatible(const struct glx_config * const a,
                      const struct glx_config * const b)
 {
-   MATCH_DONT_CARE(doubleBufferMode);
-   MATCH_DONT_CARE(visualType);
-   MATCH_DONT_CARE(visualRating);
-   MATCH_DONT_CARE(xRenderable);
-   MATCH_DONT_CARE(fbconfigID);
-   MATCH_DONT_CARE(swapMethod);
+   MATCH_EXACT(doubleBufferMode);
+   MATCH_EXACT(visualType);
+   MATCH_EXACT(visualRating);
+   MATCH_EXACT(xRenderable);
+   MATCH_EXACT(fbconfigID);
+   MATCH_EXACT(swapMethod);
 
    MATCH_MINIMUM(rgbBits);
    MATCH_MINIMUM(numAuxBuffers);
@@ -951,7 +946,7 @@ fbconfigs_compatible(const struct glx_config * const a,
    MATCH_MINIMUM(maxPbufferPixels);
    MATCH_MINIMUM(samples);
 
-   MATCH_DONT_CARE(stereoMode);
+   MATCH_EXACT(stereoMode);
    MATCH_EXACT(level);
 
    MATCH_MASK(drawableType);
@@ -978,14 +973,14 @@ fbconfigs_compatible(const struct glx_config * const a,
 
       switch (a->transparentPixel) {
       case GLX_TRANSPARENT_RGB:
-         MATCH_DONT_CARE(transparentRed);
-         MATCH_DONT_CARE(transparentGreen);
-         MATCH_DONT_CARE(transparentBlue);
-         MATCH_DONT_CARE(transparentAlpha);
+         MATCH_EXACT(transparentRed);
+         MATCH_EXACT(transparentGreen);
+         MATCH_EXACT(transparentBlue);
+         MATCH_EXACT(transparentAlpha);
          break;
 
       case GLX_TRANSPARENT_INDEX:
-         MATCH_DONT_CARE(transparentIndex);
+         MATCH_EXACT(transparentIndex);
          break;
 
       default:
-- 
1.7.11.5


More information about the mesa-dev mailing list