From e72093581bdf07784d6889035c3751cbc7fb8ca0 Mon Sep 17 00:00:00 2001 From: Akemi Date: Mon, 4 Jun 2018 19:13:15 +0200 Subject: vo_libmpv: support render performance data --- video/out/gpu/libmpv_gpu.c | 9 +++++++++ video/out/libmpv.h | 2 ++ video/out/vo_libmpv.c | 14 ++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/video/out/gpu/libmpv_gpu.c b/video/out/gpu/libmpv_gpu.c index fce2acfa4d..f597d2bb29 100644 --- a/video/out/gpu/libmpv_gpu.c +++ b/video/out/gpu/libmpv_gpu.c @@ -207,6 +207,14 @@ static void screenshot(struct render_backend *ctx, struct vo_frame *frame, gl_video_screenshot(p->renderer, frame, args); } +static void perfdata(struct render_backend *ctx, + struct voctrl_performance_data *out) +{ + struct priv *p = ctx->priv; + + gl_video_perfdata(p->renderer, out); +} + static void destroy(struct render_backend *ctx) { struct priv *p = ctx->priv; @@ -235,5 +243,6 @@ const struct render_backend_fns render_backend_gpu = { .render = render, .get_image = get_image, .screenshot = screenshot, + .perfdata = perfdata, .destroy = destroy, }; diff --git a/video/out/libmpv.h b/video/out/libmpv.h index 2fe33386f4..329b2dffec 100644 --- a/video/out/libmpv.h +++ b/video/out/libmpv.h @@ -54,6 +54,8 @@ struct render_backend_fns { void (*reset)(struct render_backend *ctx); void (*screenshot)(struct render_backend *ctx, struct vo_frame *frame, struct voctrl_screenshot *args); + void (*perfdata)(struct render_backend *ctx, + struct voctrl_performance_data *out); // Like vo_driver.get_image(). struct mp_image *(*get_image)(struct render_backend *ctx, int imgfmt, int w, int h, int stride_align); diff --git a/video/out/vo_libmpv.c b/video/out/vo_libmpv.c index 1df63a5197..b09c2c21a7 100644 --- a/video/out/vo_libmpv.c +++ b/video/out/vo_libmpv.c @@ -573,6 +573,13 @@ static void run_control_on_render_thread(void *p) talloc_free(frame); break; } + case VOCTRL_PERFORMANCE_DATA: { + if (ctx->renderer->fns->perfdata) { + ctx->renderer->fns->perfdata(ctx->renderer, data); + ret = VO_TRUE; + } + break; + } } *(int *)args[3] = ret; @@ -620,6 +627,13 @@ static int control(struct vo *vo, uint32_t request, void *data) mp_dispatch_run(ctx->dispatch, run_control_on_render_thread, args); return ret; } + case VOCTRL_PERFORMANCE_DATA: + if (ctx->dispatch) { + int ret; + void *args[] = {ctx, (void *)(intptr_t)request, data, &ret}; + mp_dispatch_run(ctx->dispatch, run_control_on_render_thread, args); + return ret; + } } int r = VO_NOTIMPL; -- cgit v1.2.3