Irregular frame rate in some fullscreen games

Bug #2016990 reported by Ernst Persson
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mutter
Fix Released
Unknown
mutter (Ubuntu)
Fix Released
High
Daniel van Vugt
Jammy
Won't Fix
Undecided
Unassigned
Lunar
Fix Committed
High
Jeremy Bícha
Mantic
Fix Released
High
Daniel van Vugt

Bug Description

[ Impact ]

I'm having a strange issue with the game Path of Exile (free). With Ubuntu Wayland session, vsync on, I get very irregular frame rates, it jumps around 40 fps.
If I switch to Plasma Wayland the game is very smooth 60 fps.

I'm running the game from Steam with Proton. I've tried Proton Experimental and Proton 8.0 so far, no difference.
The game uses Vulkan so I guess it's being allowed to set up all the swap and presentation stuff pretty much itself... ?

MUTTER_DEBUG_DISABLE_TRIPLE_BUFFERING=1 doesn't help Mutter so it's not strictly related to triple buffering, which makes sense since it's a full screen game anyway.

[ Test Plan ]

None known, other than the OP to run the game.

[ Where problems could occur ]

In rendering performance of fullscreen apps/games.

[ Workaround ]

Add this to /etc/environment:
CLUTTER_PAINT=disable-dynamic-max-render-time

[ Other Info ]

Kernel: 6.2.0-1003-lowlatency
GPU: Radeon 6800 XT
CPU: Ryzen 9 5900X

tags: added: amdgpu lunar performance
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

For lunar, please try MUTTER_DEBUG_TRIPLE_BUFFERING=never although I don't expect that's the issue. Assuming that's not the issue, please also try MUTTER_DEBUG=kms and then monitor the posting method with:

  journalctl -f /usr/bin/gnome-shell | grep Posting

or collect it afterwards:

  journalctl -b0 /usr/bin/gnome-shell | grep Posting > journal.txt

and attach the results here.

Separately, another setting to try is: CLUTTER_PAINT=disable-dynamic-max-render-time

Changed in mutter (Ubuntu):
status: New → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

If all of those fail to improve the situation then having "vsync on" in the game might be triggering https://gitlab.gnome.org/GNOME/mutter/-/issues/2646 which is fixed in Mesa 23.0.2. Though you should have that fixed version already, unless you're using a proprietary AMD driver?

Revision history for this message
Ernst Persson (ernstp) wrote :

If I set CLUTTER_PAINT=disable-dynamic-max-render-time it fixes the issue! I only had that variable set during the test.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thanks. Does that mean MUTTER_DEBUG_TRIPLE_BUFFERING=never made no difference?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Please report the bug upstream at https://gitlab.gnome.org/GNOME/mutter/-/issues and mention:

 * GPU model
 * graphics driver in use (lspci -k)
 * The version of libmutter installed (should be 44.0)
 * That CLUTTER_PAINT=disable-dynamic-max-render-time fixes it

Changed in mutter (Ubuntu):
importance: Undecided → High
status: Incomplete → Triaged
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The other upstream issue currently open that requires CLUTTER_PAINT=disable-dynamic-max-render-time is https://gitlab.gnome.org/GNOME/mutter/-/issues/2334 but that seems to be different enough that you should log a new bug.

tags: added: dynamic-max-render-time
Revision history for this message
Ernst Persson (ernstp) wrote :

I tested MUTTER_DEBUG_TRIPLE_BUFFERING=never first and it made no difference.

Changed in mutter:
status: Unknown → New
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This bug might be another cousin of bug 2017137 and bug 2017097 (both fixed as part of the 44.1 update). It would happen on either Wayland or Xorg if the graphics driver doesn't support timestamp queries.

Changed in mutter (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in mutter (Ubuntu):
status: Triaged → Fix Committed
status: Fix Committed → In Progress
tags: added: fixed-in-mutter-45 fixed-upstream
Changed in mutter (Ubuntu Lunar):
importance: Undecided → High
status: New → Triaged
summary: - [Lunar] Irregular FPS with Path of Exile
+ Irregular frame rate in some fullscreen games
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

According to upstream, the fix for this bug can't safely be applied to releases before 44.0 (https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3080#note_1772454) so I just *hope* nobody encounters this bug on jammy.

Changed in mutter (Ubuntu Jammy):
status: New → Won't Fix
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
description: updated
Changed in mutter (Ubuntu Mantic):
status: In Progress → Fix Committed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Actually if we did need to fix jammy then we could just enforce the workaround there:
CLUTTER_PAINT=disable-dynamic-max-render-time

Changed in mutter:
status: New → Fix Released
tags: added: fixed-in-mutter-44.3
removed: fixed-in-mutter-45
Changed in mutter (Ubuntu Lunar):
status: Triaged → Fix Committed
Jeremy Bícha (jbicha)
Changed in mutter (Ubuntu Lunar):
status: Fix Committed → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mutter - 44.2-3ubuntu1

---------------
mutter (44.2-3ubuntu1) mantic; urgency=medium

  * Merge with Debian. Remaining changes:
    - Add x11-Add-support-for-fractional-scaling-using-Randr.patch
    - Add window-Add-ability-to-override-the-edge-constraints.patch
      + Make possible for extensions (such as Tiling Assistant) to override
        window constraints

mutter (44.2-3) experimental; urgency=medium

  * Cherry-pick patch to fix build test with mesa 23.1 (LP: #2025287)

mutter (44.2-2ubuntu1) mantic; urgency=medium

  * Merge with Debian. Remaining changes:
    - Add x11-Add-support-for-fractional-scaling-using-Randr.patch
    - Add window-Add-ability-to-override-the-edge-constraints.patch
      + Make possible for extensions (such as Tiling Assistant) to override
        window constraints

mutter (44.2-2) experimental; urgency=medium

  [ Daniel van Vugt ]
  * Cherry-pick 2 patches for stuttering fixes
    * Avoid cursor stuttering over some windows (LP: #2023766). This will also
      improve best-case input latency by roughly half a frame.
    * Avoid render stuttering in some fullscreen games (LP: #2016990).
  * Update Support-Dynamic-triple-double-buffering.patch
    * Fix a failure to resume from sleep (frozen black screen), which seems
      to be an old bug but only became likely in 44.1.
    * Fix a crash on resume from sleep (LP: #2020049).

 -- Jeremy Bícha <email address hidden> Wed, 28 Jun 2023 15:31:07 -0400

Changed in mutter (Ubuntu Mantic):
status: Fix Committed → Fix Released
Jeremy Bícha (jbicha)
Changed in mutter (Ubuntu Lunar):
status: Triaged → In Progress
Changed in mutter (Ubuntu Lunar):
status: In Progress → Fix Committed
assignee: nobody → Jeremy Bícha (jbicha)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.