subsurface: set_desync should flush 25/241225/3
authorSeunghun Lee <shiin.lee@samsung.com>
Fri, 15 May 2020 07:49:40 +0000 (16:49 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Sun, 23 Aug 2020 23:36:49 +0000 (23:36 +0000)
wl_subsurface.set_desync should apply the cached wl_surface state.
Otherwise, the sub-surface may be stuck: a commit on the parent surface.
if desynchronized, will not commit the sub-surface because it is
desynchronized, too. A commit on the sub-surface may not happen, if it
is waiting for the frame callback from the previous commit.

Change-Id: I80abff41736ec76ed7449d14d4246eb9c6fc1412

src/bin/e_comp_wl_subsurface.c

index d532923..72a3ff9 100644 (file)
@@ -7,6 +7,9 @@ static Eina_List *hooks = NULL;
 
 static Eina_Bool  _e_comp_wl_subsurface_circular_reference_check(E_Client *ec, E_Client *parent);
 static void       _e_comp_wl_subsurface_invalid_parent_handle(E_Client *ec, struct wl_resource *resource);
+static void       _e_comp_wl_subsurface_parent_commit(E_Client *ec, Eina_Bool parent_synchronized);
+static Eina_Bool  _e_comp_wl_subsurface_synchronized_get(E_Comp_Wl_Subsurf_Data *sdata);
+static void       _e_comp_wl_subsurface_synchronized_commit(E_Client *ec);
 
 static void
 _e_comp_wl_subsurface_restack_bg_rectangle(E_Client *ec)
@@ -464,6 +467,30 @@ _e_comp_wl_subsurface_commit_from_cache(E_Client *ec)
 }
 
 static void
+_e_comp_wl_subsurface_synchronized_commit(E_Client *ec)
+{
+   E_Comp_Wl_Subsurf_Data *sdata;
+   E_Client *subc;
+   Eina_List *l;
+
+   sdata = ec->comp_data->sub.data;
+
+   if (sdata->cached.has_data)
+     _e_comp_wl_subsurface_commit_from_cache(ec);
+
+   EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc)
+     {
+        if (ec != subc)
+          _e_comp_wl_subsurface_parent_commit(subc, EINA_TRUE);
+     }
+   EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc)
+     {
+        if (ec != subc)
+          _e_comp_wl_subsurface_parent_commit(subc, EINA_TRUE);
+     }
+}
+
+static void
 _e_comp_wl_subsurface_parent_commit(E_Client *ec, Eina_Bool parent_synchronized)
 {
    E_Client *parent;
@@ -481,24 +508,7 @@ _e_comp_wl_subsurface_parent_commit(E_Client *ec, Eina_Bool parent_synchronized)
      }
 
    if ((parent_synchronized) || (sdata->synchronized))
-     {
-        E_Client *subc;
-        Eina_List *l;
-
-        if (sdata->cached.has_data)
-          _e_comp_wl_subsurface_commit_from_cache(ec);
-
-        EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc)
-          {
-             if (ec != subc)
-               _e_comp_wl_subsurface_parent_commit(subc, EINA_TRUE);
-          }
-        EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc)
-          {
-             if (ec != subc)
-               _e_comp_wl_subsurface_parent_commit(subc, EINA_TRUE);
-          }
-     }
+     _e_comp_wl_subsurface_synchronized_commit(ec);
 }
 
 static void
@@ -614,7 +624,13 @@ _e_comp_wl_subsurface_cb_desync_set(struct wl_client *client EINA_UNUSED, struct
    if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return;
    if (!(sdata = ec->comp_data->sub.data)) return;
 
-   sdata->synchronized = EINA_FALSE;
+   if (sdata->synchronized)
+     {
+        sdata->synchronized = EINA_FALSE;
+
+        if (!_e_comp_wl_subsurface_synchronized_get(sdata))
+          _e_comp_wl_subsurface_synchronized_commit(ec);
+     }
 }
 
 static const struct wl_subsurface_interface _e_subsurface_interface =