summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/context.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-08-31 16:33:15 +0200
committerAnton Kindestam <antonki@kth.se>2018-12-06 10:30:14 +0100
commit83884fdf03fc991679bea53d3d5bddf97ed16a9b (patch)
tree84248a21d9a50185dcc51bfb79077f84bdd0e96c /video/out/opengl/context.c
parent8b83c8996686072bc743b112ae5cb3bf93aa33ed (diff)
downloadmpv-83884fdf03fc991679bea53d3d5bddf97ed16a9b.tar.bz2
mpv-83884fdf03fc991679bea53d3d5bddf97ed16a9b.tar.xz
vo_gpu: glx: use GLX_OML_sync_control for better vsync reporting
Use the extension to compute the (hopefully correct) video delay and vsync phase. This is very fuzzy, because the latency will suddenly be applied after some frames have already been shown. This means there _will_ be "jumps" in the time accounting, which can lead to strange effects at start of playback (such as making initial "dropped" etc. frames worse). The only reasonable way to fix this would be running a few dummy frame swaps at start of playback until the latency is known. The same happens when unpausing. This only affects display-sync mode. Correct function was not confirmed. It only "looks right". I don't have the equipment to make scientifically correct measurements. A potentially bad thing is that we trust the timestamps we're receiving. Out of bounds timestamps could wreak havoc. On the other hand, this will probably cause the higher level code to panic and just disable DS. As a further caveat, this makes a bunch of assumptions about UST timestamps. If there are delayed frames (i.e. we skipped one or more vsyncs), the latency logic is mostly reset. There is no attempt to make the vo.c skipped vsync logic to use this. Also, the latency computation determines a vsync duration, and there's no effort to reconcile or share the vo.c logic for determining vsync duration.
Diffstat (limited to 'video/out/opengl/context.c')
-rw-r--r--video/out/opengl/context.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c
index 43b57aa4ed..44e64b7d9a 100644
--- a/video/out/opengl/context.c
+++ b/video/out/opengl/context.c
@@ -313,9 +313,16 @@ void ra_gl_ctx_swap_buffers(struct ra_swapchain *sw)
}
}
+static double ra_gl_ctx_get_latency(struct ra_swapchain *sw)
+{
+ struct priv *p = sw->priv;
+ return p->params.get_latency ? p->params.get_latency(sw->ctx) : -1;
+}
+
static const struct ra_swapchain_fns ra_gl_swapchain_fns = {
.color_depth = ra_gl_ctx_color_depth,
.start_frame = ra_gl_ctx_start_frame,
.submit_frame = ra_gl_ctx_submit_frame,
.swap_buffers = ra_gl_ctx_swap_buffers,
+ .get_latency = ra_gl_ctx_get_latency,
};