cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=bb1a1eef65a0f6db99e446d4ac56fc2896496be0

commit bb1a1eef65a0f6db99e446d4ac56fc2896496be0
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Mon Jan 25 15:18:28 2016 -0800

    ecore_evas: introduce support for per window animator trigger.
    
    This code is currently only using the older fallback code and not any
    new event source, so all animator on all window are still triggered
    whatever the case are.
---
 src/lib/ecore_evas/ecore_evas.c                    | 58 ++++++++++++++++++++++
 src/lib/ecore_evas/ecore_evas_private.h            |  8 +++
 .../ecore_evas/engines/cocoa/ecore_evas_cocoa.c    | 14 +++++-
 .../ecore_evas/engines/drm/ecore_evas_drm.c        |  5 +-
 .../ecore_evas/engines/extn/ecore_evas_extn.c      |  5 +-
 src/modules/ecore_evas/engines/fb/ecore_evas_fb.c  |  7 ++-
 .../engines/psl1ght/ecore_evas_psl1ght.c           |  5 +-
 .../ecore_evas/engines/sdl/ecore_evas_sdl.c        |  5 +-
 .../engines/wayland/ecore_evas_wayland_egl.c       |  5 +-
 .../engines/wayland/ecore_evas_wayland_shm.c       |  5 +-
 .../ecore_evas/engines/win32/ecore_evas_win32.c    |  5 +-
 src/modules/ecore_evas/engines/x/ecore_evas_x.c    |  5 +-
 12 files changed, 116 insertions(+), 11 deletions(-)

diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index d3e3f28..fa0c8eb 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -3070,12 +3070,59 @@ _ecore_evas_fps_debug_rendertime_add(double t)
 }
 
 EAPI void
+ecore_evas_animator_tick(Ecore_Evas *ee, Eina_Rectangle *viewport)
+{
+   Ecore_Evas *subee;
+   Eina_List *l;
+   Efl_Core_Event_Animator_Tick a = { { 0 } };
+
+   if (!viewport)
+     {
+        evas_output_size_get(ee->evas, &a.update_area.w, &a.update_area.h);
+     }
+   else
+     {
+        a.update_area = *viewport;
+     }
+
+   eo_do(ee->evas, 
eo_event_callback_call(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, &a));
+
+   // FIXME: We do not support partial animator in the subcanvas
+   a.update_area.x = 0;
+   a.update_area.y = 0;
+   EINA_LIST_FOREACH(ee->sub_ecore_evas, l, subee)
+     {
+        evas_output_size_get(subee->evas, &a.update_area.w, &a.update_area.h);
+        eo_do(subee->evas, 
eo_event_callback_call(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, &a));
+     }
+}
+
+static Eina_Bool
+_ecore_evas_animator_fallback(void *data)
+{
+   ecore_evas_animator_tick(data, NULL);
+   return EINA_TRUE;
+}
+
+EAPI void
 _ecore_evas_register(Ecore_Evas *ee)
 {
    ee->registered = 1;
    ecore_evases = (Ecore_Evas *)eina_inlist_prepend
      (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
 
+   if (ee->engine.func->fn_animator_register &&
+       ee->engine.func->fn_animator_unregister)
+     {
+        // Backend support per window vsync
+        ee->engine.func->fn_animator_register(ee);
+     }
+   else
+     {
+        // Backend doesn't support per window vsync, fallback to generic 
support
+        ee->anim = ecore_animator_add(_ecore_evas_animator_fallback, ee);
+     }
+
 #ifdef RENDER_SYNC
    ecore_evas_first = EINA_TRUE;
 #endif
@@ -3107,6 +3154,17 @@ _ecore_evas_free(Ecore_Evas *ee)
    ee->deleted = EINA_TRUE;
    if (ee->refcount > 0) return;
 
+   // Stop all vsync first
+   if (ee->engine.func->fn_animator_register &&
+       ee->engine.func->fn_animator_unregister)
+     {
+        // Backend support per window vsync
+        ee->engine.func->fn_animator_unregister(ee);
+     }
+   if (ee->anim)
+     ecore_animator_del(ee->anim);
+   ee->anim = NULL;
+
    if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee);
    while (ee->sub_ecore_evas)
      {
diff --git a/src/lib/ecore_evas/ecore_evas_private.h 
b/src/lib/ecore_evas/ecore_evas_private.h
index c342ace..62e5545 100644
--- a/src/lib/ecore_evas/ecore_evas_private.h
+++ b/src/lib/ecore_evas/ecore_evas_private.h
@@ -153,6 +153,9 @@ struct _Ecore_Evas_Engine_Func
    void (*fn_wm_rot_manual_rotation_done) (Ecore_Evas *ee);
 
    void (*fn_aux_hints_set) (Ecore_Evas *ee, const char *hints);
+
+   void (*fn_animator_register)  (Ecore_Evas *ee);
+   void (*fn_animator_unregister)(Ecore_Evas *ee);
 };
 
 struct _Ecore_Evas_Interface
@@ -294,6 +297,9 @@ struct _Ecore_Evas
    Ecore_Evas_Engine engine;
    Eina_List *sub_ecore_evas;
 
+   // Animator code
+   Ecore_Animator *anim;
+
    struct {
       unsigned char avoid_damage;
       unsigned char resize_shape : 1;
@@ -419,6 +425,8 @@ const Eina_List *_ecore_evas_available_engines_get(void);
 void _ecore_evas_engine_init(void);
 void _ecore_evas_engine_shutdown(void);
 
+EAPI void ecore_evas_animator_tick(Ecore_Evas *ee, Eina_Rectangle *viewport);
+
 #undef EAPI
 #define EAPI
 
diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c 
b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
index 0f9c3b6..054a1e2 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -643,7 +643,19 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
     _ecore_evas_screen_geometry_get,
     NULL, // screen_dpi_get
     NULL,
-    NULL  // msg_send
+    NULL,  // msg_send
+
+    NULL, // fn_pointer_xy_get
+    NULL, // fn_pointer_warp
+
+    NULL, // fn_wm_rot_preferred_rotation_set
+    NULL, // fn_wm_rot_available_rotations_set
+    NULL, // fn_wm_rot_manual_rotation_done_set
+    NULL, // fn_wm_rot_manual_rotation_done
+
+    NULL, // fn_aux_hints_set
+    NULL, // fn_animator_register
+    NULL  // fn_animator_unregister
   };
 
 static Ecore_Cocoa_Window *
diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c 
b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
index f25c52c..63b7949 100644
--- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
+++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
@@ -172,7 +172,10 @@ static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func =
    NULL, // wm_rot_manual_rotation_done_set
    NULL, // wm_rot_manual_rotation_done
 
-   NULL  // aux_hints_set
+   NULL, // aux_hints_set
+
+   NULL, // fn_animator_register
+   NULL  // fn_animator_unregister
 };
 
 EAPI Ecore_Evas *
diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c 
b/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
index c04afe8..6cc02b7 100644
--- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
+++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
@@ -910,7 +910,10 @@ static const Ecore_Evas_Engine_Func 
_ecore_extn_plug_engine_func =
    NULL, // wm_rot_manual_rotation_done_set
    NULL, // wm_rot_manual_rotation_done
 
-   NULL  // aux_hints_set
+   NULL, // aux_hints_set
+
+   NULL, // fn_animator_register
+   NULL  // fn_animator_unregister
 };
 
 static Eina_Bool
diff --git a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c 
b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
index 8042d0c..bd34e3c 100644
--- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
+++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
@@ -638,8 +638,11 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
      NULL, // wm_rot_manual_rotation_done_set
      NULL, // wm_rot_manual_rotation_done
 
-     NULL  // aux_hints_set
- };
+     NULL,  // aux_hints_set
+
+     NULL, // fn_animator_register
+     NULL  // fn_animator_unregister
+};
 
 EAPI Ecore_Evas *
 ecore_evas_fb_new_internal(const char *disp_name, int rotation, int w, int h)
diff --git a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c 
b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
index c323264..6235068 100644
--- a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
+++ b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
@@ -460,7 +460,10 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
    NULL, // wm_rot_manual_rotation_done_set
    NULL, // wm_rot_manual_rotation_done
 
-   NULL  // aux_hints_set
+   NULL, // aux_hints_set
+
+   NULL, // fn_animator_register
+   NULL  // fn_animator_unregister
 };
 
 EAPI Ecore_Evas *
diff --git a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c 
b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
index 0c14c89..1cdcb9a 100644
--- a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
+++ b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
@@ -549,7 +549,10 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
    NULL, // wm_rot_manual_rotation_done_set
    NULL, // wm_rot_manual_rotation_done
 
-   NULL  // aux_hints_set
+   NULL, // aux_hints_set
+
+   NULL, // fn_animator_register
+   NULL  // fn_animator_unregister
 };
 
 static Ecore_Evas*
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
index c6def65..46e9e03 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
@@ -109,7 +109,10 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
    NULL, // wm_rot_manual_rotation_done_set
    NULL, // wm_rot_manual_rotation_done
 
-   NULL  // aux_hints_set
+   NULL, // aux_hints_set
+
+   NULL, // fn_animator_register
+   NULL  // fn_animator_unregister
 };
 
 /* external variables */
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
index 23b9b01..1afa86d 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
@@ -109,7 +109,10 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
    NULL, // wm_rot_manual_rotation_done_set
    NULL, // wm_rot_manual_rotation_done
 
-   NULL  // aux_hints_set
+   NULL, // aux_hints_set
+
+   NULL, // fn_animator_register
+   NULL  // fn_animator_unregister
 };
 
 /* external variables */
diff --git a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c 
b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
index 3883334..a9404ca 100644
--- a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
+++ b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
@@ -1200,7 +1200,10 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
      NULL, // wm_rot_manual_rotation_done_set
      NULL, // wm_rot_manual_rotation_done
 
-     NULL  // aux_hints_set
+     NULL, // aux_hints_set
+
+     NULL, // fn_animator_register
+     NULL  // fn_animator_unregister
 };
 
 #endif /* BUILD_ECORE_EVAS_WIN32 */
diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c 
b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
index a2ce912..418cdaa 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -3677,7 +3677,10 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
    _ecore_evas_x_wm_rot_manual_rotation_done_set,
    _ecore_evas_x_wm_rot_manual_rotation_done,
 
-   _ecore_evas_x_aux_hints_set
+   _ecore_evas_x_aux_hints_set,
+
+   NULL, // fn_animator_register
+   NULL  // fn_animator_unregister
 };
 
 /*

-- 


Reply via email to