Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU Spike 90% with Vsync #9621

Open
howdev opened this issue Oct 7, 2020 · 8 comments
Open

CPU Spike 90% with Vsync #9621

howdev opened this issue Oct 7, 2020 · 8 comments

Comments

@howdev
Copy link

howdev commented Oct 7, 2020

 * Cinnamon version (cinnamon 4.4)
   - Please specify if you are using the daily builds PPA
     (https://launchpad.net/~linuxmint-daily-build-team/+archive/ubuntu/daily-builds).
 * Distribution - (Mint 19.3)
 * Graphics Nvidia 440.59
 * 64 bit

**Issue**
When Chrome or any Chromium based browser running with hardware acceleration on
All Vsync methods None, Fallback, Throttle, Presentation Time, causes Xorg and Cinnamon to 90% CPU usage while moving any application window for more than 2 seconds. None vsync has less CPU spike.

Tested in XFCE. does not have the issue. 


**Steps to reproduce**
Use any Chrome, Opera, Chromium or Brave browser with hardware acceleration on
continuously drag any windows for more than 2 seconds, the CPU will start to spike up to 90%, monitor with top command


**Expected behaviour**
Cpu is very low usage, should be under 10%
@howdev
Copy link
Author

howdev commented Oct 7, 2020

Also happens with Cinnamon 4.2

@sanawu
Copy link

sanawu commented Oct 7, 2020

Mint 20 64-bit
Cinnamon 4.6.3
VSync set to presentation time
NV drivers 390.138
Brave Hardware acceleration enbled

CPU normal

@howdev
Copy link
Author

howdev commented Oct 8, 2020

@sanawu Did you move any windows? if idle nothing will happen. you move any other app window for more than 2 second, just drag around the screen, Xorg will jump to 90%

if Vsync None; Xorg 60%, Cinnamon 30%
if Vsync Presentation; Xorg 90%, Cinnamon 9%

XFCE; Xorg 15%

@sanawu
Copy link

sanawu commented Oct 8, 2020

@sanawu Did you move any windows? if idle nothing will happen. you move any other app window for more than 2 second, just drag around the screen, Xorg will jump to 90%

if Vsync None; Xorg 60%, Cinnamon 30%
if Vsync Presentation; Xorg 90%, Cinnamon 9%

XFCE; Xorg 15%

Yes I moved it about a good bit for a good while, nothing dissruptive happened, Linux still works, desktop functioning, CPU not spiking massively

Isn't the use hardware rendering where available on the application so these issues would be with the application itself?

https://unix.stackexchange.com/questions/428197/how-to-check-an-application-is-using-hardware-or-software-based-display-renderin

By running

lsof -p ${pid} | grep /dev/dri

I can see the browser is indeed using the GPU when use hardware accelleration is enabled

I am also on the low latency kernel

@Philipp91
Copy link
Contributor

When Chrome or any Chromium based browser running with hardware acceleration on
All Vsync methods None, Fallback, Throttle, Presentation Time, causes Xorg and Cinnamon to 90% CPU usage while moving any application window for more than 2 seconds.

I have roughly the same issue. Though I move/change window contents (e.g. playing a video or scrolling a webpage) instead of the whole window. (When I move a window, there's also some cinnamon CPU usage, but I won't complain because I'll allow my window manager to consume CPU when I'm doing something with a window -- and that's a much less frequent use case than playing a video.) But indeed, with Firefox everything's fine. OTOH with Joplin (which is a React Native app) I can also reproduce the high cinnamon CPU load while scrolling.

None vsync has less CPU spike.

I've observed the same. I also tried various other ways of disabling VSync (on my second monitor), but it didn't help.

In addition to the above, I only observe this when a Cinnamon panel exists on my monitor with VSync (see also here and here). My other monitor (which is my primary monitor) does not have/support/use VSync (it's connected through HDMI, maybe that's why), and Cinnamon panels there don't hurt. If you only have a VSync-ed monitor, it might be inconvenient but possible to try out if removing the Cinnamon panel on that monitor improves the situation (though you might have to reconfigure it from scratch later?).

@howdev
Copy link
Author

howdev commented Apr 25, 2021

I upgraded to Mint 20 and issue stays the same. I tried XFCE and KDE don't have this problem.

@Philipp91
Copy link
Contributor

Is there any way to debug what's going on here? Is there a way to monitor CPU time of Cinnamon's sub-threads? Is there a way to see when or how often a rerender of Cinnamon's UI is triggered (e.g. through VSync)?

@Philipp91
Copy link
Contributor

Philipp91 commented Jun 5, 2021

This reproduces with generic and lowlatency kernel, and with Nvidia drivers 460.80 and 465.27, but not with the nouveau (1:1.0.16-1) driver. Maybe because that one doesn't support VSync at all. Sadly it also can't control the graphics card's fan at all and is rumored to be much less stable, so I'm disinclined to use it.

This also does *not reproduce with Cinnamon in software rendering mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants