[mutter/cherry-pick-d43c8cd8-2] window: Freeze stack when calculating showing state




commit 62c7a5d052c00fb7ce36cc967e8ea530652efaff
Author: Jonas Ådahl <jadahl gmail com>
Date:   Mon Nov 30 10:03:16 2020 +0000

    window: Freeze stack when calculating showing state
    
    Constantly manipulating the stack caused severe stalls (several seconds)
    with many open windows when switching workspaces. The cause for this was
    that each show/hide call dealt with the stack in isolation, meaning if
    you hid N windows, we'd manipulate and synchronize the stack N times,
    potentially doing synchronous calls to the X server while doing so.
    
    Avoid the most severe stalls by freezing the stack while calculating
    showing; this made the worst case go from several seconds to around
    10-20 ms, which is still bad, but by far not as bad.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1616>
    
    
    (cherry picked from commit d43c8cd8425fe1ab83c1c959a07f99c21f4844c4)

 src/core/window.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/core/window.c b/src/core/window.c
index 7a4cb164fa..71d5e7b1e6 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1796,6 +1796,7 @@ stackcmp (gconstpointer a, gconstpointer b)
 static gboolean
 idle_calc_showing (gpointer data)
 {
+  MetaDisplay *display = meta_get_display ();
   GSList *tmp;
   GSList *copy;
   GSList *should_show;
@@ -1866,6 +1867,8 @@ idle_calc_showing (gpointer data)
       tmp = tmp->next;
     }
 
+  meta_stack_freeze (display->stack);
+
   tmp = should_show;
   while (tmp != NULL)
     {
@@ -1890,6 +1893,8 @@ idle_calc_showing (gpointer data)
       tmp = tmp->next;
     }
 
+  meta_stack_thaw (display->stack);
+
   tmp = copy;
   while (tmp != NULL)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]