From 0fe3e9ca5e8e42761424b37d67b46e12514f240f Mon Sep 17 00:00:00 2001 From: rr- Date: Sat, 24 Sep 2016 14:59:31 +0200 Subject: vo_drm: provide display fps --- video/out/opengl/context_drm_egl.c | 14 ++++++++++++++ video/out/vo_drm.c | 15 +++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c index f3c0c660be..07624ccaf3 100644 --- a/video/out/opengl/context_drm_egl.c +++ b/video/out/opengl/context_drm_egl.c @@ -359,6 +359,20 @@ static int drm_egl_reconfig(struct MPGLContext *ctx) static int drm_egl_control(struct MPGLContext *ctx, int *events, int request, void *arg) { + struct priv *p = ctx->priv; + switch (request) { + case VOCTRL_GET_DISPLAY_FPS: { + double fps = + p->kms->mode.clock + * 1000.0 + / p->kms->mode.htotal + / p->kms->mode.vtotal; + if (fps <= 0) + break; + *(double*)arg = fps; + return VO_TRUE; + } + } return VO_NOTIMPL; } diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c index 6819c98bb4..cf42c4ce4a 100644 --- a/video/out/vo_drm.c +++ b/video/out/vo_drm.c @@ -467,12 +467,12 @@ static int query_format(struct vo *vo, int format) return sws_isSupportedInput(imgfmt2pixfmt(format)); } -static int control(struct vo *vo, uint32_t request, void *data) +static int control(struct vo *vo, uint32_t request, void *arg) { struct priv *p = vo->priv; switch (request) { case VOCTRL_SCREENSHOT_WIN: - *(struct mp_image**)data = mp_image_new_copy(p->cur_frame); + *(struct mp_image**)arg = mp_image_new_copy(p->cur_frame); return VO_TRUE; case VOCTRL_REDRAW_FRAME: draw_image(vo, p->last_input); @@ -481,6 +481,17 @@ static int control(struct vo *vo, uint32_t request, void *data) if (vo->config_ok) reconfig(vo, vo->params); return VO_TRUE; + case VOCTRL_GET_DISPLAY_FPS: { + double fps = + p->kms->mode.clock + * 1000.0 + / p->kms->mode.htotal + / p->kms->mode.vtotal; + if (fps <= 0) + break; + *(double*)arg = fps; + return VO_TRUE; + } } return VO_NOTIMPL; } -- cgit v1.2.3