Re: [Mesa3d-dev] Move lists to freedesktop.org?
Moving seems like a good idea. The delays here have been very troubling. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
[Mesa3d-dev] [PATCH] Build failure in glapi/glapi_getproc.c
The recent changes to _glapi_check_table included building the full version build every time. That broke builds for OpenGL ES1 and OpenGL ES2. They don't have all of the table members that OpenGL does. This first broke in commit 42f3241e04b6cd74829dfb64b4a154ac8a4e6a48 in glapi/glapi.c. But the problem function moved from glapi/glapi.c to glapi/glapi_getproc.c in commit fae5758fac963ce014e3d43f1bca7fb489e02bf9 . -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] Continue to allow building src/glx on current distros
The ifdef changes to allow building with older libdrm and glproto header files are working. But the configure.ac requirements are still aggressive, requiring LIBDRM_REQUIRED=2.4.15 and GLPROTO_REQUIRED=1.4.11 Could those back down now that the source code itself is more flexible? Those version requirements are not met by debian testing or ubuntu 9.10. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
[Mesa3d-dev] [PATCH] mesa: Thread-safety and malloc checking in hashes
While reading through Kristian's EGLImage patches I came across some questionable old code in the _mesa_HashLookup and _mesa_HashInsert functions. The _mesa_HashLookup does a linked list chase down a collision chain without holding a mutex. The _mesa_HashInsert does a MALLOC_STRUCT without checking the result. Here are patches for both of those. The _mesa_HashInsert fix is only half-hearted. It checks for a malloc failure and returns without segment faulting. But it has no return value. So it doesn't indicate to the caller that the data was not inserted into the hash. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com From 60aa1fc6754d942fe481bf40f57a40358dc2b20e Mon Sep 17 00:00:00 2001 From: Mike Stroyan m...@lunarg.com Date: Mon, 15 Feb 2010 17:40:43 -0700 Subject: [PATCH 1/2] Lock mutex around _mesa_HashLookup linked list chase. --- src/mesa/main/hash.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 08c6456..7666a4b 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -137,13 +137,16 @@ _mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key) assert(key); pos = HASH_FUNC(key); + _glthread_LOCK_MUTEX(table-Mutex); entry = table-Table[pos]; while (entry) { if (entry-Key == key) { - return entry-Data; + _glthread_UNLOCK_MUTEX(table-Mutex); + return entry-Data; } entry = entry-Next; } + _glthread_UNLOCK_MUTEX(table-Mutex); return NULL; } -- 1.6.3.3 From 2082cf395a272b168bd3b9203df19cbb86ddc423 Mon Sep 17 00:00:00 2001 From: Mike Stroyan m...@lunarg.com Date: Mon, 15 Feb 2010 17:43:33 -0700 Subject: [PATCH 2/2] Test for failed malloc in _mesa_HashInsert. --- src/mesa/main/hash.c | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 7666a4b..ae2f2fd 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -194,10 +194,12 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data) /* alloc and insert new table entry */ entry = MALLOC_STRUCT(HashEntry); - entry-Key = key; - entry-Data = data; - entry-Next = table-Table[pos]; - table-Table[pos] = entry; + if (entry) { + entry-Key = key; + entry-Data = data; + entry-Next = table-Table[pos]; + table-Table[pos] = entry; + } _glthread_UNLOCK_MUTEX(table-Mutex); } -- 1.6.3.3 -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] [PATCH 00/12] EGLImage patches
2010/2/12 Kristian Høgsberg k...@bitplanet.net wrote- Well, the pixmap doesn't have a format. A window has a visual we can look at, but a pixmap only has depth. As I wrote to Chia-I, I'll do that and infer the format (RGB or RGBA) based on whether the depth of the pixmap, and drop the extension for now. There's still the possibility that somebody will want to bind a depth 32 pixmap as an RGB texture, which won't be possible without this extension. Whether or not that's useful, I'm not sure, but it's worth noting that the EGLBindTexImage() function allows a similar thing. You can pass an attribute/value pair to specify the texture format, so that a pbuffer EGLSurface with EGL_ALPHA_SIZE == 8 can still be bound with a texture format of RGB. Maybe it's something you can bring up with Khronos? It seems like an EGLConfig is the best way to hint the pixel format when creating an EGLImage from a pixmap. A program can already call eglChooseConfig with an attribute list that requires the config to match a particular pixmap. EGLint attrib_list = { EGL_MATCH_NATIVE_PIXMAP, (EGLint) pixmap, EGL_NONE }; EGLConfig config_result[MAX_CONFIGS]; eglChooseConfig(dpy, attrib_list, config_result, MAX_CONFIGS, num_configs); Then it could choose from any of the configs in config_result. Or it could add additional attributes such as EGL_COLOR_BUFFER_TYPE and EGL_ALPHA_SIZE to select and sort among the available EGLConfigs. So an extended eglCreateImageKHR could take an attributes list that included EGL_CONFIG_ID and the ID attribute queried from the EGLConfig that is preferred. An EGLConfig still doesn't specify the exact order of the channels within a pixel. But it is more precise than just RGB or RGBA or 'default'. And it gives an application more clues to what pixel formats are possible for a particular pixmap depth. Of course, the current implementation of EGL on gallium does not present any EGLConfig values for depths that don't have a corresponding X visual. That could be improved on for the sake of pixmaps with other depths such as 8 and 16. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] [PATCH] Honor LD_LIBRARY_PATH getting EGL drivers
On Tue, Feb 2, 2010 at 9:17 PM, Chia-I Wu olva...@gmail.com wrote: On Tue, Feb 2, 2010 at 11:43 AM, Mike Stroyan m...@lunarg.com wrote: On Mon, Feb 1, 2010 at 7:34 PM, Chia-I Wu olva...@gmail.com wrote: On Tue, Feb 2, 2010 at 2:49 AM, Mike Stroyan m...@lunarg.com wrote: Here is a version of the patch that uses EGL_DRIVERS_PATH and checks for setuid/setgid before using EGL_DRIVER or EGL_DRIVERS_PATH. The patch seems to be missing :) Here is the missing patch file. The patch looks good. But when I tried to make EGL_DRIVER and the default driver also honor EGL_DRIVERS_PATH, it turned out that I need to overhaul both the existing code and your patch. I've attached my version in this mail. It is based on your work. Please have a look. If you think it looks fine, I will go ahead and commit. -olv This version looks good enough to check in. I am not fond of the static 'search_path' and 'buffer' variables in _eglGetSearchPath. It will be one more place to revisit when you come back to work on thread safety. But I understand that it will reduce the time spent formatting the search path. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] [PATCH] Honor LD_LIBRARY_PATH getting EGL drivers
On Mon, Feb 1, 2010 at 10:35 AM, tom fogal tfo...@alumni.unh.edu wrote: Mike Stroyan m...@lunarg.com writes: The changes to load EGL drivers by pattern matching had the side effect of not looking in the directories specified by LD_LIBRARY_PATH or -rpath or ldconfig . This is silly. If you give dlopen a library name: dlopen(libWhatever.so, flags); then *it* will automatically search LD_LIBRARY_PATH. By giving an absolute path, one circumvents this behavior. Tom, The reason this code is not just using dlopen with a library name is that the _eglPreloadDisplayDrivers function is attempting to find all driver libraries that match a pattern such as egl_x11_*.so. Any one of those libraries might be the best one to use. It loads them all and uses a Probe function in each driver to look for the best match for the hardware. dlopen itself cannot find libraries that match a pattern. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] [PATCH] Honor LD_LIBRARY_PATH getting EGL drivers
olv, Here is a version of the patch that uses EGL_DRIVERS_PATH and checks for setuid/setgid before using EGL_DRIVER or EGL_DRIVERS_PATH. I want to avoid suffix matching somehow. I am not clear about the motive for a less than exact check for the library suffix in EGL_DRIVER. Are you interested in a looser need_suffix test for performance reasons? Or do you expect that there will be some driver libraries that don't end with the normal suffix? -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
[Mesa3d-dev] [PATCH] Fix progs/es2/xegl/tri.c
The progs/es2/xegl/tri.c demo fails using, eglQuerySurface() with EGL_SURFACE_TYPE. Only eglGetConfigAttrib can query EGL_SURFACE_TYPE. This patch replaces that with querying EGL_CONFIG_ID, then using that ID to call eglChooseConfig and using that config to call eglGetConfigAttrib() with EGL_SURFACE_TYPE. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com From 4afd26abdeca4c0f600078abc21f000983296911 Mon Sep 17 00:00:00 2001 From: Mike Stroyan m...@lunarg.com Date: Mon, 1 Feb 2010 14:32:40 -0700 Subject: [PATCH] Use eglGetConfigAttrib EGL_SURFACE_TYPE in tri.c --- progs/es2/xegl/tri.c | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/progs/es2/xegl/tri.c b/progs/es2/xegl/tri.c index 7729a09..bb16780 100644 --- a/progs/es2/xegl/tri.c +++ b/progs/es2/xegl/tri.c @@ -340,8 +340,18 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy, assert(val == width); eglQuerySurface(egl_dpy, *surfRet, EGL_HEIGHT, val); assert(val == height); - eglQuerySurface(egl_dpy, *surfRet, EGL_SURFACE_TYPE, val); - assert(val == EGL_WINDOW_BIT); + { + EGLConfig config; + EGLint num_configs; + static EGLint attribs[3]; + attribs[0] = EGL_CONFIG_ID; + attribs[2] = EGL_NONE; + assert(eglQuerySurface(egl_dpy, *surfRet, EGL_CONFIG_ID, attribs[1])); + assert(eglChooseConfig(egl_dpy, attribs, config, 1, num_configs)); + assert(num_configs); + assert(eglGetConfigAttrib(egl_dpy, config, EGL_SURFACE_TYPE, val)); + assert(val EGL_WINDOW_BIT); + } } XFree(visInfo); -- 1.6.3.3 -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] [PATCH] Honor LD_LIBRARY_PATH getting EGL drivers
On Mon, Feb 1, 2010 at 7:34 PM, Chia-I Wu olva...@gmail.com wrote: On Tue, Feb 2, 2010 at 2:49 AM, Mike Stroyan m...@lunarg.com wrote: Here is a version of the patch that uses EGL_DRIVERS_PATH and checks for setuid/setgid before using EGL_DRIVER or EGL_DRIVERS_PATH. The patch seems to be missing :) Here is the missing patch file. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com From 4afd26abdeca4c0f600078abc21f000983296911 Mon Sep 17 00:00:00 2001 From: Mike Stroyan m...@lunarg.com Date: Mon, 1 Feb 2010 14:32:40 -0700 Subject: [PATCH] Use EGL_DRIVERS_PATH --- diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index df36369..b31b631 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -56,7 +56,7 @@ close_library(HMODULE lib) static const char * library_suffix(void) { - return dll; + return .dll; } @@ -64,10 +64,18 @@ static EGLBoolean make_library_path(char *buf, unsigned int size, const char *name) { EGLBoolean need_suffix; - const char *suffix = .dll; + const char *suffix = library_suffix(); int ret; - need_suffix = (strchr(name, '.') == NULL); + /* match the suffix */ + if (suffix) { + size_t name_len = strlen(name); + size_t suffix_len = strlen(suffix); + need_suffix = (name_len suffix_len + || strcmp(name + name_len - suffix_len, suffix) != 0); + } else { + need_suffix = EGL_FALSE; + } ret = snprintf(buf, size, %s%s, name, (need_suffix) ? suffix : ); return ((unsigned int) ret size); @@ -84,7 +92,25 @@ typedef void * lib_handle; static void * open_library(const char *filename) { - return dlopen(filename, RTLD_LAZY); + void *handle; + + /* first try opening without an explicit directory to allow search path */ + handle = dlopen(filename, RTLD_LAZY); + if (handle) { + return handle; + } + + /* if plain file unfound try adding _EGL_DRIVER_SEARCH_DIR directory */ + if (strchr(filename, '/') == NULL) { + char path[1024]; + int ret; + ret = snprintf(path, sizeof(path), %s%s, +_EGL_DRIVER_SEARCH_DIR/, filename); + if ((unsigned int) ret sizeof(path)) { + return dlopen(path, RTLD_LAZY); + } + } + return NULL; } static void @@ -97,23 +123,27 @@ close_library(void *lib) static const char * library_suffix(void) { - return so; + return .so; } static EGLBoolean make_library_path(char *buf, unsigned int size, const char *name) { - EGLBoolean need_dir, need_suffix; - const char *suffix = .so; + EGLBoolean need_suffix; + const char *suffix = library_suffix(); int ret; - need_dir = (strchr(name, '/') == NULL); - need_suffix = (strchr(name, '.') == NULL); - - ret = snprintf(buf, size, %s%s%s, - (need_dir) ? _EGL_DRIVER_SEARCH_DIR/ : , name, - (need_suffix) ? suffix : ); + /* match the suffix */ + if (suffix) { + size_t name_len = strlen(name); + size_t suffix_len = strlen(suffix); + need_suffix = (name_len suffix_len + || strcmp(name + name_len - suffix_len, suffix) != 0); + } else { + need_suffix = EGL_FALSE; + } + ret = snprintf(buf, size, %s%s, name, (need_suffix) ? suffix : ); return ((unsigned int) ret size); } @@ -333,55 +363,39 @@ _eglPreloadUserDriver(void) #endif } - +#if defined(_EGL_PLATFORM_POSIX) /** - * 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. + * Preload display drivers found in a particular directory. */ -static EGLBoolean -_eglPreloadDisplayDrivers(void) +static void +_eglPreloadDisplayDriversFromDir(const char *prefix, const char *suffix, const char *dir) { -#if defined(_EGL_PLATFORM_POSIX) - const char *dpy, *suffix; - char path[1024], prefix[32]; + char path[1024]; DIR *dirp; struct dirent *dirent; - dpy = getenv(EGL_DISPLAY); - if (!dpy || !dpy[0]) - dpy = _EGL_DEFAULT_DISPLAY; - if (!dpy || !dpy[0]) - return EGL_FALSE; - - snprintf(prefix, sizeof(prefix), egl_%s_, dpy); - suffix = library_suffix(); - - dirp = opendir(_EGL_DRIVER_SEARCH_DIR); + dirp = opendir(dir); if (!dirp) - return EGL_FALSE; + return; while ((dirent = readdir(dirp))) { _EGLDriver *drv; - const char *p; /* match the prefix */ if (strncmp(dirent-d_name, prefix, strlen(prefix)) != 0) continue; /* match the suffix */ - p = strrchr(dirent-d_name, '.'); - if ((p !suffix) || (!p suffix)) - continue; - else if (p suffix strcmp(p + 1, suffix) != 0) - continue; + if (suffix) { + size_t d_name_len = strlen(dirent-d_name); + size_t
[Mesa3d-dev] [PATCH] Honor LD_LIBRARY_PATH getting EGL drivers
The changes to load EGL drivers by pattern matching had the side effect of not looking in the directories specified by LD_LIBRARY_PATH or -rpath or ldconfig. This patch changes the search to first look in the directories listed in LD_LIBRARY_PATH. To do that it moves the possible addition of a path prefix from make_library_path() into open_library(). This patch doesn't add searches in the -rpath or ldconfig directories. Those would be more difficult (or impossible) to determine in a portable manner. The patch also tightens up the library suffix test with a specific match for the suffix at the end of the EGL_DRIVER name. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com From 59b7ddbe02fa75045c8037768127a2cfe87a7c8f Mon Sep 17 00:00:00 2001 From: Mike Stroyan m...@eclipse.(none) Date: Sun, 31 Jan 2010 17:58:41 -0700 Subject: [PATCH] Make egl look in library search path for drivers. Use full suffix test. --- src/egl/main/egldriver.c | 144 -- 1 files changed, 100 insertions(+), 44 deletions(-) diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index df36369..a801fae 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -56,7 +56,7 @@ close_library(HMODULE lib) static const char * library_suffix(void) { - return dll; + return .dll; } @@ -64,10 +64,18 @@ static EGLBoolean make_library_path(char *buf, unsigned int size, const char *name) { EGLBoolean need_suffix; - const char *suffix = .dll; + const char *suffix = library_suffix(); int ret; - need_suffix = (strchr(name, '.') == NULL); + /* match the suffix */ + if (suffix) { + size_t name_len = strlen(name); + size_t suffix_len = strlen(suffix); + need_suffix = (name_len suffix_len + || strcmp(name + name_len - suffix_len, suffix) != 0); + } else { + need_suffix = EGL_FALSE; + } ret = snprintf(buf, size, %s%s, name, (need_suffix) ? suffix : ); return ((unsigned int) ret size); @@ -84,7 +92,25 @@ typedef void * lib_handle; static void * open_library(const char *filename) { - return dlopen(filename, RTLD_LAZY); + void *handle; + + /* first try opening without an explicit directory to allow search path */ + handle = dlopen(filename, RTLD_LAZY); + if (handle) { + return handle; + } + + /* if plain file unfound try adding _EGL_DRIVER_SEARCH_DIR directory */ + if (strchr(filename, '/') == NULL) { + char path[1024]; + int ret; + ret = snprintf(path, sizeof(path), %s%s, +_EGL_DRIVER_SEARCH_DIR/, filename); + if ((unsigned int) ret sizeof(path)) { + return dlopen(path, RTLD_LAZY); + } + } + return NULL; } static void @@ -97,23 +123,27 @@ close_library(void *lib) static const char * library_suffix(void) { - return so; + return .so; } static EGLBoolean make_library_path(char *buf, unsigned int size, const char *name) { - EGLBoolean need_dir, need_suffix; - const char *suffix = .so; + EGLBoolean need_suffix; + const char *suffix = library_suffix(); int ret; - need_dir = (strchr(name, '/') == NULL); - need_suffix = (strchr(name, '.') == NULL); - - ret = snprintf(buf, size, %s%s%s, - (need_dir) ? _EGL_DRIVER_SEARCH_DIR/ : , name, - (need_suffix) ? suffix : ); + /* match the suffix */ + if (suffix) { + size_t name_len = strlen(name); + size_t suffix_len = strlen(suffix); + need_suffix = (name_len suffix_len + || strcmp(name + name_len - suffix_len, suffix) != 0); + } else { + need_suffix = EGL_FALSE; + } + ret = snprintf(buf, size, %s%s, name, (need_suffix) ? suffix : ); return ((unsigned int) ret size); } @@ -333,6 +363,48 @@ _eglPreloadUserDriver(void) #endif } +#if defined(_EGL_PLATFORM_POSIX) +/** + * Preload display drivers found in a particular directory. + */ +static void +_eglPreloadDisplayDriversFromDir(const char *prefix, const char *suffix, const char *dir) +{ + char path[1024]; + DIR *dirp; + struct dirent *dirent; + + dirp = opendir(dir); + if (!dirp) + return; + + while ((dirent = readdir(dirp))) { + _EGLDriver *drv; + + /* match the prefix */ + if (strncmp(dirent-d_name, prefix, strlen(prefix)) != 0) + continue; + + /* match the suffix */ + if (suffix) { + size_t d_name_len = strlen(dirent-d_name); + size_t suffix_len = strlen(suffix); + if (d_name_len suffix_len) +continue; + if (strcmp(dirent-d_name + d_name_len - suffix_len, suffix) != 0) +continue; + } + + snprintf(path, sizeof(path), %s/%s, dir, dirent-d_name); + + drv = _eglLoadDriver(path, NULL); + if (drv) + _eglGlobal.Drivers[_eglGlobal.NumDrivers++] = drv; + } + + closedir(dirp); +} +#endif /** * Preload display
Re: [Mesa3d-dev] [PATCH] Honor LD_LIBRARY_PATH getting EGL drivers
On Sun, Jan 31, 2010 at 7:46 PM, Chia-I Wu olva...@gmail.com wrote: On Mon, Feb 1, 2010 at 9:15 AM, Mike Stroyan m...@lunarg.com wrote: The changes to load EGL drivers by pattern matching had the side effect of not looking in the directories specified by LD_LIBRARY_PATH or -rpath or ldconfig. This patch changes the search to first look in the directories listed in LD_LIBRARY_PATH. To do that it moves the possible addition of a path prefix from make_library_path() into open_library(). This patch doesn't add searches in the -rpath or ldconfig directories. Those would be more difficult (or impossible) to determine in a portable manner. I am leaning toward something similar to how DRI drivers are loaded: Allow the users to specify the search directory through EGL_DRIVERS_PATH. A specific environment variable may be the best option if -rpath and ldconfig cannot be used. (They should be added into docs/envvars.html .) It also seems EGL will need a check for setuid in both EGL_DRIVER (my fault) and the proposed EGL_DRIVERS_PATH. A setuid/setgid check is a very good idea for allowing both *PATH and EGL_DRIVER. (geteuid() == getuid()) getegid () == getgid ()) will test for that. The patch also tightens up the library suffix test with a specific match for the suffix at the end of the EGL_DRIVER name. I want to avoid suffix matching somehow. Do you have a specific example why the change is needed? Or, will the following change suffice? p = strrchr(name, '.'); need_suffix = (!p || (strchr(p + 1, '/') != NULL)); I was thinking about future library names that might contain decimal points such as egl_x11_i999.5.so. Leaving the .so suffix off would not work as make_library_path would just check for any appearance of '.'. Of course, just setting EGL_DRIVER to include .so suffix would avoid the issue. -- Mike Stroyan - Software Architect LunarG, Inc. - The Graphics Experts Cell: (970) 219-7905 Email: m...@lunarg.com Website: http://www.lunarg.com -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] A patch to get rbug-gui working with recent util_format and libgallium.a
On Thu, Jan 7, 2010 at 4:34 AM, Keith Whitwell kei...@vmware.com wrote: It looks like there are some unrelated changes in your diff -- can you separate them out into disjoint changes? One way is to make several commits to your local git repo and then use git-format-patch to create email-ready changes with your authorship and commit message intact. Keith, Thanks for the pointer to git-format-patch. Here is my patch set restructured to be more understandable. While creating this stream I also removed a call to util_format_description that I had put into texture_action_read_info. I was thinking that could lead to a more compact icon selection of the icons. But the swizzle information in the description was harder to use than the format enum. Mike From 24d8b23b3c4bdb0c0839c77b495ac334960a915e Mon Sep 17 00:00:00 2001 From: Mike Stroyan m...@pavilion.stroyan Date: Fri, 8 Jan 2010 11:00:43 -0700 Subject: [PATCH 1/5] Change from librbug.a, libtgsi.a, and libutil.a to libgallium.a --- Makefile.in |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Makefile.in b/Makefile.in index 1d39e8b..0cc3b45 100644 --- a/Makefile.in +++ b/Makefile.in @@ -17,9 +17,7 @@ MESA_INCLUDES = \ -I$(MESA)src/gallium/drivers MESA_LIBS = \ - $(MESA)src/gallium/auxiliary/rbug/librbug.a \ - $(MESA)src/gallium/auxiliary/tgsi/libtgsi.a \ - $(MESA)src/gallium/auxiliary/util/libutil.a + $(MESA)src/gallium/auxiliary/libgallium.a -- 1.6.3.3 From 03fc1a93c31045acea6f1f3e5575e2f5838c9070 Mon Sep 17 00:00:00 2001 From: Mike Stroyan m...@pavilion.stroyan Date: Fri, 8 Jan 2010 11:14:56 -0700 Subject: [PATCH 2/5] Use util_format_* functions instead of pf_* functions. --- src/texture.c | 167 +--- 1 files changed, 122 insertions(+), 45 deletions(-) diff --git a/src/texture.c b/src/texture.c index a9ba987..6553acc 100644 --- a/src/texture.c +++ b/src/texture.c @@ -27,6 +27,7 @@ #include GL/gl.h #include pipe/p_format.h +#include util/u_format.h /* needed for u_tile */ #include pipe/p_state.h @@ -233,7 +234,7 @@ struct texture_action_read unsigned stride; unsigned size; enum pipe_format format; - struct pipe_format_block block; + uint32_t block_height; void *data; }; @@ -319,9 +320,9 @@ static void texture_action_read_upload(struct texture_action_read *action, src_stride = action-stride; - if (!pf_is_compressed(action-format)) { + if (!util_format_is_compressed(action-format)) { uint32_t dst_stride = 4 * 4 * w; - uint32_t step_h = action-block.height; + uint32_t step_h = action-block_height; float *rgba = g_malloc(dst_stride * h); GLint format, type; unsigned i; @@ -342,7 +343,7 @@ static void texture_action_read_upload(struct texture_action_read *action, format, type, rgba); g_free(rgba); - } else if (pf_is_compressed(action-format)) { + } else if (util_format_is_compressed(action-format)) { if (action-format == PIPE_FORMAT_DXT1_RGB) internal_format = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; @@ -392,11 +393,11 @@ static gboolean texture_action_read_read(struct rbug_event *e, if (!action-running) goto error; - if (pf_is_compressed(action-format)) { + if (util_format_is_compressed(action-format)) { size = read-data_len; } else { /* calculate needed size */ - size = pf_get_nblocksy(action-block, action-height) * read-stride; + size = util_format_get_nblocksx(action-format, action-height) * read-stride; if (read-data_len size) goto error; @@ -437,6 +438,7 @@ static gboolean texture_action_read_info(struct rbug_event *e, char info_short_string[64]; char info_long_string[128]; GdkPixbuf *buf = NULL; + const struct util_format_description *format_description; info = (struct rbug_proto_texture_info_reply *)header; action = (struct texture_action_read *)e; @@ -449,42 +451,119 @@ static gboolean texture_action_read_info(struct rbug_event *e, goto error; } - if (pf_layout(info-format) == PIPE_FORMAT_LAYOUT_RGBAZS) { - int swz = (info-format 2) 0xFFF; - - if (!swz) - ; - else if (swz == _PIPE_FORMAT_RGBA) - buf = icon_get(rgba, p); - else if (swz == _PIPE_FORMAT_RGB1) - buf = icon_get(rgbx, p); - else if (swz == _PIPE_FORMAT_ARGB) - buf = icon_get(argb, p); - else if (swz == _PIPE_FORMAT_1RGB) - buf = icon_get(xrgb, p); - else if (swz == _PIPE_FORMAT_000R) - buf = icon_get(rgba, p); - - else if (swz == _PIPE_FORMAT_SZ00) - buf = icon_get(s8z24, p); - else if (swz == _PIPE_FORMAT_0Z00) - buf = icon_get(x8z24, p); - else if (swz == _PIPE_FORMAT_ZS00) - buf = icon_get(z24s8, p); - else if (swz == _PIPE_FORMAT_Z000) - buf = icon_get(z24x8, p); - - } else if (pf_layout(info-format) == PIPE_FORMAT_LAYOUT_DXT) { - - if (info-format == PIPE_FORMAT_DXT1_RGB) - buf = icon_get(dxt1_rgb, p); - else if (info-format == PIPE_FORMAT_DXT1_RGBA) - buf = icon_get(dxt1_rgba, p); - else if (info-format == PIPE_FORMAT_DXT3_RGBA
[Mesa3d-dev] A patch to get rbug-gui working with recent util_format and libgallium.a
Hello folks. I started at LunarG this week and have been getting more familiar with the gallium code. I noticed that rbug-gui has not been updated to match the recent changes to the util_format. Here is a patch that switches from the pr_* functions to util_format functions. (It also adds several new icons for the many formats.) I replaced the 'action-block' field with just one 'action-block_height' field. That is the only part of action-block that is needed if util_format_get_nblocksx is called instead of pf_get_nblocksy. I don't know if there is a better way to extract block height from format instead keeping it as a separate field. Do these changes look good? Mike Stroyan, m...@lunarg.com patch Description: Binary data new_icons.tar Description: Unix tar archive -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev