diff options
author | Emil Velikov <[email protected]> | 2017-09-27 17:36:29 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-10-02 16:26:46 +0100 |
commit | d884d8d0077c16d459b11699c552184dfec581b2 (patch) | |
tree | 86c5680dc33479c9394a58dd05ab565569381737 /src/egl/drivers | |
parent | 21e271024d8e050b75361c2da2e5783100f2e87b (diff) |
egl/dri: link directly to libglapi.so
Shared glapi (libglapi.so) has been a requirement for years, in order
to build EGL.
Remove the no longer necessary dlopen/dlsym dance and link to the
library directly.
This allows us to remove a handful of platform specific workarounds, due
to the different name of the library.
v2:
- Android: export the include dir (RobH)
- Drop unused local variable (Eric)
Cc: Jonathan Gray <[email protected]>
Cc: Jon Turney <[email protected]>
Cc: Julien Isorce <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]> (v1)
Tested-by: Tomasz Figa <[email protected]> (v1)
Tested-by: Rob Herring <[email protected]>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 42 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 2 |
2 files changed, 4 insertions, 40 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index adcaae0bab7..c2b16d11732 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -62,6 +62,7 @@ #include "loader/loader.h" #include "util/u_atomic.h" #include "util/u_vector.h" +#include "mapi/glapi/glapi.h" /* The kernel header drm_fourcc.h defines the DRM formats below. We duplicate * some of the definitions here so that building Mesa won't bleeding-edge @@ -1564,9 +1565,7 @@ dri2_surface_get_dri_drawable(_EGLSurface *surf) static _EGLProc dri2_get_proc_address(_EGLDriver *drv, const char *procname) { - struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); - - return dri2_drv->get_proc_address(procname); + return _glapi_get_proc_address(procname); } static _EGLSurface* @@ -3169,7 +3168,6 @@ dri2_unload(_EGLDriver *drv) { struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); - dlclose(dri2_drv->handle); free(dri2_drv); } @@ -3177,49 +3175,17 @@ static EGLBoolean dri2_load(_EGLDriver *drv) { struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); -#ifdef HAVE_ANDROID_PLATFORM - const char *libname = "libglapi.so"; -#elif defined(__APPLE__) - const char *libname = "libglapi.0.dylib"; -#elif defined(__CYGWIN__) - const char *libname = "cygglapi-0.dll"; -#else - const char *libname = "libglapi.so.0"; -#endif - void *handle; - - /* RTLD_GLOBAL to make sure glapi symbols are visible to DRI drivers */ - handle = dlopen(libname, RTLD_LAZY | RTLD_GLOBAL); - if (!handle) { - _eglLog(_EGL_WARNING, "DRI2: failed to open glapi provider"); - goto no_handle; - } - - dri2_drv->get_proc_address = (_EGLProc (*)(const char *)) - dlsym(handle, "_glapi_get_proc_address"); - - /* if glapi is not available, loading DRI drivers will fail */ - if (!dri2_drv->get_proc_address) { - _eglLog(_EGL_WARNING, "DRI2: failed to find _glapi_get_proc_address"); - goto no_symbol; - } dri2_drv->glFlush = (void (*)(void)) - dri2_drv->get_proc_address("glFlush"); + _glapi_get_proc_address("glFlush"); /* if glFlush is not available things are horribly broken */ if (!dri2_drv->glFlush) { _eglLog(_EGL_WARNING, "DRI2: failed to find glFlush entry point"); - goto no_symbol; + return EGL_FALSE; } - dri2_drv->handle = handle; return EGL_TRUE; - -no_symbol: - dlclose(handle); -no_handle: - return EGL_FALSE; } /** diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 10a41518172..c70a84bb917 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -83,8 +83,6 @@ struct dri2_egl_driver { _EGLDriver base; - void *handle; - _EGLProc (*get_proc_address)(const char *procname); void (*glFlush)(void); }; |