mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
clutter-offscreen-effect: Invalidate cache on gl-video-memory-purged
This fixes graphics corruption that could occur on resume from suspend with the Nvidia driver. https://www.khronos.org/registry/OpenGL/extensions/NV/NV_robustness_video_memory_purge.txt https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1374
This commit is contained in:
parent
305fcd0713
commit
2de69cd3cc
@ -100,6 +100,8 @@ struct _ClutterOffscreenEffectPrivate
|
|||||||
int target_height;
|
int target_height;
|
||||||
|
|
||||||
gint old_opacity_override;
|
gint old_opacity_override;
|
||||||
|
|
||||||
|
gulong purge_handler_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
|
||||||
@ -158,6 +160,12 @@ ensure_pipeline_filter_for_scale (ClutterOffscreenEffect *self,
|
|||||||
filter, filter);
|
filter, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
video_memory_purged (ClutterOffscreenEffect *self)
|
||||||
|
{
|
||||||
|
g_clear_pointer (&self->priv->offscreen, cogl_object_unref);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
update_fbo (ClutterEffect *effect,
|
update_fbo (ClutterEffect *effect,
|
||||||
int target_width,
|
int target_width,
|
||||||
@ -166,8 +174,26 @@ update_fbo (ClutterEffect *effect,
|
|||||||
{
|
{
|
||||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||||
|
ClutterActor *stage_actor;
|
||||||
|
|
||||||
|
stage_actor = clutter_actor_get_stage (priv->actor);
|
||||||
|
if (stage_actor != priv->stage)
|
||||||
|
{
|
||||||
|
g_clear_signal_handler (&priv->purge_handler_id, priv->stage);
|
||||||
|
|
||||||
|
priv->stage = stage_actor;
|
||||||
|
|
||||||
|
if (priv->stage)
|
||||||
|
{
|
||||||
|
priv->purge_handler_id =
|
||||||
|
g_signal_connect_object (priv->stage,
|
||||||
|
"gl-video-memory-purged",
|
||||||
|
G_CALLBACK (video_memory_purged),
|
||||||
|
self,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
priv->stage = clutter_actor_get_stage (priv->actor);
|
|
||||||
if (priv->stage == NULL)
|
if (priv->stage == NULL)
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (MISC, "The actor '%s' is not part of a stage",
|
CLUTTER_NOTE (MISC, "The actor '%s' is not part of a stage",
|
||||||
|
Loading…
Reference in New Issue
Block a user