Low GPU usage in wayland

Hi,

I’ve been trying to find the cause for low gpu usage in wayland and so far the only common pattern that I found was when I enabled AsyncFlipSecondaries in X11.

As with it disabled, X11 works with the proper high gpu usage, but when I had it enabled, the usage was similar to wayland.

I have some references and topics for context.


Is there anything like that in the wayland compositor even when tearing support are enabled?

Because in X11, even if you disable TearFree, AsyncFlipSecondaries can still be enabled.


1 Like

Another possible relevant info about kwin.

With the option set to "never", KWin really never leaves VRR enabled. You can double check with drm_info | grep VRR_ENABLED

https://www.reddit.com/r/linux_gaming/comments/18lxzwm/comment/ke3mpwy/

All related to vsync / triple buffer / vrr are disabled here. Be with environment variables or UI.

❯ drm_info | grep VRR_ENABLED
│   │       ├───"VRR_ENABLED": range [0, 1] = 0
│   │       ├───"VRR_ENABLED": range [0, 1] = 0
│   │       ├───"VRR_ENABLED": range [0, 1] = 0
│           ├───"VRR_ENABLED": range [0, 1] = 0

I dont know if 0 means it’s disabled, or if he meant that just by VRR_ENABLED being found, means that VRR are there.

https://aur.archlinux.org/packages/drm_info

I can say I experience this exact issue under Wayland running Nvidia hardware. GPU usage will not go over 80% utilization under Wayland, with the issue especially noticeable when running Counterstrike 2 and Deadlock. However, under X11, GPU utilization in the above titles hits 100% no problem at all with a corresponding increase in FPS - Essentially, under Wayland FPS is around 20 - 30% lower than playing the exact same title under X11.

Commenting out ‘export SDL_VIDEO_DRIVER=x11’ under cs2.sh when running the game under Wayland makes no difference whatsoever.

System specs below:

