summaryrefslogtreecommitdiff
path: root/src/egl
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-09-29 17:17:17 +0800
committerChia-I Wu <olvaffe@gmail.com>2009-09-29 18:19:50 +0800
commit74174dd5d650ee82250724ff0d96d44c7647ff38 (patch)
tree5db48132a84e2d1738e91be8658b6bee4b88762c /src/egl
parent35f9a9c5c99d0d723bb9361fc5018cf2fdec1fce (diff)
egl: Better report of driver loading error.
Diffstat (limited to 'src/egl')
-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;