[Xorg + NVIDIA] Mutter is locked at 60fps even when monitors are running at 144hz (+example patches)
Version: 3.28.1 OS: Ubuntu 18.04 Drivers: proprietary nvidia 396.24 2x 144hz monitors
I spent some time debugging why dragging windows around wasn't smooth at all in gnome-shell. The mouse rendered and moved fine (at 144hz, but that's the GPU taking care of it), while mutter seemed to be locked at 60.
Fairly confident that this is not a hardware issue; on Xfce, Mate, i3, Plasma I didn't have this problem (all of them running with a compositor).
The first step was to remove all of Ubuntu's patches for mutter (except the startup-notifications patch, this one is also present in fedora 28 mutter packages from what I see). This didn't bring any change.
After some digging, discussions in #gnome-hackers and rebuilt mutter with this patch. The result was "ok", but not satisfied yet.
I looked around and came upon this other patch
After applying those two I had the desired results.
I am not actually sure what the second patch does (I never looked at any code part of the gnome project before). It apparently benefits nvidia users somehow from the description I saw on the AUR page. Would a workaround be possible without an external patch ?
For the first patch, replacing hardcoded values. It is probably related to this discussion. I think a short-term solution would benefit a lot of people. Perhaps allowing to set the refresh rate as an environment variable (CLUTTER_REFRESH_RATE perhaps?), defaulting to the old value of 60. This doesn't help people with monitors with different rates, but it would certainly benefit more people than the current code does.