[mutter] MetaSurfaceActorX11: invalidate the stex on video memory purged errors



commit cc6efeb14fda8948827ca84df8f81b7265423d87
Author: Rui Matos <tiagomatos gmail com>
Date:   Sun May 29 20:00:45 2016 +0200

    MetaSurfaceActorX11: invalidate the stex on video memory purged errors
    
    MetaShapedTexture uses FBOs when mipmapping so we need to cause them
    to be recreated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739178

 src/compositor/meta-surface-actor-x11.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
index b8090a5..41506aa 100644
--- a/src/compositor/meta-surface-actor-x11.c
+++ b/src/compositor/meta-surface-actor-x11.c
@@ -420,6 +420,22 @@ window_decorated_notify (MetaWindow *window,
   create_damage (self);
 }
 
+static void
+reset_texture (MetaSurfaceActorX11 *self)
+{
+  MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+  MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
+
+  if (!priv->texture)
+    return;
+
+  /* Setting the texture to NULL will cause all the FBO's cached by the
+   * shaped texture's MetaTextureTower to be discarded and recreated.
+   */
+  meta_shaped_texture_set_texture (stex, NULL);
+  meta_shaped_texture_set_texture (stex, priv->texture);
+}
+
 MetaSurfaceActor *
 meta_surface_actor_x11_new (MetaWindow *window)
 {
@@ -432,6 +448,9 @@ meta_surface_actor_x11_new (MetaWindow *window)
   priv->window = window;
   priv->display = display;
 
+  g_signal_connect_object (priv->display, "gl-video-memory-purged",
+                           G_CALLBACK (reset_texture), self, G_CONNECT_SWAPPED);
+
   create_damage (self);
   g_signal_connect_object (priv->window, "notify::decorated",
                            G_CALLBACK (window_decorated_notify), self, 0);


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