diff options
author | Niklas Haas <git@haasn.xyz> | 2017-06-29 17:00:06 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2017-07-01 00:58:27 +0200 |
commit | dd78cc6fe72a3c5fadb00563cd47cc70b68f50fb (patch) | |
tree | 5050af3285b623499d0a2b06fa0ebb8d040b7cc9 /video/out/opengl/utils.h | |
parent | f003d8ea367f247e3ff49b672003817a0c3cdb30 (diff) | |
download | mpv-dd78cc6fe72a3c5fadb00563cd47cc70b68f50fb.tar.bz2 mpv-dd78cc6fe72a3c5fadb00563cd47cc70b68f50fb.tar.xz |
vo_opengl: refactor vo performance subsystem
This replaces `vo-performance` by `vo-passes`, bringing with it a number
of changes and improvements:
1. mpv users can now introspect the vo_opengl passes, which is something
that has been requested multiple times.
2. performance data is now measured per-pass, which helps both
development and debugging.
3. since adding more passes is cheap, we can now report information for
more passes (e.g. the blit pass, and the osd pass). Note: we also
switch to nanosecond scale, to be able to measure these passes
better.
4. `--user-shaders` authors can now describe their own passes, helping
users both identify which user shaders are active at any given time
as well as helping shader authors identify performance issues.
5. the timing data per pass is now exported as a full list of samples,
so projects like Argon-/mpv-stats can immediately read out all of the
samples and render a graph without having to manually poll this
option constantly.
Due to gl_timer's design being complicated (directly reading performance
data would block, so we delay the actual read-back until the next _start
command), it's vital not to conflate different passes that might be
doing different things from one frame to another. To accomplish this,
the actual timers are stored as part of the gl_shader_cache's sc_entry,
which makes them unique for that exact shader.
Starting and stopping the time measurement is easy to unify with the
gl_sc architecture, because the existing API already relies on a
"generate, render, reset" flow, so we can just put timer_start and
timer_stop in sc_generate and sc_reset, respectively.
The ugliest thing about this code is that due to the need to keep pass
information relatively stable in between frames, we need to distinguish
between "new" and "redrawn" frames, which bloats the code somewhat and
also feels hacky and vo_opengl-specific. (But then again, this entire
thing is vo_opengl-specific)
Diffstat (limited to 'video/out/opengl/utils.h')
-rw-r--r-- | video/out/opengl/utils.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/video/out/opengl/utils.h b/video/out/opengl/utils.h index 95eb1c4fea..92b1005c39 100644 --- a/video/out/opengl/utils.h +++ b/video/out/opengl/utils.h @@ -169,7 +169,7 @@ void gl_sc_uniform_mat3(struct gl_shader_cache *sc, char *name, bool transpose, GLfloat *v); void gl_sc_set_vao(struct gl_shader_cache *sc, struct gl_vao *vao); void gl_sc_enable_extension(struct gl_shader_cache *sc, char *name); -void gl_sc_generate(struct gl_shader_cache *sc); +struct mp_pass_perf gl_sc_generate(struct gl_shader_cache *sc); void gl_sc_reset(struct gl_shader_cache *sc); struct mpv_global; void gl_sc_set_cache_dir(struct gl_shader_cache *sc, struct mpv_global *global, @@ -180,12 +180,8 @@ struct gl_timer; struct gl_timer *gl_timer_create(GL *gl); void gl_timer_free(struct gl_timer *timer); void gl_timer_start(struct gl_timer *timer); -void gl_timer_stop(struct gl_timer *timer); - -int gl_timer_sample_count(struct gl_timer *timer); -uint64_t gl_timer_last_us(struct gl_timer *timer); -uint64_t gl_timer_avg_us(struct gl_timer *timer); -uint64_t gl_timer_peak_us(struct gl_timer *timer); +void gl_timer_stop(GL *gl); +struct mp_pass_perf gl_timer_measure(struct gl_timer *timer); #define NUM_PBO_BUFFERS 3 |