summaryrefslogtreecommitdiff
path: root/package/libvdpau/0003-vdpau-module-searchpath.patch
blob: bd835153d0581a2b42494d532c04267ba76308d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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

[Patch taken from
https://anonscm.debian.org/cgit/pkg-nvidia/libvdpau.git/tree/debian/patches/vdpau-module-searchpath.patch.]

Signed-off-by: Damien Lanson <damien@kal-host.com>

--- a/src/vdpau_wrapper.c
+++ b/src/vdpau_wrapper.c
@@ -103,6 +103,13 @@ static char * _vdp_get_driver_name_from_
     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)
@@ -117,6 +127,7 @@ static VdpStatus _vdp_open_driver(
     char         vdpau_driver_lib[PATH_MAX];
     char const * vdpau_trace;
     char const * func_name;
+    char const ** module_path;
 
     vdpau_driver = secure_getenv("VDPAU_DRIVER");
     if (vdpau_driver) {
@@ -138,9 +146,11 @@ static VdpStatus _vdp_open_driver(
 
     /* Fallback to VDPAU_MODULEDIR when VDPAU_DRIVER_PATH is not set,
      * or if we fail to create the driver path/dlopen the library. */
-    if (!_vdp_driver_dll) {
+    for (module_path = _vdpau_module_search_paths;
+         !_vdp_driver_dll && *module_path;
+         ++module_path) {
         if (snprintf(vdpau_driver_lib, sizeof(vdpau_driver_lib),
-                     DRIVER_LIB_FORMAT, VDPAU_MODULEDIR, vdpau_driver) >=
+                     DRIVER_LIB_FORMAT, *module_path, vdpau_driver) >=
                 sizeof(vdpau_driver_lib)) {
             fprintf(stderr, "Failed to construct driver path: path too long\n");
         }