summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-21 17:59:53 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-23 09:34:57 +0100
commit859faad17b51162d50acc5d78beb482d9a031e01 (patch)
tree0b6ecbf0a365fcc4e58964928c80a7b8a1380ef7
parent6096779ede1c837461dfe1224f69539dd974631b (diff)
ecore-x expose some debug times like the exact time the vsync woke
this is for finding and eliminating jank in the vsync scheduling etc. - as its underscore it's clearly a private api.
-rw-r--r--src/lib/ecore_x/Ecore_X.h2
-rw-r--r--src/lib/ecore_x/ecore_x_vsync.c36
2 files changed, 33 insertions, 5 deletions
diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index 94b612abc6..eb4b08761d 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -18,6 +18,8 @@
18# define EAPI 18# define EAPI
19#endif // ifdef __GNUC__ 19#endif // ifdef __GNUC__
20 20
21EAPI double _ecore_x_vxync_wakeup_time_get(void);
22
21#define ECORE_X_VERSION_MAJOR EFL_VERSION_MAJOR 23#define ECORE_X_VERSION_MAJOR EFL_VERSION_MAJOR
22#define ECORE_X_VERSION_MINOR EFL_VERSION_MINOR 24#define ECORE_X_VERSION_MINOR EFL_VERSION_MINOR
23/** 25/**
diff --git a/src/lib/ecore_x/ecore_x_vsync.c b/src/lib/ecore_x/ecore_x_vsync.c
index e002e48302..a47e6df21c 100644
--- a/src/lib/ecore_x/ecore_x_vsync.c
+++ b/src/lib/ecore_x/ecore_x_vsync.c
@@ -282,6 +282,13 @@ _drm_vblank_handler(int fd EINA_UNUSED,
282 } 282 }
283} 283}
284 284
285static double _ecore_x_vsync_wakeup_time = 0.0;
286
287EAPI double _ecore_x_vxync_wakeup_time_get(void)
288{
289 return _ecore_x_vsync_wakeup_time;
290}
291
285static void 292static void
286_drm_tick_core(void *data EINA_UNUSED, Ecore_Thread *thread) 293_drm_tick_core(void *data EINA_UNUSED, Ecore_Thread *thread)
287{ 294{
@@ -357,6 +364,20 @@ _drm_tick_core(void *data EINA_UNUSED, Ecore_Thread *thread)
357 tv.tv_usec = _drm_fail_time * 1000000; 364 tv.tv_usec = _drm_fail_time * 1000000;
358 D(" @%1.5f wait %ims\n", ecore_time_get(), (int)(tv.tv_usec /1000)); 365 D(" @%1.5f wait %ims\n", ecore_time_get(), (int)(tv.tv_usec /1000));
359 ret = select(max_fd + 1, &rfds, &wfds, &exfds, &tv); 366 ret = select(max_fd + 1, &rfds, &wfds, &exfds, &tv);
367 _ecore_x_vsync_wakeup_time = ecore_time_get();
368#if 0
369 static double pt = 0.0;
370 double t = ecore_time_get();
371 double f = 1.0 / (t - pt);
372 char buf[1024];
373 int i, fps;
374 fps = 30 + ((f - 60.0) * 10.0);
375 if (fps > 1000) fps = 1000;
376 for (i = 0; i < fps; i++) buf[i] = '#';
377 buf[i] = 0;
378 printf("WAKE %1.5f [%s>\n", 1.0 / (t - pt), buf);
379 pt = t;
380#endif
360 if ((ret == 1) && (FD_ISSET(drm_fd, &rfds))) 381 if ((ret == 1) && (FD_ISSET(drm_fd, &rfds)))
361 { 382 {
362 D(" @%1.5f have event\n", ecore_time_get()); 383 D(" @%1.5f have event\n", ecore_time_get());
@@ -387,17 +408,22 @@ _drm_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void
387 D("notify.... %3.3f %i\n", *((double *)msg), drm_event_is_busy); 408 D("notify.... %3.3f %i\n", *((double *)msg), drm_event_is_busy);
388 if (drm_event_is_busy) 409 if (drm_event_is_busy)
389 { 410 {
390 double *t = msg; 411 double *t = msg, rt, lt;
391 static double pt = 0.0; 412 static double pt = 0.0, prt = 0.0, plt = 0.0;
392 413
393 DBG("VSYNC %1.8f = delt %1.8f", *t, *t - pt); 414 rt = ecore_time_get();
394 D("VSYNC %1.8f = delt %1.8f\n", *t, *t - pt); 415 lt = ecore_loop_time_get();
416 DBG("VSYNC %1.8f = delt %1.8f | real = %1.8f | loop = %1.8f", *t, *t - pt, rt - prt, lt - plt);
417 D("VSYNC %1.8f = delt %1.8f | real = %1.8f | loop = %1.8f", *t, *t - pt, rt - prt, lt - plt);
418// printf("VSYNC %1.8f = delt %1.5f | real = %1.5f | loop = %1.5f\n", *t, 1.0 / (*t - pt), 1.0 / (rt - prt), 1.0 / (lt - plt));
395 if ((!tick_skip) || (tick_queued == 1)) 419 if ((!tick_skip) || (tick_queued == 1))
396 { 420 {
397 ecore_loop_time_set(*t); 421 ecore_loop_time_set(*t);
398 ecore_animator_custom_tick(); 422 ecore_animator_custom_tick();
399 } 423 }
400 pt = *t; 424 pt = *t;
425 prt = rt;
426 plt = lt;
401 } 427 }
402 free(msg); 428 free(msg);
403} 429}