If you mean being able to adjust the brightness or the brightness being restored to the previous value, then I do have that working in hybrid and nvidia-only modes, do note that Iām using an Asus TUF FX505DT laptop though (Ryzen 5 3550H + Nvidia GTX), so I have no idea whatās the status of brightness control on recent Legion laptops (I had to install an additional kernel module for having the keyboard lights work in the Asus).
Even though I donāt know about the brightness thing (maybe @carlosmorales777 knows about that), there could be some things in common with this recent Ryzen + Nvidia laptops, so Iām going to give more detail on how I had everything working with Ubuntu 20.10.
First of all, I recommend using at least kernel 5.8 since I was having some problems with the kernel Ubuntu 20.04 LTS was using (sometimes the laptop would freeze on boot, but that may be an Asus TUF specific thing, fixed in newer kernels) and itās better anyways if you are using recent Ryzen CPUs, for the moment I decided to settle on 5.10.0 since the brightness was a bit weird with Ubuntuās 5.8 (brightness was not set to previous value on reboot).
After performing a normal installation of (K)Ubuntu 20.10 I first installed the 5.10.0 kernel using the very useful software for installing newer kernels in Ubuntu called Mainline. Then I installed the Nvidia drivers (460 series) from the proprietary graphics drivers PPA. After rebooting the driver will be installed correctly but I wasnāt able to use hybrid mode since for some reason the GPUs are not fully detected, this can be easily fixed with a custom Xorg configuration that specifies the PCI BusIDs assigned to each GPU, you can check that with the lspci command or something like KDEās Info Center or Hardinfo, the format is āPCI:X:X:Xā and it may vary depending on the laptop you have, in my case the Xorg configuration to make Hybrid graphics work was as follows (placed in ā/usr/share/X11/xorg.conf.dā in case of Ubuntu, ā/etc/X11/xorg.conf.dā may also work):
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "AMD"
Inactive "nvidia"
Option "AllowNVIDIAGPUScreens"
EndSection
Section "Device"
Identifier "AMD"
Driver "amdgpu"
BusID "PCI:05:0:0"
Option "DRI" "3"
Option "TearFree" "true"
EndSection
Section "Screen"
Identifier "AMD"
Device "AMD"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
BusID "PCI:01:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
EndSection
Section "ServerFlags"
Option "IgnoreABI" "1"
EndSection
Of course, as I already mentioned, I cannot get external HDMI displays working with this mode even though they should, but they do work if you use an Xorg configuration that sets up the Nvidia GPU as the primary display:
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "AMD"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:01:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
EndSection
Section "Device"
Identifier "AMD"
Driver "amdgpu"
BusID "PCI:05:0:0"
Option "DRI" "3"
Option "TearFree" "true"
EndSection
Section "Screen"
Identifier "AMD"
Device "amdgpu"
EndSection
But changing manually between the two is too cumbersome, for solving that I created two custom scripts that I linked to the desktop (keep in mind they require superuser access to work, I used KDEās kdesu in the desktop shortcut, you could use pkexec in GNOME since gksu was brilliantly removed with GNOME 3).
This script for using Hybrid mode:
#!/bin/bash
sudo mv /usr/share/X11/xorg.conf.d/09-optimus-nvidia.conf /usr/share/X11/xorg.conf.d/09-optimus-nvidia.conf.bak
sudo mv /usr/share/X11/xorg.conf.d/09-optimus-hybrid.conf.bak /usr/share/X11/xorg.conf.d/09-optimus-hybrid.conf
And this one for using only the Nvidia GPU (HDMI working):
#!/bin/bash
sudo mv /usr/share/X11/xorg.conf.d/09-optimus-hybrid.conf /usr/share/X11/xorg.conf.d/09-optimus-hybrid.conf.bak
sudo mv /usr/share/X11/xorg.conf.d/09-optimus-nvidia.conf.bak /usr/share/X11/xorg.conf.d/09-optimus-nvidia.conf
After executing those scripts you reboot and you are done.