bayasdev / envycontrol

Easy GPU switching for Nvidia Optimus laptops under Linux
https://bayas.dev/envycontrol
MIT License
1.18k stars 60 forks source link

[BUG] Black screen on gnome arch linux #94

Open kisenaa opened 1 year ago

kisenaa commented 1 year ago

Describe the bug I cant enter the os after booting after doing :

sudo envycontrol -s nvidia --force-comp --coolbits 24 --dm gdm

System Information:

Additional context journalctl -u gdm.service

-- Boot 0616ff81c7744ca5921b0f6152ed8713 --
Mar 22 18:40:52 Acer-Nitro5 systemd[1]: Starting GNOME Display Manager...
Mar 22 18:40:52 Acer-Nitro5 systemd[1]: Started GNOME Display Manager.
Mar 22 18:41:42 Acer-Nitro5 gdm[501]: Gdm: Tried to look up non-existent conversation gdm-launch-environment
Mar 22 18:41:42 Acer-Nitro5 gdm[501]: Gdm: GdmDisplay: Session never registered, failing
Mar 22 18:41:42 Acer-Nitro5 gdm[501]: Gdm: GdmDisplay: Session never registered, failing
Mar 22 18:41:42 Acer-Nitro5 gdm[501]: Gdm: Freeing conversation 'gdm-launch-environment' with active job
Mar 22 18:41:42 Acer-Nitro5 systemd[1]: Stopping GNOME Display Manager...
Mar 22 18:41:42 Acer-Nitro5 systemd[1]: gdm.service: Deactivated successfully.
Mar 22 18:41:42 Acer-Nitro5 systemd[1]: Stopped GNOME Display Manager.
bayasdev commented 1 year ago

@kisenaa attach envycontrol console output in verbose mode

kisenaa commented 1 year ago

@bayasdev sudo envycontrol -s nvidia --force-comp --coolbits 24 --dm gdm --verbose output :

Switching to nvidia mode
Enable ForceCompositionPipeline: True
Enable Coolbits: 24
INFO: Found Nvidia GPU at 01:00.0
INFO: Found AMD iGPU
INFO: Created file /etc/X11/xorg.conf
# Automatically generated by EnvyControl

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "amdgpu"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier "amdgpu"
    Driver "amdgpu"
EndSection

Section "Screen"
    Identifier "amd"
    Device "amdgpu"
EndSection

INFO: Created file /etc/modprobe.d/nvidia.conf
# Automatically generated by EnvyControl

options nvidia-drm modeset=1
options nvidia NVreg_PreserveVideoMemoryAllocations=1

INFO: Created file /etc/X11/xorg.conf.d/10-nvidia.conf
# Automatically generated by EnvyControl

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "ForceCompositionPipeline" "true"
    Option "Coolbits" "24"
EndSection

Operation completed successfully
Please reboot your computer for changes to take effect!

sudo envycontrol -s nvidia --verbose output :

[light@archlinux ~]$ sudo envycontrol -s nvidia --verbose
Switching to nvidia mode
Enable ForceCompositionPipeline: False
Enable Coolbits: False
INFO: Removed file /etc/X11/xorg.conf
INFO: Removed file /etc/X11/xorg.conf.d/10-nvidia.conf
INFO: Removed file /etc/modprobe.d/nvidia.conf
INFO: Found Nvidia GPU at 01:00.0
INFO: Found AMD iGPU
INFO: Created file /etc/X11/xorg.conf
# Automatically generated by EnvyControl

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "amdgpu"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier "amdgpu"
    Driver "amdgpu"
EndSection

Section "Screen"
    Identifier "amd"
    Device "amdgpu"
EndSection

INFO: Created file /etc/modprobe.d/nvidia.conf
# Automatically generated by EnvyControl

options nvidia-drm modeset=1
options nvidia NVreg_PreserveVideoMemoryAllocations=1

INFO: Found gdm Display Manager
Operation completed successfully
Please reboot your computer for changes to take effect!
bayasdev commented 1 year ago

@kisenaa I see the problem

  1. Run xrandr --listproviders and take note of the name of your AMD iGPU (eg: Radeon XYZ)

  2. Create the following .desktop file but replace "modesetting" with the name you got in step 1

https://wiki.archlinux.org/title/NVIDIA_Optimus#GDM

Please report back whether it works or not

kisenaa commented 1 year ago

@bayasdev i think it didn't work . i created two .desktop file . However i cant see amd igpu name through xrandr . here is the output :

[light@archlinux ~]$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x1b7 cap: 0x1, Source Output crtcs: 4 outputs: 1 associated providers: 1 name:NVIDIA-0
Provider 1: id: 0x1e0 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 4 outputs: 1 associated providers: 1 name:modesetting

So i do this instead : lspci -v | egrep -i --color 'vga|3d|2d'

01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Ti Mobile] (rev a1) (prog-if 00 [VGA controller])
06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c7) (prog-if 00 [VGA controller])

Still blackscreen. I assume it's amd problem so I removed any amd part at xorg.conf , so my xorg.conf like this :

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "amdgpu"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

I still have 10-nvidia.conf

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "ForceCompositionPipeline" "true"
    Option "Coolbits" "24"
EndSection

It's working and i can boot to arch but the screen tearing is noticable. the prime syncronization is off at nvidia settings. but i already set the ForceCompositionPipeline to true at 10-nvidia.conf . do u have any ideas to fix ?

bayasdev commented 1 year ago

@kisenaa does this work for you?

https://wiki.archlinux.org/title/NVIDIA_Optimus#Use_NVIDIA_graphics_only

Sadly I don't own any laptop with AMD and Nvidia hardware so I can't test by myself

aquilasjuca commented 1 year ago

I have the same problem, did you manage to solve it?