dglt1 / optimus-switch-amd-sddm

WIP optimus-switch for amd/nvidia hybrid laptops using SDDM.
7 stars 3 forks source link

Both AMD and Nvidia modes are working with a Ryzen 7 4800H/1660Ti, but the screen brightness control is not working #1

Open eljulians opened 4 years ago

eljulians commented 4 years ago

Hello,

First of all, thanks for your work, it took me days to try to make the Nvidia card work until I found this.

I can confirm you that the switch is working with an ASUS TUF Gaming FA506IU. I leave you the output of inxi -F:

System:    Host: TUF-FA506IU Kernel: 5.6.12-1-MANJARO x86_64 bits: 64 Desktop: KDE Plasma 5.18.5 Distro: Manjaro Linux 
Machine:   Type: Laptop System: ASUSTeK product: TUF Gaming FA506IU_FA506IU v: 1.0 serial: <root required> 
           Mobo: ASUSTeK model: FA506IU v: 1.0 serial: <root required> UEFI: American Megatrends v: FA506IU.302 
           date: 03/04/2020 
Battery:   ID-1: BAT1 charge: 47.8 Wh condition: 47.8/48.1 Wh (99%) 
CPU:       Topology: 8-Core model: AMD Ryzen 7 4800H with Radeon Graphics bits: 64 type: MT MCP L2 cache: 4096 KiB 
           Speed: 1397 MHz min/max: 1400/2900 MHz Core speeds (MHz): 1: 2017 2: 2819 3: 1465 4: 1333 5: 2059 6: 1783 7: 1450 
           8: 1512 9: 1397 10: 1397 11: 1397 12: 1397 13: 1397 14: 1482 15: 1371 16: 1391 
Graphics:  Device-1: NVIDIA TU116M [GeForce GTX 1660 Ti Mobile] driver: nvidia v: 440.82 
           Device-2: Advanced Micro Devices [AMD/ATI] Renoir driver: amdgpu v: kernel 
           Display: x11 server: X.Org 1.20.8 driver: amdgpu,nvidia resolution: 1920x1080~144Hz, 2560x1440~60Hz 
           OpenGL: renderer: AMD RENOIR (DRM 3.36.0 5.6.12-1-MANJARO LLVM 10.0.0) v: 4.6 Mesa 20.0.6 
Audio:     Device-1: NVIDIA TU116 High Definition Audio driver: snd_hda_intel 
           Device-2: Advanced Micro Devices [AMD/ATI] driver: snd_hda_intel 
           Device-3: Advanced Micro Devices [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor driver: N/A 
           Device-4: Advanced Micro Devices [AMD] Family 17h HD Audio driver: snd_hda_intel 
           Sound Server: ALSA v: k5.6.12-1-MANJARO 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 
           IF: enp2s0 state: down mac: a8:5e:45:36:94:32 
           Device-2: Realtek RTL8822CE 802.11ac PCIe Wireless Network Adapter driver: rtw_pci 
           IF: wlp3s0 state: up mac: 70:66:55:09:8c:e3 
Drives:    Local Storage: total: 476.94 GiB used: 27.08 GiB (5.7%) 
           ID-1: /dev/nvme0n1 vendor: Kingston model: OM8PCP3512F-AB size: 476.94 GiB 
Partition: ID-1: / size: 48.97 GiB used: 25.33 GiB (51.7%) fs: ext4 dev: /dev/nvme0n1p5 
           ID-2: /home size: 108.67 GiB used: 1.75 GiB (1.6%) fs: ext4 dev: /dev/nvme0n1p7 
           ID-3: swap-1 size: 3.03 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/nvme0n1p8 
Sensors:   Message: No sensors data was found. Is sensors configured? 
Info:      Processes: 346 Uptime: 8m Memory: 7.20 GiB used: 2.37 GiB (32.9%) Shell: bash inxi: 3.0.37 

The switch works fine. The nvidia-smi shows the running processes properly. I've also tested Tensorflow and using the GPU is also working fine. Please let me know if you need some specific information.

I've also leave you further feedback, in case you find it useful in case you decide working with this. Not meant to be fixed or something, I'm already very happy and thankful with the results this gives :)

Brightness control is not working

Well, this is not really accurate: brightness control is working a bit and it's always beyond the max_brightness. I can find a subtle difference between the max value and the last 5 values, but that's it. Setting it to the minimum still makes it way too bright. Night mode helps a bit (it's working). Under /sys/class/backlight I have the amdgpu_bl1 directory.

I also share some configs and outputs:

/etc/X11/xorg.conf.d/99-amd-nvidia-prime-offload.conf

Section "ServerLayout"
        Identifier "layout"
        Option "AllowNVIDIAGPUScreens"
EndSection

Section "Device"
        Identifier "AMDGPU"
        Driver "amdgpu"
        Option "TearFree" "true"
EndSection

Section "OutputClass"
        Identifier "iGPU"
        MatchDriver "amdgpu"
        Driver "modesetting"
EndSection

Section "Device"
        Identifier "nvidia"
        Driver "nvidia"
EndSection

Section "OutputClass"
        Identifier "nvidia"
        MatchDriver "nvidia-drm"
        Driver "nvidia"
        Option "AllowEmptyInitialConfiguration"
        ModulePath "/usr/lib/nvidia/xorg"
        ModulePath "/usr/lib/xorg/modules"
EndSection

/etc/X11/xorg.conf.d/99-nvidia.conf

#/etc/switch/nvidia/99-nvidia.conf
#adjust BusID to match your nvidia GPU
#uncomment and edit the DPI option as needed
#to fix scaling issues.

Section "Module"
    Load "amdgpu"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver  "nvidia"
    BusID   "PCI:1:0:0"
    #Option  "DPI" "96 x 96"    #adjust this value as needed to fix scaling
    Option  "AllowEmptyInitialConfiguration"
EndSection

Section "Extensions"
    Option  "Composite" "Enable"
EndSection

lsmod | grep asus:

asus_wmi               40960  0
sparse_keymap          16384  1 asus_wmi
rfkill                 28672  9 asus_wmi,bluetooth,cfg80211
wmi                    36864  2 asus_wmi,wmi_bmof
battery                24576  1 asus_wmi
asus_wireless          20480  0

I've already tried several values for acpi_backligth for GRUB_CMDLINE_LINUX, with no luck.

Screen flickering I get some mild screen flickering when doing the following:

Rebooting helps with this one.

Again, thanks a lot for your work!

OlivierV78 commented 4 years ago

Hi,

Brightness control should work with 5.8 mainline Kernel. Did you try it ?