-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix round-robin frame drawing behavior
Before this commit, every time redraw() was called, it would block and wait for a new frame. This works when only one output is being drawn; but when multiple outputs are drawn, this means only one output at a time is given the latest frame, instead of all of them. This change makes redraw() non-blocking,† and uses mpv_render_context's set_update_callback method to request redraws from for all outputs when a new frame is available. This requires a) tracking the lifetime of all frame callbacks, to ensure frames are not rendered too quickly (before the frame callback has returned) and b) extending the main loop so that it can be woken up via self-pipe trick after the mpv update callback is invoked. † eglSwapBuffers calls wl_display_roundtrip(), so technically redraw() ends up waiting for the compositor to respond. This can introduce some extra lag when drawing onto many outputs at once. It's possible to avoid this problem by managing the buffers onto which OpenGL draws ourselves and committing the output surfaces as a batch. However, doing so would be quite complicated.
- Loading branch information
Showing
1 changed file
with
68 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters