Introduction

Laptops designed for high graphics performance, such as that required for gaming, are typically provisioned with a discrete GPU, in addition to one integrated into the CPU. Nvidia calls this technology Optimus, or Advanced Optimus, in newer versions, which add the capability for the Nvidia GPU to output directly to the built-in screen instead of routing output through the integrated GPU. The Optimus dual GPU hardware configuration is capable of operating in one of several modes: Hybrid (or Dynamic), Discrete, or Integrated. These modes correspond, respectively, to operation in which the integrated card is used by default, with the discrete GPU activated on demand for a particular application; to operation in which only the discrete Nvidia GPU is used; or to operation in which only the integrated GPU is used. The purpose of the dual GPU configuration is to provide applications which need it increased graphics capability, but reduce power consumption when these applications are not running, with different trade-offs between power savings and graphics performance depending on the graphics mode.

As discussed in The Continuing Usefulness of X11 and Optimus Management Programs in the Age of Wayland and Switcheroo-Control, Optimus management programs can still be used alongside switcheroo-control to gain the full benefits of an Nvidia Optimus laptop. The Optimus management program can be used to set the graphics mode to

  • integrated mode to get the maximum power savings, with the trade-off that offload graphics rendering to the GPU will not be possible, nor the ability to use an external monitor connected to a port that is hard-wired to the Nvidia GPU, e.g., HDMI; not all combinations of distribution/Optimus management programs will allow this mode
  • discrete mode to get the maximum performance for all applications, including the desktop environment, using all of the resources of the Nvidia GPU, including its dedicated video memory that would otherwise be taken from the main system memory
  • hybrid mode to have the Nvidia GPU available such that application graphics rendering can be offloaded to the discrete GPU on demand through the use of the appropriate environment variables for PRIME offloading, with switcherooctl on the command line, or using the desktop environment through the capabilities provided by switcheroo-control.

The benefits of switcheroo-control can be realized in Hybrid mode, as set by the Optimus management program. But the other modes are available with their own benefits as described above.

EnvyControl Capabilities

We can see EnvyControl's capabilities by examining its --help output as shown in the following listing. Its primary usage is the envycontrol with the -s option for switching modes between integrated, hybrid, and nvidia, as in

envycontrol -s <mode>

It has various options that can specify other actions to fine tune the environment after the switch, namely specifying the Run Time D3 Power Management setting, through the option --rtd3 [VALUE] where the possible option values 0, 1, 2, 3, 4 correspond to the values of the Nvidia kernel module option values for the property NVreg_DynamicPowerManagement (see this)

󰂄 99%  20:42:37  USER: brook HOST: Legion-Siduction   
 ~  ❯$ envycontrol --help
usage: envycontrol [-h] [-v] [-q] [-s MODE] [--dm DISPLAY_MANAGER] [--force-comp] [--coolbits [VALUE]] [--rtd3 [VALUE]] [--use-nvidia-current] [--reset-sddm] [--reset] [--cache-create] [--cache-delete] [--cache-query] [--verbose]

options:
  -h, --help            show this help message and exit
  -v, --version         Output the current version
  -q, --query           Query the current graphics mode
  -s, --switch MODE     Switch the graphics mode. Available choices: integrated, hybrid, nvidia
  --dm DISPLAY_MANAGER  Manually specify your Display Manager for Nvidia mode. Available choices: gdm, gdm3, sddm, lightdm
  --force-comp          Enable ForceCompositionPipeline on Nvidia mode
  --coolbits [VALUE]    Enable Coolbits on Nvidia mode. Default if specified: 28
  --rtd3 [VALUE]        Setup PCI-Express Runtime D3 (RTD3) Power Management on Hybrid mode. Available choices: 0, 1, 2, 3. Default if specified: 2
  --use-nvidia-current  Use nvidia-current instead of nvidia for kernel modules
  --reset-sddm          Restore default Xsetup file
  --reset               Revert changes made by EnvyControl
  --cache-create        Create cache used by EnvyControl; only works in hybrid mode
  --cache-delete        Delete cache created by EnvyControl
  --cache-query         Show cache created by EnvyControl
  --verbose             Enable verbose mode

