mesa: Remove GLES overlay.
[mesa.git] / src / gallium / targets / egl / egl.c
index 7c6bb58aecf4c3275015fad23baee0e94ba44c6e..61fe5069e919c6edc857ee9fc1d979d9d6abe4a0 100644 (file)
@@ -37,6 +37,8 @@
 #include "state_tracker/drm_driver.h"
 #include "common/egl_g3d_loader.h"
 
+#include "egl.h"
+
 struct egl_g3d_loader egl_g3d_loader;
 
 static struct st_module {
@@ -98,9 +100,14 @@ load_st_module(struct st_module *stmod,
 {
    struct st_api *(*create_api)(void);
 
-   _eglLog(_EGL_DEBUG, "searching for st module %s", name);
+   if (name) {
+      _eglLog(_EGL_DEBUG, "searching for st module %s", name);
+      stmod->name = loader_strdup(name);
+   }
+   else {
+      stmod->name = NULL;
+   }
 
-   stmod->name = loader_strdup(name);
    if (stmod->name)
       _eglSearchPathForEach(dlopen_st_module_cb, (void *) stmod);
    else
@@ -182,9 +189,6 @@ load_pipe_module(struct pipe_module *pmod, const char *name)
       }
    }
 
-   if (!pmod->drmdd)
-      pmod->name = NULL;
-
    return (pmod->drmdd != NULL);
 }
 
@@ -201,19 +205,7 @@ get_st_api_full(enum st_api_type api, enum st_profile_type profile)
    switch (api) {
    case ST_API_OPENGL:
       symbol = ST_CREATE_OPENGL_SYMBOL;
-      switch (profile) {
-      case ST_PROFILE_OPENGL_ES1:
-         names[count++] = "GLESv1_CM";
-         names[count++] = "GL";
-         break;
-      case ST_PROFILE_OPENGL_ES2:
-         names[count++] = "GLESv2";
-         names[count++] = "GL";
-         break;
-      default:
-         names[count++] = "GL";
-         break;
-      }
+      names[count++] = "GL";
       break;
    case ST_API_OPENVG:
       symbol = ST_CREATE_OPENVG_SYMBOL;
@@ -233,6 +225,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;
@@ -303,7 +310,7 @@ static struct pipe_screen *
 create_drm_screen(const char *name, int fd)
 {
    struct pipe_module *pmod = get_pipe_module(name);
-   return (pmod && pmod->drmdd->create_screen) ?
+   return (pmod && pmod->drmdd && pmod->drmdd->create_screen) ?
       pmod->drmdd->create_screen(fd) : NULL;
 }