mpv/video/out/vulkan
Dudemanguy 6158bb5be2 x11: avoid wasteful rendering when possible
Because wayland is a special snowflake, mpv wound up incorporating a lot
of logic into its render loop where visibilty checks are performed
before rendering anything (in the name of efficiency of course). Only
wayland actually uses this, but there's no reason why other backends
(x11 in this commit) can't be smarter. It's far easier on xorg since we
can just query _NET_WM_STATE_HIDDEN directly and not have to do silly
callback dances.

The function, vo_x11_check_net_wm_state_change, already tracks net wm
changes, including _NET_WM_STATE_HIDDEN. There is an already existing
window_hidden variable but that is actually just for checking if the
window was mapped and has nothing to do with this particular atom. mpv
also currently assumes that a _NET_WM_STATE_HIDDEN is exactly the same
as being minimized but according to the spec, that's not neccesarily
true (in practice, it's likely that these are the same though). Anyways,
just keep track of this state in a new variable (hidden) and use that
for determing if mpv should render or not.

There is one catch though: this cannot work if a display sync mode is
used. This is why the previous commit is needed. The display sync modes
in mpv require a blocking vsync implementation since its render loop is
directly driven by vsync. In xorg, if nothing is actually rendered, then
there's nothing for eglSwapBuffers (or FIFO for vulkan) to block on so
it returns immediately. This, of course, results in completely broken
video. We just need to check to make sure that we aren't in a display
sync mode before trying to be smart about rendering. Display sync is
power inefficient anyways, so no one is really being hurt here. As an
aside, this happens to work in wayland because there's basically a
custom (and ugly) vsync blocking function + timeout but that's off
topic.
2022-04-11 18:14:22 +00:00
..
common.h libplacebo: switch to v4 naming convention 2022-02-03 18:22:14 +01:00
context.c vulkan: correctly inherit proc_addr pointer 2022-03-13 23:39:31 +01:00
context.h wayland_vk: rename start_frame to check_visible 2021-11-04 15:59:56 +00:00
context_android.c wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
context_display.c libplacebo: update log helpers 2022-02-03 18:22:14 +01:00
context_wayland.c wayland: unify visibility checking code 2022-04-11 18:14:22 +00:00
context_win.c wayland: use callback flag + poll for buffer swap 2019-10-10 17:41:19 +00:00
context_xlib.c x11: avoid wasteful rendering when possible 2022-04-11 18:14:22 +00:00
utils.c libplacebo: update log helpers 2022-02-03 18:22:14 +01:00
utils.h vo_gpu: vulkan: use libplacebo instead 2019-04-21 23:55:22 +03:00