summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/common.c
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-06-05 21:55:30 +0200
committerwm4 <wm4@nowhere>2016-06-07 12:16:15 +0200
commit8ceb935bd8e1062ff83287c00cca0b7428a7dfba (patch)
tree0183f856b6262ae8b65d65bdf0caa466c03985f3 /video/out/opengl/common.c
parent88b584656d9752573cc4320c845a6d31b5877140 (diff)
downloadmpv-8ceb935bd8e1062ff83287c00cca0b7428a7dfba.tar.bz2
mpv-8ceb935bd8e1062ff83287c00cca0b7428a7dfba.tar.xz
vo_opengl: add time queries
To avoid blocking the CPU, we use 8 time objects and rotate through them, only blocking until the last possible moment (before we need access to them on the next iteration through the ring buffer). I tested it out on my machine and 4 query objects were enough to guarantee block-free querying, but the extra margin shouldn't hurt. Frame render times are just output at the end of each frame, via MP_DBG. This might be improved in the future. (In particular, I want to expose these numbers as properties so that users get some more visible feedback about render times) Currently, we measure pass_render_frame and pass_draw_to_screen separately because the former might be called multiple times due to interpolation. Doing it this way gives more faithful numbers. Same goes for frame upload times.
Diffstat (limited to 'video/out/opengl/common.c')
-rw-r--r--video/out/opengl/common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c
index 99d8bbeb51..dd9ecc46fa 100644
--- a/video/out/opengl/common.c
+++ b/video/out/opengl/common.c
@@ -274,6 +274,23 @@ static const struct gl_functions gl_functions[] = {
},
},
{
+ .ver_core = 330,
+ .extension = "GL_ARB_timer_query",
+ .functions = (const struct gl_function[]) {
+ DEF_FN(GenQueries),
+ DEF_FN(DeleteQueries),
+ DEF_FN(BeginQuery),
+ DEF_FN(EndQuery),
+ DEF_FN(QueryCounter),
+ DEF_FN(IsQuery),
+ DEF_FN(GetQueryObjectiv),
+ DEF_FN(GetQueryObjecti64v),
+ DEF_FN(GetQueryObjectuiv),
+ DEF_FN(GetQueryObjectui64v),
+ {0}
+ },
+ },
+ {
.ver_core = 430,
.ver_es_core = 300,
.functions = (const struct gl_function[]) {