evas gl x11 - add working measure funcs for debugging performance

This commit is contained in:
Carsten Haitzler 2018-10-09 14:04:05 +01:00
parent 0c1eab0cf9
commit 76725b2d3b
1 changed files with 43 additions and 3 deletions

View File

@ -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