hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.09k stars 882 forks source link

Weird Lag when dragging floating windows #1127

Closed System-x64 closed 1 year ago

System-x64 commented 1 year ago

on setting misc{animate_manual_resizes} to true, the window gets a weird lag or idk what to call it

https://user-images.githubusercontent.com/90208727/204487118-c616074f-5d5d-4f64-9a72-7112c315d42d.mp4

Is their anyway we could fix it cuz i really love animated resize but i hate this lag thing

vaxerski commented 1 year ago

only happens for a few people which does not include me, so I don't know what is the root cause.

System-x64 commented 1 year ago

nvm

EvilBoi123 commented 1 year ago

same, happen to me too

ad-on-is commented 1 year ago

Me too, I noticed this happens when I enable animations. Otherwise it's fine.

vaxerski commented 1 year ago

can someone share a minimal reproducible config?

System-x64 commented 1 year ago

hyprland.txt

System-x64 commented 1 year ago

Me too, I noticed this happens when I enable animations. Otherwise it's fine.

Yeah...but turning animations off also removes this resize animation...maybe thats why it works?

System-x64 commented 1 year ago

it's something to do with animate_manual_resize only

System-x64 commented 1 year ago

@vaxerski I found the possible cause of this issue, while looking through my config file, I noticed I had a separate windowsMove animation with its own separate bezier curve, I removed the windowsMove line and Voila! It is working as expected, my guess is that this lag issue only persists when we explicitly set a separate beizier curve for windowsMove?

System-x64 commented 1 year ago

Is it possible to set this windowsMove thing to only apply to keybinds instead of both key and mouse binds? I suppose this would fix this issue without having to sacrifice my bezier style

vaxerski commented 1 year ago

thanks for identifying. I'll look into this.

Is it possible to set this windowsMove thing to only apply to keybinds instead of both key and mouse binds? I suppose this would fix this issue without having to sacrifice my bezier style

No.

vaxerski commented 1 year ago

check with b9812f8bc0f372875af8c332e4537fdbf2b99c23

System-x64 commented 1 year ago

