1

Yesterday I installed Kubuntu 20.04 from scratch on a Lenovo Thinkpad T490 laptop with a GeForce MX250 discrete graphics adapter.

Prime render offloading fails with:

$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  25
  Current serial number in output stream:  26

This was working perfectly in 19.10 on the same machine, using xserver-xorg-core version 2:1.20.5+git20191008-0ubuntu1.

How is Prime render offloading supposed to work in Ubuntu 20.04?

2 Answers 2

2

Apparently the default graphics configuration in stock Ubuntu 20.04 does not properly support PRIME render offloading, but adding the "Proprietary GPU Drivers" ppa solves everything.

$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt update
$ sudo apt dist-upgrade
$ shutdown -r now

And everything works perfect on reboot.

13
  • I went through your steps but it has not solved the problem for me; I still get the error message "PRIME: is it supported? no" when I try to run nvidia-settings. I have added the repository and installed the most recent version (nvidia-driver-440) which is the recommended driver. Do you have any other suggestions on how to fix this? Thanks
    – JJGabe
    May 7, 2020 at 19:06
  • @JJGabe, I'm afraid not. Both times I've had to deal with this issue, it came down to package sources (like installing the patched xsever in 19.10), and I don't really understand the difference between the versions available in the 20.04 repos and the graphics-drivers ppa. As far as I know, all of them should support on-demand offloading, so I assume it's a config issue, but that as far as I'd there to comment. Sorry :(
    – jtatria
    May 8, 2020 at 3:30
  • Oh well, thanks for responding. This has been an ongoing struggle for me since 16.04. I don't do much gaming or 3D rendering anyway so it's not a big deal but it just seems a waste to leave an nvidia card dormant while using a built in Intel graphics card haha.
    – JJGabe
    May 8, 2020 at 12:35
  • Same for me : it don't work with 450 nvidia driver and ubuntu 20.04 Any idea ?
    – Oli
    Sep 9, 2020 at 13:42
  • @Oli, honestly, no idea. I just reinstalled 20.04 from scratch on this machine (a Lenovo Thinkpad T490), and on-demand PRIME render offloading works out of the box using nvidia-driver-440. I assume the issue has something to do with installation options etc, but as I said above, every time I've had to deal with this issue, I solved it by using a ppa or, most recently, by installing everything from scratch. I'd love to share my conf for you to look for the difference, but I wouldn't even know where to begin looking for the relevant files. Sorry I can't be of more help.
    – jtatria
    Sep 10, 2020 at 15:17
0

I just got it working! :-)

Using the latest NVidia driver 455 from the PPA, running on Ubuntu Mate 20.04.1 Running in NVidia Hybrid (On-Demand) mode.

It uses Intel video for normal desktop stuff, and NVidia works when using the offload command

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME="nvidia" __VK_LAYER_NV_optimus="NVIDIA_only" %command%  
like __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME="nvidia" __VK_LAYER_NV_optimus="NVIDIA_only" glxgears

Go to /usr/share/X11/xorg.conf.d/ and make a new conf file (I called mine 20-intel.conf but it doesn't matter) and used these contents:

Section "Module"
    Load "dri3"
EndSection

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
    Screen 1 "nvidia"
EndSection

Section "Device"
    Identifier "intel"
    Driver "intel"
    BusID "PCI:0@0:2:0"
    Option      "DRI"   "3"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1@0:0:0"
    Option "ConstrainCursor" "off"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration" "on"
    Option "IgnoreDisplayDevices" "CRT"
EndSection
1
  • I just discovered that the BusID section is irrelevant - solution works without the PCI bus info
    – John
    Oct 14, 2020 at 17:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .