From 5134dd47c161a47d45e7742cbfba8a0e8cb67be5 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 15 Jan 2019 10:29:55 -0500
Subject: [PATCH 6/9] backends/native: update glyph cache on resume
As mentioned in a previous commit, the proprietary NVIDIA
driver garbles memory on suspend. That behavior, means that
clutter's glyph cache (which is stored in GPU memory) gets
corrupted on suspend.
This commit ensures the glyph cache is blown away when
the logind session becomes active (on VT switch and resume).
---
src/backends/native/meta-backend-native.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index f87c5a066..0730a4acb 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -626,43 +626,46 @@ meta_activate_session (void)
void
meta_backend_native_pause (MetaBackendNative *native)
{
MetaBackend *backend = META_BACKEND (native);
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
clutter_evdev_release_devices ();
clutter_egl_freeze_master_clock ();
meta_monitor_manager_kms_pause (monitor_manager_kms);
}
void meta_backend_native_resume (MetaBackendNative *native)
{
MetaBackend *backend = META_BACKEND (native);
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
MetaDisplay *display = meta_get_display ();
ClutterBackend *clutter_backend = clutter_get_default_backend ();
CoglContext *cogl_context =
clutter_backend_get_cogl_context (clutter_backend);
ClutterActor *stage;
MetaIdleMonitor *idle_monitor;
if (cogl_has_feature (cogl_context, COGL_FEATURE_ID_UNSTABLE_TEXTURES))
- g_signal_emit_by_name (display, "gl-video-memory-purged");
+ {
+ clutter_clear_glyph_cache ();
+ g_signal_emit_by_name (display, "gl-video-memory-purged");
+ }
meta_monitor_manager_kms_resume (monitor_manager_kms);
clutter_evdev_reclaim_devices ();
clutter_egl_thaw_master_clock ();
stage = meta_backend_get_stage (backend);
clutter_actor_queue_redraw (stage);
idle_monitor = meta_backend_get_idle_monitor (backend, 0);
meta_idle_monitor_reset_idletime (idle_monitor);
}
--
2.18.1