summaryrefslogtreecommitdiff
path: root/src/egl/main
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-06-23 21:36:20 +0800
committerChia-I Wu <olv@lunarg.com>2010-06-29 17:16:20 +0800
commita81ef14228c6fe2893527b7b5f12855c90db3f8e (patch)
treeaf46c977703847b4f262aee4efa42d198ded78ef /src/egl/main
parentd5ab243d5a5bacbd2ba615d40f13c8ab37364745 (diff)
st/egl: Build a single EGL driver.
This change makes st/egl build a single egl_gallium.so and multiple st_<API>.so and pipe_<HW>.so. When a display is initialized, the corresponding pipe driver will be loaded. When a context is created, the corresponding state tracker will be loaded. Unlike DRI drivers, no ABI compatibility is maintained. egl_gallium, pipe drivers and state trackers should always be distributed as a single package. As such, there is only a single src/gallium/targets/egl/ that builds everything for the package.
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/egldriver.c85
1 files changed, 3 insertions, 82 deletions
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index c65df28645..71d2ba06d5 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -39,7 +39,7 @@
/* XXX Need to decide how to do dynamic name lookup on Windows */
static const char *DefaultDriverNames[] = {
- "egl_gallium_swrast"
+ "egl_gallium"
};
typedef HMODULE lib_handle;
@@ -68,6 +68,7 @@ library_suffix(void)
static const char *DefaultDriverNames[] = {
+ "egl_gallium",
"egl_dri2",
"egl_glx"
};
@@ -295,71 +296,6 @@ _eglLoaderFile(const char *dir, size_t len, void *loader_data)
/**
- * A loader function for use with _eglPreloadForEach. The loader data is the
- * pattern (prefix) of the files to look for.
- */
-static EGLBoolean
-_eglLoaderPattern(const char *dir, size_t len, void *loader_data)
-{
-#if defined(_EGL_OS_UNIX)
- const char *prefix, *suffix;
- size_t prefix_len, suffix_len;
- DIR *dirp;
- struct dirent *dirent;
- char path[1024];
-
- if (len + 2 > sizeof(path))
- return EGL_TRUE;
- if (len) {
- memcpy(path, dir, len);
- path[len++] = '/';
- }
- path[len] = '\0';
-
- dirp = opendir(path);
- if (!dirp)
- return EGL_TRUE;
-
- prefix = (const char *) loader_data;
- prefix_len = strlen(prefix);
- suffix = library_suffix();
- suffix_len = (suffix) ? strlen(suffix) : 0;
-
- while ((dirent = readdir(dirp))) {
- _EGLDriver *drv;
- size_t dirent_len = strlen(dirent->d_name);
- const char *p;
-
- /* match the prefix */
- if (strncmp(dirent->d_name, prefix, prefix_len) != 0)
- continue;
- /* match the suffix */
- if (suffix) {
- p = dirent->d_name + dirent_len - suffix_len;
- if (p < dirent->d_name || strcmp(p, suffix) != 0)
- continue;
- }
-
- /* make a full path and load the driver */
- if (len + dirent_len + 1 <= sizeof(path)) {
- strcpy(path + len, dirent->d_name);
- drv = _eglLoadDriver(path, NULL);
- if (drv)
- _eglGlobal.Drivers[_eglGlobal.NumDrivers++] = drv;
- }
- }
-
- closedir(dirp);
-
- return EGL_TRUE;
-#else /* _EGL_OS_UNIX */
- /* stop immediately */
- return EGL_FALSE;
-#endif
-}
-
-
-/**
* Run the preload function on each driver directory and return the number of
* drivers loaded.
*
@@ -464,20 +400,6 @@ _eglPreloadUserDriver(void)
/**
- * Preload Gallium drivers.
- *
- * FIXME This makes libEGL a memory hog if an user driver is not specified and
- * there are many Gallium drivers
- */
-static EGLBoolean
-_eglPreloadGalliumDrivers(void)
-{
- return (_eglPreloadForEach(_eglGetSearchPath(),
- _eglLoaderPattern, (void *) "egl_gallium_") > 0);
-}
-
-
-/**
* Preload drivers.
*
* This function loads the driver modules and creates the corresponding
@@ -497,8 +419,7 @@ _eglPreloadDrivers(void)
return EGL_TRUE;
}
- loaded = (_eglPreloadUserDriver() ||
- _eglPreloadGalliumDrivers());
+ loaded = _eglPreloadUserDriver();
_eglUnlockMutex(_eglGlobal.Mutex);