From ef89bfbbede4721fd61d95e9186b370fa58b74b9 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 16 Oct 2015 15:51:06 -0400 Subject: [PATCH] ecore-evas-wayland: add frame callback listener during render when a render occurs, frame callbacks must be managed in order to ensure successful rendering for future frames. the best place to do this is in the engine here, since this is the lowest-level place which has access to both the wl_surface as well as the evas rendering state ref T2784 --- .../engines/wayland/ecore_evas_wayland_common.c | 26 +++++++++++++++++++++- .../engines/wayland/ecore_evas_wayland_private.h | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 379dcb1..41b0112 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -451,6 +451,8 @@ _ecore_evas_wl_common_free(Ecore_Evas *ee) if (!ee) return; wdata = ee->engine.data; + if (wdata->anim_callback) + wl_callback_destroy(wdata->anim_callback); if (wdata->win) ecore_wl_window_free(wdata->win); wdata->win = NULL; free(wdata); @@ -1258,6 +1260,22 @@ _ecore_evas_wl_common_pre_render(Ecore_Evas *ee) return rend; } +static void +_anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED) +{ + Ecore_Evas_Engine_Wl_Data *wdata = data; + + if ((wdata->anim_callback) && (callback != wdata->anim_callback)) return; + + wl_callback_destroy(callback); + wdata->anim_callback = NULL; +} + +static const struct wl_callback_listener _anim_listener = +{ + _anim_cb_animate +}; + void _ecore_evas_wl_common_render_updates(void *data, Evas *evas EINA_UNUSED, void *event) { @@ -1268,7 +1286,13 @@ _ecore_evas_wl_common_render_updates(void *data, Evas *evas EINA_UNUSED, void *e ee->in_async_render = EINA_FALSE; - _ecore_evas_wl_common_render_updates_process(ee, ev->updated_area); + if (_ecore_evas_wl_common_render_updates_process(ee, ev->updated_area)) + { + Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data; + + wdata->anim_callback = wl_surface_frame(ecore_wl_window_surface_get(wdata->win)); + wl_callback_add_listener(wdata->anim_callback, &_anim_listener, wdata); + } if (ee->delayed.alpha_changed) { diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h index 206d178..48e9a3f 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h @@ -35,6 +35,7 @@ struct _Ecore_Evas_Engine_Wl_Data #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL struct wl_egl_window *egl_win; #endif + struct wl_callback *anim_callback; }; Ecore_Evas_Interface_Wayland *_ecore_evas_wl_interface_new(void); -- 2.7.4