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>
This commit is contained in:
parent
fc6446f326
commit
d43c8cd842
@ -1798,6 +1798,7 @@ stackcmp (gconstpointer a, gconstpointer b)
|
|||||||
static gboolean
|
static gboolean
|
||||||
idle_calc_showing (gpointer data)
|
idle_calc_showing (gpointer data)
|
||||||
{
|
{
|
||||||
|
MetaDisplay *display = meta_get_display ();
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
GSList *copy;
|
GSList *copy;
|
||||||
GSList *should_show;
|
GSList *should_show;
|
||||||
@ -1868,6 +1869,8 @@ idle_calc_showing (gpointer data)
|
|||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta_stack_freeze (display->stack);
|
||||||
|
|
||||||
tmp = should_show;
|
tmp = should_show;
|
||||||
while (tmp != NULL)
|
while (tmp != NULL)
|
||||||
{
|
{
|
||||||
@ -1892,6 +1895,8 @@ idle_calc_showing (gpointer data)
|
|||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta_stack_thaw (display->stack);
|
||||||
|
|
||||||
tmp = copy;
|
tmp = copy;
|
||||||
while (tmp != NULL)
|
while (tmp != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user