godot icon indicating copy to clipboard operation
godot copied to clipboard

Fix laggy window resize on Wayland

Open wenekar opened this issue 2 weeks ago • 3 comments

Title: Fix laggy window resize on Wayland

Description: scale_changed and size_changed are initialized to true, making the conditional assignments inside the function ineffective—they could only ever set true to true.

This causes no issues on X11 (duh it's wayland_thread.cpp, what was i thinking...), however Wayland window resizing struggles big time. Changing the initial variables back to false fixes lag during window resize.

Regression from #101774?

wenekar avatar Dec 07 '25 15:12 wenekar

Changing the initial variables back to false fixes lag during window resize.

Are you sure that's the case? On sway I feel no speed difference (debug build), although it looks different because the viewport isn't updated as much ("stretching").

While window_state_update_size does stuff, I doubt that it's the main performance hog. Also, in DisplayServer we have a no-op check too, and I'm sure that also the Vulkan/OGL contexts no-op too, which I assume are the heaviest things.

deralmas avatar Dec 07 '25 21:12 deralmas

Changing the initial variables back to false fixes lag during window resize.

Are you sure that's the case? On sway I feel no speed difference (debug build), although it looks different because the viewport isn't updated as much ("stretching").

Yes, and no. On KDE Wayland when I build with them initially false I can resize the windows without them lagging, while leaving them true causes lag.

Am I sure this is the root cause of the problem? Heck no! I got annoyed from laggy window resizing on wayland and decided to look it up myself, tried this, fixed, oh cool MR time.

I can upload videos of both builds in ~12 hours when I'm home from work.

Edit: I should also, very probably, profile it with them set to true, so we can have something to point at.

wenekar avatar Dec 08 '25 06:12 wenekar

No rush. Any further investigation, while appreciated, is not necessary to merge this patch as this fixes a very obvious mistake. I'm glad you caught this :D

That said, when you the have time I'd be curious hearing about your setup (OS, GPU, drivers, compositor etc).

deralmas avatar Dec 08 '25 10:12 deralmas

Thanks! Congratulations on your first merged contribution! 🎉

Repiteo avatar Dec 08 '25 18:12 Repiteo