summaryrefslogtreecommitdiff
path: root/src/modules/ecore_evas
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-08-18 14:13:11 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-08-18 14:27:32 -0500
commit8c917daa069f0c646d4f9a92cb372f3da5ecfb16 (patch)
tree091f275b2033346173b7f7e1bb970cdb1ac9db9c /src/modules/ecore_evas
parent913e216ea348920b4e3fc75eacbac9835e8718c8 (diff)
wayland: Tick like a boss
Instead of the clever but awful manual_render_set hack, actually do ticks based on frame callbacks. Fix T5850
Diffstat (limited to 'src/modules/ecore_evas')
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c97
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h3
2 files changed, 64 insertions, 36 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 4fac885..fe45f8a 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
@@ -35,6 +35,58 @@ static void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int
35 35
36/* local functions */ 36/* local functions */
37static void 37static void
38_anim_cb_tick(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
39{
40 Ecore_Evas *ee = data;
41 Ecore_Evas_Engine_Wl_Data *edata;
42
43 edata = ee->engine.data;
44
45 if (!edata->ticking) return;
46
47 ecore_evas_animator_tick(ee, NULL, ecore_loop_time_get());
48}
49
50static void
51_ecore_evas_wl_common_animator_register(Ecore_Evas *ee)
52{
53 Ecore_Evas_Engine_Wl_Data *edata;
54
55 edata = (Ecore_Evas_Engine_Wl_Data *)ee->engine.data;
56
57 EINA_SAFETY_ON_TRUE_RETURN(edata->ticking);
58
59 edata->frame = ecore_wl2_window_frame_callback_add(edata->win,
60 _anim_cb_tick, ee);
61 if (!ecore_wl2_window_pending_get(edata->win) && !ee->in_async_render)
62 ecore_wl2_window_commit(edata->win, EINA_TRUE);
63 edata->ticking = EINA_TRUE;
64}
65
66static void
67_ecore_evas_wl_common_animator_unregister(Ecore_Evas *ee)
68{
69 Ecore_Evas_Engine_Wl_Data *edata;
70
71 edata = ee->engine.data;
72 edata->ticking = EINA_FALSE;
73 ecore_wl2_window_frame_callback_del(edata->frame);
74 edata->frame = NULL;
75}
76
77static void
78_ecore_evas_wl_common_evas_changed(Ecore_Evas *ee, Eina_Bool changed)
79{
80 Ecore_Evas_Engine_Wl_Data *edata;
81
82 if (changed) return;
83
84 edata = (Ecore_Evas_Engine_Wl_Data *)ee->engine.data;
85 if (edata->ticking && !ecore_wl2_window_pending_get(edata->win))
86 ecore_wl2_window_commit(edata->win, EINA_TRUE);
87}
88
89static void
38_ecore_evas_wl_common_state_update(Ecore_Evas *ee) 90_ecore_evas_wl_common_state_update(Ecore_Evas *ee)
39{ 91{
40 if (ee->func.fn_state_change) ee->func.fn_state_change(ee); 92 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
@@ -158,8 +210,6 @@ _ecore_evas_wl_common_cb_disconnect(void *data EINA_UNUSED, int type EINA_UNUSED
158 Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data; 210 Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
159 211
160 if (wdata->display != ev->display) continue; 212 if (wdata->display != ev->display) continue;
161 if (wdata->anim_callback) wl_callback_destroy(wdata->anim_callback);
162 wdata->anim_callback = NULL;
163 wdata->sync_done = EINA_FALSE; 213 wdata->sync_done = EINA_FALSE;
164 wdata->defer_show = EINA_TRUE; 214 wdata->defer_show = EINA_TRUE;
165 ee->visible = EINA_FALSE; 215 ee->visible = EINA_FALSE;
@@ -475,7 +525,6 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
475 wdata->win->zxdg_configure_ack(wdata->win->zxdg_surface, 525 wdata->win->zxdg_configure_ack(wdata->win->zxdg_surface,
476 wdata->win->configure_serial); 526 wdata->win->configure_serial);
477 wdata->win->configure_serial = 0; 527 wdata->win->configure_serial = 0;
478 ecore_wl2_window_commit(wdata->win, EINA_TRUE);
479 } 528 }
480 return ECORE_CALLBACK_RENEW; 529 return ECORE_CALLBACK_RENEW;
481 } 530 }
@@ -553,6 +602,8 @@ _ecore_evas_wl_common_cb_window_configure_complete(void *data EINA_UNUSED, int t
553 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 602 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
554 ERR("Failed to set Evas Engine Info for '%s'", ee->driver); 603 ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
555 604
605 ecore_evas_manual_render_set(ee, 0);
606
556 return ECORE_CALLBACK_PASS_ON; 607 return ECORE_CALLBACK_PASS_ON;
557} 608}
558 609
@@ -1210,7 +1261,8 @@ _ecore_evas_wl_common_free(Ecore_Evas *ee)
1210 ee_list = eina_list_remove(ee_list, ee); 1261 ee_list = eina_list_remove(ee_list, ee);
1211 1262
1212 eina_list_free(wdata->regen_objs); 1263 eina_list_free(wdata->regen_objs);
1213 if (wdata->anim_callback) wl_callback_destroy(wdata->anim_callback); 1264 if (wdata->frame) ecore_wl2_window_frame_callback_del(wdata->frame);
1265 wdata->frame = NULL;
1214 ecore_event_handler_del(wdata->sync_handler); 1266 ecore_event_handler_del(wdata->sync_handler);
1215 if (wdata->win) ecore_wl2_window_free(wdata->win); 1267 if (wdata->win) ecore_wl2_window_free(wdata->win);
1216 ecore_wl2_display_disconnect(wdata->display); 1268 ecore_wl2_display_disconnect(wdata->display);
@@ -1635,46 +1687,21 @@ _ecore_evas_wl_common_ignore_events_set(Ecore_Evas *ee, int ignore)
1635} 1687}
1636 1688
1637static void 1689static void
1638_anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED)
1639{
1640 Ecore_Evas *ee = data;
1641 Ecore_Evas_Engine_Wl_Data *wdata;
1642
1643 wdata = ee->engine.data;
1644 wl_callback_destroy(callback);
1645 wdata->anim_callback = NULL;
1646 ecore_evas_manual_render_set(ee, 0);
1647}
1648
1649static const struct wl_callback_listener _anim_listener =
1650{
1651 _anim_cb_animate
1652};
1653
1654static void
1655_ecore_evas_wl_common_render_flush_pre(void *data, Evas *evas, void *event EINA_UNUSED) 1690_ecore_evas_wl_common_render_flush_pre(void *data, Evas *evas, void *event EINA_UNUSED)
1656{ 1691{
1657 Ecore_Evas *ee = data; 1692 Ecore_Evas *ee = data;
1658 Evas_Engine_Info_Wayland *einfo; 1693 Evas_Engine_Info_Wayland *einfo;
1659 Ecore_Evas_Engine_Wl_Data *wdata; 1694 Ecore_Evas_Engine_Wl_Data *wdata;
1660 struct wl_surface *surf;
1661 int fx, fy; 1695 int fx, fy;
1662 1696
1663 einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(evas); 1697 einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(evas);
1664 if (!einfo) return; 1698 if (!einfo) return;
1665 1699
1666 surf = ecore_wl2_window_surface_get(einfo->info.wl2_win);
1667 if (!surf) return;
1668
1669 wdata = ee->engine.data; 1700 wdata = ee->engine.data;
1670 if (!wdata) return; 1701 if (!wdata) return;
1671 1702
1672 if (wdata->win->pending.configure) return; 1703 if (wdata->win->pending.configure) return;
1673 1704
1674 wdata->anim_callback = wl_surface_frame(surf);
1675 wl_callback_add_listener(wdata->anim_callback, &_anim_listener, ee);
1676 ecore_evas_manual_render_set(ee, 1);
1677
1678 if (!ecore_wl2_window_shell_surface_exists(wdata->win)) return; 1705 if (!ecore_wl2_window_shell_surface_exists(wdata->win)) return;
1679 1706
1680 if (wdata->win->zxdg_configure_ack && wdata->win->configure_serial) 1707 if (wdata->win->zxdg_configure_ack && wdata->win->configure_serial)
@@ -2027,6 +2054,7 @@ _ecore_evas_wl_common_show(Ecore_Evas *ee)
2027 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh); 2054 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
2028 else 2055 else
2029 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h + fh, ee->w + fw); 2056 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h + fh, ee->w + fw);
2057 ecore_evas_manual_render(ee);
2030 } 2058 }
2031 } 2059 }
2032 2060
@@ -2076,9 +2104,6 @@ _ecore_evas_wl_common_hide(Ecore_Evas *ee)
2076 ee->visible = 0; 2104 ee->visible = 0;
2077 ee->should_be_visible = 0; 2105 ee->should_be_visible = 0;
2078 ee->draw_ok = EINA_FALSE; 2106 ee->draw_ok = EINA_FALSE;
2079 if (wdata->anim_callback) wl_callback_destroy(wdata->anim_callback);
2080 wdata->anim_callback = NULL;
2081 ecore_evas_manual_render_set(ee, 0);
2082 2107
2083 if (ee->func.fn_hide) ee->func.fn_hide(ee); 2108 if (ee->func.fn_hide) ee->func.fn_hide(ee);
2084} 2109}
@@ -2318,10 +2343,10 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
2318 2343
2319 NULL, // aux_hints_set 2344 NULL, // aux_hints_set
2320 2345
2321 NULL, // fn_animator_register 2346 _ecore_evas_wl_common_animator_register,
2322 NULL, // fn_animator_unregister 2347 _ecore_evas_wl_common_animator_unregister,
2323 2348
2324 NULL, // fn_evas_changed 2349 _ecore_evas_wl_common_evas_changed,
2325 NULL, //fn_focus_device_set 2350 NULL, //fn_focus_device_set
2326 NULL, //fn_callback_focus_device_in_set 2351 NULL, //fn_callback_focus_device_in_set
2327 NULL, //fn_callback_focus_device_out_set 2352 NULL, //fn_callback_focus_device_out_set
@@ -2491,6 +2516,8 @@ _ecore_evas_wl_common_new_internal(const char *disp_name, unsigned int parent, i
2491 2516
2492 ee_list = eina_list_append(ee_list, ee); 2517 ee_list = eina_list_append(ee_list, ee);
2493 2518
2519 ecore_evas_manual_render_set(ee, 1);
2520
2494 return ee; 2521 return ee;
2495 2522
2496eng_err: 2523eng_err:
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 76ca2d9..07832c6 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
@@ -41,7 +41,7 @@ struct _Ecore_Evas_Engine_Wl_Data
41 Ecore_Event_Handler *sync_handler; 41 Ecore_Event_Handler *sync_handler;
42 int fx, fy, fw, fh; 42 int fx, fy, fw, fh;
43 Eina_Rectangle content; 43 Eina_Rectangle content;
44 struct wl_callback *anim_callback; 44 Ecore_Wl2_Frame_Cb_Handle *frame;
45 int x_rel; 45 int x_rel;
46 int y_rel; 46 int y_rel;
47 uint32_t timestamp; 47 uint32_t timestamp;
@@ -64,6 +64,7 @@ struct _Ecore_Evas_Engine_Wl_Data
64 Eina_Bool defer_show : 1; 64 Eina_Bool defer_show : 1;
65 Eina_Bool reset_pending : 1; 65 Eina_Bool reset_pending : 1;
66 Eina_Bool activated : 1; 66 Eina_Bool activated : 1;
67 Eina_Bool ticking : 1;
67}; 68};
68 69
69/** 70/**