e_comp_wl: delay subsurface commit 70/57970/1
authorBoram Park <boram1288.park@samsung.com>
Tue, 26 Jan 2016 08:04:40 +0000 (17:04 +0900)
committerBoram Park <boram1288.park@samsung.com>
Tue, 26 Jan 2016 12:09:53 +0000 (21:09 +0900)
    In case subsurface is desync mode, subsurface can be shown before
    parent is shown on screen. So delay subsurface's commit if parent
    is not ready to show until parent's first commit.

Change-Id: I4de5153d38de2566871948bcc2df308376568039

src/bin/e_comp_wl.c
src/bin/e_comp_wl.h

index 67df761..43d4c15 100644 (file)
@@ -557,6 +557,42 @@ _e_comp_wl_surface_to_buffer_rect(E_Client *ec, Eina_Rectangle *srect, Eina_Rect
                                  srect, drect);
 }
 
+static E_Client*
+_e_comp_wl_topmost_parent_get(E_Client *ec)
+{
+   E_Client *parent = NULL;
+
+   if (!ec->comp_data || !ec->comp_data->sub.data)
+      return ec;
+
+   parent = ec->comp_data->sub.data->parent;
+   while (parent)
+     {
+        if (!parent->comp_data || !parent->comp_data->sub.data)
+          return parent;
+
+        parent = parent->comp_data->sub.data->parent;
+     }
+
+   return ec;
+}
+
+static void
+_e_comp_wl_extern_parent_commit(E_Client *ec)
+{
+   E_Client **subc;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc)
+     _e_comp_wl_extern_parent_commit(subc);
+
+   EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc)
+     _e_comp_wl_extern_parent_commit(subc);
+
+   if (ec->comp_data->has_extern_parent)
+     _e_comp_wl_subsurface_parent_commit(ec, EINA_TRUE);
+}
+
 static void
 _e_comp_wl_map_apply(E_Client *ec)
 {
@@ -2536,6 +2572,12 @@ _e_comp_wl_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_res
 
    e_comp_wl_surface_commit(ec);
 
+   if (ec->comp_data->need_commit_extern_parent)
+     {
+        ec->comp_data->need_commit_extern_parent = 0;
+        _e_comp_wl_extern_parent_commit(ec);
+     }
+
    EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc)
      {
         if (ec != subc)
@@ -4615,12 +4657,20 @@ EINTERN Eina_Bool
 e_comp_wl_subsurface_commit(E_Client *ec)
 {
    E_Comp_Wl_Subsurf_Data *sdata;
+   E_Client *topmost;
 
    /* check for valid subcompositor data */
    if (!(sdata = ec->comp_data->sub.data)) return EINA_FALSE;
 
+   topmost = _e_comp_wl_topmost_parent_get(ec);
+
    if (_e_comp_wl_subsurface_synchronized_get(sdata))
      _e_comp_wl_subsurface_commit_to_cache(ec);
+   else if (ec->comp_data->has_extern_parent && !topmost->visible)
+     {
+        _e_comp_wl_subsurface_commit_to_cache(ec);
+        topmost->comp_data->need_commit_extern_parent = 1;
+     }
    else
      {
         E_Client *subc;
index 2acfbb3..4d77038 100644 (file)
@@ -427,6 +427,8 @@ struct _E_Comp_Wl_Client_Data
 
    Eina_Bool keep_buffer : 1;
    Eina_Bool mapped : 1;
+   Eina_Bool has_extern_parent : 1;
+   Eina_Bool need_commit_extern_parent : 1;
    Eina_Bool change_icon : 1;
    Eina_Bool need_reparent : 1;
    Eina_Bool reparented : 1;