Strange framerate drop on Gnome on amdgpu

I have a very odd problem I am trying to wrap my head around… ever since updating from kernel 5.16.9 to anything higher, the Gnome desktop has been quite sluggish. After trying out a few things I found that when running glxgears the framerate stays often below 60hz, or the refresh rate of my two monitors. Looking like this for example:

glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
217 frames in 5.0 seconds = 43.397 FPS
177 frames in 5.0 seconds = 35.301 FPS
169 frames in 5.0 seconds = 33.683 FPS
184 frames in 5.7 seconds = 32.391 FPS
163 frames in 5.0 seconds = 32.518 FPS
265 frames in 5.0 seconds = 52.838 FPS
274 frames in 5.0 seconds = 54.693 FPS
275 frames in 5.0 seconds = 54.826 FPS

When doing nothing, just having a Chrome window open, it drops to a steady 55 fps. Moving the window around or switching desktops or anything else makes it drop even more.

However: when running glxgears without sync to refresh rate, there is no problem.

vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
117004 frames in 5.0 seconds = 23400.729 FPS
109880 frames in 5.0 seconds = 21975.996 FPS
111736 frames in 5.0 seconds = 22347.018 FPS
119470 frames in 5.0 seconds = 23893.951 FPS
120343 frames in 5.0 seconds = 24068.547 FPS
120781 frames in 5.0 seconds = 24156.186 FPS
121270 frames in 5.0 seconds = 24253.859 FPS

Interestingly, when running glxgears without vertical sync, the desktop becomes snappy as it should be.


Running the same test without overriding vblank_mode on the older kernel 5.16.9 gives the following result, which is basically as expected:

glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
306 frames in 5.0 seconds = 60.998 FPS
300 frames in 5.0 seconds = 59.997 FPS
299 frames in 5.0 seconds = 59.792 FPS
300 frames in 5.0 seconds = 60.000 FPS
300 frames in 5.0 seconds = 59.997 FPS
298 frames in 5.0 seconds = 59.598 FPS

My setup is this:

AMD Ryzen 3900X
AMD 5500XT GPU (Navi 14)
kernel 6.1.2
Gnome 43.2 on Wayland
two 4k displays @ 60hz

Any ideas how to fix this? It is really a bit annoying…

So if anyone ever finds this interesting, there is actually an issue on Gnome’s GitLab related to this. It appears to be both related to the AMD 5500XT and Gnome’s Mutter somehow.