From: Andreas Beckmann 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) {