Mesa (7.10): st/egl: Fix eglChooseConfig when configs is NULL.

Chia-I Wu olv at kemper.freedesktop.org
Sun Dec 26 16:49:34 UTC 2010


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

Author: Chia-I Wu <olv at lunarg.com>
Date:   Sun Dec 26 23:34:57 2010 +0800

st/egl: Fix eglChooseConfig when configs is NULL.

When configs is NULL, the app wants to know the number of matching
configs.
(cherry picked from commit 9f2062fb12aa4e0d69583e88e70080efe70e1967)

---

 .../state_trackers/egl/common/egl_g3d_api.c        |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index ef1c116..169a441 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -158,17 +158,17 @@ egl_g3d_choose_config(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attribs,
          (_EGLArrayForEach) egl_g3d_match_config, (void *) &criteria);
 
    /* perform sorting of configs */
-   if (tmp_configs && tmp_size) {
+   if (configs && tmp_size) {
       _eglSortConfigs((const _EGLConfig **) tmp_configs, tmp_size,
             egl_g3d_compare_config, (void *) &criteria);
-      size = MIN2(tmp_size, size);
-      for (i = 0; i < size; i++)
+      tmp_size = MIN2(tmp_size, size);
+      for (i = 0; i < tmp_size; i++)
          configs[i] = _eglGetConfigHandle(tmp_configs[i]);
    }
 
    FREE(tmp_configs);
 
-   *num_configs = size;
+   *num_configs = tmp_size;
 
    return EGL_TRUE;
 }




More information about the mesa-commit mailing list