summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/egl/main/egldriver.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 4673617cff..1eb374650c 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -116,6 +116,8 @@ _eglChooseDriver(_EGLDisplay *dpy, char **argsRet)
suffix = "dll";
#else /* _EGL_PLATFORM_NO_OS */
if (path) {
+ /* force the use of the default driver */
+ _eglLog(_EGL_DEBUG, "ignore EGL_DRIVER");
free(path);
path = NULL;
}
@@ -154,44 +156,48 @@ _eglChooseDriver(_EGLDisplay *dpy, char **argsRet)
static _EGLMain_t
_eglOpenLibrary(const char *driverPath, lib_handle *handle)
{
- _EGLMain_t mainFunc;
lib_handle lib;
+ _EGLMain_t mainFunc = NULL;
+ const char *error = "unknown error";
assert(driverPath);
-#if defined(_EGL_PLATFORM_WINDOWS)
- /* XXX untested */
_eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath);
lib = open_library(driverPath);
- if (!lib) {
- _eglLog(_EGL_WARNING, "Could not open %s",
- driverPath);
- return NULL;
- }
- mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain");
+
+#if defined(_EGL_PLATFORM_WINDOWS)
+ /* XXX untested */
+ if (lib)
+ mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain");
#elif defined(_EGL_PLATFORM_X)
- _eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath);
- lib = open_library(driverPath);
- if (!lib) {
- _eglLog(_EGL_WARNING, "Could not open %s (%s)",
- driverPath, dlerror());
- if (!getenv("EGL_DRIVER"))
- _eglLog(_EGL_WARNING,
- "The driver can be overridden by setting EGL_DRIVER");
- return NULL;
+ if (lib) {
+ mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
+ if (!mainFunc)
+ error = dlerror();
+ }
+ else {
+ error = dlerror();
}
- mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
#else /* _EGL_PLATFORM_NO_OS */
- lib = 0;
- /* must be default driver name */
+ /* must be the default driver name */
if (strcmp(driverPath, DefaultDriverName) == 0)
mainFunc = (_EGLMain_t) _eglMain;
else
- mainFunc = NULL;
+ error = "not builtin driver";
#endif
+ if (!lib) {
+ _eglLog(_EGL_WARNING, "Could not open driver %s (%s)",
+ driverPath, error);
+ if (!getenv("EGL_DRIVER"))
+ _eglLog(_EGL_WARNING,
+ "The driver can be overridden by setting EGL_DRIVER");
+ return NULL;
+ }
+
if (!mainFunc) {
- _eglLog(_EGL_WARNING, "_eglMain not found in %s", driverPath);
+ _eglLog(_EGL_WARNING, "_eglMain not found in %s (%s)",
+ driverPath, error);
if (lib)
close_library(lib);
return NULL;