mirror of https://github.com/mpv-player/mpv
vo_libmpv: support render performance data
This commit is contained in:
parent
9e466ee621
commit
e72093581b
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue