OSDN Git Service

Wayland-drm: Fix not finding wl_drm_interface on systems with libglvnd
authorHans de Goede <hdegoede@redhat.com>
Wed, 15 Feb 2017 14:18:44 +0000 (15:18 +0100)
committerSean V. Kelley <seanvk@users.noreply.github.com>
Wed, 15 Feb 2017 17:43:52 +0000 (09:43 -0800)
We do not want just any libEGL.so.1 we want mesa's libEGL.so.1 as that
is the only way which defines the wl_drm_interface symbol we need,
one systems with libglvnd libEGL.so.1 is a dispatcher library provided
by libglvnd and the actual mesa libEGL we want is named libEGL_mesa.so.0
so try that first.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
va/wayland/va_wayland_drm.c

index 958ea85..2ff19f5 100644 (file)
 #include "wayland-drm-client-protocol.h"
 
 /* XXX: Wayland/DRM support currently lives in Mesa libEGL.so.* library */
-#define LIBWAYLAND_DRM_NAME "libEGL.so.1"
+/* First try the soname of a glvnd enabled mesa build */
+#define LIBWAYLAND_DRM_NAME "libEGL_mesa.so.0"
+/* Then fallback to plain libEGL.so.1 (which might not be mesa) */
+#define LIBWAYLAND_DRM_NAME_FALLBACK "libEGL.so.1"
 
 typedef struct va_wayland_drm_context {
     struct va_wayland_context   base;
@@ -207,8 +210,11 @@ va_wayland_drm_create(VADisplayContextP pDisplayContext)
     vtable->has_prime_sharing = 0;
 
     wl_drm_ctx->handle = dlopen(LIBWAYLAND_DRM_NAME, RTLD_LAZY|RTLD_LOCAL);
-    if (!wl_drm_ctx->handle)
-        return false;
+    if (!wl_drm_ctx->handle) {
+        wl_drm_ctx->handle = dlopen(LIBWAYLAND_DRM_NAME_FALLBACK, RTLD_LAZY|RTLD_LOCAL);
+        if (!wl_drm_ctx->handle)
+            return false;
+    }
 
     wl_drm_ctx->drm_interface =
         dlsym(wl_drm_ctx->handle, "wl_drm_interface");