gbm: dlopen libglapi so gbm_create_device works

Dri driver libs are not linked to pull in libglapi so gbm_create_device()
fails when it tries to dlopen them (unless the application is linked
with something that does pull in libglapi, like libGL).
Until dri drivers can be fixed properly, dlopen libglapi before trying
to dlopen them.

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Frank Henigman <fjhenigman@google.com>
[Emil Velikov: Drop misleading bugzilla link, mention that libname differs]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>

(cherry picked from commit 828f13330c)
This commit is contained in:
Frank Henigman 2014-11-06 16:29:26 -05:00 committed by Emil Velikov
parent 6bb51be018
commit 8c748fa125

View file

@ -311,6 +311,14 @@ dri_open_driver(struct gbm_dri_device *dri)
if (search_paths == NULL)
search_paths = DEFAULT_DRIVER_DIR;
/* Temporarily work around dri driver libs that need symbols in libglapi
* but don't automatically link it in.
*/
/* XXX: Library name differs on per platforms basis. Update this as
* osx/cygwin/windows/bsd gets support for GBM..
*/
dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL);
dri->driver = NULL;
end = search_paths + strlen(search_paths);
for (p = search_paths; p < end && dri->driver == NULL; p = next + 1) {