Huge performance drop when game window gets larger than a certain size

I’m on Ubuntu 19.04 with a Nvidia GTX 1050 Mobile, using the latest nvidia-driver-430 from the ppa.

In the PRIME profile, I have selected Nvidia instead of Intel. It seems like this is acknowledged (OpenGL ES 3.0 Renderer: GeForce GTX 1050 with Max-Q Design/PCIe/SSE2). nvidia-smi also reports that the GPU is under load.

However, I have a very strange issue: When running a Godot Engine game (using GLES3), the size of the window has a huge effect on performance. Most of the time (not always!) a window sized at 720p or below is as performant as I’d expect it to be, and the CPU load is minimal. However, resizing it to be larger causes everything (even the OS itself) to become incredibly laggy due to the graphics processing load.

It seems almost like somehow, Intel graphics are used with larger windows? The reason for that assumption is that there is a major increase in CPU usage when this happens. nvidia-smi does still also show the GPU-Util at 100% and the program in the Processes tab though…

When selecting the Intel graphics processor in PRIME, my performance is acceptable and consistent. In fact, it’s better with large windows due to that bug when using the Nvidia chip.

Interestingly, when using Godot with GLES2, the problem does not occur. However I can’t say for sure whether it’s because of that, or because something else that is deactivated in GLES2 mode.

This is an example of how the CPU usage looks when resizing the window just a bit above the lag threshold, and then back down: https://i.imgur.com/WIZxHqk.png With more complex 3D scenes, the jump can get much higher. When this happens, FPS go down from >60 to around 10 or sometimes <1 in an almost empty scene.

There really seems to be one specific window size which is the threshold of the lag. However, that size is different after each reboot.

I’d really appreciate some help since the performance is really unbearable with full-screen windows.

I’ve tested with GNOME and Xfce, as well as with and without an external monitor. Disabling display compositing in the Window Manager did not have an effect as well.

As it turns out, my VRAM was full. This is what caused the strange correlation with the window size.

I now installed Bumblebee and when using optirun, Godot uses a much more acceptable amount of VRAM. Apparently, not using Nvidia Optimus caused it to use too much VRAM (About 4x the usual amount)…

I’m pondering who to report this to. Seems like a driver bug?