󰂄 99%  20:42:45  USER: brook HOST: Legion-Siduction   
 ~  ❯$

The complete set of actions it takes during a switch is shown in the following listing showing the command to switch to integrated mode and the output. It:

  • disables the systemd service nvidia-persistenced.service
  • it replaces the contents of /etc/udev/rules.d/50-remove-nvidia.rules with rules appropriate for the mode; see Nvidia Driver READMEl Chapter 22. PCI-Express Runtime D3 (RTD3) Power Management
  • deletes the file in /etc/modprobe.d that it previously generated for blacklisting modules in the previous mode; and generates a new file for the new mode
  • it rebuilds the initial ram filesystem to include the necessary components and omit those that are not needed in the new mode; note that despite errors in the initramfs regeneration stage, the process completes successfully
󰁹 100%  20:54:55  USER: brook HOST: Legion-Siduction   
PCD: 4s ~  ❯$ sudo envycontrol --verbose -s integrated
INFO: Found Nvidia GPU at 01:00.0
DEBUG: Created file /var/cache/envycontrol/cache.json
Switching to integrated mode
Synchronizing state of nvidia-persistenced.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install disable nvidia-persistenced
Removed '/etc/systemd/system/multi-user.target.wants/nvidia-persistenced.service'.
Successfully disabled nvidia-persistenced.service
INFO: Removed file /etc/udev/rules.d/80-nvidia-pm.rules
INFO: Removed file /etc/modprobe.d/nvidia.conf
INFO: Created file /etc/modprobe.d/blacklist-nvidia.conf
# Automatically generated by EnvyControl

blacklist nouveau
blacklist nvidia
blacklist nvidia_drm
blacklist nvidia_uvm
blacklist nvidia_modeset
blacklist nvidia_current
blacklist nvidia_current_drm
blacklist nvidia_current_uvm
blacklist nvidia_current_modeset
blacklist i2c_nvidia_gpu
alias nouveau off
alias nvidia off
alias nvidia_drm off
alias nvidia_uvm off
alias nvidia_modeset off
alias nvidia_current off
alias nvidia_current_drm off
alias nvidia_current_uvm off
alias nvidia_current_modeset off
alias i2c_nvidia_gpu off

INFO: Created file /etc/udev/rules.d/50-remove-nvidia.rules
# Automatically generated by EnvyControl

# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"

# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"

# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"

# Remove NVIDIA VGA/3D controller devices
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1"

Rebuilding the initramfs...
update-initramfs: Generating /boot/initrd.img-6.16.5-1-siduction-amd64
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
mkinitramfs: copy_file: config '/etc/modprobe.d/virtualbox-dkms.conf' not found
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
I: The initramfs will attempt to resume from /dev/nvme0n1p1
I: (UUID=980ddbbf-9b79-4390-be21-850e62b7ebb2)
I: Set the RESUME variable to override this.
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
update-initramfs: Generating /boot/initrd.img-6.15.10-1-siduction-amd64
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
mkinitramfs: copy_file: config '/etc/modprobe.d/virtualbox-dkms.conf' not found
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
I: The initramfs will attempt to resume from /dev/nvme0n1p1
I: (UUID=980ddbbf-9b79-4390-be21-850e62b7ebb2)
I: Set the RESUME variable to override this.
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
update-initramfs: Generating /boot/initrd.img-6.15.6-1-siduction-amd64
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
mkinitramfs: copy_file: config '/etc/modprobe.d/virtualbox-dkms.conf' not found
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
I: The initramfs will attempt to resume from /dev/nvme0n1p1
I: (UUID=980ddbbf-9b79-4390-be21-850e62b7ebb2)
I: Set the RESUME variable to override this.
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
Successfully rebuilt the initramfs!
Operation completed successfully
Please reboot your computer for changes to take effect!

󰁹 100%  20:55:24  USER: brook HOST: Legion-Siduction   
PCD: 21s ~  ❯$ 

