[mutter/wip/rstrode/rhel-8.0.0: 95/117] backends/native: explicitly pause on suspend
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/rstrode/rhel-8.0.0: 95/117] backends/native: explicitly pause on suspend
- Date: Sun, 17 Feb 2019 17:30:49 +0000 (UTC)
commit bac2a0752b3efd230661d1048cd4331ed583b209
Author: Ray Strode <rstrode redhat com>
Date: Tue Feb 12 10:40:47 2019 -0500
backends/native: explicitly pause on suspend
The kernel forces a VT switch during suspend on some hardware,
and not on others.
We run code from the VT switch handler that we need to also get
run on resume.
This commit makes sure we explicitly run the VT switch handler
during suspend and resume.
src/backends/native/meta-backend-native.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
---
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index fd95dfc11..8cc322c6b 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -60,6 +60,8 @@ struct _MetaBackendNativePrivate
{
MetaLauncher *launcher;
MetaBarrierManagerNative *barrier_manager;
+
+ gboolean is_paused;
};
typedef struct _MetaBackendNativePrivate MetaBackendNativePrivate;
@@ -332,6 +334,15 @@ meta_backend_native_post_init (MetaBackend *backend)
NULL, NULL);
clutter_evdev_set_relative_motion_filter (manager, relative_motion_filter,
meta_backend_get_monitor_manager (backend));
+
+ g_signal_connect (G_OBJECT (backend),
+ "suspending",
+ G_CALLBACK (meta_backend_native_pause),
+ NULL);
+ g_signal_connect (G_OBJECT (backend),
+ "resuming",
+ G_CALLBACK (meta_backend_native_resume),
+ NULL);
}
static MetaMonitorManager *
@@ -631,11 +642,18 @@ meta_backend_native_pause (MetaBackendNative *native)
meta_backend_get_monitor_manager (backend);
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
+ MetaBackendNativePrivate *priv =
+ meta_backend_native_get_instance_private (native);
+
+ if (priv->is_paused)
+ return;
clutter_evdev_release_devices ();
clutter_egl_freeze_master_clock ();
meta_monitor_manager_kms_pause (monitor_manager_kms);
+
+ priv->is_paused = TRUE;
}
void meta_backend_native_resume (MetaBackendNative *native)
@@ -645,6 +663,8 @@ void meta_backend_native_resume (MetaBackendNative *native)
meta_backend_get_monitor_manager (backend);
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
+ MetaBackendNativePrivate *priv =
+ meta_backend_native_get_instance_private (native);
MetaDisplay *display = meta_get_display ();
ClutterBackend *clutter_backend = clutter_get_default_backend ();
CoglContext *cogl_context =
@@ -652,6 +672,9 @@ void meta_backend_native_resume (MetaBackendNative *native)
ClutterActor *stage;
MetaIdleMonitor *idle_monitor;
+ if (!priv->is_paused)
+ return;
+
if (cogl_has_feature (cogl_context, COGL_FEATURE_ID_UNSTABLE_TEXTURES))
{
clutter_clear_glyph_cache ();
@@ -669,4 +692,6 @@ void meta_backend_native_resume (MetaBackendNative *native)
idle_monitor = meta_backend_get_idle_monitor (backend, 0);
meta_idle_monitor_reset_idletime (idle_monitor);
+
+ priv->is_paused = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]