ecore_evas: Don't start custom tickers for manually rendered canvases
authorDerek Foreman <derekf@osg.samsung.com>
Tue, 11 Jul 2017 21:43:33 +0000 (16:43 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Thu, 13 Jul 2017 23:07:42 +0000 (18:07 -0500)
When a canvas is manually rendered the ticker is just a waste of cpu, and
worse - it can wake the drm back-end from dpms sleep, as the display needs
to be awake to generate vblanks.

We fire a DBG message when attempting to start an animator in this state
because it's frequently a bug that wastes battery life - (like E doing idle
cursor animations or clock updates while the display is off)

However, dpms off is not the only potential usage of manual render, so
another commit will follow shortly to fix the bug this commit introduces -
when using a backend with a custom ticker and doing manual render with
the display on, calling ecore_evas_manual_render() will not draw with
updated animator state.

Fix T5462
Again.
Really.

src/lib/ecore_evas/ecore_evas.c

index ffc4e6f..5997628 100644 (file)
@@ -2646,6 +2646,14 @@ ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render)
 {
    ECORE_EVAS_CHECK(ee);
    ee->manual_render = manual_render;
+   if (!ee->anim_count) return;
+   if (!ee->engine.func->fn_animator_register) return;
+   if (!ee->engine.func->fn_animator_unregister) return;
+
+   if (manual_render)
+     ee->engine.func->fn_animator_unregister(ee);
+   else
+     ee->engine.func->fn_animator_register(ee);
 }
 
 EAPI Eina_Bool
@@ -3085,6 +3093,11 @@ _ecore_evas_custom_tick_begin(void *data)
 
    if (ee->anim_count++ > 0) return;
 
+   if (ee->manual_render)
+     {
+       DBG("Attempt to schedule tick for manually rendered canvas.");
+       return;
+     }
    ee->engine.func->fn_animator_register(ee);
 }
 
@@ -3095,6 +3108,8 @@ _ecore_evas_custom_tick_end(void *data)
 
    if ((--ee->anim_count) > 0) return;
 
+   if (ee->manual_render) return;
+
    ee->engine.func->fn_animator_unregister(ee);
 }