The integrated mode is not useful Optimus laptops with the post Turing generation laptops as the Nvidia driver is required to be loaded to manage the power state. Without it, it seems that while the NVIDIA GPU is not viewable in the output of lspci output, it is not really powered off when the system is rebooted into the integrated mode. This mode is usable with pre Turing generation Optimus laptops with other Optimus management programs, specifically, Optimus Manager for Arch and the recently deprecated SUSEPrime, which can also use bbswitch tor other external methods to power off the Nvidia GPU.

So, the real benefit for users with post Turing Optimus laptops is to switch between

  • Hybrid mode where the the modern convenience of switcheroo-control and its facilitating of on demand PRIME offloading on a per application basis using the switcherooctl command or using the desktop environment through capabilities provided to it by switcheroo-control
  • Discrete mode where all applications and the desktop environment will use the Nvidia GPU all the time, such that all of its resources are used for all processes requiring GPU rendering, including the GPU's discrete video memory, where otherwise memory for graphics would be taken or shared by the main system memory
These benefits are demonstrated in The Continuing Usefulness of X11 and Optimus Management Programs in the Age of Wayland and Switcheroo-Control.

The command to switch toHybrid mode and its output is shown in the following listing. In this case we use the option --rtd3, described above, to specify that Run Time D3 Power Management should be enabled. The --use-nvidia-current only applies to Debian or Debian derivatives like Siduction because the kernel module is named nvidia-current in Debian.

As seen in the output, the command performs the following tasks, some common to the previous switch, but reversing their actions, others only relevant to the for the Hybrid mode. It:
  • the systemd service nvidia-persistenced.service
  • it creates the file /etc/modprobe.d/nvidia.conf, placing nvidia kernel module options in it
  • it creates the file /etc/udev/rules.d/80-nvidia-pm.rules with udev rules to automatically place appropriate contents in the PCI related pseudo filesystems such as auto in /sys/bus/pci/devices/0000\:01\:00.0/power/control, enabling Run Time Power Management at the device level (it is enabled at the driver level in the kernel module options)
  • it regenerates the initial RAM FS, even ensuring that the resume component uses the swap partition for resuming as specified in /etc/default/grub; note that despite errors in the initramfs regeneration stage, the process completes successfully
󰂃 52%  00:47:47  USER: brook HOST: Legion-Siduction   
PCD: 3s ~  ❯$ sudo envycontrol --verbose -s hybrid --rtd3 --use-nvidia-current
Switching to hybrid mode
Enable PCI-Express Runtime D3 (RTD3) Power Management: 2
INFO: Removed file /etc/modprobe.d/blacklist-nvidia.conf
INFO: Removed file /etc/udev/rules.d/50-remove-nvidia.rules
Synchronizing state of nvidia-persistenced.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable nvidia-persistenced
Created symlink '/etc/systemd/system/multi-user.target.wants/nvidia-persistenced.service' → '/usr/lib/systemd/system/nvidia-persistenced.service'.
Successfully enabled nvidia-persistenced.service
INFO: Created file /etc/modprobe.d/nvidia.conf
# Automatically generated by EnvyControl

options nvidia-current-drm modeset=1
options nvidia-current "NVreg_DynamicPowerManagement=0x02"
options nvidia-current NVreg_UsePageAttributeTable=1 NVreg_InitializeSystemMemoryAllocations=0

INFO: Created file /etc/udev/rules.d/80-nvidia-pm.rules
# Automatically generated by EnvyControl

# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{remove}="1"

# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{remove}="1"

# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{remove}="1"

# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="auto"

# Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="on"
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="on"

