From fc24552e0ef9ade0db45799457cbad76cdf2fc27 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 26 Feb 2014 20:43:01 -0500 Subject: [PATCH] Revert "window: Update the shape, input, and opaque regions immediately" This reverts commit 64a82c8d7703186b8004d73299b4425545cab990. This broke everything, and the perf regressions I was seeing went away after a reboot... --- src/compositor/compositor.c | 28 +------------- src/compositor/meta-window-actor-private.h | 5 +-- src/compositor/meta-window-actor.c | 43 ++++++++++++++++++++-- src/core/window.c | 6 +-- src/meta/compositor.h | 6 +-- 5 files changed, 46 insertions(+), 42 deletions(-) diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index f955ceea0..51e27f3b6 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -823,31 +823,7 @@ is_grabbed_event (MetaDisplay *display, } void -meta_compositor_update_shape_region (MetaCompositor *compositor, - MetaWindow *window) -{ - MetaWindowActor *window_actor; - window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window)); - if (!window_actor) - return; - - meta_window_actor_update_shape_region (window_actor); -} - -void -meta_compositor_update_input_region (MetaCompositor *compositor, - MetaWindow *window) -{ - MetaWindowActor *window_actor; - window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window)); - if (!window_actor) - return; - - meta_window_actor_update_input_region (window_actor); -} - -void -meta_compositor_update_opaque_region (MetaCompositor *compositor, +meta_compositor_window_shape_changed (MetaCompositor *compositor, MetaWindow *window) { MetaWindowActor *window_actor; @@ -855,7 +831,7 @@ meta_compositor_update_opaque_region (MetaCompositor *compositor, if (!window_actor) return; - meta_window_actor_update_opaque_region (window_actor); + meta_window_actor_update_shape (window_actor); } void diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h index 7d2a10f25..75a19e1a3 100644 --- a/src/compositor/meta-window-actor-private.h +++ b/src/compositor/meta-window-actor-private.h @@ -46,6 +46,7 @@ gboolean meta_window_actor_effect_in_progress (MetaWindowActor *self); void meta_window_actor_sync_actor_geometry (MetaWindowActor *self, gboolean did_placement); void meta_window_actor_sync_visibility (MetaWindowActor *self); +void meta_window_actor_update_shape (MetaWindowActor *self); void meta_window_actor_update_opacity (MetaWindowActor *self); void meta_window_actor_mapped (MetaWindowActor *self); void meta_window_actor_unmapped (MetaWindowActor *self); @@ -57,8 +58,4 @@ void meta_window_actor_queue_frame_drawn (MetaWindowActor *self, void meta_window_actor_effect_completed (MetaWindowActor *actor, gulong event); -void meta_window_actor_update_shape_region (MetaWindowActor *self); -void meta_window_actor_update_input_region (MetaWindowActor *self); -void meta_window_actor_update_opaque_region (MetaWindowActor *self); - #endif /* META_WINDOW_ACTOR_PRIVATE_H */ diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 67935456d..dcb1bd2a7 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -106,6 +106,7 @@ struct _MetaWindowActorPrivate guint needs_frame_drawn : 1; guint needs_pixmap : 1; + guint needs_reshape : 1; guint recompute_focused_shadow : 1; guint recompute_unfocused_shadow : 1; guint size_changed : 1; @@ -161,6 +162,8 @@ static gboolean meta_window_actor_has_shadow (MetaWindowActor *self); static void meta_window_actor_handle_updates (MetaWindowActor *self); +static void check_needs_reshape (MetaWindowActor *self); + static void do_send_frame_drawn (MetaWindowActor *self, FrameData *frame); static void do_send_frame_timings (MetaWindowActor *self, FrameData *frame, @@ -1307,7 +1310,10 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self, return; if (priv->size_changed) - meta_window_actor_queue_create_pixmap (self); + { + meta_window_actor_queue_create_pixmap (self); + meta_window_actor_update_shape (self); + } if (meta_window_actor_effect_in_progress (self)) return; @@ -1967,7 +1973,7 @@ build_and_scan_frame_mask (MetaWindowActor *self, g_free (mask_data); } -void +static void meta_window_actor_update_shape_region (MetaWindowActor *self) { MetaWindowActorPrivate *priv = self->priv; @@ -2005,7 +2011,7 @@ meta_window_actor_update_shape_region (MetaWindowActor *self) meta_window_actor_invalidate_shadow (self); } -void +static void meta_window_actor_update_input_region (MetaWindowActor *self) { MetaWindowActorPrivate *priv = self->priv; @@ -2050,7 +2056,7 @@ meta_window_actor_update_input_region (MetaWindowActor *self) cairo_region_destroy (region); } -void +static void meta_window_actor_update_opaque_region (MetaWindowActor *self) { MetaWindowActorPrivate *priv = self->priv; @@ -2085,6 +2091,34 @@ meta_window_actor_update_opaque_region (MetaWindowActor *self) cairo_region_destroy (opaque_region); } +static void +check_needs_reshape (MetaWindowActor *self) +{ + MetaWindowActorPrivate *priv = self->priv; + + if (!priv->needs_reshape) + return; + + meta_window_actor_update_shape_region (self); + meta_window_actor_update_input_region (self); + meta_window_actor_update_opaque_region (self); + + priv->needs_reshape = FALSE; +} + +void +meta_window_actor_update_shape (MetaWindowActor *self) +{ + MetaWindowActorPrivate *priv = self->priv; + + priv->needs_reshape = TRUE; + + if (is_frozen (self)) + return; + + clutter_actor_queue_redraw (priv->actor); +} + static void meta_window_actor_handle_updates (MetaWindowActor *self) { @@ -2136,6 +2170,7 @@ meta_window_actor_handle_updates (MetaWindowActor *self) } check_needs_pixmap (self); + check_needs_reshape (self); check_needs_shadow (self); } diff --git a/src/core/window.c b/src/core/window.c index cc4e14d70..0a2bbf04b 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -7677,7 +7677,7 @@ meta_window_set_opaque_region (MetaWindow *window, window->opaque_region = cairo_region_reference (region); if (window->display->compositor) - meta_compositor_update_opaque_region (window->display->compositor, window); + meta_compositor_window_shape_changed (window->display->compositor, window); } void @@ -7763,7 +7763,7 @@ meta_window_set_input_region (MetaWindow *window, window->input_region = cairo_region_reference (region); if (window->display->compositor) - meta_compositor_update_input_region (window->display->compositor, window); + meta_compositor_window_shape_changed (window->display->compositor, window); } void @@ -7849,7 +7849,7 @@ meta_window_set_shape_region (MetaWindow *window, window->shape_region = cairo_region_reference (region); if (window->display->compositor) - meta_compositor_update_shape_region (window->display->compositor, window); + meta_compositor_window_shape_changed (window->display->compositor, window); } void diff --git a/src/meta/compositor.h b/src/meta/compositor.h index eb5372dfb..d1be47e36 100644 --- a/src/meta/compositor.h +++ b/src/meta/compositor.h @@ -62,11 +62,7 @@ void meta_compositor_manage_screen (MetaCompositor *compositor, void meta_compositor_unmanage_screen (MetaCompositor *compositor, MetaScreen *screen); -void meta_compositor_update_shape_region (MetaCompositor *compositor, - MetaWindow *window); -void meta_compositor_update_input_region (MetaCompositor *compositor, - MetaWindow *window); -void meta_compositor_update_opaque_region (MetaCompositor *compositor, +void meta_compositor_window_shape_changed (MetaCompositor *compositor, MetaWindow *window); void meta_compositor_window_opacity_changed (MetaCompositor *compositor, MetaWindow *window);