Laptop with Dual GPU Setup Guide
What’s hybrid graphics?
Hybrid graphics is a hardware configuration in which you have two graphics cards that can work in tandem with each other. This approach is mainly found in laptops where you have integrated graphics (iGPU) of your CPU, and discrete graphics (dGPU). The main advantage is that integrated graphics should (but not necessarily) only be used for low-profile tasks, such as surfing the Internet, watching videos, etc. On the other hand, discrete graphics are used for high-performance things like gaming, video editing, 3D modeling, and so on. Consequently, if two GPUs share “big” and “small” tasks, then if we have only “small” tasks running at the moment, we don’t need to use our dGPU, so it can simply be disabled (as if asleep), thereby significantly reducing power consumption. This way when our dGPU is needed again (we run an application using it), it will wake up and start working.
What’s PRIME Offload?
PRIME is a unifying technology for working with different sets of hybrid graphics in Linux, like NVIDIA Optimus/AMD Dynamic Switchable Graphics. PRIME Offload is an implementation of the idea of moving the execution of render from one GPU to another in Linux. PRIME support in a closed NVIDIA driver actually started only with the 435.17 driver. So if you are a user of the outdated 390xx or even 340xx driver branches, PRIME Offload will not work for you. Note that we also strongly discourage you from using outdated ways to handle hybrid graphics, such as nvidia-xrun or Bumblebee. They are obsolete and unsupported (Bumblebee has not been updated for over 8 years), run solely on hacks and have low performance. At the same time the Nouveau driver supports PRIME Offload, which can be an alternative for older dGPUs.
In CachyOS, you don’t need to configure anything to make PRIME Offload work. With the nvidia-utils package and cachyos-settings you already have everything you need to use PRIME Offload.
Also, please avoid using tools like optimus-manager. They may seem quite handy to you, but believe us, they can cause a lot of issues and you really don’t need them if your dGPU supports PRIME Offload and dynamic power management.
How to use PRIME Offload
To indicate PRIME that you want to use discrete graphics instead of integrated graphics, you must specify a number of environment variables before running the program:
This set of variables looks very cumbersome and easy to forget, so you can
install the nvidia-prime
package (sudo pacman -S nvidia-prime
), which
contains script-alias for all these variables. Then running an application
using it will look like this:
Where <program>
is the name of command that runs your application.
For configurations where both graphics cards are managed by open Mesa drivers
(e.g. AMD+AMD, AMD+Intel or even Intel+NVIDIA where NVIDIA discrete graphics
are managed by open source Nouveau driver), nothing needs to be configured and
to use discrete graphics you only need to specify the DRI_PRIME=1
environment variable before launching applications or games, similar to all
those variables described earlier for NVIDIA or use ready-made graphics methods
discussed below.
Graphical method
You might find launching all needed applications through the terminal using prime-run
inconvenient.
Fortunately, some applications and desktop environments provide tools to control which GPU is used for specific applications.
Lutris
To configure games to run with discrete graphics in Lutris you need to go to settings (three strips in the bottom right corner of the window and “Preferences” button). Next, go to “Global Options” -> “Display”. Here, you can select the GPU the game will run on.
Steam
Steam doesn’t have a specific setting to force a game to use discrete graphics. However, you can access the game’s properties by clicking the gear icon before launching it. In the “Launch options” field, you can add the prime-run command or environment variables. Example:
Be sure to add %command%
after prime-run
. Remember that game options come after the placeholder,
while system environment variables or commands should precede it.
KDE Plasma
Plasma has a very handy way to set up the startup of applications with discrete graphics. However, this method only works if the switcheroo-control package and its corresponding service are installed on your system.
In a fresh installation of CachyOS, this package and service should already be enabled by default via chwd.
After having executed both commands, right click on the desktop entry you want on your desktop or in the application menu then go to “Properties” -> “Application” -> “Advanced Options”.
You should have “Run using dedicated graphics card” checkbox checked.
GNOME
On GNOME, you should also install switcheroo-control as shown above and right-click on the application icon and select “Run using discrete graphics”. But note that GNOME does not remember this choice for later, and the next time you run the application from the icon, its going to run using integrated graphics instead of discrete.
Cinnamon
Similar to Plasma, Cinnamon also allows you to select the GPU for specific applications. Right-click the application’s desktop entry, go to Properties, and enable the relevant option.
If it’s not available, make sure you have switcheroo-control
installed and
its service enabled, because all desktop environments rely on it for this
functionality.
Troubleshooting
”My external monitor is very laggy on PRIME”
This is a known NVIDIA driver issue. You should have the latest NVIDIA driver installed and use Wayland with a compositor that supports explicit sync. For GNOME this has been fixed in version 46.2. For Plasma 6 it will probably be fixed with 6.1 although some users report normal performance already on 6.0. Other environments/window managers still have this issue, so you need to switch to the latest version of GNOME or Plasma to fix it.