Rebuilding the initramfs...
update-initramfs: Generating /boot/initrd.img-6.16.5-1-siduction-amd64
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
mkinitramfs: copy_file: config '/etc/modprobe.d/virtualbox-dkms.conf' not found
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
I: The initramfs will attempt to resume from /dev/nvme0n1p1
I: (UUID=980ddbbf-9b79-4390-be21-850e62b7ebb2)
I: Set the RESUME variable to override this.
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
update-initramfs: Generating /boot/initrd.img-6.15.10-1-siduction-amd64
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
mkinitramfs: copy_file: config '/etc/modprobe.d/virtualbox-dkms.conf' not found
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
I: The initramfs will attempt to resume from /dev/nvme0n1p1
I: (UUID=980ddbbf-9b79-4390-be21-850e62b7ebb2)
I: Set the RESUME variable to override this.
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
update-initramfs: Generating /boot/initrd.img-6.15.6-1-siduction-amd64
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
mkinitramfs: copy_file: config '/etc/modprobe.d/virtualbox-dkms.conf' not found
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
I: The initramfs will attempt to resume from /dev/nvme0n1p1
I: (UUID=980ddbbf-9b79-4390-be21-850e62b7ebb2)
I: Set the RESUME variable to override this.
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
libkmod: ERROR: conf_files_filter_out: Directories inside directories are not supported: /etc/modprobe.d/virtualbox-dkms.conf
Successfully rebuilt the initramfs!
Operation completed successfully
Please reboot your computer for changes to take effect!

󰂃 50%  00:49:52  USER: brook HOST: Legion-Siduction   
PCD: 20s ~  ❯$

Installation

EnvyControl is not available in the official repositories of any distribution, but is available in the community repositories of many distributions, such as the AUR, for Arch and derivatives, and Copr. Official experimental and community packages are available in openSUSE's OBS. For Debian and Ubuntu the project distributes .deb packages from its GitHub repository.

Before installing EnvyControl, the proprietary Nvidia driver should installed -- preferably not the Nvidia Open driver as I have had problems with this on openSUSE that were resolved after replacing Nvidia Open with the non-Open driver.

Installing EnvyControl on openSUSE

One of the unique features of openSUSE is the extensive set of online resources, which includes the online package search accessible from the pre-configured bookmarks in the default browser, Firefox, or accessible at https://software.opensuse.org. Normally, the infrastructure allows a simple automated installation of software found from the results, such that pressing the Install 1-Click button opens YaST's software component to install. However, I may be missing some package as the button only opened an xml file in the browser. So, I installed manually using the guidance from the openSUSE's software site.

