summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-02-22 11:41:42 -0600
committerDerek Foreman <derekf@osg.samsung.com>2017-02-22 12:01:34 -0600
commit704c90263c258d980363bf330ba0c8e475172407 (patch)
treec66f196881dbb1810e37c69352e7b412280f0056
parent35bb87529f701f0128a338b2313092c4876c6737 (diff)
downloadenlightenment-devs/derekf/wip.tar.gz
Defer wayland frame callbacks from empty commitsdevs/derekf/wip
These are usually being used for timing by the client, so while our habit of kicking them back immediately works, it burns a lot of cpu. Instead, use an animator to hold the frame callback off for a tick, which is what frame cbs are supposed to do anyway.
-rw-r--r--src/bin/e_comp_wl.c15
-rw-r--r--src/bin/e_comp_wl.h2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index e636ce94c6..d58fbc1e23 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -2480,6 +2480,8 @@ _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec)
/* make sure this is a wayland client */
if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return;
+ E_FREE_FUNC(ec->comp_data->clear_animator, ecore_animator_del);
+
e_comp_wl_extension_pointer_unconstrain(ec);
/* remove sub list */
@@ -2979,12 +2981,23 @@ e_comp_wl_surface_create(struct wl_client *client, int version, uint32_t id)
return ret;
}
+Eina_Bool
+image_clear_cb(void *data)
+{
+ E_Client *ec;
+ ec = data;
+ if (ec->pixmap) e_pixmap_image_clear(ec->pixmap, 1);
+ ec->comp_data->clear_animator = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
EINTERN Eina_Bool
e_comp_wl_surface_commit(E_Client *ec)
{
_e_comp_wl_surface_state_commit(ec, &ec->comp_data->pending);
+ E_FREE_FUNC(ec->comp_data->clear_animator, ecore_animator_del);
if (!e_comp_object_damage_exists(ec->frame))
- e_pixmap_image_clear(ec->pixmap, 1);
+ ec->comp_data->clear_animator = ecore_animator_add(image_clear_cb, ec);
e_comp_wl_extension_pointer_constraints_commit(ec);
return EINA_TRUE;
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index 9a211d61f6..e29ba3cd3c 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -330,6 +330,8 @@ struct _E_Comp_Wl_Client_Data
Eina_List *frames;
Eina_List *constraints;
+ Ecore_Animator *clear_animator;
+
struct
{
int32_t x, y;