diff options
author | Dudemanguy <random342@airmail.cc> | 2020-12-11 13:14:50 -0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2020-12-14 22:44:43 +0000 |
commit | b59eaf57fef7b4fef37991ad68bdba3a6fca3490 (patch) | |
tree | e133740f3509be6cba82b5d094071745b19e27e1 /video/out/vo_wlshm.c | |
parent | 8e793bde78f00fbb64223db30851c6d080c4abeb (diff) | |
download | mpv-b59eaf57fef7b4fef37991ad68bdba3a6fca3490.tar.bz2 mpv-b59eaf57fef7b4fef37991ad68bdba3a6fca3490.tar.xz |
wayland: unify frame/presentation callback code
Originally when presentation time was implemented, the frame callback
and presentation feedback functions were called in each rendering api's
separate backend (egl and vulkan). This meant that their respective
structs were basically copy and pasted across both files. Plus later
vo_wlshm started using frame callbacks too. Things got refactored a few
times and it turns out there's actually no need to have these things
separate anymore. The frame callback can just be initialized in
vo_wayland_init and then everything else will follow from there. Just
move all of this code to wayland_common and get rid of the duplication.
Sidenote: This means that vo_wlshm can actually receive presentation
feedback now. It's really simple to do so might as well. See the next
commit.
Diffstat (limited to 'video/out/vo_wlshm.c')
-rw-r--r-- | video/out/vo_wlshm.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/video/out/vo_wlshm.c b/video/out/vo_wlshm.c index f6c37714da..994df64d02 100644 --- a/video/out/vo_wlshm.c +++ b/video/out/vo_wlshm.c @@ -73,25 +73,6 @@ static void buffer_destroy(void *p) munmap(buf->mpi.planes[0], buf->size); } -static const struct wl_callback_listener frame_listener; - -static void frame_callback(void *data, struct wl_callback *callback, uint32_t time) -{ - struct vo_wayland_state *wl = data; - - if (callback) - wl_callback_destroy(callback); - - wl->frame_callback = wl_surface_frame(wl->surface); - wl_callback_add_listener(wl->frame_callback, &frame_listener, wl); - - wl->frame_wait = false; -} - -static const struct wl_callback_listener frame_listener = { - frame_callback, -}; - static int allocate_memfd(size_t size) { int fd = memfd_create("mpv", MFD_CLOEXEC | MFD_ALLOW_SEALING); @@ -142,10 +123,6 @@ static struct buffer *buffer_create(struct vo *vo, int width, int height) if (!buf->buffer) goto error4; wl_buffer_add_listener(buf->buffer, &buffer_listener, buf); - if (!wl->frame_callback) { - wl->frame_callback = wl_surface_frame(wl->surface); - wl_callback_add_listener(wl->frame_callback, &frame_listener, wl); - } close(fd); talloc_set_destructor(buf, buffer_destroy); |