diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-01-08 15:42:57 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-01-08 15:42:57 +0000 |
commit | 080c40ab32b2abd6d8381b4a0cc143d36a1652b2 (patch) | |
tree | e173767ebc5a82d81b9fc086449d915e29348976 /src/egl/main/egldriver.c | |
parent | 9cdf6f025b2ed55cfb13dd09f870f01d0c7947d3 (diff) | |
parent | a1de400e8de06a80ab140bb0fa950e990607572d (diff) |
Merge remote branch 'origin/master' into lp-binning
Conflicts:
src/gallium/auxiliary/util/u_surface.c
src/gallium/drivers/llvmpipe/Makefile
src/gallium/drivers/llvmpipe/SConscript
src/gallium/drivers/llvmpipe/lp_bld_arit.c
src/gallium/drivers/llvmpipe/lp_bld_flow.c
src/gallium/drivers/llvmpipe/lp_bld_interp.c
src/gallium/drivers/llvmpipe/lp_clear.c
src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/llvmpipe/lp_context.h
src/gallium/drivers/llvmpipe/lp_draw_arrays.c
src/gallium/drivers/llvmpipe/lp_jit.c
src/gallium/drivers/llvmpipe/lp_jit.h
src/gallium/drivers/llvmpipe/lp_prim_vbuf.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup_point.c
src/gallium/drivers/llvmpipe/lp_state.h
src/gallium/drivers/llvmpipe/lp_state_blend.c
src/gallium/drivers/llvmpipe/lp_state_derived.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_sampler.c
src/gallium/drivers/llvmpipe/lp_state_surface.c
src/gallium/drivers/llvmpipe/lp_tex_cache.c
src/gallium/drivers/llvmpipe/lp_tex_cache.h
src/gallium/drivers/llvmpipe/lp_tex_sample.h
src/gallium/drivers/llvmpipe/lp_tile_cache.c
Diffstat (limited to 'src/egl/main/egldriver.c')
-rw-r--r-- | src/egl/main/egldriver.c | 159 |
1 files changed, 94 insertions, 65 deletions
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 87786e36bb..018b06d3be 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -22,59 +22,70 @@ #if defined(_EGL_PLATFORM_X) #include <dlfcn.h> -#elif defined(_EGL_PLATFORM_WINDOWS) -/* Use static linking on Windows for now */ -#define WINDOWS_STATIC_LINK #endif + /** * Wrappers for dlopen/dlclose() */ #if defined(_EGL_PLATFORM_WINDOWS) -#ifdef WINDOWS_STATIC_LINK - static const char *DefaultDriverName = "Windows EGL Static Library"; -#else - /* XXX Need to decide how to do dynamic name lookup on Windows */ - static const char *DefaultDriverName = "TBD"; -#endif - typedef HMODULE lib_handle; - - static HMODULE - open_library(const char *filename) - { -#ifdef WINDOWS_STATIC_LINK - return 0; -#else - return LoadLibrary(filename); -#endif - } - static void - close_library(HMODULE lib) - { -#ifdef WINDOWS_STATIC_LINK -#else - FreeLibrary(lib); -#endif - } + +/* XXX Need to decide how to do dynamic name lookup on Windows */ +static const char DefaultDriverName[] = "TBD"; + +typedef HMODULE lib_handle; + +static HMODULE +open_library(const char *filename) +{ + return LoadLibrary(filename); +} + +static void +close_library(HMODULE lib) +{ + FreeLibrary(lib); +} + #elif defined(_EGL_PLATFORM_X) - static const char *DefaultDriverName = "egl_softpipe"; - typedef void * lib_handle; - static void * - open_library(const char *filename) - { - return dlopen(filename, RTLD_LAZY); - } +static const char DefaultDriverName[] = "egl_softpipe"; + +typedef void * lib_handle; + +static void * +open_library(const char *filename) +{ + return dlopen(filename, RTLD_LAZY); +} + +static void +close_library(void *lib) +{ + dlclose(lib); +} + +#else /* _EGL_PLATFORM_NO_OS */ + +static const char DefaultDriverName[] = "builtin"; + +typedef void *lib_handle; + +static INLINE void * +open_library(const char *filename) +{ + return (void *) filename; +} + +static INLINE void +close_library(void *lib) +{ +} + - static void - close_library(void *lib) - { - dlclose(lib); - } - #endif @@ -95,14 +106,22 @@ _eglChooseDriver(_EGLDisplay *dpy, char **argsRet) path = _eglstrdup(path); #if defined(_EGL_PLATFORM_X) - if (!path && dpy->NativeDisplay) { + if (!path && dpy && dpy->NativeDisplay) { /* assume (wrongly!) that the native display is a display string */ path = _eglSplitDisplayString((const char *) dpy->NativeDisplay, &args); } suffix = "so"; #elif defined(_EGL_PLATFORM_WINDOWS) suffix = "dll"; -#endif /* _EGL_PLATFORM_X */ +#else /* _EGL_PLATFORM_NO_OS */ + if (path) { + /* force the use of the default driver */ + _eglLog(_EGL_DEBUG, "ignore EGL_DRIVER"); + free(path); + path = NULL; + } + suffix = NULL; +#endif if (!path) path = _eglstrdup(DefaultDriverName); @@ -136,43 +155,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) -/* Use static linking on Windows for now */ -#ifdef WINDOWS_STATIC_LINK - lib = 0; - mainFunc = (_EGLMain_t)_eglMain; -#else - /* XXX untested */ _eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath); lib = open_library(driverPath); - if (!lib) { - _eglLog(_EGL_WARNING, "Could not open %s", - driverPath); - return NULL; + +#if defined(_EGL_PLATFORM_WINDOWS) + /* XXX untested */ + if (lib) + mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain"); +#elif defined(_EGL_PLATFORM_X) + if (lib) { + mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); + if (!mainFunc) + error = dlerror(); + } + else { + error = dlerror(); } - mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain"); +#else /* _EGL_PLATFORM_NO_OS */ + /* must be the default driver name */ + if (strcmp(driverPath, DefaultDriverName) == 0) + mainFunc = (_EGLMain_t) _eglMain; + else + error = "not builtin driver"; #endif -#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()); + _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; } - mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); -#endif 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; @@ -384,7 +408,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv) drv->API.CopyBuffers = _eglCopyBuffers; drv->API.QueryString = _eglQueryString; - drv->API.WaitGL = _eglWaitGL; + drv->API.WaitClient = _eglWaitClient; drv->API.WaitNative = _eglWaitNative; #ifdef EGL_MESA_screen_surface @@ -428,6 +452,11 @@ _eglFindAPIs(void) const char *es2_libname = "libGLESv2.so"; const char *gl_libname = "libGL.so"; const char *vg_libname = "libOpenVG.so"; +#else /* _EGL_PLATFORM_NO_OS */ + const char *es1_libname = NULL; + const char *es2_libname = NULL; + const char *gl_libname = NULL; + const char *vg_libname = NULL; #endif if ((lib = open_library(es1_libname))) { |