Mesa (master): targets/egl: Improve st_GL.so loading.

Chia-I Wu olv at kemper.freedesktop.org
Fri Dec 10 03:01:56 UTC 2010


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

Author: Chia-I Wu <olv at lunarg.com>
Date:   Fri Dec 10 10:44:03 2010 +0800

targets/egl: Improve st_GL.so loading.

When the application is not linked to any libGL*.so, loading st_GL.so
would give

  /usr/local/lib/egl/st_GL.so: undefined symbol: _glapi_tls_Context

In that case, load libGL.so and try again.  This works because
util_dl_open loads with RTLD_GLOBAL.

Fix "clear" OpenGL ES 1.1 demo.

---

 src/gallium/targets/egl/egl.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/gallium/targets/egl/egl.c b/src/gallium/targets/egl/egl.c
index 19404c8..bb182ba 100644
--- a/src/gallium/targets/egl/egl.c
+++ b/src/gallium/targets/egl/egl.c
@@ -237,6 +237,21 @@ get_st_api_full(enum st_api_type api, enum st_profile_type profile)
          break;
    }
 
+   /* try again with libGL.so loaded */
+   if (!stmod->stapi && api == ST_API_OPENGL) {
+      struct util_dl_library *glapi = util_dl_open("libGL" UTIL_DL_EXT);
+
+      if (glapi) {
+         _eglLog(_EGL_DEBUG, "retry with libGL" UTIL_DL_EXT " loaded");
+         /* skip the last name (which is NULL) */
+         for (i = 0; i < count - 1; i++) {
+            if (load_st_module(stmod, names[i], symbol))
+               break;
+         }
+         util_dl_close(glapi);
+      }
+   }
+
    if (!stmod->stapi) {
       EGLint level = (egl_g3d_loader.profile_masks[api]) ?
          _EGL_WARNING : _EGL_DEBUG;




More information about the mesa-commit mailing list