The actual installation commands were as follows.

  1. sudo zypper addrepo https://download.opensuse.org/repositories/X11:XOrg/openSUSE_Tumbleweed/X11:XOrg.repo
    
    To enable auto-refresh of the repo, add the option -f to the command, as in:
    sudo zypper addrepo -f https://download.opensuse.org/repositories/X11:XOrg/openSUSE_Tumbleweed/X11:XOrg.repo
    󰁹 100%  19:59:15  USER: brook HOST: openSUSE-16ITH6   
     ~  ❯$ sudo zypper addrepo https://download.opensuse.org/repositories/X11:XOrg/openSUSE_Tumbleweed/X11:XOrg.repo
    [sudo] password for root: 
    System management is locked by the application with pid 22796 (/usr/bin/ruby.ruby3.4).
    Close this application before trying again.
    
    󰁹 100%  20:01:54  USER: brook HOST: openSUSE-16ITH6   
    PCD: 3s ~  ❯$ sudo zypper addrepo https://download.opensuse.org/repositories/X11:XOrg/openSUSE_Tumbleweed/X11:XOrg.repo
    Adding repository 'X.Org development (openSUSE_Tumbleweed)' ...............................................................................................................................[done]
    Repository 'X.Org development (openSUSE_Tumbleweed)' successfully added
    
    URI         : https://download.opensuse.org/repositories/X11:/XOrg/openSUSE_Tumbleweed/
    Enabled     : Yes
    GPG Check   : Yes
    Autorefresh : No
    Priority    : 99 (default priority)
    
    Repository priorities are without effect. All enabled repositories share the same priority.
    
    
  2. sudo zypper refresh
    󰁹 100%  20:02:46  USER: brook HOST: openSUSE-16ITH6   
     ~  ❯$ sudo zypper refresh
    Repository 'update-tumbleweed' is up to date.                                                                                                                                                    
    Repository 'repo-non-free' is up to date.                                                                                                                                                        
    Looking for gpg keys in repository X.Org development (openSUSE_Tumbleweed).
      gpgkey=https://download.opensuse.org/repositories/X11:/XOrg/openSUSE_Tumbleweed/repodata/repomd.xml.key
    Retrieving repository 'X.Org development (openSUSE_Tumbleweed)' metadata ..................................................................................................................[done]
    Building repository 'X.Org development (openSUSE_Tumbleweed)' cache .......................................................................................................................[done]
    Repository 'Visual Studio Code' is up to date.                                                                                                                                                   
    Repository 'google-chrome' is up to date.                                                                                                                                                        
    Repository 'repo-non-oss' is up to date.                                                                                                                                                         
    Repository 'repo-openh264' is up to date.                                                                                                                                                        
    Repository 'repo-oss' is up to date.                                                                                                                                                             
    All repositories have been refreshed.
    
  3. sudo zypper install EnvyControl
    󰁹 100%  20:03:51  USER: brook HOST: openSUSE-16ITH6   
     ~  ❯$ sudo zypper install EnvyControl
    Refreshing service 'NVIDIA'.
    Refreshing service 'openSUSE'.
    Loading repository data...
    Reading installed packages...
    Resolving package dependencies...
    
    The following NEW package is going to be installed:
      EnvyControl
    
    1 new package to install.
    
    Package download size:    25.7 KiB
    
    Package install size change:
                  |      58.8 KiB  required by packages that will be installed
        58.8 KiB  |  -      0 B    released by packages that will be removed
    
    Backend:  classic_rpmtrans
    Continue? [y/n/v/...? shows all options] (y): 
    Preloading: EnvyControl-3.5.2-1.1.noarch.rpm [done]
    Preload finished. [success (1.3 KiB/s) ] ..................................................................................................................................................[done]
    Retrieving: EnvyControl-3.5.2-1.1.noarch (X.Org development (openSUSE_Tumbleweed))                                                                                           (1/1),  25.7 KiB    
    
    Checking for file conflicts: ..............................................................................................................................................................[done]
    (1/1) Installing: EnvyControl-3.5.2-1.1.noarch ............................................................................................................................................[done]
    Running post-transaction scripts ..........................................................................................................................................................[done]
    
  4. EnvyControl is now available to use. We can use the --query option to verify the current mode, which is Hybrid mode, after installing Nvidia but without any further graphics related configuration modifications.
    󰁹 100%  20:08:08  USER: brook HOST: openSUSE-16ITH6   
     ~  ❯$ sudo envycontrol --query
    [sudo] password for root: 
    hybrid
    
    
    
  5. If you did not set the auto refresh option, but later decide you want it to be enabled for the repo, list the repos to find its identifier modifyrepo mr, then use the modifyrepo mr
    
    󰁹 100%  20:05:54  USER: brook HOST: openSUSE-16ITH6   
     ~  ❯$ sudo zypper lr
    Repository priorities are without effect. All enabled repositories share the same priority.
    
    #  | Alias                      | Name                                    | Enabled | GPG Check | Refresh
    ---+----------------------------+-----------------------------------------+---------+-----------+--------
     1 | NVIDIA:repo-non-free       | repo-non-free                           | Yes     | (r ) Yes  | Yes
     2 | X11_XOrg                   | X.Org development (openSUSE_Tumbleweed) | Yes     | (r ) Yes  | No
     3 | code                       | Visual Studio Code                      | Yes     | (r ) Yes  | Yes
     4 | google-chrome              | google-chrome                           | Yes     | (r ) Yes  | Yes
     5 | openSUSE:repo-non-oss      | repo-non-oss                            | Yes     | (r ) Yes  | Yes
     6 | openSUSE:repo-openh264     | repo-openh264                           | Yes     | (r ) Yes  | Yes
     7 | openSUSE:repo-oss          | repo-oss                                | Yes     | (r ) Yes  | Yes
     8 | openSUSE:repo-oss-debug    | repo-oss-debug                          | No      | ----      | ----
     9 | openSUSE:repo-oss-source   | repo-oss-source                         | No      | ----      | ----
    10 | openSUSE:update-tumbleweed | update-tumbleweed                       | Yes     | (r ) Yes  | Yes
    
    󰁹 100%  20:07:51  USER: brook HOST: openSUSE-16ITH6   
     ~  ❯$ sudo zypper mr -f 2
    Autorefresh has been enabled for repository 'X11_XOrg'

