[Mesa-dev] [PATCH] glx: Don't uselessly dlopen libGL within libGL

Jose Fonseca jfonseca at vmware.com
Thu May 29 10:55:33 PDT 2014


----- Original Message -----
> This is entirely pointless.  The DRI driver does not need any symbols
> from libGL, even if it did 

I think DRI drivers did at one point depend on getting some glapi symbols from libGL.so.  I don't recall which situations the DRI driver could be loaded without libGL though (maybe indirect rendering inside X?)

Anyway, I agree is not nice to dlopen(libGL).  I do recall stumbling into these confusing dlopens when debugging apitrace.

Jose

> libGL would already be available to resolve
> them because that's how dlopen works.
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  src/glx/dri_common.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
> index e5a3f70..235d350 100644
> --- a/src/glx/dri_common.c
> +++ b/src/glx/dri_common.c
> @@ -93,14 +93,11 @@ dri_message(int level, const char *f, ...)
>  _X_HIDDEN void *
>  driOpenDriver(const char *driverName)
>  {
> -   void *glhandle, *handle;
> +   void *handle;
>     const char *libPaths, *p, *next;
>     char realDriverName[200];
>     int len;
>  
> -   /* Attempt to make sure libGL symbols will be visible to the driver */
> -   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_LOCAL);
> -
>     libPaths = NULL;
>     if (geteuid() == getuid()) {
>        /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
> @@ -146,9 +143,6 @@ driOpenDriver(const char *driverName)
>     if (!handle)
>        ErrorMessageF("unable to load driver: %s_dri.so\n", driverName);
>  
> -   if (glhandle)
> -      dlclose(glhandle);
> -
>     return handle;
>  }
>  
> --
> 1.9.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=VVUsK%2BQzrCw4fR82%2BqwgGqUu17b9yHhCTZ2d3K0ddfc%3D%0A&s=3be3e011473b906a7b7ef6e3f00d1c662f475caae7105be21067f4a46a199675
> 


More information about the mesa-dev mailing list