High CPU usage on xorg when the external monitor is plugged in

The driver version 525.78.01 release notes suggest that a fix was made; there are two items worth reporting:

a) on my Dell 7610 with Nvidia 3060, Fedora 37, NVIDIA drivers via rpmfusion, KDE 5.26.4, with an LG 4K screen connected and displayed “to the left” of the laptop, the excessive CPU load - i.e. the performance issue - is gone; this also applies to Ubuntu 20.04 LTS with Mutter.

b) during testing I noticed serious functional misbehaviour, though, when running glxgears; step:

  • boot box
  • log into an X11 desktop environment (Fedora 37 + KDE; Ubuntu 20.04 LTS + Mutter)
  • start glxgears (without PRIME offload)
  • make sure that glxgears runs on the screen connected to the Nvidia GPU
    … and wait for 60 seconds to repeatedly observe, eventually, one of the following two broken behaviours
  • screen connected to the NVIDIA output turns black (but recovers within a second)
  • some garbage rectangles (pink pixel garbage) show up, and get cleared again in what appears to be random sizes and random locations, but only on the screen attached to the NVIDIA GPU

This faulty behaviour also occurs with __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears (and all other things being equal)

This faulty behaviour does not occur when the output screen is the laptop’s 3072x1920 (3K!) Intel GPU driven built-in screen.

This misbehaviour is not limited to glxgears; it also applies to, for instance, Firefox, or Visual Studio Code, when those application windows are moved around with the mouse; once the corrupt is present, moving the mouse will nicely animate the pixel garbage.

The photo below shows the pixel garbage - it appears in totally random locations, nowhere close where I would expect repaint damage. The garbage cannot be captured using a screenshot tool, e.g. KDE’s "Spectacle, all looks good there, hence the photo:

And, bonus misbehaviour: I think while glxgears was running in the background on the NVIDIA GPU screen, and while I was doing some wiggling on that screen, I got something to totally lock up, because the content on the NVIDIA GPU screen was totally frozen. Things did come back after I disabled the screen via KDE Display Configuration and re-enabled it. But this smelled a lot like a deadlock (somewhere).

I see exactly nothing of that reflected in logs as WARN or ERROR (and I really would expect at least the screen going all black to emit some kind of diagnostic). I expect that

Jan 07 14:18:13 fedora.home kernel: nvidia-modeset: ERROR: GPU:0: Idling display engine timed out: 0x0000c67e:0:0:1128
Jan 07 14:18:15 fedora.home kernel: nvidia-modeset: ERROR: GPU:0: Idling display engine timed out: 0x0000c67e:0:0:1128

is the result of my “fixing” the deadlock, not something that was emitted by the running driver.

1 Like

The problem is greatly improved (the high CPU), but CPU usage is still higher (6-8%, vs. 2-3%) with no DE apps running with 1 or 2 external monitors enabled, than with none.

Also, the ordering/assignment of displays is all messed up. If I set my laptop display as primary, the taskbar gets moved to the 3rd monitor. If I force an app to run on primary, it runs on the 2nd monitor. When I disable both displays, go to sleep, and wake up, the 2nd monitor re-enables itself (likely due to hotplug events in the driver detecting a “new display” during wake).

So…better than not being able to use it at all, but buggy AF. I’m going to try your test and see what happens.

I have a 5800h (AMD) + 3070 laptop, with mux. I only tested in hybrid mode (internal display = AMD, external displays = nV). I ran multiple glxgears, including with no frame rate cap, and several concurrently, and I don’t see any corruption. Interestingly, the instance running on the AMD driver, even with “reverse prime” (AMD driver, displayed on an nV display), maintains >15k fps…the nV instance hovers around 4-5k fps (on an nV monitor), and if I drag it to the AMD display it drops to 3-4k fps.

Performance mode is “auto” but it pegs itself to the max clocks.

I think the issues you’re having likely have something to do with the Intel hybrid config.

1 Like

I’ve downloaded the latest driver 525.78.01 but no luck, still high usage 25-30%.
nvidia-bug-report.log.gz (431.0 KB)

For me, after updating to 525.78.01 the CPU usage dropped to 3%-8%. That’s good, but still not acceptable. When using only dGPU or iGPU the CPU usage is around 0.3%. I hope this isuue will be fixed too.

