summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-10-20 16:41:28 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-10-20 16:57:05 -0400
commita347a47e7502542115412efc4f2ddcd78c610193 (patch)
tree25edb0be263403470fa28de109ddd31d921b2582
parent9d3bc82d0834d20a21b1feefc2eb3209f6cd9be4 (diff)
ee-wayland: use frame callbacks exclusively to determine render timing
when running in a wayland compositor, the ideal mode of operation is to only prepare/send frames when the compositor has finished with the previous frame to achieve this, manual rendering can be toggled upon creating and completing a frame callback, ensuring that a canvas never has multiple pending buffers at any given time fix T2784
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c27
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c3
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h1
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c3
4 files changed, 24 insertions, 10 deletions
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 41b0112d57..2ba972f82b 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
@@ -1263,12 +1263,13 @@ _ecore_evas_wl_common_pre_render(Ecore_Evas *ee)
1263static void 1263static void
1264_anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED) 1264_anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED)
1265{ 1265{
1266 Ecore_Evas_Engine_Wl_Data *wdata = data; 1266 Ecore_Evas *ee = data;
1267 1267 Ecore_Evas_Engine_Wl_Data *wdata;
1268 if ((wdata->anim_callback) && (callback != wdata->anim_callback)) return;
1269 1268
1269 wdata = ee->engine.data;
1270 wl_callback_destroy(callback); 1270 wl_callback_destroy(callback);
1271 wdata->anim_callback = NULL; 1271 wdata->anim_callback = NULL;
1272 ecore_evas_manual_render_set(ee, 0);
1272} 1273}
1273 1274
1274static const struct wl_callback_listener _anim_listener = 1275static const struct wl_callback_listener _anim_listener =
@@ -1276,6 +1277,18 @@ static const struct wl_callback_listener _anim_listener =
1276 _anim_cb_animate 1277 _anim_cb_animate
1277}; 1278};
1278 1279
1280void
1281_ecore_evas_wl_common_render_pre(void *data, Evas *evas EINA_UNUSED, void *event EINA_UNUSED)
1282{
1283 Ecore_Evas *ee = data;
1284 Ecore_Evas_Engine_Wl_Data *wdata;
1285
1286 wdata = ee->engine.data;
1287 wdata->anim_callback = wl_surface_frame(ecore_wl_window_surface_get(wdata->win));
1288 wl_callback_add_listener(wdata->anim_callback, &_anim_listener, ee);
1289 ecore_evas_manual_render_set(ee, 1);
1290}
1291
1279void 1292void
1280_ecore_evas_wl_common_render_updates(void *data, Evas *evas EINA_UNUSED, void *event) 1293_ecore_evas_wl_common_render_updates(void *data, Evas *evas EINA_UNUSED, void *event)
1281{ 1294{
@@ -1286,13 +1299,7 @@ _ecore_evas_wl_common_render_updates(void *data, Evas *evas EINA_UNUSED, void *e
1286 1299
1287 ee->in_async_render = EINA_FALSE; 1300 ee->in_async_render = EINA_FALSE;
1288 1301
1289 if (_ecore_evas_wl_common_render_updates_process(ee, ev->updated_area)) 1302 _ecore_evas_wl_common_render_updates_process(ee, ev->updated_area);
1290 {
1291 Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
1292
1293 wdata->anim_callback = wl_surface_frame(ecore_wl_window_surface_get(wdata->win));
1294 wl_callback_add_listener(wdata->anim_callback, &_anim_listener, wdata);
1295 }
1296 1303
1297 if (ee->delayed.alpha_changed) 1304 if (ee->delayed.alpha_changed)
1298 { 1305 {
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 367546d693..4871283fd2 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
@@ -227,6 +227,9 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
227 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, 227 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST,
228 _ecore_evas_wl_common_render_updates, ee); 228 _ecore_evas_wl_common_render_updates, ee);
229 229
230 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_PRE,
231 _ecore_evas_wl_common_render_pre, ee);
232
230 /* FIXME: This needs to be set based on theme & scale */ 233 /* FIXME: This needs to be set based on theme & scale */
231 if (ee->prop.draw_frame) 234 if (ee->prop.draw_frame)
232 evas_output_framespace_set(ee->evas, fx, fy, fw, fh); 235 evas_output_framespace_set(ee->evas, fx, fy, fw, fh);
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 48e9a3ff7a..7929ab32f5 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
@@ -74,6 +74,7 @@ void _ecore_evas_wl_common_post_render(Ecore_Evas *ee);
74int _ecore_evas_wl_common_render(Ecore_Evas *ee); 74int _ecore_evas_wl_common_render(Ecore_Evas *ee);
75void _ecore_evas_wl_common_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); 75void _ecore_evas_wl_common_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
76void _ecore_evas_wl_common_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi); 76void _ecore_evas_wl_common_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi);
77void _ecore_evas_wl_common_render_pre(void *data, Evas *evas EINA_UNUSED, void *event);
77void _ecore_evas_wl_common_render_updates(void *data, Evas *evas, void *event); 78void _ecore_evas_wl_common_render_updates(void *data, Evas *evas, void *event);
78void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize); 79void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize);
79void _ecore_evas_wl_common_borderless_set(Ecore_Evas *ee, Eina_Bool on); 80void _ecore_evas_wl_common_borderless_set(Ecore_Evas *ee, Eina_Bool on);
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 4d3af44303..530b3ce7d1 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
@@ -222,6 +222,9 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
222 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, 222 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST,
223 _ecore_evas_wl_common_render_updates, ee); 223 _ecore_evas_wl_common_render_updates, ee);
224 224
225 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_PRE,
226 _ecore_evas_wl_common_render_pre, ee);
227
225 /* FIXME: This needs to be set based on theme & scale */ 228 /* FIXME: This needs to be set based on theme & scale */
226 if (ee->prop.draw_frame) 229 if (ee->prop.draw_frame)
227 evas_output_framespace_set(ee->evas, fx, fy, fw, fh); 230 evas_output_framespace_set(ee->evas, fx, fy, fw, fh);