Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

Gnome with 60hz display causes framerate issues

Open solidv opened this issue 7 months ago • 8 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Is your issue described in the documentation?

  • [x] I have read the documentation

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

When using Gnome 50, if the display is set to 60hz i can't stream at stable 60fps. If i set the display to 120hz i can reach stable 60fps. This only happens with xdg portal, if i try 60hz display with KMS on gnome it works fine. Also in KDE i don't have this issue, i can reach stable 60fps even with display at 60hz. I'm streaming to a xbox series s.

Expected Behavior

No response

Additional Context

No response

Host Operating System

Linux

Operating System Version

Arch

Architecture

amd64/x86_64

Package

Linux - LizardByte/pacman-repo

GPU Type

AMD

GPU Model

9070XT

GPU Driver/Mesa Version

Mesa 26.0.4-arch2.2

Capture Method

XDG Portal Grab (Linux)

Apps


Log output


Online logs

No response

solidv avatar Apr 16 '26 07:04 solidv

I don't use GNOME daily, but I have done some testing related to this. I believe there are multiple issues at play here.

  1. The kmsgrab capture method doesn't do any duplicate filtering. When you see a 60fps incoming rate, it doesn't reflect the active host framerate. The host could be running at a continuous 52fps, but the stream will always see 60fps due to the duplicates. One of the commits that currently part of #4967 will introduce duplicate filtering to kmsgrab, but that commit may be split into another PR later.
  2. GNOME 50's screencasting code doesn't support variable rate capture, so the maximum FPS it can send is currently limited to the host screen refresh rate. This may be part of the problem.
  3. When the host framerate matches the stream framerate, mutter will not sustain the expected framerate when host-side vsync is disabled in games. In my testing, the portalgrab incoming rate would randomly degrade to ~52fps despite the on-screen FPS counter showing a solid 60fps. This actually applies to both kmsgrab and portalgrab capture, but because kmsgrab lies about the incoming framerate (point 1), you can only see this against stable/master by watching for stuttering rather than the reported framerate. Try enabling vsync and see if the issue improves.

psyke83 avatar Apr 16 '26 17:04 psyke83

i can't even get locked 60fps while in desktop. vsync didn't help, the framerate in moonlight xbox while gaming still flactuates between 57/58/59.

solidv avatar Apr 16 '26 18:04 solidv

When the host framerate matches the stream framerate, mutter will not sustain the expected framerate when host-side vsync is disabled in games. In my testing, the portalgrab incoming rate would randomly degrade to ~52fps despite the on-screen FPS counter showing a solid 60fps. This actually applies to both kmsgrab and portalgrab capture, but because kmsgrab lies about the incoming framerate (point 1), you can only see this against stable/master by watching for stuttering rather than the reported framerate. Try enabling vsync and see if the issue improves.

Just wanted to add that this accurately describes the behaviour I see using GNOME: random perceivable frame rate dips in the stream with FPS counters (MangoHUD on the host and incoming FPS in Moonlight) all reporting 60. Enabling v-sync in game helps, but does come at the cost of small stutters in some games (probably with bad v-sync). I saw a similar issue when trying out KDE (to see how things behaved with "Allow tearing"), but that could be https://github.com/LizardByte/Sunshine/issues/4884 (I haven't tried an earlier version to eliminate the newer Plasma version issue).

Happy to try out any debugging/workarounds to help find a fix if you have ideas @psyke83!

seadowg avatar May 29 '26 07:05 seadowg

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

LizardByte-bot avatar Aug 27 '26 20:08 LizardByte-bot

It's still an issue.

seadowg avatar Aug 28 '26 08:08 seadowg

This requires an upstream change which I submitted here: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/5278. Sunshine also needs a slight adjustment so that it will negotiate variable rate for mutter: https://github.com/LizardByte/Sunshine/pull/5569

Edit: actually, the upstream patch may not be needed after all. #5569 may be enough on its own.

psyke83 avatar Aug 29 '26 02:08 psyke83

@psyke83 testing with Ubuntu 26.04.1 (so still on Gnome 50), it does seem like frame pacing issues without v-sync are less noticeable, but I think there are still seems to be small client visible rate drops. I tried with Moonlight's Frame Pacing enabled and disabled, but it was hard to tell the difference.

Obviously worth waiting to see if the linked Gnome changes help once I'm using Gnome 51.

seadowg avatar Oct 04 '26 14:10 seadowg

@psyke83 testing with Ubuntu 26.04.1 (so still on Gnome 50), it does seem like frame pacing issues without v-sync are less noticeable, but I think there are still seems to be small client visible rate drops. I tried with Moonlight's Frame Pacing enabled and disabled, but it was hard to tell the difference.

Obviously worth waiting to see if the linked Gnome changes help once I'm using Gnome 51.

The upstream change makes negotiation smoother, but isn't strictly necessary. As long as you see variable rate at the end of the log it should be fine:

[conn@archlinux ~]$ cat ~/.config/sunshine/sunshine.log | grep -Ei "negotiated frame rate|pacing" | tail -n2
[2026-10-04 15:44:09.674]: Info: [pipewire] Compositor negotiated frame rate: 0/1 (variable rate capture)
[2026-10-04 15:44:09.682]: Info: [pipewire] Sunshine frame pacing: enabled (16.666666ms)

With variable rate I don't encounter any major incoming frame drops as before, but I still feel that pacing is much better with vsync enabled on the host. I haven't tried streaming when the client and host rates are mismatched as I don't have a VRR monitor for it to make sense. Disabling vsync in Moonlight also disables client-side frame pacing, too.

psyke83 avatar Oct 04 '26 14:10 psyke83