godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.9k stars 21.05k forks source link

Child windows drop to 1 FPS they obscure their parent [Wayland/Mutter] #69926

Open santiagocezar opened 1 year ago

santiagocezar commented 1 year ago

Godot version

v4.0.beta7.official [0bb1e89fb]

System information

Arch Linux, GNOME Wayland 43.2, Intel UHD Graphics 620, Mesa 22.2.3

Issue description

Child windows seem to be frame limited when covering their parent window. This is caused by GNOME Mutter window culling, which prevents unnecesary redraws for windows that are not visible.

Grabación de pantalla desde 2022-12-11 16-17-23.webm

This also happens when clicking Browse in that dialog, because it opens the file picker which covers it instantly.

Steps to reproduce

  1. Open the Project Manager
  2. Click on "New Project"
  3. Resize the window so it covers the Project Manager
    (or alternatively, click the browse button)
  4. Interact with new child window

Minimal reproduction project

N/A

Calinou commented 1 year ago

This is likely expected. Low processor mode is enabled in the editor and project manager, which means redrawing only occurs if needed.

Can you reproduce this in the editor when the Update Continuously editor setting is enabled?

This might be caused by some kind of check that lowers the app/game FPS when it's minimized or covered by another window

I don't think Godot is actively checking for window obstruction – this is likely the OS/window manager doing its job here. You can try this with other windows not spawned by Godot.

santiagocezar commented 1 year ago

This is likely expected. Low processor mode is enabled in the editor and project manager, which means redrawing only occurs if needed.

I don't think that's what's causing problems here, in the screencap I was constantly writing stuff into the textbox, which should trigger a redraw.

Can you reproduce this in the editor when the Update Continuously editor setting is enabled?

Can reproduce.

I don't think Godot is actively checking for window obstruction – this is likely the OS/window manager doing its job here. You can try this with other windows not spawned by Godot.

Yeah just found out that this is a Mutter feature, not Godot. In that case, do child windows have an independent frame rate to their parent? If they don't then that might be the root of the issue.

lcarsos commented 8 months ago

I have this issue also, but I'm running sway and the problem seems to be related to window size on my machine. When a dialog pops up, it goes into tiling, taking up half the screen, and the frame rate is quite low, but nothing is being obscured. When I make the window smaller or allow it to float at it's normal resolution performance is near what I expect.

nonchip commented 3 months ago

i had a similarish issue (frame rate / general "performance feeling" being shit, and whole windows just being completely black when they don't have the focus, which seems to be an interaction with a different issue where the compositor sometimes blanks buffers when it shouldnt, i have black flashes in some games too that do "weird advanced vsync things" through WINE/Proton) issue when running recent 4.2 and 4.3 on Wayland/KDE-plasma.

then i noticed that it was still actually using the X11 backend through XWayland, and if i start godot with --display-driver wayland --rendering-driver vulkan or set ProjectSettings["run/platforms/linuxbsd/prefer_wayland"] (which was default off for me), all those issues vanished for me.

lilly-lizard commented 6 days ago

updated link to the mutter window culling source code referenced in the issue (original link has wrong line number now) https://gitlab.gnome.org/GNOME/mutter/-/blob/89af55d8aa3c98157d34fde4c4c60b83a5a7c346/src/compositor/meta-window-actor.c#L1635