summaryrefslogtreecommitdiffstats
path: root/video/out/opengl
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-08-31 20:08:08 +0200
committerAnton Kindestam <antonki@kth.se>2018-12-06 10:30:25 +0100
commitb1ba7de34dd5685a082454817f23509d1c28e4aa (patch)
treedc7c077d64742cb728c88fc582f952718a61155d /video/out/opengl
parent83884fdf03fc991679bea53d3d5bddf97ed16a9b (diff)
downloadmpv-b1ba7de34dd5685a082454817f23509d1c28e4aa.tar.bz2
mpv-b1ba7de34dd5685a082454817f23509d1c28e4aa.tar.xz
vo: use a struct for vsync feedback stuff
So new useless stuff can be easily added.
Diffstat (limited to 'video/out/opengl')
-rw-r--r--video/out/opengl/context.c8
-rw-r--r--video/out/opengl/context.h4
-rw-r--r--video/out/opengl/context_glx.c6
3 files changed, 10 insertions, 8 deletions
diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c
index 44e64b7d9a..9b3dd6a827 100644
--- a/video/out/opengl/context.c
+++ b/video/out/opengl/context.c
@@ -313,10 +313,12 @@ void ra_gl_ctx_swap_buffers(struct ra_swapchain *sw)
}
}
-static double ra_gl_ctx_get_latency(struct ra_swapchain *sw)
+static void ra_gl_ctx_get_vsync(struct ra_swapchain *sw,
+ struct vo_vsync_info *info)
{
struct priv *p = sw->priv;
- return p->params.get_latency ? p->params.get_latency(sw->ctx) : -1;
+ if (p->params.get_vsync)
+ p->params.get_vsync(sw->ctx, info);
}
static const struct ra_swapchain_fns ra_gl_swapchain_fns = {
@@ -324,5 +326,5 @@ static const struct ra_swapchain_fns ra_gl_swapchain_fns = {
.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,
+ .get_vsync = ra_gl_ctx_get_vsync,
};
diff --git a/video/out/opengl/context.h b/video/out/opengl/context.h
index feaf8e1ab6..2dd2517ef5 100644
--- a/video/out/opengl/context.h
+++ b/video/out/opengl/context.h
@@ -23,8 +23,8 @@ struct ra_gl_ctx_params {
// function or if you override it yourself.
void (*swap_buffers)(struct ra_ctx *ctx);
- // See ra_swapchain_fns.get_latency.
- double (*get_latency)(struct ra_ctx *ctx);
+ // See ra_swapchain_fns.get_vsync.
+ void (*get_vsync)(struct ra_ctx *ctx, struct vo_vsync_info *info);
// Set to false if the implementation follows normal GL semantics, which is
// upside down. Set to true if it does *not*, i.e. if rendering is right
diff --git a/video/out/opengl/context_glx.c b/video/out/opengl/context_glx.c
index fe210c5f7d..2a6a2a4cf1 100644
--- a/video/out/opengl/context_glx.c
+++ b/video/out/opengl/context_glx.c
@@ -305,10 +305,10 @@ static void glx_swap_buffers(struct ra_ctx *ctx)
p->latency = update_latency_oml(ctx);
}
-static double glx_get_latency(struct ra_ctx *ctx)
+static void glx_get_vsync(struct ra_ctx *ctx, struct vo_vsync_info *info)
{
struct priv *p = ctx->priv;
- return p->latency;
+ info->latency = p->latency;
}
static bool glx_init(struct ra_ctx *ctx)
@@ -394,7 +394,7 @@ static bool glx_init(struct ra_ctx *ctx)
struct ra_gl_ctx_params params = {
.swap_buffers = glx_swap_buffers,
- .get_latency = glx_get_latency,
+ .get_vsync = glx_get_vsync,
};
if (!ra_gl_ctx_init(ctx, gl, params))