forked from enlightenment/efl
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
This commit is contained in:
parent
d80de732d1
commit
da04400c5d
|
@ -69,6 +69,9 @@ static volatile int timer_fd_read = -1;
|
||||||
static volatile int timer_fd_write = -1;
|
static volatile int timer_fd_write = -1;
|
||||||
static Ecore_Thread *timer_thread = NULL;
|
static Ecore_Thread *timer_thread = NULL;
|
||||||
static volatile int timer_event_is_busy = 0;
|
static volatile int timer_event_is_busy = 0;
|
||||||
|
static Eina_Spinlock tick_queue_lock;
|
||||||
|
static int tick_queue_count = 0;
|
||||||
|
static Eina_Bool tick_skip = EINA_FALSE;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_tick_send(signed char val)
|
_tick_send(signed char val)
|
||||||
|
@ -88,6 +91,9 @@ _timer_send_time(double t)
|
||||||
{
|
{
|
||||||
*tim = t;
|
*tim = t;
|
||||||
DBG(" ... send %1.8f", t);
|
DBG(" ... send %1.8f", t);
|
||||||
|
eina_spinlock_take(&tick_queue_lock);
|
||||||
|
tick_queue_count++;
|
||||||
|
eina_spinlock_release(&tick_queue_lock);
|
||||||
ecore_thread_feedback(timer_thread, tim);
|
ecore_thread_feedback(timer_thread, tim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,6 +156,12 @@ done:
|
||||||
static void
|
static void
|
||||||
_timer_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg)
|
_timer_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg)
|
||||||
{
|
{
|
||||||
|
int tick_queued;
|
||||||
|
|
||||||
|
eina_spinlock_take(&tick_queue_lock);
|
||||||
|
tick_queued = tick_queue_count;
|
||||||
|
tick_queue_count--;
|
||||||
|
eina_spinlock_release(&tick_queue_lock);
|
||||||
DBG("notify.... %3.3f %i", *((double *)msg), timer_event_is_busy);
|
DBG("notify.... %3.3f %i", *((double *)msg), timer_event_is_busy);
|
||||||
if (timer_event_is_busy)
|
if (timer_event_is_busy)
|
||||||
{
|
{
|
||||||
|
@ -157,8 +169,11 @@ _timer_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, voi
|
||||||
static double pt = 0.0;
|
static double pt = 0.0;
|
||||||
|
|
||||||
DBG("VSYNC %1.8f = delt %1.8f", *t, *t - pt);
|
DBG("VSYNC %1.8f = delt %1.8f", *t, *t - pt);
|
||||||
|
if ((!tick_skip) || (tick_queued == 1))
|
||||||
|
{
|
||||||
ecore_loop_time_set(*t);
|
ecore_loop_time_set(*t);
|
||||||
_do_tick();
|
_do_tick();
|
||||||
|
}
|
||||||
pt = *t;
|
pt = *t;
|
||||||
}
|
}
|
||||||
free(msg);
|
free(msg);
|
||||||
|
@ -167,7 +182,9 @@ _timer_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, voi
|
||||||
static void
|
static void
|
||||||
_timer_tick_finished(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
|
_timer_tick_finished(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
eina_spinlock_free(&tick_queue_lock);
|
||||||
timer_thread = NULL;
|
timer_thread = NULL;
|
||||||
|
tick_queue_count = 0;
|
||||||
if (timer_fd_read >= 0)
|
if (timer_fd_read >= 0)
|
||||||
{
|
{
|
||||||
pipe_close(timer_fd_read);
|
pipe_close(timer_fd_read);
|
||||||
|
@ -190,6 +207,9 @@ _timer_tick_begin(void)
|
||||||
if (pipe(fds) != 0) return;
|
if (pipe(fds) != 0) return;
|
||||||
timer_fd_read = fds[0];
|
timer_fd_read = fds[0];
|
||||||
timer_fd_write = fds[1];
|
timer_fd_write = fds[1];
|
||||||
|
if (getenv("ECORE_ANIMATOR_SKIP")) tick_skip = EINA_TRUE;
|
||||||
|
tick_queue_count = 0;
|
||||||
|
eina_spinlock_new(&tick_queue_lock);
|
||||||
timer_thread = ecore_thread_feedback_run(_timer_tick_core,
|
timer_thread = ecore_thread_feedback_run(_timer_tick_core,
|
||||||
_timer_tick_notify,
|
_timer_tick_notify,
|
||||||
_timer_tick_finished,
|
_timer_tick_finished,
|
||||||
|
|
|
@ -147,6 +147,10 @@ static void *drm_lib = NULL;
|
||||||
|
|
||||||
static Eina_Thread_Queue *thq = NULL;
|
static Eina_Thread_Queue *thq = NULL;
|
||||||
static Ecore_Thread *drm_thread = NULL;
|
static Ecore_Thread *drm_thread = NULL;
|
||||||
|
static Eina_Spinlock tick_queue_lock;
|
||||||
|
static int tick_queue_count = 0;
|
||||||
|
static Eina_Bool tick_skip = EINA_FALSE;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Eina_Thread_Queue_Msg head;
|
Eina_Thread_Queue_Msg head;
|
||||||
|
@ -208,6 +212,9 @@ _drm_send_time(double t)
|
||||||
*tim = t;
|
*tim = t;
|
||||||
DBG(" ... send %1.8f", t);
|
DBG(" ... send %1.8f", t);
|
||||||
D(" @%1.5f ... send %1.8f\n", ecore_time_get(), t);
|
D(" @%1.5f ... send %1.8f\n", ecore_time_get(), t);
|
||||||
|
eina_spinlock_take(&tick_queue_lock);
|
||||||
|
tick_queue_count++;
|
||||||
|
eina_spinlock_release(&tick_queue_lock);
|
||||||
ecore_thread_feedback(drm_thread, tim);
|
ecore_thread_feedback(drm_thread, tim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,6 +370,12 @@ _drm_tick_core(void *data EINA_UNUSED, Ecore_Thread *thread)
|
||||||
static void
|
static void
|
||||||
_drm_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg)
|
_drm_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg)
|
||||||
{
|
{
|
||||||
|
int tick_queued;
|
||||||
|
|
||||||
|
eina_spinlock_take(&tick_queue_lock);
|
||||||
|
tick_queued = tick_queue_count;
|
||||||
|
tick_queue_count--;
|
||||||
|
eina_spinlock_release(&tick_queue_lock);
|
||||||
DBG("notify.... %3.3f %i", *((double *)msg), drm_event_is_busy);
|
DBG("notify.... %3.3f %i", *((double *)msg), drm_event_is_busy);
|
||||||
D("notify.... %3.3f %i\n", *((double *)msg), drm_event_is_busy);
|
D("notify.... %3.3f %i\n", *((double *)msg), drm_event_is_busy);
|
||||||
if (drm_event_is_busy)
|
if (drm_event_is_busy)
|
||||||
|
@ -372,8 +385,11 @@ _drm_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void
|
||||||
|
|
||||||
DBG("VSYNC %1.8f = delt %1.8f", *t, *t - pt);
|
DBG("VSYNC %1.8f = delt %1.8f", *t, *t - pt);
|
||||||
D("VSYNC %1.8f = delt %1.8f\n", *t, *t - pt);
|
D("VSYNC %1.8f = delt %1.8f\n", *t, *t - pt);
|
||||||
|
if ((!tick_skip) || (tick_queued == 1))
|
||||||
|
{
|
||||||
ecore_loop_time_set(*t);
|
ecore_loop_time_set(*t);
|
||||||
ecore_animator_custom_tick();
|
ecore_animator_custom_tick();
|
||||||
|
}
|
||||||
pt = *t;
|
pt = *t;
|
||||||
}
|
}
|
||||||
free(msg);
|
free(msg);
|
||||||
|
@ -666,6 +682,9 @@ checkdone:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getenv("ECORE_ANIMATOR_SKIP")) tick_skip = EINA_TRUE;
|
||||||
|
tick_queue_count = 0;
|
||||||
|
eina_spinlock_new(&tick_queue_lock);
|
||||||
thq = eina_thread_queue_new();
|
thq = eina_thread_queue_new();
|
||||||
drm_thread = ecore_thread_feedback_run(_drm_tick_core, _drm_tick_notify,
|
drm_thread = ecore_thread_feedback_run(_drm_tick_core, _drm_tick_notify,
|
||||||
NULL, NULL, NULL, EINA_TRUE);
|
NULL, NULL, NULL, EINA_TRUE);
|
||||||
|
|
Loading…
Reference in New Issue