Installing EnvyControl on Fedora

The default mode of Optimus operation on Fedora as of Fedora 41 is in hybrid mode with the Nvidia card available for on demand use. Switching to discrete mode requires modification of the X.org configuration file, if using X. If using Wayland.

Using EnvyControl precludes having to use the manual process described in the RPMFusion Optimus HowTO page

An EnvyControl package is not available the official Fedora repositories, but a Copr repository named sunwire/envycontrol is available. To install on Fedora:

  1. Enable the Copr repository with:
    sudo dnf copr enable sunwire/envycontrol
    The command with the output:
    brook on ultramarine-16ith6 ~ took 6s 
    ❯ sudo dnf copr enable sunwire/envycontrol
     https://copr.fedorainfracloud.org/api_3/rpmrepo/sunwire/envycontrol/fedora-41/         100% | 686.0   B/s | 412.0   B |  00m01s
    Enabling a Copr repository. Please note that this repository is not part
    of the main distribution, and quality may vary.
    
    The Fedora Project does not exercise any power over the contents of
    this repository beyond the rules outlined in the Copr FAQ at
    ,
    and packages are not held to any quality or security level.
    
    Please do not file bug reports about these packages in Fedora
    Bugzilla. In case of problems, contact the owner of this repository.
    Is this ok [Y/n]: 
    
    
  2. Install the package with:
    sudo dnf install python3-envycontrol
    The command with the output:
    brook on ultramarine-16ith6 ~ took 4s 
    ❯ sudo dnf install python3-envycontrol
    Updating and loading repositories:
     Copr repo for envycontrol owned by sunwire                                             100% |   2.2 KiB/s |   2.6 KiB |  00m01s
    Repositories loaded.
    Package                               Arch   Version                               Repository                               Size
    Installing:
     python3-envycontrol                  noarch 3.5.2-1.git20250708.fc41              copr:copr.fedorainfracloud.org:sunw  70.6 KiB
    
    Transaction Summary:
     Installing:         1 package
    
    Total size of inbound packages is 33 KiB. Need to download 33 KiB.
    After this operation, 71 KiB extra will be used (install 71 KiB, remove 0 B).
    Is this ok [Y/n]: 
    [1/1] python3-envycontrol-0:3.5.2-1.git20250708.fc41.noarch                             100% | 146.0 KiB/s |  32.5 KiB |  00m00s
    --------------------------------------------------------------------------------------------------------------------------------
    [1/1] Total                                                                             100% | 144.7 KiB/s |  32.5 KiB |  00m00s
    [1/2] https://download.copr.fedorainfracloud.org/results/sunwire/e ???% [<=>               ] |   0.0   B/s |   0.0   B |  00m00s
    [1/2] https://download.copr.fedorainfracloud.org/results/sunwire/e ???% [<=>               ] |   0.0   B/s |   0.0   B |  00m00s
    [1/2] https://download.copr.fedorainfracloud.org/results/sunwire/envycontrol/pubkey.gpg 100% |   6.2 KiB/s |   1.0 KiB |  00m00s
    --------------------------------------------------------------------------------------------------------------------------------
    [2/2] Total                                                                             100% | 144.7 KiB/s |  32.5 KiB |  00m00s
    Importing OpenPGP key 0x738205FB:
     UserID     : "sunwire_envycontrol (None) "
     Fingerprint: 2E2B739E31D8D7097A8AB7BD8454B6FA738205FB
     From       : https://download.copr.fedorainfracloud.org/results/sunwire/envycontrol/pubkey.gpg
    Is this ok [Y/n]: 
    The key was successfully imported.
    [1/3] Verify package files                                                              100% | 200.0   B/s |   1.0   B |  00m00s
    [2/3] Prepare transaction                                                               100% |   1.0   B/s |   1.0   B |  00m01s
    [3/3] Installing python3-envycontrol-0:3.5.2-1.git20250708.fc41.noarch                  100% |  62.1 KiB/s |  73.3 KiB |  00m01s
    Complete!
    
    
  3. EnvyControl is now available to use. We can use the --query option to verify the current mode, which is Hybrid mode, after installing Nvidia but without any further graphics related configuration modifications.
    brook on ultramarine-16ith6 ~ took 25s 
    ❯ sudo envycontrol --query             
    [sudo] password for brook: 
    hybrid
    
  4. For an Plasma X11 session, install plasma-workspace-x11
    brook on ultramarine-16ith6 ~ took 2s 
    ❯ sudo dnf install plasma-workspace-x11
    Updating and loading repositories:
    Repositories loaded.
    Package                                 Arch     Version                                 Repository                         Size
    Installing:
     plasma-workspace-x11                   x86_64   6.4.4-1.fc41                            updates                       209.7 KiB
    Installing dependencies:
     kwin-x11                               x86_64   6.4.4-1.fc41                            updates                        16.8 MiB
     kwin-x11-libs                          x86_64   6.4.4-1.fc41                            updates                         7.6 MiB
     xorg-x11-drv-libinput                  x86_64   1.4.0-3.fc41                            fedora                        101.6 KiB
     xorg-x11-drv-nvidia-xorg-libs          x86_64   3:575.64.05-2.fc41                      rpmfusion-nonfree-updates      19.4 MiB
     xorg-x11-server-Xorg                   x86_64   21.1.18-1.fc41                          updates                         3.4 MiB
     xorg-x11-server-common                 x86_64   21.1.18-1.fc41                          updates                       127.0 KiB
     xsetroot                               x86_64   1.1.2-11.fc41                           fedora                         27.0 KiB
    Installing weak dependencies:
     libreoffice-x11                        x86_64   1:24.8.7.2-2.fc41                       updates                       503.9 KiB
    
    Transaction Summary:
     Installing:         9 packages
    
    Total size of inbound packages is 12 MiB. Need to download 12 MiB.
    After this operation, 48 MiB extra will be used (install 48 MiB, remove 0 B).
    Is this ok [Y/n]: 
    [1/9] xorg-x11-server-common-0:21.1.18-1.fc41.x86_64                                    100% | 138.8 KiB/s |  36.2 KiB |  00m00s
    [2/9] xsetroot-0:1.1.2-11.fc41.x86_64                                                   100% |  50.3 KiB/s |  19.8 KiB |  00m00s
    [3/9] xorg-x11-drv-libinput-0:1.4.0-3.fc41.x86_64                                       100% |  62.3 KiB/s |  49.9 KiB |  00m01s
    [4/9] plasma-workspace-x11-0:6.4.4-1.fc41.x86_64                                        100% |  33.7 KiB/s |  89.1 KiB |  00m03s
    [5/9] xorg-x11-server-Xorg-0:21.1.18-1.fc41.x86_64                                      100% | 366.8 KiB/s |   1.4 MiB |  00m04s
    [6/9] libreoffice-x11-1:24.8.7.2-2.fc41.x86_64                                          100% |  49.4 KiB/s | 201.0 KiB |  00m04s
    [7/9] xorg-x11-drv-nvidia-xorg-libs-3:575.64.05-2.fc41.x86_64                           100% | 376.5 KiB/s |   2.3 MiB |  00m06s
    [8/9] kwin-x11-libs-0:6.4.4-1.fc41.x86_64                                               100% | 216.3 KiB/s |   2.1 MiB |  00m10s
    [9/9] kwin-x11-0:6.4.4-1.fc41.x86_64                                                    100% | 540.6 KiB/s |   6.1 MiB |  00m12s
    --------------------------------------------------------------------------------------------------------------------------------
    [9/9] Total                                                                             100% | 938.6 KiB/s |  12.4 MiB |  00m14s
    Running transaction
    [ 1/11] Verify package files                                                            100% |  93.0   B/s |   9.0   B |  00m00s
    [ 2/11] Prepare transaction                                                             100% |   9.0   B/s |   9.0   B |  00m01s
    [ 3/11] Installing xorg-x11-server-common-0:21.1.18-1.fc41.x86_64                       100% |   3.0 MiB/s | 127.9 KiB |  00m00s
    [ 4/11] Installing xorg-x11-drv-libinput-0:1.4.0-3.fc41.x86_64                          100% |   7.2 MiB/s | 103.1 KiB |  00m00s
    [ 5/11] Installing xorg-x11-server-Xorg-0:21.1.18-1.fc41.x86_64                         100% |  44.3 MiB/s |   3.4 MiB |  00m00s
    [ 6/11] Installing kwin-x11-libs-0:6.4.4-1.fc41.x86_64                                  100% | 104.2 MiB/s |   7.6 MiB |  00m00s
    [ 7/11] Installing kwin-x11-0:6.4.4-1.fc41.x86_64                                       100% |  14.3 MiB/s |  17.0 MiB |  00m01s
    [ 8/11] Installing xsetroot-0:1.1.2-11.fc41.x86_64                                      100% |   3.4 MiB/s |  28.1 KiB |  00m00s
    [ 9/11] Installing plasma-workspace-x11-0:6.4.4-1.fc41.x86_64                           100% |  22.8 MiB/s | 210.6 KiB |  00m00s
    [10/11] Installing xorg-x11-drv-nvidia-xorg-libs-3:575.64.05-2.fc41.x86_64              100% | 227.7 MiB/s |  19.4 MiB |  00m00s
    [11/11] Installing libreoffice-x11-1:24.8.7.2-2.fc41.x86_64                             100% | 199.3 KiB/s | 504.6 KiB |  00m03s
    Complete!
    
    

