Mesa (master): egl: Add debug messages to config validation and matching.

Chia-I Wu olv at kemper.freedesktop.org
Fri Feb 5 06:20:30 UTC 2010


Module: Mesa
Branch: master
Commit: 4f47684f7555cc973a89add9a28c9ae3c3c4a989
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f47684f7555cc973a89add9a28c9ae3c3c4a989

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Fri Feb  5 14:11:29 2010 +0800

egl: Add debug messages to config validation and matching.

It might be desirable find out which attribute went wrong.

---

 src/egl/main/eglconfig.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 635ffee..1190f8c 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -366,8 +366,11 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
          if (_eglValidationTable[i].criterion == ATTRIB_CRITERION_SPECIAL)
             valid = EGL_TRUE;
       }
-      if (!valid)
+      if (!valid) {
+         _eglLog(_EGL_DEBUG,
+               "attribute 0x%04x has an invalid value 0x%x", attr, val);
          break;
+      }
    }
 
    /* any invalid attribute value should have been catched */
@@ -390,10 +393,18 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
          valid = EGL_FALSE;
       break;
    }
+   if (!valid) {
+      _eglLog(_EGL_DEBUG, "conflicting color buffer type and channel sizes");
+      return EGL_FALSE;
+   }
 
    val = GET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS);
    if (!val && GET_CONFIG_ATTRIB(conf, EGL_SAMPLES))
       valid = EGL_FALSE;
+   if (!valid) {
+      _eglLog(_EGL_DEBUG, "conflicting samples and sample buffers");
+      return EGL_FALSE;
+   }
 
    val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE);
    if (!(val & EGL_WINDOW_BIT)) {
@@ -406,6 +417,10 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
           GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA))
          valid = EGL_FALSE;
    }
+   if (!valid) {
+      _eglLog(_EGL_DEBUG, "conflicting surface type and native visual/texture binding");
+      return EGL_FALSE;
+   }
 
    return valid;
 }
@@ -457,8 +472,14 @@ _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria)
          break;
       }
 
-      if (!matched)
+      if (!matched) {
+#ifdef DEBUG
+         _eglLog(_EGL_DEBUG,
+               "the value (0x%x) of attribute 0x%04x did not meet the criteria (0x%x)",
+               val, attr, cmp);
+#endif
          break;
+      }
    }
 
    return matched;




More information about the mesa-commit mailing list