Game and X server freeze using fullscreen and NVIDIA On-Demand on laptop with hybrid RTX 3070

Hello there,

recently I acquired a Lenovo ThinkPad T15g g2 which has a discrete video card (NVidia GeForce RTX 3070 mobile). In order to reduce stress on the video card and battery I am using the prime profile NVIDIA On-Demand from the nvidia-settings configuration menu.

The problem is that whenever I want to play a game using the discrete video card I have to use windowed mode because otherwise the game and probably the X server freeze.

E.g. I start Splitgate using Steam and the launch options
The game starts without problems, I start looking for a session and when I get into a match itself the game freezes.
I can still hear sound but I cannot interact with the X server and I also cannot switch to a virtual terminal. Using the magic SysRq key combination REISUB I can reboot the machine as gracefully as possible or I can ssh into the machine and restart SDDM (killing the game doesn’t do anything - the process disappears but the game image is still frozen on the screen, that is why I think the X server is also affected) but otherwise I cannot do anything short of a hard reset.

I also cannot pinpoint when the freeze occurs. It happens both with native Linux games and with games running Proton. Watch Dogs, for example, freezes almost immediately right at the start when the first logos appear. Splitgate freezes when I get into a match and wait for it to start. Something like the training camp or the race still works.
I was able to play DOOM 2016 for 15 minutes or so until it froze, Far Cry 5 a bit less. I cannot say when it occurs.
Sometimes I cannot even get into the options menu fast enough to set it to windowed mode to stop the freeze. For ELEX I had to manually edit the config file while in Control I could get into the options and set it to windowed.

I haven’t tested it thoroughly but I think that when using the performance mode, i.e. everything runs on the discrete card, this issue doesn’t occur. Also just setting to windowed mode completely negates the issue. Everything works without a problem. I am not sure about borderless windowed mode.

I am running Ubuntu 21.04 with KDE Plasma but I guess all of this information should be inside the bug report.

nvidia-bug-report.log.gz (1.1 MB)

I finally switched back to Debian and am currently using the testing branch (bookworm). Driver version is 470.74 and kernel is 5.14.0-2-amd64. The problem still persists.
However, now it seems there is no option in nvidia-settings to switch to on-demand or always on/off. The system is per default in the on-demand mode and you need to set the variables mentioned in the first post to use the discrete GPU.

Ubuntu provides their own, patched version of nvidia-settings with options for gpu-manager to switch modes. With debian, you have to set this up yourself.
Are you also using kde on debian? Please check if drm modesetting is enabled,

sudo cat /sys/module/nvidia_drm/parameters/modeset

should return ‘Y’

It returns ‘N’ in my case. What is it for and why should it be ‘Y’?

It’s to enable prime sync, i.e. vsync on hybrid graphics. Please set kernel parameter
and check if that helps with the freezes. The output of the aforementioned command should be checked to make sure it’s really enabled.

Hey, I added the kernel parameter and checked that it was really enabled. Unfortunately it did not help with the freeze (just loaded Splitgate, set it to fullscreen and started looking for a match - this time it froze inside the lobby).

Then it’s not the solution, you’d better untick that, otherwise the topic will be closed.
Looking at this:
it seems this is a bug in the intel driver reintroduced with kernel 5.11. Did you check if this occurs under 20.04, too?

I did indeed get a lot of these

[   165.740] (WW) modeset(0): flip queue failed: Invalid argument
[   165.740] (WW) modeset(0): Page flip failed: Invalid argument
[   165.740] (EE) modeset(0): present flip failed

but it seems they stop after a while.

Though could a bug in the intel driver cause problems while using the dedicated gpu on-demand in a graphics heavy application?

Unfortunately I do not know whether it happens in 20.04 since I installed Ubuntu 21.04 when I got this machine.

The internal display is hardwired to the intel gpu so it has to do the page flipping on demand. If it gets stuck, the dgpu (Nvidia or AMD) can’t do anything.

Alright, looks like I’m out of luck since that issue has existed for quite some time now. :|
Shall I close this then? Looks like this isn’t the fault of anything in the nvidia driver then.

Yes, you can only join the bug report on and maybe also open one witth your distributions kernel/xserver team. I’ve also take a look at the kernel and modesetting driver’ sources and there’s no simple way disabling async flip other that patching and recompiling.

Okay, thank you very much for your hard work!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.