diff options
author | Niklas Haas <git@nand.wakku.to> | 2016-06-06 02:44:15 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-06-07 12:17:25 +0200 |
commit | 393a06911269b69ed83f1b29bd5e252c07ba59bf (patch) | |
tree | ba49b6ce002d4a9ef1946d04c8bfa5be4fb3755a /video/out/opengl/video.c | |
parent | 8ceb935bd8e1062ff83287c00cca0b7428a7dfba (diff) | |
download | mpv-393a06911269b69ed83f1b29bd5e252c07ba59bf.tar.bz2 mpv-393a06911269b69ed83f1b29bd5e252c07ba59bf.tar.xz |
vo_opengl: expose performance timers as properties
This is plumbed through a new VOCTRL, VOCTRL_PERFORMANCE_DATA, and
exposed as properties render-time-last, render-time-avg etc.
All of these numbers are in microseconds, which gives a good precision
range when just outputting them via show-text. (Lua scripts can
obviously still do their own formatting etc.)
Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r-- | video/out/opengl/video.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index fe7c0abaa9..ea24f6e9a1 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -2908,6 +2908,24 @@ void gl_video_resize(struct gl_video *p, int vp_w, int vp_h, mpgl_osd_resize(p->osd, p->osd_rect, p->image_params.stereo_out); } +static struct voctrl_performance_entry gl_video_perfentry(struct gl_timer *t) +{ + return (struct voctrl_performance_entry) { + .last = gl_timer_last_us(t), + .avg = gl_timer_avg_us(t), + .peak = gl_timer_peak_us(t), + }; +} + +struct voctrl_performance_data gl_video_perfdata(struct gl_video *p) +{ + return (struct voctrl_performance_data) { + .upload = gl_video_perfentry(p->upload_timer), + .render = gl_video_perfentry(p->render_timer), + .present = gl_video_perfentry(p->present_timer), + }; +} + static bool unmap_image(struct gl_video *p, struct mp_image *mpi) { GL *gl = p->gl; |