summaryrefslogtreecommitdiffstats
path: root/video/out/vo.h
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-10-01 01:19:40 -0500
committerDudemanguy <random342@airmail.cc>2023-10-03 23:45:20 +0000
commit7b8a30fc8132203bc93d35ac887682d2044ad5a9 (patch)
tree3ab055580db0e1eaadd9395945562a3ea6c4f424 /video/out/vo.h
parentd147a06e60bfc10cb2fd7c66af7eb6871dba163e (diff)
downloadmpv-7b8a30fc8132203bc93d35ac887682d2044ad5a9.tar.bz2
mpv-7b8a30fc8132203bc93d35ac887682d2044ad5a9.tar.xz
vo_dmabuf_wayland: eliminate an extra frame copy
When implementing vo_dmabuf_wayland, it always did a copy of the image from the current frame and worked with that. The reason was because mpv's core held onto the frame and caused some timing issues and rendering glitches depending on when it freed the image. This is pretty easy to fix: just make vo_dmabuf_wayland manage the the frames. In vo.h, we add a boolean that a VO can set to make them manage freeing frames directly. After doing this, change the buffers in vo_dmabuf_wayland to store the whole vo_frame instead of just the image. Then, just modify some things a bit so frame is freed instead of the image. Now, we should truly have zero-copy playback. Well as long as you don't use libass to render anything (that's still a copy from system memory).
Diffstat (limited to 'video/out/vo.h')
-rw-r--r--video/out/vo.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/video/out/vo.h b/video/out/vo.h
index e11c23a60a..a6c6a3ce6e 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -305,6 +305,9 @@ struct vo_driver {
// Disable video timing, push frames as quickly as possible, never redraw.
bool untimed;
+ // The VO is responsible for freeing frames.
+ bool frame_owner;
+
const char *name;
const char *description;
@@ -381,7 +384,8 @@ struct vo_driver {
/* Render the given frame. Note that this is also called when repeating
* or redrawing frames.
*
- * frame is freed by the caller, but the callee can still modify the
+ * frame is freed by the caller if the callee did not assume ownership
+ * of the frames, but in any case the callee can still modify the
* contained data and references.
*/
void (*draw_frame)(struct vo *vo, struct vo_frame *frame);