From 20749e5dbd15f6125519b241e989d985a0d5ccdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 28 Sep 2017 11:59:27 -0400 Subject: [PATCH] renderer-native: Unset mode on disabled CRTCs Make sure we properly unset the CRTC mode when a monitor is disabled. https://bugzilla.gnome.org/show_bug.cgi?id=787629 --- src/backends/native/meta-renderer-native.c | 26 ++++++++++++++++++++++ src/backends/native/meta-stage-native.c | 1 + 2 files changed, 27 insertions(+) diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 755970852..4d1d8902f 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -132,6 +132,7 @@ struct _MetaRendererNative CoglClosure *swap_notify_idle; int64_t frame_counter; + gboolean pending_unset_disabled_crtcs; gboolean no_add_fb2; }; @@ -1396,6 +1397,8 @@ meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native) onscreen_native->pending_set_crtc = TRUE; } + + renderer_native->pending_unset_disabled_crtcs = TRUE; } static CoglOnscreen * @@ -1778,6 +1781,29 @@ void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native) { renderer_native->frame_counter++; + + if (renderer_native->pending_unset_disabled_crtcs) + { + MetaBackend *backend = meta_get_backend (); + MetaMonitorManager *monitor_manager = + meta_backend_get_monitor_manager (backend); + MetaMonitorManagerKms *monitor_manager_kms = + META_MONITOR_MANAGER_KMS (monitor_manager); + unsigned int i; + + for (i = 0; i < monitor_manager->n_crtcs; i++) + { + MetaCrtc *crtc = &monitor_manager->crtcs[i]; + + if (crtc->current_mode) + continue; + + meta_monitor_manager_kms_apply_crtc_mode (monitor_manager_kms, + crtc, 0, 0, 0); + } + + renderer_native->pending_unset_disabled_crtcs = FALSE; + } } int64_t diff --git a/src/backends/native/meta-stage-native.c b/src/backends/native/meta-stage-native.c index 82ede47cf..3a39f93f7 100644 --- a/src/backends/native/meta-stage-native.c +++ b/src/backends/native/meta-stage-native.c @@ -160,6 +160,7 @@ meta_stage_native_rebuild_views (MetaStageNative *stage_native) MetaRenderer *renderer = meta_backend_get_renderer (backend); meta_renderer_rebuild_views (renderer); + meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer)); ensure_frame_callbacks (stage_native); }