mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-24 05:31:08 +00:00
Fix Vulkan decoder probing on Nvidia using KMSDRM
This commit is contained in:
@@ -87,15 +87,30 @@ Uint32 StreamUtils::getPlatformWindowFlags()
|
|||||||
SDL_Window* StreamUtils::createTestWindow()
|
SDL_Window* StreamUtils::createTestWindow()
|
||||||
{
|
{
|
||||||
SDL_Window* testWindow;
|
SDL_Window* testWindow;
|
||||||
|
Uint32 baseFlags = 0;
|
||||||
|
|
||||||
|
// Test windows are always hidden
|
||||||
|
baseFlags |= SDL_WINDOW_HIDDEN;
|
||||||
|
|
||||||
|
// Creating a Vulkan surface with KMSDRM requires finding a display mode
|
||||||
|
// that exactly matches the window size. This is not always possible,
|
||||||
|
// particularly with drivers (Nvidia) that only expose modes matching
|
||||||
|
// the current resolution (only differing by refresh rate). Fullscreen
|
||||||
|
// desktop mode ensures the window size exactly matches the display mode
|
||||||
|
// which prevents false Vulkan renderer failures during decoder probing.
|
||||||
|
if (QString(SDL_GetCurrentVideoDriver()) == "KMSDRM") {
|
||||||
|
baseFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to add the platform-specific flags first and fall back if that fails
|
||||||
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720,
|
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720,
|
||||||
SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags());
|
baseFlags | StreamUtils::getPlatformWindowFlags());
|
||||||
if (!testWindow) {
|
if (!testWindow) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Failed to create test window with platform flags: %s",
|
"Failed to create test window with platform flags: %s",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
|
|
||||||
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN);
|
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, baseFlags);
|
||||||
if (!testWindow) {
|
if (!testWindow) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user