Ubuntu 20.04 Nvidia prime on Demand and External Monitors
I've been exploring the options of Nvidia Optimus under Ubuntu since the release of the on-demand option with Ubuntu 20.04 and nvidia-driver-440. I can now run my laptop using the Intel HD530 iGPU while I will switch to the Quadro M1000M dGPU for renderer for a specific program.
I tested the setup with glxheads
:
$ glxheads :1
Name: :1
Display: 0x55afe7f84d80
Window: 0x4200002
Context: 0x55afe7fa4710
GL_VERSION: 4.6 (Compatibility Profile) Mesa 20.0.4
GL_VENDOR: Intel
GL_RENDERER: Mesa Intel(R) HD Graphics 530 (SKL GT2)
$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxheads :1
Name: :1
Display: 0x55dda746ffa0
Window: 0x4200002
Context: 0x55dda7510ae8
GL_VERSION: 4.6.0 NVIDIA 440.64
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: Quadro M1000M/PCIe/SSE2
And the performance is also as expected in games.
However, I have a problem, my external monitors do not work anymore when using the On-Demand. That means when using Intel (power saving) ore Nvidia (performance mode) my external screens do work. But if I use Nvidia (on-demand) all my external screens stay black. I tested screens over HDMI and DisplayPort (thunderbolt).
I think that my issues are related to:
- Second monitor in X server PRIME profile "On-demand" (unasnwerd)
- https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-435/+bug/1849214 (states the issue and that it is because the external screens are directly connected to the Nividia card
- https://forums.developer.nvidia.com/t/support-external-displays-in-render-offload-mode/107046/7 (similar to the launchpad issue)
Is there any way to make this work without having to wait for Nvidia to work on this. I mean that could take years. Currently, my solution is to switch between the Intel (power saving) and Nvidia (Performance mode) and reboot the laptop in between. But the rebooting is annoying as I have to close and reopen all my programs. Is there a way to achieve the same thing without rebooting or logging off. For example, restarting the graphical environment or XOrg?
Solution 1:
Your external monitors are connected to the Nvidia card and using them while in offload mode is supported only by the 450 family of Nvidia drivers. In summary: if you want to use them with "On demand" you need to install the latest Nvidia drivers (450.57 at the time of writing).
There's no package yet for Ubuntu, but I think you'll be able to ultimately find the drivers in the Graphics Drivers ppa in a few days or weeks.