summaryrefslogtreecommitdiffstats
path: root/video/out/x11_common.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-11-02 13:41:32 -0500
committerDudemanguy <random342@airmail.cc>2023-11-06 15:44:45 +0000
commit261f51b475e17459274b24ae8a0515d7ac969cd0 (patch)
tree849355df70d6d216d1fdfd7a0515831ac0f7f977 /video/out/x11_common.c
parentbcbd821fa9ff6b1128801b240f22541e1cd76555 (diff)
downloadmpv-261f51b475e17459274b24ae8a0515d7ac969cd0.tar.bz2
mpv-261f51b475e17459274b24ae8a0515d7ac969cd0.tar.xz
present_sync: rewrite around linked list
When this was originally written, the queuing/list approach was deliberately removed since it adds more complication and xorg/wayland don't really use it anyway. In practice, you only really have one frame in flight with presentation timestamps. However, one slight annoyance is that the drm code has its own thing which is almost exactly the same and does its own calculations. Ideally, we'd port drm to this instead, but the implementation there takes into account N-frames in flight which probably does actually work. So we need to make present_sync smarter and be able to handle this. mpv does actually have its own linked list implementation already which is a good fit for this. mp_present becomes the list and each mp_present_entry has its own set of timestamps. During initialization, we create all the entries we need and then simply treat it like a queue during the lifecycle of the VO. When an entry is fully used (present_sync_get_info), then we remove it from the list, zero it out, and append it to the end for future use. This avoids needing to allocate memory on every frame (which is what drm currently does) and allows for a reasonable number of in flight frames at the same time as this should never grow to some obscene number. The nice thing is that current users of present_sync don't need to change anything besides the initialization step.
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r--video/out/x11_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index f77f4c86f8..a4498a60e0 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -626,7 +626,7 @@ bool vo_x11_init(struct vo *vo)
x11_error_output = x11->log;
XSetErrorHandler(x11_errorhandler);
- x11->present = talloc_zero(x11, struct mp_present);
+ x11->present = mp_present_initialize(x11, 8); // max swapchain depth allowed
dispName = XDisplayName(NULL);