hyprland-wiki icon indicating copy to clipboard operation
hyprland-wiki copied to clipboard

optimus-manager working well with SDDM

Open EmmChriss opened this issue 11 months ago • 0 comments

TLDR

optimus-manager works flawlessly with SDDM on AMD/NVIDIA optimus laptop. This should maybe be included in the wiki.

Explanation

On Optimus laptops, it's important to be able to switch active video cards; in my case (AMD + NVIDIA), an external monitor will only work if the proprietary nvidia driver is loaded and in use. As such, I experimented a lot trying to start a graphical session in either battery friendly or NVIDIA mode. optimus-manager did the trick for me on X.

On the wiki, optimus-manager is regarded as public enemy number 1 with regard to multi-monitor setups, but with SDDM, I got it working flawlessy. The trick probably lies in an SDDM config file optimus-manager installs by default on Arch:

[X11]
DisplayCommand=/sbin/prime-offload
DisplayStopCommand=/sbin/prime-switch

My theory is due to there being an X11 config file, Xorg starts even if the selected session is a wayland compositor. Due to this, the optimus-manager hooks run without problems. In my hyprland.conf I have env = WLR_DRM_DEVICES,/dev/dri/card0:/dev/dri/card1, so if /dev/dri/card1 (NVIDIA) is available, Hyprland will use it for an external display; no render offloading is done though. Additionally, in my optimus-manager.conf I have:

[optimus]
switching=none
pci_power_control=yes
pci_remove=yes

What makes this work is temporarily removing the NVIDIA card from the pci bus when switching to integrated mode.

The limitations of this include that optimus-manager is not happy about switching to/being in nvidia mode. The only mode that works well with both internal and external monitor is hybrid.

Also, nvidia kernel modesetting is set up according to Arch wiki.

EmmChriss avatar Mar 16 '24 09:03 EmmChriss