godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.38k stars 21.26k forks source link

Defaulting to integrated GPU instead of dedicted GPU #28437

Closed PtrMan closed 5 years ago

PtrMan commented 5 years ago

Godot version: 3.1 (steam)

OS/device including version: Ubuntu Linux, Intel® Core™ i7-4700MQ CPU (with Haswell Graphics), NVIDIA GT 740M

Issue description: It was always using the Haswell GPU instead of the dedicated GPU in the Laptop. The effect of this was a bad performance.

YeldhamDev commented 5 years ago

Does this only happen to Godot? NVIDIA Optimus, responsible to switch between the two GPUs in laptops, has a history of being wonky in GNU/Linux.

Calinou commented 5 years ago

I don't think this can be solved on our side on Linux, as @YeldhamDev pointed out. The only way to default to the dedicated GPU on Linux is to disable the IGP entirely in nvidia-settings (or in your laptop's UEFI if available), which will strongly reduce battery life.

If you're distributing exported projects and want them to run efficiently on Linux, maybe you could write a launcher script that will use primusrun if available, then optirun if primusrun is not available, then it will fall back to running the project directly if neither is available. (You may also want to set vblank_mode=0 before running the game to disable V-Sync, which can be useful to decrease stuttering.)

PtrMan commented 5 years ago

I was running the nouveau (OSS) drivers, it caused to use the IGP in other games too. It is working fine with the proprietary drivers from NVidia.