Friday 13 December 2019

Dual-GPU support follow-up: NVIDIA driver support

If you remember, back in 2016, I did the work to get a “Launch on Discrete GPU” menu item added to application in gnome-shell.

This cycle I worked on adding support for the NVIDIA proprietary driver, so that the menu item shows up, and the right environment variables are used to launch applications on that device.

Tested with another unsupported device...


Behind the scenes

There were a number of problems with the old detection code in switcheroo-control:
- it required the graphics card to use vga_switcheroo in the kernel, which the NVIDIA driver didn't do
- it could support more than 2 GPUs
- and it didn't really actually know which GPU was going to be the “main” one

And, on top of all that, gnome-shell expected the Mesa OpenGL stack to be used, so it only knew the right environment variables to do that, and only for one secondary GPU.

So we've extended switcheroo-control and its API to do all this.

(As a side note, commenters asked me about the KDE support, and how it would integrate, and it turns out that KDE's code just checks for the presence of a file in /sys, which is only present when vga_switcheroo is used. So I would encourage KDE to adopt the switcheroo-control D-Bus API for this)

Closing

All this will be available in Fedora 32, using GNOME 3.36 and switcheroo-control 2.0. We might backport this to Fedora 31 after it's been tested, and if there is enough interest.

3 comments:

Unknown said...

Trident Vesa Local Bus 512kb :) Reminds me of my first PC: 386 DX 40MHz, but it had Trident 512kb card using the ISA port - it was awful.

peter said...

Will this work with the combination of Wayland and Nvidia Optimus hybrid graphics as in the Thinkpad W and P series workstation laptops where the external port is wired to the discrete GPU?

Bastien Nocera said...

I'm afraid that I don't have access to the hardware, so I wouldn't know. I'm guessing that it might offer the option, but not work as expected. Hard to tell.