Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot 4: Stuttering on project startup. #71361

Open
Marigem opened this issue Jan 13, 2023 · 10 comments
Open

Godot 4: Stuttering on project startup. #71361

Marigem opened this issue Jan 13, 2023 · 10 comments

Comments

@Marigem
Copy link

Marigem commented Jan 13, 2023

Godot version

Godot 4 beta 1 through 12

System information

Arch Linux, GeForce GTX 650, i3-3220

Issue description

Stuttering occurs in the first seconds after the project is ran. Switching to compatibility alleviates the problem a bit but not completely. I know it's an older PC, but I thought maybe there is a problem somewhere since the projects are smooth after that initial stuttering. Meanwhile Godot 3 is smooth as butter as though the PC is brand new (on 2D anyway, heh).

2023-01-13.23-14-30.mp4

Steps to reproduce

Running any project on my Linux machine with specs specified above.

Minimal reproduction project

N/A

@clayjohn clayjohn added this to the 4.x milestone Jan 13, 2023
@clayjohn
Copy link
Member

This is going to require some investigation. Typically we attribute stuttering issues like this to an issue with shader compilation. But that isn't what is going on here as the stutter happens randomly over a few frames and it's occurring in the Vulkan backend.

@Calinou
Copy link
Member

Calinou commented Jan 13, 2023

Can you try enabling the profiler just after the project starts, then stop it once stuttering ends? Also try doing the same with the visual profiler.

@Marigem
Copy link
Author

Marigem commented Jan 13, 2023

profilers

@Calinou
Copy link
Member

Calinou commented Jan 9, 2024

@Marigem Can you (or anyone else) still reproduce this bug in Godot 4.2.1 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

@Marigem
Copy link
Author

Marigem commented Jan 9, 2024

I managed to narrow down the problem.

The stuttering happens when I set the window mode to DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN

This happens on Linux, and setting to DisplayServer.WINDOW_MODE_FULLSCREEN instead, removes the stuttering.

Here is an MRP:
mrp.zip

settings.gd is where the problem happens, upon pressing f11 to toggle fullscreen.

A workaround currently is to check whether it's a linux machine or a windows one and not set exclusive fullscreen if its the linux one.

@Calinou
Copy link
Member

Calinou commented Jan 9, 2024

The stuttering happens when I set the window mode to DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN

This happens on Linux, and setting to DisplayServer.WINDOW_MODE_FULLSCREEN instead, removes the stuttering.

I can't reproduce this on Linux (KDE X11, compositing disabled). Both modes show some unstability in frametimes with the MangoHud readout, but neither mode is more unstable than the other:1

image

Which window manager are you using? Are you on a X11 or Wayland session? Use echo $XDG_SESSION_TYPE to know. If using a X11 session, do you have compositing enabled? It may be automatically suspended when going in exclusive fullscreen, but not when going in "standard" fullscreen.

Footnotes

  1. Ideally, the min/max frametime values should both be 8.3 ms for a 120 Hz target.

@Marigem
Copy link
Author

Marigem commented Jan 10, 2024

It's X11, kde plasma desktop with kwin compositor.

I found that un-ticking "Allow applications to block compositing" removes the stuttering. So it does seem to be a compositor issue.

image

Leaving it ticked and the stuttering will occur when going into exclusive fullscreen.

It is possible that the stuttering occurs because the machine can't keep up with the load of blocking the compositor. But I have no way of testing if that's the case.

@Calinou
Copy link
Member

Calinou commented Jan 10, 2024

I find it very strange that you get stuttering without compositing, but no stuttering with compositing. For me, it's typically the opposite: compositing often makes it impossible to have a smooth, low-latency gaming experience on X11. I have compositing disabled system-wide for this reason…

@Marigem
Copy link
Author

Marigem commented Jan 11, 2024

If the compositor is disabled outright, then no stuttering occurs.

The stuttering occurs when the compositor is enabled, but "Allow applications to block compositing" is also enabled.

So it seems that the act of blocking the compositor is what causes the stuttering, which lasts for around 3 sec.

@h0lley
Copy link

h0lley commented Aug 31, 2024

I am observing this exact issue on Ubuntu, Nvidia, x11 as well, Godot v4.3.stable.official [77dcf97].

image

and just the same, the stutter spike right after starting the game is gone with "Allow applications to block compositing" disabled, however, in its place I am getting constant, ongoing micro-stuttering (perhaps #84137) that is ultimately much worse UX than the one-time spike after startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants