summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/lib/ecore/ecore_anim.c24
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_vsync.c23
2 files changed, 43 insertions, 4 deletions
diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c
index 70c2f89..c069c96 100644
--- a/src/lib/ecore/ecore_anim.c
+++ b/src/lib/ecore/ecore_anim.c
@@ -69,6 +69,9 @@ static volatile int timer_fd_read = -1;
69static volatile int timer_fd_write = -1; 69static volatile int timer_fd_write = -1;
70static Ecore_Thread *timer_thread = NULL; 70static Ecore_Thread *timer_thread = NULL;
71static volatile int timer_event_is_busy = 0; 71static volatile int timer_event_is_busy = 0;
72static Eina_Spinlock tick_queue_lock;
73static int tick_queue_count = 0;
74static Eina_Bool tick_skip = EINA_FALSE;
72 75
73static void 76static void
74_tick_send(signed char val) 77_tick_send(signed char val)
@@ -88,6 +91,9 @@ _timer_send_time(double t)
88 { 91 {
89 *tim = t; 92 *tim = t;
90 DBG(" ... send %1.8f", t); 93 DBG(" ... send %1.8f", t);
94 eina_spinlock_take(&tick_queue_lock);
95 tick_queue_count++;
96 eina_spinlock_release(&tick_queue_lock);
91 ecore_thread_feedback(timer_thread, tim); 97 ecore_thread_feedback(timer_thread, tim);
92 } 98 }
93} 99}
@@ -150,6 +156,12 @@ done:
150static void 156static void
151_timer_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg) 157_timer_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg)
152{ 158{
159 int tick_queued;
160
161 eina_spinlock_take(&tick_queue_lock);
162 tick_queued = tick_queue_count;
163 tick_queue_count--;
164 eina_spinlock_release(&tick_queue_lock);
153 DBG("notify.... %3.3f %i", *((double *)msg), timer_event_is_busy); 165 DBG("notify.... %3.3f %i", *((double *)msg), timer_event_is_busy);
154 if (timer_event_is_busy) 166 if (timer_event_is_busy)
155 { 167 {
@@ -157,8 +169,11 @@ _timer_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, voi
157 static double pt = 0.0; 169 static double pt = 0.0;
158 170
159 DBG("VSYNC %1.8f = delt %1.8f", *t, *t - pt); 171 DBG("VSYNC %1.8f = delt %1.8f", *t, *t - pt);
160 ecore_loop_time_set(*t); 172 if ((!tick_skip) || (tick_queued == 1))
161 _do_tick(); 173 {
174 ecore_loop_time_set(*t);
175 _do_tick();
176 }
162 pt = *t; 177 pt = *t;
163 } 178 }
164 free(msg); 179 free(msg);
@@ -167,7 +182,9 @@ _timer_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, voi
167static void 182static void
168_timer_tick_finished(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED) 183_timer_tick_finished(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
169{ 184{
185 eina_spinlock_free(&tick_queue_lock);
170 timer_thread = NULL; 186 timer_thread = NULL;
187 tick_queue_count = 0;
171 if (timer_fd_read >= 0) 188 if (timer_fd_read >= 0)
172 { 189 {
173 pipe_close(timer_fd_read); 190 pipe_close(timer_fd_read);
@@ -190,6 +207,9 @@ _timer_tick_begin(void)
190 if (pipe(fds) != 0) return; 207 if (pipe(fds) != 0) return;
191 timer_fd_read = fds[0]; 208 timer_fd_read = fds[0];
192 timer_fd_write = fds[1]; 209 timer_fd_write = fds[1];
210 if (getenv("ECORE_ANIMATOR_SKIP")) tick_skip = EINA_TRUE;
211 tick_queue_count = 0;
212 eina_spinlock_new(&tick_queue_lock);
193 timer_thread = ecore_thread_feedback_run(_timer_tick_core, 213 timer_thread = ecore_thread_feedback_run(_timer_tick_core,
194 _timer_tick_notify, 214 _timer_tick_notify,
195 _timer_tick_finished, 215 _timer_tick_finished,
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);