summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-12-28 02:57:26 -0200
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-10-17 08:47:04 +0200
commit8d891e625b772860b2975bbc8032d18349da224e (patch)
treef15bf2b42e2ad039e2937028d9c0a6e91bb333f9
parent1a4cc1db59b28cc66d52e7f520ed5ba5768d098b (diff)
downloadmutter-gbsneto/content-part2.tar.gz
shaped-texture: Update mipmap counters on invalidationgbsneto/content-part2
https://gitlab.gnome.org/GNOME/mutter/merge_requests/861
-rw-r--r--src/compositor/meta-shaped-texture.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index e7b76ca8d..87a2bc443 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -684,6 +684,24 @@ do_paint_content (MetaShapedTexture *stex,
g_clear_pointer (&blended_tex_region, cairo_region_destroy);
}
+static void
+update_invalidation_counters (MetaShapedTexture *stex)
+{
+ stex->prev_invalidation = stex->last_invalidation;
+ stex->last_invalidation = g_get_monotonic_time ();
+
+ if (stex->prev_invalidation)
+ {
+ gint64 interval = stex->last_invalidation - stex->prev_invalidation;
+ gboolean fast_update = interval < MIN_MIPMAP_AGE_USEC;
+
+ if (!fast_update)
+ stex->fast_updates = 0;
+ else if (stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
+ stex->fast_updates++;
+ }
+}
+
static CoglTexture *
select_texture_for_paint (MetaShapedTexture *stex)
{
@@ -782,6 +800,8 @@ meta_shaped_texture_invalidate (ClutterContent *content)
{
MetaShapedTexture *stex = META_SHAPED_TEXTURE (content);
+ update_invalidation_counters (stex);
+
if (!stex->invalidate_func)
return;
@@ -793,6 +813,8 @@ meta_shaped_texture_invalidate_size (ClutterContent *content)
{
MetaShapedTexture *stex = META_SHAPED_TEXTURE (content);
+ update_invalidation_counters (stex);
+
if (!stex->invalidate_func)
return;