Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wayland: use the surface-suspension-v1 protocol #8959

Closed

Conversation

Dudemanguy
Copy link
Member

An implementation of the surface-suspension-v1 protocol for mpv wayland. See the upstream discussion here. Everyone seems to like it, so hopefully the protocol won't sit in wayland-protocols forever. I plan to merge this after the protocol gets upstreamed with a new release.

You can test this by using: swaywm/sway#6336

@Dudemanguy
Copy link
Member Author

Sidenote: we could actually be pretty aggressive with this protocol. If we always trust the compositor to tell us when the surface is suspended, then eglSwapInterval could be set to 1 and vulkan's present mode set to FIFO because it would guarantee that the blocking calls would never indefinitely block/stall the player. That would let me delete some more wayland code and simplify it. I probably won't do that the first pass around (that WIP sway implementation is imperfect of course), but in the future this will probably be a hard requirement for mpv to function on wayland.

@Dudemanguy Dudemanguy force-pushed the wayland-surface-suspension branch 3 times, most recently from d31c7ac to 55e74d3 Compare June 30, 2021 16:53
Currently, mpv tries very hard to not do wasteful draws when the surface
is hidden. This is accomplished by abusing vo_wayland_wait_frame and
just guessing that consecutive timeouts == surface hidden. This works
but it's pretty ugly (explaining why wl->timeout_count > 1 is an entire
novel. Go dig up that commit if you're curious). Luckily, we now have
the ability to just get suspended events from the compositor. Delete the
entire timeout/hidden surface heuristic and use the surface_suspended
and surface_resumed events instead. As a side effect of this, this means
that mpv will always "overdraw" (i.e. render when not needed) if the
compositor does not implement this protocol. If this bothers you, go bug
your compositor developers to fix it and/or switch do a better one.
@Dudemanguy
Copy link
Member Author

Closing since upstream looks like it'll make this a part of xdg-shell instead.

@Dudemanguy Dudemanguy closed this Mar 30, 2023
@Dudemanguy Dudemanguy deleted the wayland-surface-suspension branch March 30, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant