Ubuntu 20.04 simpleGL not running with GPU

I fresh installed ubuntu 20.04 on my laptop with i5 cpu and MX350 graphics card.
I apt installed nvidia-driver-470
And I found nvidia driver is only working as 3D and VGA is still managed by intel graphics as lspci shows below

$ lspci | egrep -i "vga|display|3d"
00:02.0 VGA compatible controller: Intel Corporation Iris Plus Graphics G1 (Ice Lake) (rev 07)
30:00.0 3D controller: NVIDIA Corporation GP107M [GeForce MX350] (rev a1)

This resulted GUI acceleration is not applied thus making xorg desktop become very slow and not responsive.

So I created xorg.conf under /etc/X11 as below

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

Section "Device"
    Identifier "intel"
    Driver "intel"
    BusID "PCI:0@0:2:0"
    Option "AccelMethod" "sna"
    Option      "DRI"   "1"

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

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

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration" "on"
    Option "IgnoreDisplayDevices" "CRT"

Now everything works fine but I am getting error when running anything with 3D graphics.

$ ./simpleGL 
simpleGL (VBO) starting...

GPU Device 0: "Pascal" with compute capability 6.1

CUDA error at simpleGL.cu:421 code=999(cudaErrorUnknown) "cudaGraphicsGLRegisterBuffer(vbo_res, *vbo, vbo_res_flags)" 
CUDA error at simpleGL.cu:433 code=400(cudaErrorInvalidResourceHandle) "cudaGraphicsUnregisterResource(vbo_res)" 

It seems like GPU is not utilized for any graphics acceleration. How can I solve this issue? Any help would be much appreciated.

I also attached nvidia-smi result below

$ nvidia-smi 
Mon Oct 25 22:22:10 2021       
| NVIDIA-SMI 470.57.02    Driver Version: 470.57.02    CUDA Version: 11.4     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|   0  NVIDIA GeForce ...  On   | 00000000:30:00.0 Off |                  N/A |
| N/A   41C    P8    N/A /  N/A |      4MiB /  2002MiB |      0%      Default |
|                               |                      |                  N/A |
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|    0   N/A  N/A       825      G   /usr/lib/xorg/Xorg                  4MiB |

Please delete your xorg.conf, the settings on ubuntu are manage by the gpu-manager.
Per default, with ubuntu on an Optimus enabled notebook, the nvidia gpu is used in on-demand mode, meaning you have to explicitly demand it


or switch to nvidia exclusive mode using
sudo prime-select nvidia
and reboot.

Hi, thanks for your comment.
As I described, when there is no xorg.conf, VGA acceleration is not handled by any device (internal or external gpu)
I also did sudo prime-select nvidia but did not solve the issue.

I did see simpleGL is running on GPU with this command.


Can you tell me what is needed to fix xorg.conf to use GPU acceleration as default.

prime-select nvidia and rebooting should switch to nvidia always, if it doesn’t, please create a new nvidia-bug-report.log in that state.

Here I attached the issue with using nvidia gpu for xorg rendering.

Please check this video.

Compare to GUI rendering with intel cpu, there are significant delay, rendering issues when gpu is used for graphics.

I switched to gpu graphics by entering below command

$ sudo nvidia-xconfig --prime

I only assume that when gpu is used, it doesn’t really do anything about VGA and only kicks in when 3D graphics required.

I even tried to switch between NVIDIA Performance Mode and NVIDIA On-Demand mode in nvidia-settings but no difference.

Please create a new nvidia-bug-report.log while switched to performance mode.

I attached the bug report. Thanks.

nvidia-bug-report.log.gz (282.7 KB)

Please delete /etc/X11/xorg.conf, it’s overriding Ubuntu’s gpu-manager.
Furthermore, please set kernel parameter

I deleted it.
Also checked nvidia-drim modeset=1

$ cat /etc/modprobe.d/nvidia-drm-nomodeset.conf 
options nvidia-drm modeset=1

But it doesn’t really help improving xorg rendering.

Please create a new nvidia-bug-report.log in the current state.
Please also check if drm modesetting is active,

sudo cat /sys/module/nvidia_drm/parameters/modeset

should return ‘Y’ if done right.

Here is another bug report.
nvidia-bug-report.log.gz (305.3 KB)

Also checked drm modeset as below. “Y” is returned.

$ sudo cat /sys/module/nvidia_drm/parameters/modeset

Ok, everything seems to be set up and running cleanly, so it’s a bit mysterious.
Besides the input lag, are there any other rendering issues (delays, artifacts)?

Well, rendering issue still there as you can see.

Thank you for helping me out anyway. Don’t know what else can be done.
Hope another driver update will fix this issue.

Ok, the previous video was a bit too blocky to notice the other effects.
All of this rather looks like compositor faults, are you running plain Ubuntu with gnome or any other DE?

I don’t get it what other DE, but I installed using official ubuntu 20.04 iso image and had not changed anything about desktop environment.

I found a thread exactly about this issue here.

Though I have no idea about what PSR is, disabling it by adding


to /etc/default/grub
then “$ sudo update-grub” and “reboot”
seem to fix the screen tearing, delayed rendering issue.

To check if PSR is enabled by entering

$ sudo cat /sys/module/i915/parameters/enable_psr

should return “0” zero.

Formerly, it gave me “-1”.

PSR means panel self refresh, so that when the gpu doesn’t have anything new to render, it doesn’t need to push the same picture over and over to the panel. Saves energy, but is broken on some panels (like mine). So far, this only resulted in flickering which was very easy to assign to psr.

1 Like

Thanks for helping me. Your guide has been great for me to understand.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.