[mutter] background-content: Use redraw_clip when culling is unavailable



commit 86af337585e35aad9caa094da63a9ca887f6e0c9
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Thu Jul 9 17:48:32 2020 +0800

    background-content: Use redraw_clip when culling is unavailable
    
    When in the overview culling via `self->clip_region` is unavailable.
    The region is `NULL` because the paint call has not originated from a
    `WindowGroup`, because the overview does not use `WindowGroup`.
    
    So the main wallpaper was being painted in full while in the overview.
    That's a waste of effort because `redraw_clip` is going to be used to
    stencil/scissor out only the parts that are changing. We don't need to
    paint *most* of the wallpaper, only the parts behind anything changing.
    
    For the overview this reduces GPU power usage (intel_gpu_top) roughly
    10% and reduces render times almost as much.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1363

 src/compositor/meta-background-content.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/compositor/meta-background-content.c b/src/compositor/meta-background-content.c
index 1ccec1d867..bf203aa9af 100644
--- a/src/compositor/meta-background-content.c
+++ b/src/compositor/meta-background-content.c
@@ -544,7 +544,18 @@ meta_background_content_paint_content (ClutterContent      *content,
         }
       else
         {
-          region = cairo_region_create_rectangle (&rect_within_stage);
+          const cairo_region_t *redraw_clip;
+
+          redraw_clip = clutter_paint_context_get_redraw_clip (paint_context);
+          if (redraw_clip)
+            {
+              region = cairo_region_copy (redraw_clip);
+              cairo_region_intersect_rectangle (region, &rect_within_stage);
+            }
+          else
+            {
+              region = cairo_region_create_rectangle (&rect_within_stage);
+            }
         }
 
       if (self->unobscured_region)


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