From 602c91c9308539e5d86dfcbe72dedadfd352b5d3 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Fri, 15 May 2020 16:49:40 +0900 Subject: [PATCH] subsurface: set_desync should flush 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 | 54 ++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/src/bin/e_comp_wl_subsurface.c b/src/bin/e_comp_wl_subsurface.c index d5329235c2..72a3ff9706 100644 --- a/src/bin/e_comp_wl_subsurface.c +++ b/src/bin/e_comp_wl_subsurface.c @@ -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) @@ -463,6 +466,30 @@ _e_comp_wl_subsurface_commit_from_cache(E_Client *ec) sdata->cached.has_data = EINA_FALSE; } +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) { @@ -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 = -- 2.34.1