-
Notifications
You must be signed in to change notification settings - Fork 170
Home
optimus-manager provides a solution for switching between the Intel GPU and the Nvidia GPU on Optimus laptops running Archlinux-based distributions.
On Windows, the Optimus technology works by dynamically offloading rendering to the Nvidia GPU when running 3D-intensive applications, while the desktop session itself runs on the Intel GPU.
However, on Linux, the Nvidia driver does not provide such offloading capabilities (yet), which difficult for us to use the full potential of our machines without destroying their battery life.
Currently, if you have Linux installed on an Optimus laptop, there are three methods to use your Nvidia GPU :
-
Run your whole X session on the Intel GPU and use Bumblebee to offload rendering to the Nvidia GPU. While this mimic the behavior of Optimus on Windows, this is an unofficial, hacky solution with three major drawbacks :
- a noticeable performance hit (because Bumblebee has to use your CPU to copy frames over to the display)
- no direct support for Vulkan, though it can be added with primus_vk
- you will be unable to use any video output (like HDMI ports) connected to the Nvidia GPU, unless you have the open-source
nouveau
driver loaded to this GPU at the same time (or use some solution like intel-virtual-output).
-
Use nvidia-xrun to have the Nvidia GPU run on its own X server in another virtual terminal. You still have to run two X servers at the same time, and you do not have acess to your normal desktop environment while in the virtual terminal of the Nvidia GPU. Also, in my own experience, desktop environments are prone prone to crashing when switching between virtual terminals while the nvidia driver is running.
-
Run your whole X session on the Nvidia GPU and disable rendering on the Intel GPU. This allows you to run your applications at full performance, with Vulkan support, and with access to all video outputs. However, since your power-hungry Nvidia GPU is turned on at all times, it has a massive impact on your battery life. This method is often called Nvidia PRIME, although technically PRIME is just the technology that allows your Nvidia GPU to send its frames to the built-in display of your laptop via the Intel GPU.
An acceptable middle ground could be to use the third method on demand : switching the X session to the Nvidia GPU when you need extra rendering power, and then switching it back to Intel when you are done, to save battery life.
Unfortunately the X server configuration is set-up in a permanent manner with configuration files, which makes switching a hassle because you have to rewrite those files every time you want to switch GPUs. You also have to restart the X server for those changes to be taken into account.
What optimus-manager does for you is dynamically write the X configuration at boot time, rewrite it every time you need to switch GPUs, and also loads the appropriate kernel modules to make sure your GPUs are properly turned on/off.
This is essentially a port of the prime-select
script from Ubuntu-based distributions.
In practice, here is what happens when switching to the Intel GPU (for example) :
- You are automatically logged out from your session, which also stops the X server (warning : this closes all opened applications)
- The Nvidia modules are unloaded and either
bbswitch
ornouveau
are loaded instead.bbswitch
is used to turn off the card on machines which do not support power management from the kernel, whilenouveau
is the open-source driver for Nvidia cards, which allows you to use external outputs even in Intel mode. - The configuration for X and your login manager is updated (note that the configuration is saved to dedicated files, this will not overwrite any of your own configuration files)
- The login manager restarts a X server running on the proper GPU.
Before using optimus-manager, be aware that this is still a hacky solution and may have stability issues with some desktop environments/display managers.
I will happily deprecate this tool the day Nvidia implements proper GPU offloading in their Linux driver.