Installing EnvyControl on Debian

EnvyControl is not packaged in Debian or Siduction repositories, but a .deb package can be downloaded from the project's Github and installed manually as described below.

  1. Download the python3-envycontrol package from the Github releases page. The link to the latest release, as of this writing, is https://github.com/bayasdev/envycontrol/releases.
  2. Change directory to the directory in which the download was saved, or use the full path to the downloaded file as the argument to the apt command in the next step.
  3. Install the package.
    󰂄 100%  19:24:22  USER: brook HOST: Legion-Siduction
    	PCD: 12s ~/Downloads  ❯$ sudo apt install ./python3-envycontrol_3.5.1-1_all.deb
    	
    	... truncated ...
    	

The following image, taken from the Siduction Linux 2024.1.0 (Shine On) Review [KDE Plasma Edition] Supplement: Fixes and Enhancements shown the installation on Siduction.

Installing the EnvyControl .deb Package Downloaded from the Project's Github Releases Page

References

  1. Securing The X Window System With SELinux
  2. Advanced Configuration and Power Interface (ACPI) Specification, Release 6.6
  3. Microsoft Learn: Device Power States
  4. Nvidia Driver README; Chapter 22. PCI-Express Runtime D3 (RTD3) Power Management
  5. openSUSE Online man Page for switcherooctl(1)
  6. Optimus Manager GitHub Wiki Main Page
  7. Optimus Manager GitHub Wiki; Nvidia GPU offloading for "hybrid" mode
  8. SUSEPrime Github Repository
  9. Debian Packages Web Portal: switcheroo-control
  10. freedesktop.org switcheroo-control GitLab Repository
  11. CachyOS Wiki: Dual GPU Setup Guide
  12. openSUSE News: GPU Switching: A Multi-GPU Game Changer
  13. openSUSE Wiki: SDB:NVIDIA Switcheroo Control
  14. endeavourOS Wiki (Discover): Switcheroo Control
  15. Nvidia Optimus on Linux
  16. Siduction Linux 2024.1.0 (Shine On) Review [KDE Plasma Edition]
  17. bayasdev / envycontrol GitHub Repository