Also I’ve noticed a strange little issue. When I’m using external display with reverse PRIME setup, and playing games on external display (no matter whether via dGPU or iGPU), during camera movements the picture is not as smooth as when using only one GPU (dGPU or iGPU, external monitor or laptop - doesn’t matter) without reverse PRIME - the picture moves smoother. I’ve noticed this in such native Linux games as SuperTuxKart, Yamagi Quake 2 and 0AD. Vsync configurations don’t affect this issue at all.

Finally, there is absolutely working flawlessly on Ubuntu 23.04 Daily build by using Wayland and the latest Nvidia Beta Drivers the problems that I had gotten so far are now gone in these current versions, the external monitor is not tearing anymore, about the Nvidia power usage is really low at idle it is like windows how it behaves sitting at 5 watts when no activities, when the cursor is moving around there are still under 10Watts with external monitor connected which are great improvement so far.
I forgot something to tell, now on Wayland I can set fractional scaling individually of each monitor. That is so cool, I love it.

1 Like

I have the same issue as OP.

Hybrid graphics. Nvidia and Intel.

NVIDIA GeForce GTX 1070 Mobile

Running Pop OS 20.10

It’s been fixed since Nvidia 525.78.01, I tested Nvidia 530.30 with the latest Linux kernel 6.2, Both Xorg and Wayland are now working perfectly fine, I tested on Ubuntu 23.04 Development Branch.

1 Like

I have RTX 3060 laptop GPU.

I installed the Nvidia driver from additional drivers. as you can see in the image

I have the version of 525.89.02 installed now which is newer than 525.78.01.

However, I still have the problem of high CPU usage. As a workaround I am running on the power mode on nvidia but that is still really problematic. My external monitor is able to work with a certain combination of settings(59Hz, On Performance…) and the fans of my laptop are still so loud. I have a dual boot with Windows11 and I have never heard any fan noise on that setup.

Would you be able to help me with this?

1 Like

Like I said, the problems have gone fixed in the latest Ubuntu 23.04 it’s shipped with the latest Xorg and Wayland so you can have your external monitor without worrying excessive CPU usage.
Let’s try to add the latest Nvidia graphics from the repo:

sudo add-apt-repository ppa:graphics-drivers/ppa

You can either install Nvidia 525.105.17 or Nvidia 530.41.03
I have tested it both versions are working just fine.

I’ve just installed Nvidia 525.105.17 on my Ubuntu 22.04, the problem still continues. Should I upgrade to Ubuntu 23.04? It says it is not released officially yet.

1 Like

Yes, You have to upgrade/install Ubuntu 23.04 is now currently in Beta. I was using 2 months ago, even was still in daily build.

I switched to Ubuntu 23.04, installed the Nvidia 525.105.17 driver and the problem still exists :( Especially while I am using Chrome and Youtube, the CPU goes crazy once every minute or so. I am on On Demand for Nvidia and Balanced for the System.

This happens only with 2 tabs opened on chrome. One with a 1080p video open the other is just new tab

1 Like

Seems like you are using Xorg instead of Wayland right? On the bottom right corner after typing a password you can change into Wayland session if you are logged in by default with Xorg.

Original issue reported was high CPU utilization consumed by Xorg which has been root caused and available in released drivers.
Please help to share fresh bug report, snippet of top command highlighting high utilization by Xorg if issue still persists at your end.

Issue still persists on Ubuntu 23.04. and nvidia driver 515.105.
I have attached nvidia-bug-report and a top screenshot with around 40% usage

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

Today, I realized that my problem only happens when my laptop is connected to the power. So, it has nothing to do with having an external monitor. I unplugged the laptop and used it on battery on normal balanced power mode and on-demand Nvidia mode like I do when it is on power. Would you be able to help me with this?

Please test with 525 or 530 branch release driver and share bug report if problem still persists.

I still have the exact same issue on X11 on Intel 1135g7, now with different display. And it’s even crazier, because it happens when I plug HDMI or USB for power an touch, but when I connect the display when using Wayland everything is fine. Ican even log out ang log back in X11 and then everything works.

Driver 525.105.17, Ubuntu 22.04 (KDE neon)
CPU usage reduced to 5-10% which is an improvement but still a bit high, the GPU usage is still around 25%, thanks for your work.
nvidia-bug-report.log.gz (483.6 KB)