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.
This commit is contained in:
Cedric BAIL 2016-01-25 15:18:28 -08:00
parent e8134e868a
commit bb1a1eef65
12 changed files with 116 additions and 11 deletions

View File

@ -3069,6 +3069,41 @@ _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)
{
@ -3076,6 +3111,18 @@ _ecore_evas_register(Ecore_Evas *ee)
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)
{

View File

@ -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

View File

@ -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 *

View File

@ -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 *

View File

@ -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

View File

@ -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)

View File

@ -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 *

View File

@ -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*

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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
};
/*