WayfireWM / wayfire

A modular and extensible wayland compositor
https://wayfire.org/
MIT License
2.35k stars 174 forks source link

Monitor refresh rate influences animation behavior (of some plugins) #1420

Open Nuc1eoN opened 2 years ago

Nuc1eoN commented 2 years ago

I have a multi monitor setup configured like this:

[output:DP-2]
mode = 1920x1080@239000
position = 0,0
transform = normal
scale = 1.000000

[output:HDMI-A-2]
mode = 1920x1080@60000
position = 1920,0 
transform = normal 
scale = 1.000000 

So basically I have noticed that my 240hz monitor displays some animations differently (I guess faster) than my 60hz secondary monitor.

I have found this to be true with wobbly windows and the fire animation. vswitcher, expo, zoom do not seem to be affected (at least my eye doesn't notice it)

With wobbly: The window on my 60hz monitor is super wobbly, while on 240hz it is pretty stiff. This is only true for the display from which you've "started". Say you start to drag the window on the 60hz side, it will still persist to be extremely wobbly while you drag it over to the monitor with the higher refresh rate.

With fire: The animation on 240hz is super smooth. It looks like the window is cleanly burning from the bottom to the top. The flame is closely following the bottom window border. On 60 hz this looks totally different: Overall the window vanishes at the same speed, but the flames themselves (I guess) animate slower. So what this mean is, that the fire doesn't "follow" the bottom window border, but basically gets repeated and it looks like the whole window just "burned". It looks like the flame animation gets repeated over the whole space. So it is actually pretty different I must say.

However I find it to be more obvious and thus easier to reproduce with wobbly windows.


To Reproduce Prequisites: Well I guess you need a monitor with at least 75hz. You do not need a multi monitor setup to reproduce this. Also set animate.duration=100 (I think the default value is 500). I do not know if that makes a difference, but that is my setting.

Then:

  1. Apply 60hz rate to your monitor
  2. Test how wobbly your window is by shaking it vigorously.
  3. Now apply the highest refresh rate you can. Preferably 240hz, 144hz, maybe even on 75hz there will be a noticable difference.
  4. Shake vigorously.

If you do not have a high refresh rate monitor, maybe you can set your monitor to a lower refresh rate? 29hz or 30hz is often possible to be set. As a last resort, monitor refresh rates can also be overriden by editing EDID information. I manage to overclock my 60hz monitor to 75hz easily (anything above that fails). If you want to know how to do this I guess research by yourself :p

Expected behavior Animation's behavior should not depend on the monitors refresh rate!

Wayfire version 0.7.2

Nuc1eoN commented 2 years ago

Here are some screen recordings with the wonderful wf-recorder:

60hz: https://0x0.st/oHit.mp4 240hz: https://0x0.st/oHiw.mp4

Notice the wobblyness difference. The difference in the fire animation should also be visible to you.

valpackett commented 2 years ago

fire literally has a "FIXME: don't hardcode 60FPS" :)

https://github.com/WayfireWM/wayfire/blob/9458f58959512222f3f154b40b0a48584033ca24/plugins/animate/fire/particle.cpp#L163-L164

To test if that's all there is to fix, try replacing the 16.0 with a 4.0.

wobbly also has a hardcoded 16 for a "not WobblyVelocity" case whatever that means:

https://github.com/WayfireWM/wayfire/blob/9458f58959512222f3f154b40b0a48584033ca24/plugins/wobbly/wobbly.c#L526-L528

try 4 here too.

Nuc1eoN commented 2 years ago

Uhh ah!

Thanks for making the research. I will need to set up a local build of wayfire then, gonna come back here once I've made the tests!

not-nullptr commented 6 months ago

bumping !! very noticable using the wobbly animations on 144hz and 390hz (also some flickering whilst using it?)

ammen99 commented 6 months ago

@not-nullptr I do not have mixed-refresh-rate monitors so I cannot easily test this. If you're willing to test patches, I can send you a patch and if it works, we can merge upstream. For example https://0x0.st/HR9B.diff, does that help at all?

Nuc1eoN commented 6 months ago

@ammen99 you could set up two monitors and set them to different refresh rates, e.g. if you have low rated monitors one in 60hz (or better 75hz if it supports this) and one in 30hz.

Or if you have only one monitor it would also work but you wouldn't have a side by side. Since the wobbliness effect depends on the refresh rate you should notice a difference between 60 and 30hz I think.

ammen99 commented 6 months ago

@ammen99 you could set up two monitors and set them to different refresh rates, e.g. if you have low rated monitors one in 60hz and one in 30hz.

Or if you have only one monitor it would also work but you wouldn't have a side by side. Since the wobbliness effect depends on the refresh rate you should notice a difference between 60 and 30hz I think.

I am mostly on a single-monitor setup and usually use nested wayland displays for multi-output testing nowadays xD

ammen99 commented 6 months ago

I also think the main difficulty here is getting wobbly to work on mixed-refresh-rate systems. Even if it works the same on one monitor with 30 vs 60fps that doesn't necessarily mean everything is correct for multi-rr setups.

Nuc1eoN commented 6 months ago

@ammen99 not try to convince you of anything but if that's the way you work, I would bet that a dual monitor setup would greatly increase your comfort and maybe even productivity. It did that to me. Now using one monitor is like you are missing a right arm 😁 Just saying, sorry for the aside :D

Nuc1eoN commented 6 months ago

I also think the main difficulty here is getting wobbly to work on mixed-refresh-rate systems. Even if it works the same on one monitor with 30 vs 60fps that doesn't necessarily mean everything is correct for multi-rr setups.

Personally I don't think so. The only reason why it is apparent on a multi-monitor setup is because you can compare the animations side by side.

So practically the bug is there also on single monitor setups. But how would you ever notice that the animation is 'too' fast or too 'slow' if you have nothing to compare against.

On a 60hz to 240hz scale this is just blatantly obvious.

Not to say that there cannot be a bug on a multimonitor setup. But apart from the wobblyness there is no misbehavior. The effect works great on both monitors, just that it beheaves totally different and that makes it unpleasant.

not-nullptr commented 6 months ago

@not-nullptr I do not have mixed-refresh-rate monitors so I cannot easily test this. If you're willing to test patches, I can send you a patch and if it works, we can merge upstream. For example https://0x0.st/HR9B.diff, does that help at all?

more than willing - i'm just unsure on how to use this to patch my local copy?

ammen99 commented 6 months ago

more than willing - i'm just unsure on how to use this to patch my local copy?

Go to the directory where you downloaded Wayfire-git, run

curl  https://0x0.st/HR9B.diff | git apply

And then compile as usual.