Espionage724
Posts: 20
Joined: Sat Sep 17, 2016 8:42 pm

NVIDIA Optimus (no GPU switching)

Sat Sep 17, 2016 9:09 pm

These instructions will install the NVIDIA driver from the Solus repo and set it up so that everything you do is rendered on the NVIDIA GPU (aka NVIDIA Prime). Instructions were adapted from the Arch Wiki documentation.

Warnings:
  • Untested with laptops that have certain display ports wired to the NVIDIA GPU (some laptops have the built-in screen on Intel, and VGA/HDMI ports on NVIDIA)
  • You cannot easily switch the GPU in-use (this isn't Bumblebee nor does it have a GUI setting for GPU switching like Ubuntu, everything is rendered on the NVIDIA GPU at all times; this is the NVIDIA-supported method of handling Optimus)
  • This set-up will have screen tearing and it does not respect Vsync (can be solved with Xorg 1.19 and by enabling KMS, this is beyond the scope of this guide)
  • Any time nvidia-glx-driver updates, you need to delete /etc/X11/xorg.conf or else upon next reboot, LightDM will fail to start (see notes at bottom)
  • This will likely be deprecated once official Optimus support arrives in Solus, and the below notes will need to be undone manually when that happens
1. Install the graphics driver package
  • If you plan to use Wine and/or Steam, you'll need the 32-bit driver for compatibility (this also pulls in the 64-bit driver)
  • If you have no need for 32-bit GL support, just install nvidia-glx-driver
  • There is also the nvidia-340-glx-driver and nvidia-304-glx-driver packages (and respective 32-bit versions) that are necessary for other hardware, I'm unsure of how to determine which one to use currently

Code: Select all

sudo eopkg install 'nvidia-glx-driver-32bit'
2a. Create a script for LightDM to use the NVIDIA GPU and make it executable:

Code: Select all

sudo mkdir -p '/etc/lightdm/lightdm.conf.d' && sudo nano '/etc/lightdm/nvidia-optimus.sh' && sudo chmod +x '/etc/lightdm/nvidia-optimus.sh'

Code: Select all

xrandr --setprovideroutputsource 'modesetting' 'NVIDIA-0'
xrandr --auto
2b. Tell LightDM to execute the script on-startup:

Code: Select all

sudo nano '/etc/lightdm/lightdm.conf.d/nvidia-optimus.conf'

Code: Select all

[Seat:*]
display-setup-script=/etc/lightdm/nvidia-optimus.sh
3. Delete the generated xorg.conf and create a proper one
  • This uses the modesetting driver for the Intel iGPU and the NVIDIA driver for the dGPU
  • Since acpid doesn't exist, the option for the NVIDIA driver to connect to it is disabled
  • You can also add any other NVIDIA-specific options here too, such as Coolbits
  • Verify if the BusID below will work for your hardware

Code: Select all

sudo rm -Rf '/etc/X11/xorg.conf' && sudo nano '/etc/X11/xorg.conf.d/nvidia-optimus.conf'

Code: Select all

Section "Module"
    Load        "modesetting"
EndSection

Section "Device"
    Identifier  "nvidia"
    Driver      "nvidia"
    BusID       "PCI:1:0:0"
    Option      "AllowEmptyInitialConfiguration"
    Option      "ConnectToAcpid"                    "0"
EndSection
4. Reboot and win

From what I've seen, this survives updates without problem; just need to take care to delete xorg.conf anytime the NVIDIA driver updates. As for how I take care of this, I have an automatic update script that runs daily and removes xorg.conf if it exists. You could also remove the file on every boot though via this simple systemd script:

Code: Select all

sudo -e '/etc/systemd/system/xconf-rm.service' && sudo systemctl daemon-reload && sudo systemctl enable 'xconf-rm'

Code: Select all

[Unit]
Description=NVIDIA Optimus xorg.conf Removal

[Service]
Type=oneshot
ExecStart=/bin/rm -Rf '/etc/X11/xorg.conf'

[Install]
WantedBy=multi-user.target
Last edited by Espionage724 on Mon Dec 05, 2016 4:59 am, edited 12 times in total.

User avatar
Rufus Dexter
Posts: 32
Joined: Fri Oct 07, 2016 9:16 pm

Re: NVIDIA Optimus (no GPU switching)

Mon Oct 10, 2016 7:22 pm

Thank you!
This works, I can confirm.
It's getting the nvidia card to be used by X and all, minor thing missing: not able to select between nvidia and integrated graphics from CPU.

Best wishes to Espionage724 for solving this.
Hope to see Optimus support soon on Solus 1.2.1 ;)
Image

