mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 06:30:55 +00:00
Add VAAPI driver path fallbacks for AppImage
This commit is contained in:
@@ -138,25 +138,57 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
|
|
||||||
int major, minor;
|
int major, minor;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
|
||||||
if (status != VA_STATUS_SUCCESS && qEnvironmentVariableIsEmpty("LIBVA_DRIVER_NAME")) {
|
for (;;) {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||||
"Default VAAPI driver failed - trying fallback drivers");
|
if (status != VA_STATUS_SUCCESS && qEnvironmentVariableIsEmpty("LIBVA_DRIVER_NAME")) {
|
||||||
if (status != VA_STATUS_SUCCESS) {
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
// The iHD driver supports newer hardware like Ice Lake and Comet Lake.
|
"Trying fallback VAAPI driver names");
|
||||||
// It should be picked by default on those platforms, but that doesn't
|
if (status != VA_STATUS_SUCCESS) {
|
||||||
// always seem to be the case for some reason.
|
// The iHD driver supports newer hardware like Ice Lake and Comet Lake.
|
||||||
vaSetDriverName(vaDeviceContext->display, const_cast<char*>("iHD"));
|
// It should be picked by default on those platforms, but that doesn't
|
||||||
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
// always seem to be the case for some reason.
|
||||||
|
vaSetDriverName(vaDeviceContext->display, const_cast<char*>("iHD"));
|
||||||
|
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||||
|
}
|
||||||
|
if (status != VA_STATUS_SUCCESS) {
|
||||||
|
// The Iris driver in Mesa 20.0 returns a bogus VA driver (iris_drv_video.so)
|
||||||
|
// even though the correct driver is still i965. If we hit this path, we'll
|
||||||
|
// explicitly try i965 to handle this case.
|
||||||
|
vaSetDriverName(vaDeviceContext->display, const_cast<char*>("i965"));
|
||||||
|
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (status != VA_STATUS_SUCCESS) {
|
|
||||||
// The Iris driver in Mesa 20.0 returns a bogus VA driver (iris_drv_video.so)
|
if (status == VA_STATUS_SUCCESS) {
|
||||||
// even though the correct driver is still i965. If we hit this path, we'll
|
// Success!
|
||||||
// explicitly try i965 to handle this case.
|
break;
|
||||||
vaSetDriverName(vaDeviceContext->display, const_cast<char*>("i965"));
|
}
|
||||||
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
|
||||||
|
if (qEnvironmentVariableIsEmpty("LIBVA_DRIVERS_PATH")) {
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Trying fallback VAAPI driver paths");
|
||||||
|
|
||||||
|
qputenv("LIBVA_DRIVERS_PATH",
|
||||||
|
#if Q_PROCESSOR_WORDSIZE == 8
|
||||||
|
"/usr/lib64/dri:" // Fedora x86_64
|
||||||
|
"/usr/lib64/va/drivers:" // Gentoo x86_64
|
||||||
|
#endif
|
||||||
|
"/usr/lib/dri:" // Arch i386 & x86_64, Fedora i386
|
||||||
|
"/usr/lib/va/drivers:" // Gentoo i386
|
||||||
|
#if defined(Q_PROCESSOR_X86_64)
|
||||||
|
"/usr/lib/x86_64-linux-gnu/dri:" // Ubuntu/Debian x86_64
|
||||||
|
#elif defined(Q_PROCESSOR_X86_32)
|
||||||
|
"/usr/lib/i386-linux-gnu/dri:" // Ubuntu/Debian i386
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Give up
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status != VA_STATUS_SUCCESS) {
|
if (status != VA_STATUS_SUCCESS) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Failed to initialize VAAPI: %d",
|
"Failed to initialize VAAPI: %d",
|
||||||
|
|||||||
Reference in New Issue
Block a user