X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fegl%2Fmain%2Fegldriver.c;h=ff0011c4b15f3e0913e19a59b5061183daa5085c;hb=195bbe8ce218533569dde1368d04da0fd229913d;hp=2f42e64fbe00ef1849a7104569ef453a26c05960;hpb=6e9da8ab6085b72473aa414922aa9cfa6ee508f9;p=mesa.git diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 2f42e64fbe0..ff0011c4b15 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -7,21 +7,15 @@ #include #include #include -#include "eglconfig.h" -#include "eglcontext.h" + +#include "eglstring.h" #include "egldefines.h" #include "egldisplay.h" #include "egldriver.h" -#include "eglglobals.h" #include "egllog.h" -#include "eglmisc.h" -#include "eglmode.h" -#include "eglscreen.h" -#include "eglstring.h" -#include "eglsurface.h" -#include "eglimage.h" +#include "eglmutex.h" -#if defined(_EGL_PLATFORM_POSIX) +#if defined(_EGL_OS_UNIX) #include #include #include @@ -29,17 +23,22 @@ #endif +typedef struct _egl_module { + char *Path; + void *Handle; + _EGLDriver *Driver; +} _EGLModule; + +static _EGL_DECLARE_MUTEX(_eglModuleMutex); +static _EGLArray *_eglModules; + + /** * Wrappers for dlopen/dlclose() */ -#if defined(_EGL_PLATFORM_WINDOWS) +#if defined(_EGL_OS_WINDOWS) -/* XXX Need to decide how to do dynamic name lookup on Windows */ -static const char DefaultDriverNames[] = { - "TBD", -}; - typedef HMODULE lib_handle; static HMODULE @@ -62,13 +61,8 @@ library_suffix(void) } -#elif defined(_EGL_PLATFORM_POSIX) - +#elif defined(_EGL_OS_UNIX) -static const char *DefaultDriverNames[] = { - "egl_dri2", - "egl_glx" -}; typedef void * lib_handle; @@ -95,13 +89,6 @@ library_suffix(void) #endif -#define NUM_PROBE_CACHE_SLOTS 8 -static struct { - EGLint keys[NUM_PROBE_CACHE_SLOTS]; - const void *values[NUM_PROBE_CACHE_SLOTS]; -} _eglProbeCache; - - /** * Open the named driver and find its bootstrap function: _eglMain(). */ @@ -117,11 +104,11 @@ _eglOpenLibrary(const char *driverPath, lib_handle *handle) _eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath); lib = open_library(driverPath); -#if defined(_EGL_PLATFORM_WINDOWS) +#if defined(_EGL_OS_WINDOWS) /* XXX untested */ if (lib) mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain"); -#elif defined(_EGL_PLATFORM_POSIX) +#elif defined(_EGL_OS_UNIX) if (lib) { union { _EGLMain_t func; @@ -161,85 +148,106 @@ _eglOpenLibrary(const char *driverPath, lib_handle *handle) /** - * Load the named driver. + * Load a module and create the driver object. */ -static _EGLDriver * -_eglLoadDriver(const char *path, const char *args) +static EGLBoolean +_eglLoadModule(_EGLModule *mod) { _EGLMain_t mainFunc; lib_handle lib; - _EGLDriver *drv = NULL; + _EGLDriver *drv; - mainFunc = _eglOpenLibrary(path, &lib); + mainFunc = _eglOpenLibrary(mod->Path, &lib); if (!mainFunc) - return NULL; + return EGL_FALSE; - drv = mainFunc(args); + drv = mainFunc(NULL); if (!drv) { if (lib) close_library(lib); - return NULL; + return EGL_FALSE; } if (!drv->Name) { - _eglLog(_EGL_WARNING, "Driver loaded from %s has no name", path); + _eglLog(_EGL_WARNING, "Driver loaded from %s has no name", mod->Path); drv->Name = "UNNAMED"; } - drv->Path = _eglstrdup(path); - drv->Args = (args) ? _eglstrdup(args) : NULL; - if (!drv->Path || (args && !drv->Args)) { - if (drv->Path) - free((char *) drv->Path); - if (drv->Args) - free((char *) drv->Args); - drv->Unload(drv); - if (lib) - close_library(lib); - return NULL; - } + mod->Handle = (void *) lib; + mod->Driver = drv; + + return EGL_TRUE; +} - drv->LibHandle = lib; - return drv; +/** + * Unload a module. + */ +static void +_eglUnloadModule(_EGLModule *mod) +{ + /* destroy the driver */ + if (mod->Driver && mod->Driver->Unload) + mod->Driver->Unload(mod->Driver); + if (mod->Handle) + close_library(mod->Handle); + + mod->Driver = NULL; + mod->Handle = NULL; } /** - * Match a display to a preloaded driver. - * - * The matching is done by finding the driver with the highest score. + * Add a module to the module array. */ -_EGLDriver * -_eglMatchDriver(_EGLDisplay *dpy) +static _EGLModule * +_eglAddModule(const char *path) { - _EGLDriver *best_drv = NULL; - EGLint best_score = -1, i; - - /* - * this function is called after preloading and the drivers never change - * after preloading. - */ - for (i = 0; i < _eglGlobal.NumDrivers; i++) { - _EGLDriver *drv = _eglGlobal.Drivers[i]; - EGLint score; - - score = (drv->Probe) ? drv->Probe(drv, dpy) : 0; - if (score > best_score) { - if (best_drv) { - _eglLog(_EGL_DEBUG, "driver %s has higher score than %s", - drv->Name, best_drv->Name); - } + _EGLModule *mod; + EGLint i; - best_drv = drv; - best_score = score; - /* perfect match */ - if (score >= 100) - break; + if (!_eglModules) { + _eglModules = _eglCreateArray("Module", 8); + if (!_eglModules) + return NULL; + } + + /* find duplicates */ + for (i = 0; i < _eglModules->Size; i++) { + mod = _eglModules->Elements[i]; + if (strcmp(mod->Path, path) == 0) + return mod; + } + + /* allocate a new one */ + mod = calloc(1, sizeof(*mod)); + if (mod) { + mod->Path = _eglstrdup(path); + if (!mod->Path) { + free(mod); + mod = NULL; } } + if (mod) { + _eglAppendArray(_eglModules, (void *) mod); + _eglLog(_EGL_DEBUG, "added %s to module array", mod->Path); + } - return best_drv; + return mod; +} + + +/** + * Free a module. + */ +static void +_eglFreeModule(void *module) +{ + _EGLModule *mod = (_EGLModule *) module; + + _eglUnloadModule(mod); + free(mod->Path); + free(mod); } @@ -250,7 +258,6 @@ _eglMatchDriver(_EGLDisplay *dpy) static EGLBoolean _eglLoaderFile(const char *dir, size_t len, void *loader_data) { - _EGLDriver *drv; char path[1024]; const char *filename = (const char *) loader_data; size_t flen = strlen(filename); @@ -266,9 +273,7 @@ _eglLoaderFile(const char *dir, size_t len, void *loader_data) len += flen; path[len] = '\0'; - if (library_suffix() == NULL || strstr(path, library_suffix())) - drv = _eglLoadDriver(path, NULL); - else { + if (library_suffix()) { const char *suffix = library_suffix(); size_t slen = strlen(suffix); const char *p; @@ -276,19 +281,23 @@ _eglLoaderFile(const char *dir, size_t len, void *loader_data) p = filename + flen - slen; need_suffix = (p < filename || strcmp(p, suffix) != 0); - if (need_suffix && len + slen + 1 <= sizeof(path)) { + if (need_suffix) { + /* overflow */ + if (len + slen + 1 > sizeof(path)) + return EGL_TRUE; strcpy(path + len, suffix); - drv = _eglLoadDriver(path, NULL); - } else { - drv = NULL; } } - if (!drv) + +#if defined(_EGL_OS_UNIX) + /* check if the file exists */ + if (access(path, F_OK)) return EGL_TRUE; +#endif - /* remember the driver and stop */ - _eglGlobal.Drivers[_eglGlobal.NumDrivers++] = drv; - return EGL_FALSE; + _eglAddModule(path); + + return EGL_TRUE; } @@ -299,7 +308,7 @@ _eglLoaderFile(const char *dir, size_t len, void *loader_data) static EGLBoolean _eglLoaderPattern(const char *dir, size_t len, void *loader_data) { -#if defined(_EGL_PLATFORM_POSIX) +#if defined(_EGL_OS_UNIX) const char *prefix, *suffix; size_t prefix_len, suffix_len; DIR *dirp; @@ -324,7 +333,6 @@ _eglLoaderPattern(const char *dir, size_t len, void *loader_data) suffix_len = (suffix) ? strlen(suffix) : 0; while ((dirent = readdir(dirp))) { - _EGLDriver *drv; size_t dirent_len = strlen(dirent->d_name); const char *p; @@ -338,19 +346,17 @@ _eglLoaderPattern(const char *dir, size_t len, void *loader_data) continue; } - /* make a full path and load the driver */ + /* make a full path and add it to the module array */ if (len + dirent_len + 1 <= sizeof(path)) { strcpy(path + len, dirent->d_name); - drv = _eglLoadDriver(path, NULL); - if (drv) - _eglGlobal.Drivers[_eglGlobal.NumDrivers++] = drv; + _eglAddModule(path); } } closedir(dirp); return EGL_TRUE; -#else /* _EGL_PLATFORM_POSIX */ +#else /* _EGL_OS_UNIX */ /* stop immediately */ return EGL_FALSE; #endif @@ -358,19 +364,17 @@ _eglLoaderPattern(const char *dir, size_t len, void *loader_data) /** - * Run the preload function on each driver directory and return the number of - * drivers loaded. + * Run the callback function on each driver directory. * * The process may end prematurely if the callback function returns false. */ -static EGLint +static void _eglPreloadForEach(const char *search_path, EGLBoolean (*loader)(const char *, size_t, void *), void *loader_data) { const char *cur, *next; size_t len; - EGLint num_drivers = _eglGlobal.NumDrivers; cur = search_path; while (cur) { @@ -382,8 +386,6 @@ _eglPreloadForEach(const char *search_path, cur = (next) ? next + 1 : NULL; } - - return (_eglGlobal.NumDrivers - num_drivers); } @@ -393,53 +395,80 @@ _eglPreloadForEach(const char *search_path, static const char * _eglGetSearchPath(void) { - static const char *search_path; - -#if defined(_EGL_PLATFORM_POSIX) || defined(_EGL_PLATFORM_WINDOWS) - if (!search_path) { - static char buffer[1024]; - const char *p; + static char search_path[1024]; + +#if defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS) + if (search_path[0] == '\0') { + char *buf = search_path; + size_t len = sizeof(search_path); + EGLBoolean use_env; + char dir_sep; int ret; - p = getenv("EGL_DRIVERS_PATH"); -#if defined(_EGL_PLATFORM_POSIX) - if (p && (geteuid() != getuid() || getegid() != getgid())) { +#if defined(_EGL_OS_UNIX) + use_env = (geteuid() == getuid() && getegid() == getgid()); + dir_sep = '/'; +#else + use_env = EGL_TRUE; + dir_sep = '\\'; +#endif + + if (use_env) { + char *p; + + /* extract the dirname from EGL_DRIVER */ + p = getenv("EGL_DRIVER"); + if (p && strchr(p, dir_sep)) { + ret = _eglsnprintf(buf, len, "%s", p); + if (ret > 0 && ret < len) { + p = strrchr(buf, dir_sep); + *p++ = ':'; + + len -= p - buf; + buf = p; + } + } + + /* append EGL_DRIVERS_PATH */ + p = getenv("EGL_DRIVERS_PATH"); + if (p) { + ret = _eglsnprintf(buf, len, "%s:", p); + if (ret > 0 && ret < len) { + buf += ret; + len -= ret; + } + } + } + else { _eglLog(_EGL_DEBUG, "ignore EGL_DRIVERS_PATH for setuid/setgid binaries"); - p = NULL; } -#endif /* _EGL_PLATFORM_POSIX */ - if (p) { - ret = snprintf(buffer, sizeof(buffer), - "%s:%s", p, _EGL_DRIVER_SEARCH_DIR); - if (ret > 0 && ret < sizeof(buffer)) - search_path = buffer; - } + ret = _eglsnprintf(buf, len, "%s", _EGL_DRIVER_SEARCH_DIR); + if (ret < 0 || ret >= len) + search_path[0] = '\0'; + + _eglLog(_EGL_DEBUG, "EGL search path is %s", search_path); } - if (!search_path) - search_path = _EGL_DRIVER_SEARCH_DIR; -#else - search_path = ""; -#endif +#endif /* defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS) */ return search_path; } /** - * Preload a user driver. + * Add the user driver to the module array. * - * A user driver can be specified by EGL_DRIVER. + * The user driver is specified by EGL_DRIVER. */ -static EGLBoolean -_eglPreloadUserDriver(void) +static void +_eglAddUserDriver(void) { const char *search_path = _eglGetSearchPath(); char *env; env = getenv("EGL_DRIVER"); -#if defined(_EGL_PLATFORM_POSIX) +#if defined(_EGL_OS_UNIX) if (env && strchr(env, '/')) { search_path = ""; if ((geteuid() != getuid() || getegid() != getgid())) { @@ -448,193 +477,207 @@ _eglPreloadUserDriver(void) env = NULL; } } -#endif /* _EGL_PLATFORM_POSIX */ - if (!env) - return EGL_FALSE; +#endif /* _EGL_OS_UNIX */ + if (env) + _eglPreloadForEach(search_path, _eglLoaderFile, (void *) env); +} - if (!_eglPreloadForEach(search_path, _eglLoaderFile, (void *) env)) { - _eglLog(_EGL_WARNING, "EGL_DRIVER is set to an invalid driver"); - return EGL_FALSE; - } - return EGL_TRUE; +/** + * Add default drivers to the module array. + */ +static void +_eglAddDefaultDrivers(void) +{ + const char *search_path = _eglGetSearchPath(); + EGLint i; +#if defined(_EGL_OS_WINDOWS) + const char *DefaultDriverNames[] = { + "egl_gallium" + }; +#elif defined(_EGL_OS_UNIX) + const char *DefaultDriverNames[] = { + "egl_gallium", + "egl_dri2", + "egl_glx" + }; +#endif + + for (i = 0; i < ARRAY_SIZE(DefaultDriverNames); i++) { + void *name = (void *) DefaultDriverNames[i]; + _eglPreloadForEach(search_path, _eglLoaderFile, name); + } } /** - * Preload display drivers. - * - * Display drivers are a set of drivers that support a certain display system. - * The display system may be specified by EGL_DISPLAY. - * - * FIXME This makes libEGL a memory hog if an user driver is not specified and - * there are many display drivers. + * Add drivers to the module array. Drivers will be loaded as they are matched + * to displays. */ static EGLBoolean -_eglPreloadDisplayDrivers(void) +_eglAddDrivers(void) { - const char *dpy; - char prefix[32]; - int ret; - - dpy = getenv("EGL_DISPLAY"); - if (!dpy || !dpy[0]) - dpy = _EGL_DEFAULT_DISPLAY; - if (!dpy || !dpy[0]) - return EGL_FALSE; + if (_eglModules) + return EGL_TRUE; - ret = snprintf(prefix, sizeof(prefix), "egl_%s_", dpy); - if (ret < 0 || ret >= sizeof(prefix)) - return EGL_FALSE; + /* the order here decides the priorities of the drivers */ + _eglAddUserDriver(); + _eglAddDefaultDrivers(); + _eglPreloadForEach(_eglGetSearchPath(), _eglLoaderPattern, (void *) "egl_"); - return (_eglPreloadForEach(_eglGetSearchPath(), - _eglLoaderPattern, (void *) prefix) > 0); + return (_eglModules != NULL); } /** - * Preload drivers. + * Match a display to a driver. The display is initialized unless use_probe is + * true. * - * This function loads the driver modules and creates the corresponding - * _EGLDriver objects. + * The matching is done by finding the first driver that can initialize the + * display, or when use_probe is true, the driver with highest score. */ -EGLBoolean -_eglPreloadDrivers(void) +_EGLDriver * +_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean use_probe) { - EGLBoolean loaded; + _EGLModule *mod; + _EGLDriver *best_drv = NULL; + EGLint best_score = 0; + EGLint major, minor, i; - /* protect the preloading process */ - _eglLockMutex(_eglGlobal.Mutex); + _eglLockMutex(&_eglModuleMutex); - /* already preloaded */ - if (_eglGlobal.NumDrivers) { - _eglUnlockMutex(_eglGlobal.Mutex); - return EGL_TRUE; + if (!_eglAddDrivers()) { + _eglUnlockMutex(&_eglModuleMutex); + return EGL_FALSE; } - loaded = (_eglPreloadUserDriver() || - _eglPreloadDisplayDrivers()); + /* match the loaded modules */ + for (i = 0; i < _eglModules->Size; i++) { + mod = (_EGLModule *) _eglModules->Elements[i]; + if (!mod->Driver) + break; - _eglUnlockMutex(_eglGlobal.Mutex); + if (use_probe) { + EGLint score = (mod->Driver->Probe) ? + mod->Driver->Probe(mod->Driver, dpy) : 1; + if (score > best_score) { + best_drv = mod->Driver; + best_score = score; + } + } + else { + if (mod->Driver->API.Initialize(mod->Driver, dpy, &major, &minor)) { + best_drv = mod->Driver; + best_score = 100; + } + } + /* perfect match */ + if (best_score >= 100) + break; + } - return loaded; -} + /* load more modules */ + if (!best_drv) { + EGLint first_unloaded = i; -/** - * Unload preloaded drivers. - */ -void -_eglUnloadDrivers(void) -{ - EGLint i; + while (i < _eglModules->Size) { + mod = (_EGLModule *) _eglModules->Elements[i]; + assert(!mod->Driver); - /* this is called at atexit time */ - for (i = 0; i < _eglGlobal.NumDrivers; i++) { - _EGLDriver *drv = _eglGlobal.Drivers[i]; - lib_handle handle = drv->LibHandle; - - if (drv->Path) - free((char *) drv->Path); - if (drv->Args) - free((char *) drv->Args); - - /* destroy driver */ - if (drv->Unload) - drv->Unload(drv); - - if (handle) - close_library(handle); - _eglGlobal.Drivers[i] = NULL; + if (!_eglLoadModule(mod)) { + /* remove invalid modules */ + _eglEraseArray(_eglModules, i, _eglFreeModule); + continue; + } + + if (use_probe) { + best_score = (mod->Driver->Probe) ? + mod->Driver->Probe(mod->Driver, dpy) : 1; + } + else { + if (mod->Driver->API.Initialize(mod->Driver, dpy, &major, &minor)) + best_score = 100; + } + + if (best_score > 0) { + best_drv = mod->Driver; + /* loaded modules come before unloaded ones */ + if (first_unloaded != i) { + void *tmp = _eglModules->Elements[i]; + _eglModules->Elements[i] = + _eglModules->Elements[first_unloaded]; + _eglModules->Elements[first_unloaded] = tmp; + } + break; + } + else { + _eglUnloadModule(mod); + i++; + } + } } - _eglGlobal.NumDrivers = 0; + _eglUnlockMutex(&_eglModuleMutex); + + if (best_drv) { + _eglLog(_EGL_DEBUG, "the best driver is %s (score %d)", + best_drv->Name, best_score); + if (!use_probe) { + dpy->Driver = best_drv; + dpy->Initialized = EGL_TRUE; + dpy->APImajor = major; + dpy->APIminor = minor; + } + } + + return best_drv; } -_EGLDriver * -_eglLoadDefaultDriver(EGLDisplay dpy, EGLint *major, EGLint *minor) + +__eglMustCastToProperFunctionPointerType +_eglGetDriverProc(const char *procname) { - _EGLDriver *drv = NULL; - int i; + EGLint i; + _EGLProc proc = NULL; + + if (!_eglModules) { + /* load the driver for the default display */ + EGLDisplay egldpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); + _EGLDisplay *dpy = _eglLookupDisplay(egldpy); + if (!dpy || !_eglMatchDriver(dpy, EGL_TRUE)) + return NULL; + } - _eglLockMutex(_eglGlobal.Mutex); + for (i = 0; i < _eglModules->Size; i++) { + _EGLModule *mod = (_EGLModule *) _eglModules->Elements[i]; - for (i = 0; i < ARRAY_SIZE(DefaultDriverNames); i++) { - _eglPreloadForEach(_eglGetSearchPath(), - _eglLoaderFile, (void *) DefaultDriverNames[i]); - if (_eglGlobal.NumDrivers == 0) - continue; - drv = _eglGlobal.Drivers[0]; - if (drv->API.Initialize(drv, dpy, major, minor)) - break; - _eglUnloadDrivers(); - } - - _eglUnlockMutex(_eglGlobal.Mutex); - - return _eglGlobal.NumDrivers > 0 ? drv : NULL; + if (!mod->Driver) + break; + proc = mod->Driver->API.GetProcAddress(mod->Driver, procname); + if (proc) + break; + } + + return proc; } /** - * Plug all the available fallback routines into the given driver's - * dispatch table. + * Unload all drivers. */ void -_eglInitDriverFallbacks(_EGLDriver *drv) +_eglUnloadDrivers(void) { - /* If a pointer is set to NULL, then the device driver _really_ has - * to implement it. - */ - drv->API.Initialize = NULL; - drv->API.Terminate = NULL; - - drv->API.GetConfigs = _eglGetConfigs; - drv->API.ChooseConfig = _eglChooseConfig; - drv->API.GetConfigAttrib = _eglGetConfigAttrib; - - drv->API.CreateContext = _eglCreateContext; - drv->API.DestroyContext = _eglDestroyContext; - drv->API.MakeCurrent = _eglMakeCurrent; - drv->API.QueryContext = _eglQueryContext; - - drv->API.CreateWindowSurface = _eglCreateWindowSurface; - drv->API.CreatePixmapSurface = _eglCreatePixmapSurface; - drv->API.CreatePbufferSurface = _eglCreatePbufferSurface; - drv->API.DestroySurface = _eglDestroySurface; - drv->API.QuerySurface = _eglQuerySurface; - drv->API.SurfaceAttrib = _eglSurfaceAttrib; - drv->API.BindTexImage = _eglBindTexImage; - drv->API.ReleaseTexImage = _eglReleaseTexImage; - drv->API.SwapInterval = _eglSwapInterval; - drv->API.SwapBuffers = _eglSwapBuffers; - drv->API.CopyBuffers = _eglCopyBuffers; - - drv->API.QueryString = _eglQueryString; - drv->API.WaitClient = _eglWaitClient; - drv->API.WaitNative = _eglWaitNative; - -#ifdef EGL_MESA_screen_surface - drv->API.ChooseModeMESA = _eglChooseModeMESA; - drv->API.GetModesMESA = _eglGetModesMESA; - drv->API.GetModeAttribMESA = _eglGetModeAttribMESA; - drv->API.GetScreensMESA = _eglGetScreensMESA; - drv->API.CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA; - drv->API.ShowScreenSurfaceMESA = _eglShowScreenSurfaceMESA; - drv->API.ScreenPositionMESA = _eglScreenPositionMESA; - drv->API.QueryScreenMESA = _eglQueryScreenMESA; - drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA; - drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA; - drv->API.QueryModeStringMESA = _eglQueryModeStringMESA; -#endif /* EGL_MESA_screen_surface */ - -#ifdef EGL_VERSION_1_2 - drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer; -#endif /* EGL_VERSION_1_2 */ - -#ifdef EGL_KHR_image_base - drv->API.CreateImageKHR = _eglCreateImageKHR; - drv->API.DestroyImageKHR = _eglDestroyImageKHR; -#endif /* EGL_KHR_image_base */ + /* this is called at atexit time */ + if (_eglModules) { +#if defined(_EGL_OS_UNIX) + _eglDestroyArray(_eglModules, _eglFreeModule); +#elif defined(_EGL_OS_WINDOWS) + /* XXX Windows unloads DLLs before atexit */ + _eglDestroyArray(_eglModules, NULL); +#endif + _eglModules = NULL; + } } @@ -651,44 +694,3 @@ _eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *), const char *search_path = _eglGetSearchPath(); _eglPreloadForEach(search_path, callback, callback_data); } - - -/** - * Set the probe cache at the given key. - * - * A key, instead of a _EGLDriver, is used to allow the probe cache to be share - * by multiple drivers. - */ -void -_eglSetProbeCache(EGLint key, const void *val) -{ - EGLint idx; - - for (idx = 0; idx < NUM_PROBE_CACHE_SLOTS; idx++) { - if (!_eglProbeCache.keys[idx] || _eglProbeCache.keys[idx] == key) - break; - } - assert(key > 0); - assert(idx < NUM_PROBE_CACHE_SLOTS); - - _eglProbeCache.keys[idx] = key; - _eglProbeCache.values[idx] = val; -} - - -/** - * Return the probe cache at the given key. - */ -const void * -_eglGetProbeCache(EGLint key) -{ - EGLint idx; - - for (idx = 0; idx < NUM_PROBE_CACHE_SLOTS; idx++) { - if (!_eglProbeCache.keys[idx] || _eglProbeCache.keys[idx] == key) - break; - } - - return (idx < NUM_PROBE_CACHE_SLOTS && _eglProbeCache.keys[idx] == key) ? - _eglProbeCache.values[idx] : NULL; -}