[Mesa-dev] [PATCH v2 06/15] android: try to load gallium_dri.so directly

Eric Anholt eric at anholt.net
Mon Jun 8 13:39:20 PDT 2015


Chih-Wei Huang <cwhuang at android-x86.org> writes:

> To avoid the trick of creating links for all dri drivers.
>
> Signed-off-by: Chih-Wei Huang <cwhuang at linux.org.tw>
> ---
>  src/egl/drivers/dri2/egl_dri2.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index fe5cbc8..7fc9f78 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -419,6 +419,10 @@ dri2_open_driver(_EGLDisplay *disp)
>        /* not need continue to loop all paths once the driver is found */
>        if (dri2_dpy->driver != NULL)
>           break;
> +#ifdef ANDROID
> +      snprintf(path, sizeof path, "%.*s/gallium_dri.so", len, p);
> +      dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
> +#endif
>     }

It looks like with your change, things wouldn't work if you had more
than one entry in your drivers path, and gallium_dri.so wasn't in the
last directory.

I want to squish the following changes on to this:

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0b8a49b..44a6c96 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -419,9 +419,14 @@ dri2_open_driver(_EGLDisplay *disp)
       /* not need continue to loop all paths once the driver is found */
       if (dri2_dpy->driver != NULL)
          break;
+
 #ifdef ANDROID
       snprintf(path, sizeof path, "%.*s/gallium_dri.so", len, p);
       dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
+      if (dri2_dpy->driver == NULL)
+         _eglLog(_EGL_DEBUG, "failed to open %s: %s\n", path, dlerror());
+      else
+         break;
 #endif
    }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150608/80fd5458/attachment.sig>


More information about the mesa-dev mailing list