summaryrefslogtreecommitdiff
path: root/src/lib/ecore_x
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-10-28 13:58:56 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-10-28 13:58:56 +0900
commitda04400c5d22aac0888ceb945c0afe28459af06c (patch)
tree3663b5abb3bd14e0c7070d18ed08eefc30337cb2 /src/lib/ecore_x
parentd80de732d1e6b7ae360b015dc5193c944e0e349d (diff)
ecore-animator allow for animator to skip queued animator ticks
set ECORE_ANIMATOR_SKIP to skip queued animtor ticks if multiple are in the pipeline. optional and not on by default. i would think its not a good idea to skip these animator ticks and skipping/deferring is a job higher up. @feature
Diffstat (limited to 'src/lib/ecore_x')
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_vsync.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/ecore_x/xlib/ecore_x_vsync.c b/src/lib/ecore_x/xlib/ecore_x_vsync.c
index 34eb605..436645e 100644
--- a/src/lib/ecore_x/xlib/ecore_x_vsync.c
+++ b/src/lib/ecore_x/xlib/ecore_x_vsync.c
@@ -147,6 +147,10 @@ static void *drm_lib = NULL;
147 147
148static Eina_Thread_Queue *thq = NULL; 148static Eina_Thread_Queue *thq = NULL;
149static Ecore_Thread *drm_thread = NULL; 149static Ecore_Thread *drm_thread = NULL;
150static Eina_Spinlock tick_queue_lock;
151static int tick_queue_count = 0;
152static Eina_Bool tick_skip = EINA_FALSE;
153
150typedef struct 154typedef struct
151{ 155{
152 Eina_Thread_Queue_Msg head; 156 Eina_Thread_Queue_Msg head;
@@ -208,6 +212,9 @@ _drm_send_time(double t)
208 *tim = t; 212 *tim = t;
209 DBG(" ... send %1.8f", t); 213 DBG(" ... send %1.8f", t);
210 D(" @%1.5f ... send %1.8f\n", ecore_time_get(), t); 214 D(" @%1.5f ... send %1.8f\n", ecore_time_get(), t);
215 eina_spinlock_take(&tick_queue_lock);
216 tick_queue_count++;
217 eina_spinlock_release(&tick_queue_lock);
211 ecore_thread_feedback(drm_thread, tim); 218 ecore_thread_feedback(drm_thread, tim);
212 } 219 }
213} 220}
@@ -363,6 +370,12 @@ _drm_tick_core(void *data EINA_UNUSED, Ecore_Thread *thread)
363static void 370static void
364_drm_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg) 371_drm_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg)
365{ 372{
373 int tick_queued;
374
375 eina_spinlock_take(&tick_queue_lock);
376 tick_queued = tick_queue_count;
377 tick_queue_count--;
378 eina_spinlock_release(&tick_queue_lock);
366 DBG("notify.... %3.3f %i", *((double *)msg), drm_event_is_busy); 379 DBG("notify.... %3.3f %i", *((double *)msg), drm_event_is_busy);
367 D("notify.... %3.3f %i\n", *((double *)msg), drm_event_is_busy); 380 D("notify.... %3.3f %i\n", *((double *)msg), drm_event_is_busy);
368 if (drm_event_is_busy) 381 if (drm_event_is_busy)
@@ -372,8 +385,11 @@ _drm_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void
372 385
373 DBG("VSYNC %1.8f = delt %1.8f", *t, *t - pt); 386 DBG("VSYNC %1.8f = delt %1.8f", *t, *t - pt);
374 D("VSYNC %1.8f = delt %1.8f\n", *t, *t - pt); 387 D("VSYNC %1.8f = delt %1.8f\n", *t, *t - pt);
375 ecore_loop_time_set(*t); 388 if ((!tick_skip) || (tick_queued == 1))
376 ecore_animator_custom_tick(); 389 {
390 ecore_loop_time_set(*t);
391 ecore_animator_custom_tick();
392 }
377 pt = *t; 393 pt = *t;
378 } 394 }
379 free(msg); 395 free(msg);
@@ -666,6 +682,9 @@ checkdone:
666 return 0; 682 return 0;
667 } 683 }
668 684
685 if (getenv("ECORE_ANIMATOR_SKIP")) tick_skip = EINA_TRUE;
686 tick_queue_count = 0;
687 eina_spinlock_new(&tick_queue_lock);
669 thq = eina_thread_queue_new(); 688 thq = eina_thread_queue_new();
670 drm_thread = ecore_thread_feedback_run(_drm_tick_core, _drm_tick_notify, 689 drm_thread = ecore_thread_feedback_run(_drm_tick_core, _drm_tick_notify,
671 NULL, NULL, NULL, EINA_TRUE); 690 NULL, NULL, NULL, EINA_TRUE);