summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-10-09 14:04:05 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-10-11 16:25:06 +0100
commit76725b2d3b16aaa49dc5bea64bc83adf4605e5f8 (patch)
tree0ad2983a7371bae97ff2aa5b7c9c187afc2f45bf
parent0c1eab0cf999db94164b70a80cc3941561a26844 (diff)
evas gl x11 - add working measure funcs for debugging performance
-rw-r--r--src/modules/evas/engines/gl_x11/evas_x_main.c46
1 files 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;
39static int win_count = 0; 39static int win_count = 0;
40static Eina_Bool initted = EINA_FALSE; 40static Eina_Bool initted = EINA_FALSE;
41 41
42#if 0
43static double
44_time_get(void)
45{
46 struct timespec t;
47
48 if (clock_gettime(CLOCK_MONOTONIC, &t))
49 {
50 fprintf(stderr, "Failed to get monotonic clock time...");
51 return 0.0;
52 }
53
54 return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0);
55}
56
57static void
58measure(int inout, const char *what)
59{
60 static double t0 = 0.0;
61 double t;
62
63 if (inout == 0) t0 = _time_get();
64 else if (inout ==1)
65 {
66 t = _time_get() - t0;
67 printf("%s: %1.2f\n", what, t * 1000.0);
68 }
69}
70#else
71# define measure(x, y)
72#endif
73
42Eina_Bool 74Eina_Bool
43eng_init(void) 75eng_init(void)
44{ 76{
@@ -1396,6 +1428,7 @@ eng_outbuf_swap_mode(Outbuf *ob)
1396 { 1428 {
1397 Render_Output_Swap_Mode swap_mode; 1429 Render_Output_Swap_Mode swap_mode;
1398 eina_evlog("+gl_query_surf_swap_mode", ob, 0.0, NULL); 1430 eina_evlog("+gl_query_surf_swap_mode", ob, 0.0, NULL);
1431 measure(0, "query age");
1399#ifdef GL_GLES 1432#ifdef GL_GLES
1400 EGLint age = 0; 1433 EGLint age = 0;
1401 1434
@@ -1412,6 +1445,7 @@ eng_outbuf_swap_mode(Outbuf *ob)
1412 age = 0; 1445 age = 0;
1413 } 1446 }
1414#endif 1447#endif
1448 measure(1, "query age");
1415 if (age == 1) swap_mode = MODE_COPY; 1449 if (age == 1) swap_mode = MODE_COPY;
1416 else if (age == 2) swap_mode = MODE_DOUBLE; 1450 else if (age == 2) swap_mode = MODE_DOUBLE;
1417 else if (age == 3) swap_mode = MODE_TRIPLE; 1451 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
1615 _convert_to_glcoords(&result[i], ob, r->x, r->y, r->w, r->h); 1649 _convert_to_glcoords(&result[i], ob, r->x, r->y, r->w, r->h);
1616 i += 4; 1650 i += 4;
1617 } 1651 }
1652 measure(0, "swap with damage");
1618 glsym_eglSwapBuffersWithDamage(ob->egl_disp, 1653 glsym_eglSwapBuffersWithDamage(ob->egl_disp,
1619 ob->egl_surface, 1654 ob->egl_surface,
1620 result, num); 1655 result, num);
1656 measure(1, "swap with damage");
1621 } 1657 }
1622 } 1658 }
1623 else 1659 else
1624 eglSwapBuffers(ob->egl_disp, ob->egl_surface); 1660 {
1661 measure(0, "swap");
1662 eglSwapBuffers(ob->egl_disp, ob->egl_surface);
1663 measure(1, "swap");
1664 }
1625 1665
1626//xx if (!safe_native) eglWaitGL(); 1666//xx if (!safe_native) eglWaitGL();
1627// if (eglGetError() != EGL_SUCCESS) 1667// if (eglGetError() != EGL_SUCCESS)
@@ -1664,9 +1704,9 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_R
1664 } 1704 }
1665#endif 1705#endif
1666 // XXX: if partial swaps can be done use re->rects 1706 // XXX: if partial swaps can be done use re->rects
1667// measure(0, "swap"); 1707 measure(0, "swap");
1668 glXSwapBuffers(ob->disp, ob->glxwin); 1708 glXSwapBuffers(ob->disp, ob->glxwin);
1669// measure(1, "swap"); 1709 measure(1, "swap");
1670#endif 1710#endif
1671 // clear out rects after swap as we may use them during swap 1711 // clear out rects after swap as we may use them during swap
1672 1712