Optimus Switch for Ryzen/Nvidia hybrids

I have one of these lovely hybrid laptops that has Ryzen/Nvidia combo. They can sometimes be a pain in the butt to get going graphically. Over on MJ @dglt wrote optimus switch for intel/nvidia. They were gracious enough to port it over to work with a ryzen/nvidia combo. I have done 3 full installs to test switch with lightdm, sddm, gdm. I had it work for all 3 by just simply cloning the git and running the install script. Originally you would need to download a few packages to get the switch function to work, but that is not the case over here on EOS. It looks as if EOS installs the video-vesa package and xf86-video-amdgpu driver. You should really only need the amdgpu, I haven’t run into anything with video-vesa being installed as well.

First step is to clone the repo using git(links posted at the bottom), and then open a terminal in the location or cd to the location. Once you have a terminal in the location you will run the following.

chmod +x install.sh

If you get a permissions error then run it with sudo. Once that has been done you will run

sudo ./install.sh

This will run through and install all the necessary stuff for this to work, and when it finishes it sets it nvidia only. To change between ryzen and nvidia you will simply run one of the following commands.

sudo set-nvidia.sh
sudo set-amd.sh

Then reboot your system and you should be good to go. One thing I recommend is that you go into the amd-xorg.conf located at /etc/switch/amd/amd-xorg.conf and check that the BusID matches your amd card. It defaults to 5 but I added another ssd to my machine and it bumped mine to 6. To find the BusID of your amd card simply run lspci in the terminal.

With nvidia set and running there is a chance your screen may display everything a bit smaller. To fix you need to uncomment the line in the nvidia-xorg.conf that list dpi 96x96. The location for that file should be /etc/switch/nvidia/nvidia-xorg.conf

In the location for all the conf files you will notice a few that may say mhwd, that is strictly a MJ thing and you can delete those and not experience an issues. I cannot speak on the switch methods used for intel/nvidia seeing as how I don’t own one of those laptops.



3 Likes

Does prime-run not work for this hardware configuration?

What’s the advantage of a “hard” configuration switcher?

Edit: The advantage of this over prime render is at last check prime render doesnt allow for external displays to be used. To do that you need to render the whole system off of the nvidia gpu. I don’t really have a way to test this at the moment to see if that has been updated with the nvidia driver recently.

This sets it up to either render the system using amd only or nvidia only. Prime run is not needed with nvidia set due to the system rendering everything using the nvidia card. Picture is the nvidia settings with nvidia mode set.

An advantage of this is nvidia cards that are not turing architecture don’t have power setting available to them with nvidia card.

3 Likes