| 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"); |
| } |