User avatar
ikey
Project Founder
Posts: 1581
Joined: Sun Jul 27, 2014 10:42 pm
Location: Ireland
Contact: Website

Re: NVIDIA Optimus (no GPU switching)

Mon Oct 10, 2016 10:35 pm

Rufus Dexter wrote: Hope to see Optimus support soon on Solus 1.2.1 ;)
As I've said many times, it's coming *after* 1.2.1 :)
Image

nod@doxi
Posts: 37
Joined: Fri Nov 20, 2015 6:42 am

Re: NVIDIA Optimus (no GPU switching)

Tue Oct 11, 2016 4:23 am

*patiently waiting*

User avatar
ikey
Project Founder
Posts: 1581
Joined: Sun Jul 27, 2014 10:42 pm
Location: Ireland
Contact: Website

Re: NVIDIA Optimus (no GPU switching)

Tue Oct 11, 2016 7:41 am

nod@doxi wrote:*patiently waiting*
Your wait is now significantly reduced. I've just ploughed through most of the work remaining for 1.2.1, i.e. full disk encryption. :)
Image

nod@doxi
Posts: 37
Joined: Fri Nov 20, 2015 6:42 am

Re: NVIDIA Optimus (no GPU switching)

Tue Oct 11, 2016 1:30 pm

*now waiting unpatiently*

User avatar
Justin
Development Team
Posts: 3701
Joined: Mon Jul 28, 2014 10:42 am
Location: Adelaide, Australia
Contact: Website Google+ Twitter

Re: NVIDIA Optimus (no GPU switching)

Wed Oct 19, 2016 9:45 pm

nod@doxi wrote:*now waiting unpatiently*
Impatiently, and every time you post and he comes here to see it, your request is delayed those few extra seconds :)

buciuta.andrei
Posts: 2
Joined: Sat May 27, 2017 1:09 pm

Re: NVIDIA Optimus (no GPU switching)

Sat May 27, 2017 1:45 pm

Hi everyone!
I'm a Linux beginner but I love it but I stumble upon a problem with the Nvidia graphics. I installed Solus, everything works fine but after I install the nvidia drivers from Solus repository, the 38x version I get a black screen with only the mouse present. Followed this guide, I have the same problem. Lspci output shows both intel and nvidia cards but in xrandr I get Can't open display.
Can someone help me? I am struggling with this for over a week and I really want to get Solus working

buciuta.andrei
Posts: 2
Joined: Sat May 27, 2017 1:09 pm

Re: NVIDIA Optimus (no GPU switching)

Sun May 28, 2017 10:03 pm

Solved the problem, it was so easy, in front of my eyes.
At the black screen with the cursor you have to click and the login screen appears, login and with windows+P switched the laptop screen to primary and then disabled from settings the second unknown and inexistent screen.
buciuta.andrei wrote:
Sat May 27, 2017 1:45 pm
Hi everyone!
I'm a Linux beginner but I love it but I stumble upon a problem with the Nvidia graphics. I installed Solus, everything works fine but after I install the nvidia drivers from Solus repository, the 38x version I get a black screen with only the mouse present. Followed this guide, I have the same problem. Lspci output shows both intel and nvidia cards but in xrandr I get Can't open display.
Can someone help me? I am struggling with this for over a week and I really want to get Solus working

Return to “Tutorials”