The lag does seem to get better (it's more responsive) but it's not completely gone, the best bet for now is to not put bezier for windowsMove all together

ad-on-is commented 1 year ago

Is it possible to set this windowsMove thing to only apply to keybinds instead of both key and mouse binds? I suppose this would fix this issue without having to sacrifice my bezier style

removing windowsMove did not solve the issue for me

System-x64 commented 1 year ago

Can you share me your config? @ad-on-is

ad-on-is commented 1 year ago

Can you share me your config? @ad-on-is

Sure: https://pastebin.com/GCYkbCuW

DashieTM commented 1 year ago

~~@vaxerski sorry for the ping, but I have a likely cause for this, animate manual resizes = true. At least that setting causes this exact issue on 3 different pcs~~ long day sorry.

vaxerski commented 1 year ago

umm thats exactly what the reporter said... image

it's just that I can't repro it. Been always using it on true and nothing's amiss

DashieTM commented 1 year ago

So I tried to build version 14, but I have no idea how to get the compatible wlroots for that. Either way I remember this starting to happen between version 14 to 16. I can't pinpoint it though sadly.

vaxerski commented 1 year ago

So I tried to build version 14, but I have no idea how to get the compatible wlroots for that.

git reset --hard <hash> --recurse-submodules && sudo make install ?

DashieTM commented 1 year ago

Ah thanks for the info, personally never used submodules with git, that's why I didn't understand that part, in the meantime I tried your binaries, and the problem starts at version 17. Tomorrow I might be able to be pinpoint when it started.

vaxerski commented 1 year ago

thank you. git bisect may come in handy.

DashieTM commented 1 year ago

Found it, this commit creates the bug: https://github.com/hyprwm/Hyprland/commit/8ffd244ef6cca76af51e283355ae048557510349

vaxerski commented 1 year ago

well that's anticlimactic. That's the commit that introduced the animations on dragging floating windows.

DashieTM commented 1 year ago

I was also extremely surprised, and I still can't figure out why though. When I move the window extremely slowly it works. But the moment I do it with a normal speed it has these small stops where it freezes. A brief guess would be a performance issue, but I doubt that an rx6600xt or a gtx 1070 wouldn't be good enough.

I guess my suggestion is to put this behind a different config flag, animate_mouse_windowdragging.

vaxerski commented 1 year ago

I mean, it could also be your curve.

How it's currently animated is that whenever you move your window by 1 pixel or more, it restarts the animation.

My guess is that it's not lag, but the animation curve snapping back to the start.

Can you try with a linear curve? it's 0.5,0.5,0.5,0.5.

DashieTM commented 1 year ago

Hmm, it doesn't make much of a difference, I guess there is always going to be a slight "delay" with animations, but it definitely doesn't feel right. Perhaps polling rate (and/or refreshrate etc ) might cause some issues here as well ? (I haven't checked how the tick is done)

DashieTM commented 1 year ago

I added that config flag for now in a pr -> https://github.com/hyprwm/Hyprland/pull/1658, not necessarily a fix, but this allows users to still get manual resizes without floating window animations.

vaxerski commented 1 year ago

you can't really fix it cuz it works as intended... #1658 merged

vaxerski commented 1 year ago

I also suppose misc:vfr = false doesn't fix this right?

vaxerski commented 1 year ago

patch.txt

please check out this patch

DashieTM commented 1 year ago

Neither of them made the result much different sadly.

vaxerski commented 1 year ago

can you try with the "default" curve?

DashieTM commented 1 year ago

I tried a lot of curves, including the default one with different "speeds".

vaxerski commented 1 year ago

I still can't repro it, even with configs provided by other people.

I'll be posting patches then and I'd like for everyone affected to try and report the results.

If someone has posted it doesn't work already, no need to affirm them. If someone posted it works though, feel free to double their comment so that I know it's not fixed just for them.

Please test this patch: patch.txt

jacekpoz commented 1 year ago

no changes to the bug with this patch, only difference I can see so far is the mouse cursor being reset to the default one

vaxerski commented 1 year ago

IIRC @jacekpoz your issue was not the lag but delay, which is intended.

jacekpoz commented 1 year ago

what do you mean intended it didn't happen before

vaxerski commented 1 year ago

misc:animate_manual_resizes and misc:animate_manual_windowdragging to false to get the "old" behavior.

jacekpoz commented 1 year ago

whoopsie daisy

DashieTM commented 1 year ago

Alright, here some feedback and some questions.

The performance has been improved by a lot on the default curves(very close to no difference to animation disabled), but now it definitely does depend on the curve used, some are still extremely bad, which makes sense ofc. Not every curve fits this animation.

Does the performance in the debug version differ much? I have not tested the regular installation yet, only via the debug environment. If so I will retest with the regular version.

And lastly, because of the dependency on a specific curve, I would suggest leaving this behind a config flag, might be enabled by default ofc should that be the idea.

Either way, nice work!

vaxerski commented 1 year ago

And lastly, because of the dependency on a specific curve, I would suggest leaving this behind a config flag, might be enabled by default ofc should that be the idea.

it is.

Patch pushed in 34685a836a40648167848060b48b62788cdcc85f. Lmk how it runs in a real session.

I am only interested in the choppiness. If it's delayed / slow, that's an effect of your windowsMove animation setting.

GrabbenD commented 1 year ago

Patch pushed in 34685a8. Lmk how it runs in a real session.

I tried this commit and here's my observations:

vaxerski commented 1 year ago

huuuh

can you see if debug:damage_tracking=1 fixes the stutter? (tho don't keep it at that setting after testing god-forbid)

GrabbenD commented 1 year ago

can you see if debug:damage_tracking=1 fixes the stutter? (tho don't keep it at that setting after testing god-forbid)

This made huge difference!

(For reference, I'm using the performance power governor).

vaxerski commented 1 year ago

Can you (without the damage_tracking opt changed now, you can remove it) turn on debug:damage_blink (warning: epilepsy) and see whether if you move the window quickly the pink highlight follows it correctly?

vaxerski commented 1 year ago

reproduced, found the issue. Fix on the way. 10 month old bug. Nice.

System-x64 commented 1 year ago

Finally 😭

vaxerski commented 1 year ago

fixed with 64f35c0e3190f3b56a1c17e81c775966bd0a2251

I was searching in all the wrong places. Murphy's law at its finest.

The source of the issue was invalid bezier calculations for very small $t$ values.

@ sample size 1200: image

This was causing the perceived "hiccups"

NextWork123 commented 1 year ago

Hello, I tried the latest commit but I'm still experiencing the same issue :/. I have an AMD RX 6600 with Mesa-stable. I also tried setting misc{animate_manual_resizes} to false and true to test, but the result was the same.

https://user-images.githubusercontent.com/46625863/222792947-3346668e-b70e-4602-a1b5-470fb081e291.mp4