bayasdev / envycontrol

Easy GPU switching for Nvidia Optimus laptops under Linux
MIT License
1.22k stars 62 forks source link

Update 2.0: Nvidia mode not bootable with amd/nvidia configurations #33

Closed cronyakatsuki closed 2 years ago

cronyakatsuki commented 2 years ago

Distro: Arch Linux Kernel: 5.17.1-zen1-1-zen WM: BSPWM, startx Nvidia version: 510.60.02 Envycontrol version: 2.0

With the new 2.0 update the nvidia mode won't boot with amd/nvidia hardware. (I use startx and automatic login and startup so it just goes and restarts xorg without stopping)

pastebin for the xorg log file.

bayasdev commented 2 years ago

@cronyakatsuki can you check if using amdgpu instead of modesetting driver on /etc/X11/xorg.conf fixes your issue?

Greetings.

cronyakatsuki commented 2 years ago

Already checked but it doesn't fix it. I'm gonna try to work out the problem on my fork so if I find the issue will do a pull request.

cronyakatsuki commented 2 years ago

@geminis3 I have found the culprit. I wasn't running the xrandr part of the setup correctly. Will checkout if it is needed for amd in dm's to specify it on the amd part explicitly.

bayasdev commented 2 years ago

@cronyakatsuki can you check if removing /etc/X11/xorg.conf and creating /etc/X11/xorg.conf.d/10-nvidia.conf with the following content just works without additional setup?

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "IgnoreDisplayDevices" "CRT"
    Option "PrimaryGPU" "Yes"
    ModulePath "/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection
cronyakatsuki commented 2 years ago

@cronyakatsuki can you check if removing /etc/X11/xorg.conf and creating /etc/X11/xorg.conf.d/10-nvidia.conf with the following content just works without additional setup?

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "IgnoreDisplayDevices" "CRT"
    Option "PrimaryGPU" "Yes"
    ModulePath "/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection

No it doesn't regretfully still needs the additional steps. I also checked just now and sddm and lightdm were just showing a black screen when using either modesetting or amdgpu in nvidia mode.

bayasdev commented 2 years ago

@cronyakatsuki can you post the script that works for your AMD + Nvidia config?

cronyakatsuki commented 2 years ago

@geminis3 this is the script

xrandr --setprovideroutputsource "AMD Radeon Vega 8 Graphics @ pci:0000:05:00.0" NVIDIA-0
xrandr --auto

Amd radeon name depends on the name you get from xrandr --listproviders.

example

Providers: number : 2
Provider 0: id: 0x54 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 4 outputs: 2 associated providers: 0 name:AMD Radeon Vega 8 Graphics @ pci:0000:05:00.0
Provider 1: id: 0x1f5 cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:NVIDIA-G0

EDIT: The user still needs to run xrandr --output eDP-1-0(OR OTHER SCREEN NAME) --set "PRIME Synchronization" 1 for it to work correctly.