celluloid icon indicating copy to clipboard operation
celluloid copied to clipboard

mpv: Prevent blocking in the render update callback for vo=libmpv

Open tsukinaha opened this issue 1 year ago • 4 comments

According to the documentation, setting video-timing-offset to 0 prevents blocking during render updates. This has a noticeable effect on improving the software frame rate on wayland.

photo_2024-09-29_07-52-03

tsukinaha avatar Sep 29 '24 00:09 tsukinaha

I'm not sure this should be the default. Wouldn't it make frame timings worse in some cases?

gnome-mpv avatar Sep 29 '24 17:09 gnome-mpv

I'm not sure this should be the default. Wouldn't it make frame timings worse in some cases?

By default, the render update callback blocks the UI thread for 0.05 seconds during rendering. We really shouldn’t be blocking the UI thread like that.

It works fine on my machine and even helps reduce frame drops. But you’re right, it probably does need more testing.

tsukinaha avatar Sep 29 '24 23:09 tsukinaha

Tested on a laptop with 240Hz screen. Celluloid went from under 60 FPS to 230-240 FPS.

Kimiblock avatar Nov 24 '24 04:11 Kimiblock

After some more testing, I noticed that these options cause a small amount of AV desync (around 0.0002s). From my reading of the documentation, I think we're supposed to time the call mpv_render_context_render() ourselves to eliminate the desync. Once that's done, it should be okay to merge this.

gnome-mpv avatar Nov 24 '24 05:11 gnome-mpv