Bug 490561 - Error launching Vulkan/DXVK games in Flatpak on Nvidia GPU
Summary: Error launching Vulkan/DXVK games in Flatpak on Nvidia GPU
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 6.1.2
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-20 14:44 UTC by YanEx
Modified: 2025-01-29 14:29 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
inxi -Fzxx, dnf list installed \*nvidia\*, flatpak run com.valvesoftware.Steam (15.45 KB, text/plain)
2024-07-20 14:44 UTC, YanEx
Details
Screenshot error (13.36 KB, image/png)
2024-07-20 14:46 UTC, YanEx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description YanEx 2024-07-20 14:44:15 UTC
Created attachment 171825 [details]
inxi -Fzxx, dnf list installed \*nvidia\*, flatpak run com.valvesoftware.Steam

SUMMARY
When launching games via Steam/Heroic Launcher/Bottles Flatpak, they fail to start with the error 'Error: couldn’t switch to requested monitor resolution'. However, in the native clients for Steam/Heroic, everything works fine. This issue occurs only with games running on Vulkan/DXVK, while games using OpenGL run without problems in Flatpak. Interestingly, if you run 'vulkaninfo', the games will start correctly until the next reboot.

STEPS TO REPRODUCE
1. Launch Steam/Heroic Flatpak
2. Launch any game using Vulkan/DXVK
3. Get an error

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.2
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
Kernel Version: 6.9.9-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × 11th Gen Intel® Core™ i5-11400H @ 2.70GHz
Memory: 15.3 ГиБ of RAM
Graphics Processor: Mesa Intel® UHD Graphics
dGPU: NVIDIA GeForce RTX 3060 Laptop GPU Driver: 555.58.02
Manufacturer: HP
Product Name: Victus by HP Laptop

ADDITIONAL INFORMATION
This only happens with proprietary Nvidia drivers, nouveau doesn't have this problem. Other distributions (Arch/openSUSE) do not have this problem. In the X11 session, the error does not occur either.

https://forums.developer.nvidia.com/t/error-couldn-t-switch-to-requested-monitor-resolution/291376
Comment 1 YanEx 2024-07-20 14:46:52 UTC
Created attachment 171826 [details]
Screenshot error
Comment 3 YanEx 2025-01-16 19:35:20 UTC
As it turned out, this issue affects not only Fedora but also Arch, specifically CachyOS
Comment 4 YanEx 2025-01-21 23:35:24 UTC
Based on my tests, this seems to be exclusively a KDE issue, as the problem does not occur in other DEs, such as GNOME.

Interestingly, in GNOME, you don’t even need to enter any commands in the launch parameters for games to forcefully use Nvidia instead of Intel.

Additionally, if you connect the laptop to an external monitor, this error does not occur in KDE, as Nvidia is used directly, as far as I understand.
Comment 5 YanEx 2025-01-28 21:51:22 UTC
If you enable the nvidia-persistenced daemon by running:  
"sudo systemctl enable nvidia-persistenced --now", it seems to resolve this issue.  

Additionally, you no longer need to add  
"__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia"  
to the launch parameters to force games to use the Nvidia GPU instead of Intel.  

However, I don't fully understand the exact purpose of this daemon. Moreover, it's not required in other desktop environments, where it's disabled by default.

If this isn't a KDE-specific issue, I'd like to understand where to look for answers and who I can reach out to for help. Thank you.
Comment 6 Zamundaaa 2025-01-29 13:47:36 UTC
> However, I don't fully understand the exact purpose of this daemon. Moreover, it's not required in other desktop environments, where it's disabled by default.
It is required by the NVidia driver for suspend.

I'm not sure either what's going on here, but I think the best place you could get answers is https://forums.developer.nvidia.com/c/gpu-graphics/linux
Comment 7 YanEx 2025-01-29 13:56:09 UTC
(In reply to Zamundaaa from comment #6)
> > However, I don't fully understand the exact purpose of this daemon. Moreover, it's not required in other desktop environments, where it's disabled by default.
> It is required by the NVidia driver for suspend.
> 
> I'm not sure either what's going on here, but I think the best place you
> could get answers is https://forums.developer.nvidia.com/c/gpu-graphics/linux

This issue is already being discussed here:  

https://github.com/NVIDIA/open-gpu-kernel-modules/issues/698

But so far, we don't have any ideas on why exactly it's happening. Are you sure the report should be closed?
Comment 8 Zamundaaa 2025-01-29 14:29:42 UTC
Yes. KWin doesn't really have anything to do with Flatpak or what the Vulkan driver is doing under the hood.