Only use fallback VDPAU/VAAPI driver paths on AppImages

Native packages and Flatpak/Snap packages both have properly set
driver path values embedded in libva.so/libvdpau.so. Let's not go
splunking for drivers in random folders on those systems.
This commit is contained in:
Cameron Gutman 2024-05-25 14:39:09 -05:00
parent e130a15037
commit 4474f815af
2 changed files with 18 additions and 1 deletions

View File

@ -277,6 +277,13 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
break;
}
#if defined(APP_IMAGE) || defined(USE_FALLBACK_DRIVER_PATHS)
// AppImages will be running with our libva.so which means they don't know about
// distro-specific driver paths. To avoid failing in this scenario, we'll hardcode
// some such paths here for common distros. Non-AppImage packaging mechanisms won't
// need this fallback because either:
// a) They are using both distro libva.so and distro libva drivers (native packages)
// b) They are using both runtime libva.so and runtime libva drivers (Flatpak/Snap)
if (qEnvironmentVariableIsEmpty("LIBVA_DRIVERS_PATH")) {
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Trying fallback VAAPI driver paths");
@ -298,7 +305,9 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
);
setPathVar = true;
}
else {
else
#endif
{
if (setPathVar) {
// Unset LIBVA_DRIVERS_PATH if we set it ourselves
// and we didn't find any working VAAPI drivers.

View File

@ -149,6 +149,13 @@ bool VDPAURenderer::initialize(PDECODER_PARAMETERS params)
AV_HWDEVICE_TYPE_VDPAU,
nullptr, nullptr, 0);
#if defined(APP_IMAGE) || defined(USE_FALLBACK_DRIVER_PATHS)
// AppImages will be running with our libvdpau.so which means they don't know about
// distro-specific driver paths. To avoid failing in this scenario, we'll hardcode
// some such paths here for common distros. Non-AppImage packaging mechanisms won't
// need this fallback because either:
// a) They are using both distro libvdpau.so and distro VDPAU drivers (native packages)
// b) They are using both runtime libvdpau.so and runtime VDPAU drivers (Flatpak/Snap)
if (err < 0 && qEnvironmentVariableIsEmpty("VDPAU_DRIVER_PATH")) {
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Trying fallback VDPAU driver paths");
@ -173,6 +180,7 @@ bool VDPAURenderer::initialize(PDECODER_PARAMETERS params)
qunsetenv("VDPAU_DRIVER_PATH");
}
}
#endif
if (err < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,