[INFO] Using EnvyControl with Nvidia

Post Reply
User avatar
fennec
Ensign
Posts: 174
Joined: Wed Dec 28, 2022 9:54 pm
Location: UK
Contact:

What is EnvyControl ?

EnvyControl provides an alternative method of GPU switching to Optimus Manager
EnvyControl is a program aimed to provide an easy way to switch GPU modes on Nvidia Optimus systems (i.e laptops with hybrid Intel + Nvidia or AMD + Nvidia graphics configurations) under Linux.
How is this different from Optimus Manager

One of the key points to take away from the differences are:
  • It is supposedly less resource intensive than Optimus Manager
  • Uses less configuration files
Supported Display Managers
  • LightDM
  • SDDM
  • GDM
Installation prerequisites

Move any existing Optimus Manager configuration files which you may have.

Code: Select all

ls /etc/X11/xorg.conf.d/
00-keyboard.conf 10-optimus-manager.conf

Code: Select all

mkdir $HOME/backups
mv /etc/X11/xorg.conf.d/10-optimus-manager.conf $HOME/backups
Move xorg.conf file to your $HOME/backups directory if it exists.

Code: Select all

ls /etc/X11/xorg.conf
ls: cannot access ‘/etc/X11/xorg.conf’: No such file or directory

Code: Select all

# Display manager and login screen - support library
sudo pacman -S libgdm

# Remove optimus manager - skip this step if you don't have it installed
sudo pacman -R optimus-manager optimus-manager-qt

Code: Select all

# Modify /etc/default/grub ensure nvidia-drm.modeset=1
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 nowatchdog nvme_load=YES nvidia-drm.modeset=1"
If you do modify the grub file be sure to rebuild.

Code: Select all

# Rebuild grub
sudo grub-mkconfig -o /boot/grub/grub.cfg
Installation

Code: Select all

# Install envycontrol
yay -S envycontrol
Switching GPU modes

Setting the mode

There are 3 modes to choose from: integrated, nvidia, hybrid

Code: Select all

envycontrol -s $mode
To set hybrid mode

Code: Select all

sudo envycontrol -s hybrid
Enable RTD3 Power Management? (y/N) N
RTD3 Power Management only supported on newer cards so I set this to N since I experienced a black screen, and high CPU usage on the Display Manager

Reboot your system.

Further example can be found on https://github.com/bayasdev/envycontrol#usage-examples

Validating the switched mode

To check if processes are running on the Nvidia GPU run nvidia-smi or nvtop

For hybrid modes, processes should run on the integrated Intel GPU and to use the Nvidia GPU you need to carry out the following.

Code: Select all

# For nouveau driver users
DRI_PRIME=1 <command> 

# For nvidia propriety driver users
__NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia <command>
Further examples using the hybrid mode

Run Firefox on the Nvidia GPU

Code: Select all

# Firefox on X11
__NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia /usr/lib/firefox/firefox &

# Firefox on Wayland
MOZ_ENABLE_WAYLAND=1 __NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia /usr/lib/firefox/firefox &
Run Discord on the Nvidia GPU

Code: Select all

__NV_PRIME_RENDER_OFFLOAD=1 __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia discord &
Troubleshooting

See the following pages to help troubleshooting.

https://github.com/DaVikingMan/EnvyCont ... n-problems
https://github.com/bayasdev/envycontrol/issues
Post Reply

Return to “Graphical Drivers (Nvidia,...)”