[mutter/wip/carlosg/performance-improvements: 12/13] compositor: Avoid redoing the background pipeline on each paint() call
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/performance-improvements: 12/13] compositor: Avoid redoing the background pipeline on each paint() call
- Date: Fri, 5 May 2017 13:06:04 +0000 (UTC)
commit 6704fa1d57577aa3648537be8ff5d141a8c50f22
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri May 5 14:14:28 2017 +0200
compositor: Avoid redoing the background pipeline on each paint() call
Just set filter quality, as that's the only thing depending on the viewport.
src/compositor/meta-background-actor.c | 52 ++++++++++++++++++++++++--------
1 files changed, 39 insertions(+), 13 deletions(-)
---
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index 132494d..ffdee9a 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -269,14 +269,12 @@ make_pipeline (PipelineFlags pipeline_flags)
}
static void
-setup_pipeline (MetaBackgroundActor *self,
- cairo_rectangle_int_t *actor_pixel_rect)
+setup_pipeline (MetaBackgroundActor *self)
{
MetaBackgroundActorPrivate *priv = self->priv;
PipelineFlags pipeline_flags = 0;
guint8 opacity;
float color_component;
- CoglPipelineFilter filter;
opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self));
if (opacity < 255)
@@ -342,14 +340,6 @@ setup_pipeline (MetaBackgroundActor *self,
color_component,
color_component,
opacity / 255.);
-
- if (!priv->force_bilinear &&
- meta_actor_painting_untransformed (actor_pixel_rect->width, actor_pixel_rect->height, NULL, NULL))
- filter = COGL_PIPELINE_FILTER_NEAREST;
- else
- filter = COGL_PIPELINE_FILTER_LINEAR;
-
- cogl_pipeline_set_layer_filters (priv->pipeline, 0, filter, filter);
}
static void
@@ -380,6 +370,22 @@ set_glsl_parameters (MetaBackgroundActor *self,
}
static void
+set_pipeline_filter (MetaBackgroundActor *self,
+ cairo_rectangle_int_t *actor_pixel_rect)
+{
+ MetaBackgroundActorPrivate *priv = self->priv;
+ CoglPipelineFilter filter;
+
+ if (!priv->force_bilinear &&
+ meta_actor_painting_untransformed (actor_pixel_rect->width, actor_pixel_rect->height, NULL, NULL))
+ filter = COGL_PIPELINE_FILTER_NEAREST;
+ else
+ filter = COGL_PIPELINE_FILTER_LINEAR;
+
+ cogl_pipeline_set_layer_filters (priv->pipeline, 0, filter, filter);
+}
+
+static void
paint_clipped_rectangle (CoglFramebuffer *fb,
CoglPipeline *pipeline,
cairo_rectangle_int_t *rect,
@@ -411,6 +417,26 @@ meta_background_actor_get_paint_volume (ClutterActor *actor,
}
static void
+meta_background_actor_allocate (ClutterActor *self,
+ const ClutterActorBox *box,
+ ClutterAllocationFlags flags)
+{
+ ClutterActorBox actor_box;
+ cairo_rectangle_int_t actor_pixel_rect;
+
+ CLUTTER_ACTOR_CLASS (meta_background_actor_parent_class)->allocate (self, box,
+ flags);
+ clutter_actor_get_content_box (self, &actor_box);
+ actor_pixel_rect.x = actor_box.x1;
+ actor_pixel_rect.y = actor_box.y1;
+ actor_pixel_rect.width = actor_box.x2 - actor_box.x1;
+ actor_pixel_rect.height = actor_box.y2 - actor_box.y1;
+
+ setup_pipeline (META_BACKGROUND_ACTOR (self));
+ set_glsl_parameters (META_BACKGROUND_ACTOR (self), &actor_pixel_rect);
+}
+
+static void
meta_background_actor_paint (ClutterActor *actor)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (actor);
@@ -429,8 +455,7 @@ meta_background_actor_paint (ClutterActor *actor)
actor_pixel_rect.width = actor_box.x2 - actor_box.x1;
actor_pixel_rect.height = actor_box.y2 - actor_box.y1;
- setup_pipeline (self, &actor_pixel_rect);
- set_glsl_parameters (self, &actor_pixel_rect);
+ set_pipeline_filter (self, &actor_pixel_rect);
/* Limit to how many separate rectangles we'll draw; beyond this just
* fall back and draw the whole thing */
@@ -557,6 +582,7 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass)
actor_class->get_preferred_width = meta_background_actor_get_preferred_width;
actor_class->get_preferred_height = meta_background_actor_get_preferred_height;
actor_class->get_paint_volume = meta_background_actor_get_paint_volume;
+ actor_class->allocate = meta_background_actor_allocate;
actor_class->paint = meta_background_actor_paint;
param_spec = g_param_spec_object ("meta-screen",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]