[mutter] renderer-native: Destroy monitor framebuffers when suspending
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] renderer-native: Destroy monitor framebuffers when suspending
- Date: Wed, 16 Aug 2017 05:42:02 +0000 (UTC)
commit dbc63430d879c927f7e308e29e4570993eccbfde
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Aug 1 17:13:32 2017 +0800
renderer-native: Destroy monitor framebuffers when suspending
When suspending (i.e. VT switching away, the GDM gnome-shell instance
gets hidden, or changing user), destroy the onscreen and offscreen
monitor framebuffers. When resuming, the stage views and framebuffers
will be recreated anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=786299
clutter/clutter/clutter-stage-view.c | 4 +++-
src/backends/native/meta-backend-native.c | 3 +++
src/backends/native/meta-renderer-native.c | 18 ++++++++++++++++++
src/backends/native/meta-renderer-native.h | 2 ++
4 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c
index 0003712..e2792a0 100644
--- a/clutter/clutter/clutter-stage-view.c
+++ b/clutter/clutter/clutter-stage-view.c
@@ -267,6 +267,7 @@ clutter_stage_view_set_property (GObject *object,
priv->layout = *layout;
break;
case PROP_FRAMEBUFFER:
+ g_clear_pointer (&priv->framebuffer, cogl_object_unref);
priv->framebuffer = g_value_dup_boxed (value);
#ifndef G_DISABLE_CHECKS
if (priv->framebuffer)
@@ -284,6 +285,7 @@ clutter_stage_view_set_property (GObject *object,
#endif
break;
case PROP_OFFSCREEN:
+ g_clear_pointer (&priv->offscreen, cogl_object_unref);
priv->offscreen = g_value_dup_boxed (value);
break;
case PROP_SCALE:
@@ -355,7 +357,7 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
"Framebuffer used as intermediate buffer",
COGL_TYPE_HANDLE,
G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SCALE] =
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index eeb5ac1..547bdde 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -668,11 +668,14 @@ meta_backend_native_pause (MetaBackendNative *native)
meta_backend_get_monitor_manager (backend);
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
+ MetaRendererNative *renderer_native =
+ META_RENDERER_NATIVE (meta_backend_get_renderer (backend));
clutter_evdev_release_devices ();
clutter_egl_freeze_master_clock ();
meta_monitor_manager_kms_pause (monitor_manager_kms);
+ meta_renderer_native_pause (renderer_native);
}
void meta_backend_native_resume (MetaBackendNative *native)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 85ee278..90a029f 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -1786,6 +1786,24 @@ meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native)
return renderer_native->frame_counter;
}
+void
+meta_renderer_native_pause (MetaRendererNative *renderer_native)
+{
+ GList *views;
+ GList *l;
+
+ views = meta_renderer_get_views (META_RENDERER (renderer_native));
+ for (l = views; l; l = l->next)
+ {
+ ClutterStageView *stage_view = l->data;
+
+ g_object_set (G_OBJECT (stage_view),
+ "framebuffer", NULL,
+ "offscreen", NULL,
+ NULL);
+ }
+}
+
static void
meta_renderer_native_get_property (GObject *object,
guint prop_id,
diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h
index 24cfdd3..8a88476 100644
--- a/src/backends/native/meta-renderer-native.h
+++ b/src/backends/native/meta-renderer-native.h
@@ -71,4 +71,6 @@ void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native);
int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);
+void meta_renderer_native_pause (MetaRendererNative *renderer_native);
+
#endif /* META_RENDERER_NATIVE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]