summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/out/drm_common.c2
-rw-r--r--video/out/present_sync.c8
-rw-r--r--video/out/present_sync.h3
-rw-r--r--video/out/wayland_common.c2
-rw-r--r--video/out/x11_common.c2
5 files changed, 10 insertions, 7 deletions
diff --git a/video/out/drm_common.c b/video/out/drm_common.c
index 2b68bac2ff..fcd2a3baee 100644
--- a/video/out/drm_common.c
+++ b/video/out/drm_common.c
@@ -1030,7 +1030,7 @@ bool vo_drm_init(struct vo *vo)
drm->ev.version = DRM_EVENT_CONTEXT_VERSION;
drm->ev.page_flip_handler = &drm_pflip_cb;
- drm->present = mp_present_initialize(drm, VO_MAX_SWAPCHAIN_DEPTH);
+ drm->present = mp_present_initialize(drm, drm->vo->opts, VO_MAX_SWAPCHAIN_DEPTH);
return true;
diff --git a/video/out/present_sync.c b/video/out/present_sync.c
index 75004f56b5..e527f8cf98 100644
--- a/video/out/present_sync.c
+++ b/video/out/present_sync.c
@@ -57,13 +57,14 @@ void present_sync_get_info(struct mp_present *present, struct vo_vsync_info *inf
LL_APPEND(list_node, present, cur);
}
-struct mp_present *mp_present_initialize(void *talloc_ctx, int entries)
+struct mp_present *mp_present_initialize(void *talloc_ctx, struct mp_vo_opts *opts, int entries)
{
struct mp_present *present = talloc_zero(talloc_ctx, struct mp_present);
for (int i = 0; i < entries; i++) {
struct mp_present_entry *entry = talloc_zero(present, struct mp_present_entry);
LL_APPEND(list_node, present, entry);
}
+ present->opts = opts;
return present;
}
@@ -120,8 +121,9 @@ void present_sync_update_values(struct mp_present *present, int64_t ust,
int64_t msc)
{
struct mp_present_entry *cur = present->head;
- while (cur) {
- if (!cur->ust)
+ int index = 0;
+ while (cur && ++index) {
+ if (!cur->ust || index == present->opts->swapchain_depth)
break;
cur = cur->list_node.next;
}
diff --git a/video/out/present_sync.h b/video/out/present_sync.h
index 361045548d..7ec0edb85c 100644
--- a/video/out/present_sync.h
+++ b/video/out/present_sync.h
@@ -39,9 +39,10 @@ struct mp_present_entry {
struct mp_present {
struct mp_present_entry *head, *tail;
+ struct mp_vo_opts *opts;
};
-struct mp_present *mp_present_initialize(void *talloc_ctx, int entries);
+struct mp_present *mp_present_initialize(void *talloc_ctx, struct mp_vo_opts *opts, int entries);
// Used during the get_vsync call to deliver the presentation statistics to the VO.
void present_sync_get_info(struct mp_present *present, struct vo_vsync_info *info);
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index fa6356084c..0ee49541ed 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -2283,7 +2283,7 @@ bool vo_wayland_init(struct vo *vo)
wl->fback_pool->len = VO_MAX_SWAPCHAIN_DEPTH;
wl->fback_pool->fback = talloc_zero_array(wl->fback_pool, struct wp_presentation_feedback *,
wl->fback_pool->len);
- wl->present = mp_present_initialize(wl, VO_MAX_SWAPCHAIN_DEPTH);
+ wl->present = mp_present_initialize(wl, wl->vo_opts, VO_MAX_SWAPCHAIN_DEPTH);
} else {
MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n",
wp_presentation_interface.name);
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index f0f859d6f6..9be2e9b93d 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 = mp_present_initialize(x11, VO_MAX_SWAPCHAIN_DEPTH);
+ x11->present = mp_present_initialize(x11, x11->opts, VO_MAX_SWAPCHAIN_DEPTH);
dispName = XDisplayName(NULL);