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
This commit is contained in:
Daniel van Vugt 2020-07-09 17:48:32 +08:00 committed by Robert Mader
parent 30809665d8
commit 86af337585

View File

@ -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)