[gnome-shell/gnome-3-36] st-label: Keep labels fully pre-rendered on the GPU
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-36] st-label: Keep labels fully pre-rendered on the GPU
- Date: Thu, 25 Jun 2020 19:19:02 +0000 (UTC)
commit 96f1d1b08db550bd51374c081f8729383a7065a0
Author: Daniel van Vugt <daniel van vugt canonical com>
Date: Wed Jun 24 16:00:17 2020 +0800
st-label: Keep labels fully pre-rendered on the GPU
The performance of the icon grid was being hindered by a large number
of primitives (a few hundred) being copied from the CPU to the GPU on
each frame. This was first noticed in mutter#971 but we failed to
investigate all the issues at the time.
You can also see the high number using `COGL_DEBUG=batching` or
`COGL_DEBUG=disable-texturing`. So now it's obvious that high number is
every letter of every label being uploaded as a separate quad. Let's not
do that and instead treat the whole label as a single quad/texture.
Measured performance on an i7-7700 at UHD 3840x2160:
Journal entries per frame on the icon grid:
* Before: 288 (18 KB copied from CPU to GPU)
* After: 73 ( 4 KB copied from CPU to GPU)
Spring animation:
* Before: 20-30 FPS, avg 22/peak 45 milliseconds per frame
* After: 30-40 FPS, avg 14/peak 28 milliseconds per frame
Scrolling the icon grid:
* Before: 15 FPS, 50 milliseconds per frame
* After: 30 FPS, 28 milliseconds per frame
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1329
(cherry picked from commit ae338af1e80ed89eb624a36a666894c986573c76)
src/st/st-label.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/st/st-label.c b/src/st/st-label.c
index 947c8ec861..3f82a2c152 100644
--- a/src/st/st-label.c
+++ b/src/st/st-label.c
@@ -294,6 +294,7 @@ st_label_class_init (StLabelClass *klass)
static void
st_label_init (StLabel *label)
{
+ ClutterActor *actor = CLUTTER_ACTOR (label);
StLabelPrivate *priv;
label->priv = priv = st_label_get_instance_private (label);
@@ -305,7 +306,10 @@ st_label_init (StLabel *label)
label->priv->shadow_width = -1.;
label->priv->shadow_height = -1.;
- clutter_actor_add_child (CLUTTER_ACTOR (label), priv->label);
+ clutter_actor_add_child (actor, priv->label);
+
+ clutter_actor_set_offscreen_redirect (actor,
+ CLUTTER_OFFSCREEN_REDIRECT_ALWAYS);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]