Operating System: KDE neon 6.2
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.1
Kernel Version: 6.8.0-51-generic (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-8700K CPU @ 3.70GHz
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2

Hi - I would assume, based on the last NVIDIA forum link posted above (someone using GNOME), that this isn’t an issue that’s unique to KDE Plasma?

If it’s an inherent limitation of the NVIDIA proprietary driver, then unfortunately there’s not much that folks working on KDE can do - especially with the NVIDIA drivers being closed source and all :face_with_diagonal_mouth:

I dont know about gnome as they have their own wayland implementation.

What I wanted to know is from KDE (kwin), is if there is anything vblank related active like a behavior similar as with AsyncFlipSecondaries, that could be causing this lower gpu usage.

But sure, the problem could be only from nvidia.

Furthermore, the problem isn’t limited to Nvidia, it’s just that Nvidia have an official platform for people to outline their issues directly to Nvidia themselves.

Here’s an AMD user with the exact same issue:

https://www.reddit.com/r/linux_gaming/comments/1hae6k6/cs2_doesnt_use_more_than_70_of_the_gpu/

Between the low GPU utilization, the janky desktop animations switching between virtual desktops, the issues with floating panels running icons only task manager under load, problems with windows remembering their location/monitor placement/geometry, and the numerous fractional scaling issues - I think I’ll be sticking with X11 until the bitter end.

You’ve got the freedom to choose whatever the right setup for your own device is - for what it’s worth, though, it looks like the result of that thread was the OP trying X11 to no effect, then reinstalling to find that a different CPU governor tool worked (I could be misreading). Maybe there are multiple different underlying issues with the same initial symptoms?

I’m not saying you should keep hacking away at something frustrating, without practical benefit to you, just for the sake of using Wayland now - just that in your particular case, a driver bug might not be helping matters :slight_smile:

Don’t get me wrong, I want to switch to Wayland. But in comparison to X11, Wayland’s just not there yet. Unless you run mixed monitors with VRR, Wayland’s too much of a compromise when X11 just works.

Having said that, this performance issue under Wayland really needs some attention, it is a widespread problem.

1 Like

Sure, some people might be using their own distro and settings which can result in different issues for different things.

But at least in my case, using cachyos, plus many more tweaks, CPU usage are surely not the problem. But again, lower GPU usage is, in wayland that is.

X11 has the right usage, while wayland still lacks, while also being enforced to VRR/Gsync, even with all of it disabled through UI or variables.


Only two reasons left I have not yet completed migrated to wayland, the low gpu usage and being enforced to vrr/gsync, all the rest, wayland are there, at least in my experience.

If I didnt run any games, I would have no reason for x11, at this point, as wayland works very well with all the rest.

If other people results are different, it could be due to their own distro and configurations.

https://www.reddit.com/r/linux_gaming/comments/1c2ey6u/comment/kzasm0j/

Another Kwin possible relevant information.

With this second set of variables, the hardware cursor is kept enabled and instead "atomic modesetting" is disabled. The only concrete upside to atomic modesetting I could find was a person reporting that fps are improved when the GPU is under full load.

I tried that variable before, but went black screen. I also read that based on some changes that was no longer needed. But I wonder if those changes took everything into account, leaving the result the samee.

I’m running KDE Neon 6.2.5, and Wayland is still a compromise at best compared to X11 due to all the reasons I mentioned in an earlier post.

1 Like

Seems like issues / bugs related to the desktop environment (in this case KDE) and not wayland itself, since they are features of the DE, unlike the main issues of the thread.

Well, the problem with Wayland as a protocol is the fact that it’s tied largely to the compositor used by the DE in question, with the DE taking over certain functionality normally handled by the display server - Therefore your Wayland experience tends to vary depending on the DE being used; with certain issues isolated to either Wayland or X11 depending on the type of problem being experienced even under the same DE.

At the end of the day, I’m agreeing with you that there are still issues under Wayland that aren’t present under X11 that need to be resolved in order for Wayland to be a viable alternative for many in comparison to X11 - With the FPS/GPU utilization issue being one of those problems.

Yeah.


Today, I tested a game for that first time has linux native support. (Shadow of the tomb raider)

It’s the only one ever to use 100% GPU all the time that I’ve seen. So, this GPU issue could also be related to Wine / Proton. I confirmed this in Wayland and X11.

Because, even X11 does not reach 100% usage most of the time. But it’s game, rig and settings dependant too. And, there could be other factors like specific env vars or nvidia reflex.

Wine 10 will be released with native wayland driver soon, though some proton / wine already it or part (old version) of it, like the one that I usually use (proton-cachyos), I suppose this could be a possible factor in this too.

And because till now Wine used XWayland for Wayland. So, we’ll see.

But not the one from VRR / Gsync enforced. This is most likely GPU driver or DE (compositor) and GPU driver.


I tested two other in attempt to confirm, these were valve titles, both didnt got to full gpu usage, but both had the same gpu usage in both wayland and x11. So, another factor can be the game itself.


I tested shadow of the tomb raider with wayland native driver, while X11 stayed on 90%+ gpu usage. In wayland the GPU usage was 99% most of the time.

Where in another title, Marvel Rivals, X11 has a bit better usage than Wayland, but both stayed 90%+

So, with the new wayland driver, this part might improve. Leaving only one problem left mentioned in this thread.

I got say that with NTSync, the smoothness are improved too.


I suppose this gives more clarity to the main issue. Which was lower gpu usage.

There could be other factors though, but this should bring it closer to X11, than it ever been.

CS2 and Deadlock (both Valve tities) both show no more than 80% GPU usage here running Wayland. In comparison Battlefield 4 running under Proton performs identically to Wayland with 100% GPU usage. CS2 is Linux native, Deadlock is running via Proton.

I’ve tried CS2 with Nvidia Reflex enabled as well as disabled under Wayland, it doesn’t make a difference regarding low GPU usege under Wayland vs X11.

In all cases, the CPU is nowhere near maxed out, I’ve even tried native 4k vs 1200p - The problem doesn’t change at higher resolutions. No matter what you do, GPU utilization will not crack 80% under certain titles under Wayland, but hits 100% under X11 with a corresponding increase in FPS no problem.

What about on Windows, do the valve titles max out in GPU or CPU?

Because, if they dont, the issue would be in the game/engine.

If it’s unable to reach the usage in native, and it’s the same on both display servers, nothing else to see there.

I personally dont really care about valve titles.


Another thing observed in wayland, unrelated to valve titles.

Is that in some games, even if the GPU are not at the X11 usage, but closer with the wayland wine native driver, the overall fps seems lower. Who knows maybe there are more things that will need improvement or will be improved in the actual Wine / Proton 10 release.

I don’t use Windows, so I can’t comment. I’m sure if it was a problem under Windows users would be shouting from the rooftops…

The fact that the issue is only present under Wayland tends to imply a distinct possibility the issue is largely a result of a broader Wayland issue.