Commit 90d87bbe authored by Andreas Beckmann's avatar Andreas Beckmann
Browse files

search the vdpau module in multiple directories

start searching the vdpau module in ${ORIGIN}/vdpau, then the MODULEDIR and
finally fall back to /usr/lib/vdpau
parent f25b3b62
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -6,7 +6,8 @@ libvdpau (0.4.1-3) UNRELEASED; urgency=low
  [ Andreas Beckmann ]
  * Build for multiarch.  Based on patches from Daniel Schaal.
    (Closes: #631174)
  * Add fallback search patch /usr/lib/vdpau.
  * Search the vdpau module in multiple directories, starting with
    ${ORIGIN}/vdpau and fall back to /usr/lib/vdpau in the end.
  * Add conflicts to prevent mixing biarch and multiarch packages (i.e.
    lib32vdpau1:amd64 and libvdpau1:i386).
  * Use unversioned Conflicts/Replaces on nvidia-libvdpau* to cleanup the
+1 −0
Original line number Diff line number Diff line
@@ -2,3 +2,4 @@ track_dynamic_library_handles_and_free_them_on_exit.patch
link-with-libx11.patch
autoreconf_-fi.patch
simplify-dlopen-path-length-error-handling.patch
vdpau-module-searchpath.patch
+56 −0
Original line number Diff line number Diff line
From: Andreas Beckmann <debian@abeckmann.de>
Subject: search the vdpau module in multiple directories
 start searching the vdpau module in ${ORIGIN}/vdpau, then the MODULEDIR and
 finally fall back to /usr/lib/vdpau

Index: b/src/vdpau_wrapper.c
===================================================================
--- a/src/vdpau_wrapper.c
+++ b/src/vdpau_wrapper.c
@@ -98,6 +98,14 @@
     return driver_name;
 }
 
+static char const * _vdpau_module_search_paths[] = {
+    "${ORIGIN}/vdpau/",
+    VDPAU_MODULEDIR "/",
+    "/usr/lib/vdpau/",
+    "",
+    NULL
+};
+
 static VdpStatus _vdp_open_driver(
     Display *             display,
     int                   screen)
@@ -107,6 +115,7 @@
     char         vdpau_driver_lib[PATH_MAX];
     char const * vdpau_trace;
     char const * func_name;
+    char const ** module_path;
 
     vdpau_driver = getenv("VDPAU_DRIVER");
     if (!vdpau_driver) {
@@ -118,12 +127,17 @@
     }
 
     _vdp_driver_dll = NULL;
-    if (snprintf(vdpau_driver_lib, sizeof(vdpau_driver_lib), DRIVER_LIB_FORMAT,
-                 VDPAU_MODULEDIR "/", vdpau_driver, ".1") >=
-            sizeof(vdpau_driver_lib)) {
-        fprintf(stderr, "Failed to construct driver path: path too long\n");
-    } else {
-        _vdp_driver_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
+
+    for (module_path = _vdpau_module_search_paths; *module_path; ++module_path) {
+        if (snprintf(vdpau_driver_lib, sizeof(vdpau_driver_lib), DRIVER_LIB_FORMAT,
+                     *module_path, vdpau_driver, ".1") >= sizeof(vdpau_driver_lib)) {
+            fprintf(stderr, "Failed to construct driver path: path too long\n");
+        } else {
+            _vdp_driver_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
+            if (_vdp_driver_dll) {
+                break;
+            }
+        }
     }
 
     if (!_vdp_driver_dll) {