diff options
author | Ben Skeggs <skeggsb@localhost.localdomain> | 2008-08-07 11:19:15 +1000 |
---|---|---|
committer | Ben Skeggs <skeggsb@localhost.localdomain> | 2008-08-07 11:19:15 +1000 |
commit | 4b1c508f49a070f113929393423d6704f1ff18b6 (patch) | |
tree | 76803b434b75b438c44829ed55e1a19b208dde01 /src/egl/main | |
parent | 7fde9febd6f212494730ebef916fe25c95d30be9 (diff) | |
parent | be66a8f43172327e3cdde27281e40377cacbb121 (diff) |
Merge remote branch 'origin/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/egl/main')
-rw-r--r-- | src/egl/main/eglapi.c | 17 | ||||
-rw-r--r-- | src/egl/main/eglconfigutil.h | 2 | ||||
-rw-r--r-- | src/egl/main/egldriver.c | 68 | ||||
-rw-r--r-- | src/egl/main/eglglobals.c | 7 | ||||
-rw-r--r-- | src/egl/main/egllog.c | 4 |
5 files changed, 65 insertions, 33 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 49d1f3d0eb..9df938e188 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -63,6 +63,8 @@ eglGetDisplay(NativeDisplayType nativeDisplay) EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { + EGLint major_int, minor_int; + if (dpy) { EGLBoolean retVal; _EGLDisplay *dpyPriv = _eglLookupDisplay(dpy); @@ -77,12 +79,19 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) } /* Initialize the particular driver now */ retVal = dpyPriv->Driver->API.Initialize(dpyPriv->Driver, dpy, - major, minor); + &major_int, &minor_int); - dpyPriv->Driver->APImajor = *major; - dpyPriv->Driver->APIminor = *minor; + dpyPriv->Driver->APImajor = major_int; + dpyPriv->Driver->APIminor = minor_int; snprintf(dpyPriv->Driver->Version, sizeof(dpyPriv->Driver->Version), - "%d.%d (%s)", *major, *minor, dpyPriv->Driver->Name); + "%d.%d (%s)", major_int, minor_int, dpyPriv->Driver->Name); + + /* Update applications version of major and minor if not NULL */ + if((major != NULL) && (minor != NULL)) + { + *major = major_int; + *minor = minor_int; + } return retVal; } diff --git a/src/egl/main/eglconfigutil.h b/src/egl/main/eglconfigutil.h index 7fe875a7d0..c477b94737 100644 --- a/src/egl/main/eglconfigutil.h +++ b/src/egl/main/eglconfigutil.h @@ -4,7 +4,9 @@ #include "eglconfig.h" #include "GL/internal/glcore.h" +#if (!defined(WIN32) && !defined(_WIN32_WCE)) #include "stdint.h" +#endif extern void diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index edf85abe01..43b1f51903 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -24,37 +24,45 @@ #include <dlfcn.h> #include "eglx.h" #elif defined(_EGL_PLATFORM_WINDOWS) -/* XXX to do */ -#elif defined(_EGL_PLATFORM_WINCE) -/* XXX to do */ +/* Use static linking on Windows for now */ +#define WINDOWS_STATIC_LINK #endif - -static const char *DefaultDriverName = ":0"; -static const char *SysFS = "/sys/class"; - - - /** * 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 + static const char *SysFS = NULL; 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 } - + #elif defined(_EGL_PLATFORM_X) + static const char *DefaultDriverName = ":0"; + static const char *SysFS = "/sys/class"; typedef void * lib_handle; @@ -72,8 +80,6 @@ static const char *SysFS = "/sys/class"; #endif - - /** * Given a card number, use sysfs to determine the DRI driver name. */ @@ -108,7 +114,6 @@ _eglChooseDRMDriver(int card) #endif } - /** * XXX this function is totally subject change!!! * @@ -130,15 +135,23 @@ _eglChooseDRMDriver(int card) const char * _eglChooseDriver(_EGLDisplay *dpy) { + /* Under Windows, the NativeDisplay is an HDC handle, therefore */ + /* it can't be interpreted as a string or a pointer. */ +#if defined(_EGL_PLATFORM_WINDOWS) + const char *displayString = NULL; +#else const char *displayString = (const char *) dpy->NativeDisplay; +#endif const char *driverName = NULL; (void) DefaultDriverName; +#if defined(_EGL_PLATFORM_X) /* First, if the EGL_DRIVER env var is set, use that */ driverName = getenv("EGL_DRIVER"); if (driverName) return _eglstrdup(driverName); +#endif #if 0 if (!displayString) { @@ -173,15 +186,11 @@ _eglChooseDriver(_EGLDisplay *dpy) } } } - else { + else + { /* NativeDisplay is not a string! */ #if defined(_EGL_PLATFORM_X) driverName = _xeglChooseDriver(dpy); -#elif defined(_EGL_PLATFORM_WINDOWS) - /* XXX to do */ - driverName = _weglChooseDriver(dpy); -#elif defined(_EGL_PLATFORM_WINCE) - /* XXX to do */ #else driverName = DefaultDriverName; #endif @@ -209,25 +218,32 @@ _eglOpenDriver(_EGLDisplay *dpy, const char *driverName, const char *args) assert(driverName); #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 */ sprintf(driverFilename, "%s.dll", driverName); _eglLog(_EGL_DEBUG, "dlopen(%s)", driverFilename); + lib = open_library(driverFilename); + if (!lib) { + _eglLog(_EGL_WARNING, "Could not open %s", + driverFilename); + return NULL; + } + mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain"); +#endif #elif defined(_EGL_PLATFORM_X) /* XXX also prepend a directory path??? */ sprintf(driverFilename, "%s.so", driverName); _eglLog(_EGL_DEBUG, "dlopen(%s)", driverFilename); -#endif lib = open_library(driverFilename); - if (!lib) { _eglLog(_EGL_WARNING, "Could not open %s (%s)", driverFilename, dlerror()); return NULL; } - -#if defined(_EGL_PLATFORM_WINDOWS) - mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain"); -#elif defined(_EGL_PLATFORM_X) mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); #endif diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c index 5da59af91d..b770e55dbd 100644 --- a/src/egl/main/eglglobals.c +++ b/src/egl/main/eglglobals.c @@ -2,9 +2,10 @@ #include <stdlib.h> #include "eglglobals.h" - -struct _egl_global _eglGlobal = { .Initialized = EGL_FALSE }; - +struct _egl_global _eglGlobal = +{ + EGL_FALSE +}; /** * Init the fields in the _eglGlobal struct diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c index 23eb523eeb..1d7a0a388c 100644 --- a/src/egl/main/egllog.c +++ b/src/egl/main/egllog.c @@ -21,7 +21,11 @@ static EGLint ReportingLevel = -1; static void log_level_initialize(void) { +#if defined(_EGL_PLATFORM_X) char *log_env = getenv("EGL_LOG_LEVEL"); +#else + char *log_env = NULL; +#endif if (log_env == NULL) { ReportingLevel = FALLBACK_LOG_LEVEL; |