From 76725b2d3b16aaa49dc5bea64bc83adf4605e5f8 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 9 Oct 2018 14:04:05 +0100 Subject: [PATCH] evas gl x11 - add working measure funcs for debugging performance --- src/modules/evas/engines/gl_x11/evas_x_main.c | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c b/src/modules/evas/engines/gl_x11/evas_x_main.c index b86916966b..07d757e118 100644 --- a/src/modules/evas/engines/gl_x11/evas_x_main.c +++ b/src/modules/evas/engines/gl_x11/evas_x_main.c @@ -39,6 +39,38 @@ static Eina_Hash *_evas_gl_visuals = NULL; static int win_count = 0; static Eina_Bool initted = EINA_FALSE; +#if 0 +static double +_time_get(void) +{ + struct timespec t; + + if (clock_gettime(CLOCK_MONOTONIC, &t)) + { + fprintf(stderr, "Failed to get monotonic clock time..."); + return 0.0; + } + + return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0); +} + +static void +measure(int inout, const char *what) +{ + static double t0 = 0.0; + double t; + + if (inout == 0) t0 = _time_get(); + else if (inout ==1) + { + t = _time_get() - t0; + printf("%s: %1.2f\n", what, t * 1000.0); + } +} +#else +# define measure(x, y) +#endif + Eina_Bool eng_init(void) { @@ -1396,6 +1428,7 @@ eng_outbuf_swap_mode(Outbuf *ob) { Render_Output_Swap_Mode swap_mode; eina_evlog("+gl_query_surf_swap_mode", ob, 0.0, NULL); + measure(0, "query age"); #ifdef GL_GLES EGLint age = 0; @@ -1412,6 +1445,7 @@ eng_outbuf_swap_mode(Outbuf *ob) age = 0; } #endif + measure(1, "query age"); if (age == 1) swap_mode = MODE_COPY; else if (age == 2) swap_mode = MODE_DOUBLE; else if (age == 3) swap_mode = MODE_TRIPLE; @@ -1615,13 +1649,19 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_R _convert_to_glcoords(&result[i], ob, r->x, r->y, r->w, r->h); i += 4; } + measure(0, "swap with damage"); glsym_eglSwapBuffersWithDamage(ob->egl_disp, ob->egl_surface, result, num); + measure(1, "swap with damage"); } } else - eglSwapBuffers(ob->egl_disp, ob->egl_surface); + { + measure(0, "swap"); + eglSwapBuffers(ob->egl_disp, ob->egl_surface); + measure(1, "swap"); + } //xx if (!safe_native) eglWaitGL(); // if (eglGetError() != EGL_SUCCESS) @@ -1664,9 +1704,9 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_R } #endif // XXX: if partial swaps can be done use re->rects -// measure(0, "swap"); + measure(0, "swap"); glXSwapBuffers(ob->disp, ob->glxwin); -// measure(1, "swap"); + measure(1, "swap"); #endif // clear out rects after swap as we may use them during swap