Commit 74174dd5d650ee82250724ff0d96d44c7647ff38
- Diff rendering mode:
- inline
- side by side
src/egl/main/egldriver.c
(29 / 23)
|   | |||
| 116 | 116 | suffix = "dll"; | |
| 117 | 117 | #else /* _EGL_PLATFORM_NO_OS */ | |
| 118 | 118 | if (path) { | |
| 119 | /* force the use of the default driver */ | ||
| 120 | _eglLog(_EGL_DEBUG, "ignore EGL_DRIVER"); | ||
| 119 | 121 | free(path); | |
| 120 | 122 | path = NULL; | |
| 121 | 123 | } | |
| … | … | ||
| 156 | 156 | static _EGLMain_t | |
| 157 | 157 | _eglOpenLibrary(const char *driverPath, lib_handle *handle) | |
| 158 | 158 | { | |
| 159 | _EGLMain_t mainFunc; | ||
| 160 | 159 | lib_handle lib; | |
| 160 | _EGLMain_t mainFunc = NULL; | ||
| 161 | const char *error = "unknown error"; | ||
| 161 | 162 | ||
| 162 | 163 | assert(driverPath); | |
| 163 | 164 | ||
| 164 | #if defined(_EGL_PLATFORM_WINDOWS) | ||
| 165 | /* XXX untested */ | ||
| 166 | 165 | _eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath); | |
| 167 | 166 | lib = open_library(driverPath); | |
| 168 | if (!lib) { | ||
| 169 | _eglLog(_EGL_WARNING, "Could not open %s", | ||
| 170 | driverPath); | ||
| 171 | return NULL; | ||
| 172 | } | ||
| 173 | mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain"); | ||
| 167 | |||
| 168 | #if defined(_EGL_PLATFORM_WINDOWS) | ||
| 169 | /* XXX untested */ | ||
| 170 | if (lib) | ||
| 171 | mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain"); | ||
| 174 | 172 | #elif defined(_EGL_PLATFORM_X) | |
| 175 | _eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath); | ||
| 176 | lib = open_library(driverPath); | ||
| 177 | if (!lib) { | ||
| 178 | _eglLog(_EGL_WARNING, "Could not open %s (%s)", | ||
| 179 | driverPath, dlerror()); | ||
| 180 | if (!getenv("EGL_DRIVER")) | ||
| 181 | _eglLog(_EGL_WARNING, | ||
| 182 | "The driver can be overridden by setting EGL_DRIVER"); | ||
| 183 | return NULL; | ||
| 173 | if (lib) { | ||
| 174 | mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); | ||
| 175 | if (!mainFunc) | ||
| 176 | error = dlerror(); | ||
| 184 | 177 | } | |
| 185 | mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); | ||
| 178 | else { | ||
| 179 | error = dlerror(); | ||
| 180 | } | ||
| 186 | 181 | #else /* _EGL_PLATFORM_NO_OS */ | |
| 187 | lib = 0; | ||
| 188 | /* must be default driver name */ | ||
| 182 | /* must be the default driver name */ | ||
| 189 | 183 | if (strcmp(driverPath, DefaultDriverName) == 0) | |
| 190 | 184 | mainFunc = (_EGLMain_t) _eglMain; | |
| 191 | 185 | else | |
| 192 | mainFunc = NULL; | ||
| 186 | error = "not builtin driver"; | ||
| 193 | 187 | #endif | |
| 194 | 188 | ||
| 189 | if (!lib) { | ||
| 190 | _eglLog(_EGL_WARNING, "Could not open driver %s (%s)", | ||
| 191 | driverPath, error); | ||
| 192 | if (!getenv("EGL_DRIVER")) | ||
| 193 | _eglLog(_EGL_WARNING, | ||
| 194 | "The driver can be overridden by setting EGL_DRIVER"); | ||
| 195 | return NULL; | ||
| 196 | } | ||
| 197 | |||
| 195 | 198 | if (!mainFunc) { | |
| 196 | _eglLog(_EGL_WARNING, "_eglMain not found in %s", driverPath); | ||
| 199 | _eglLog(_EGL_WARNING, "_eglMain not found in %s (%s)", | ||
| 200 | driverPath, error); | ||
| 197 | 201 | if (lib) | |
| 198 | 202 | close_library(lib); | |
| 199 | 203 | return NULL; |

