[mutter/wip/texture-purge-on-nvidia: 62/66] monitor-manager/kms: Inhibit frame clock when power save mode active
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/texture-purge-on-nvidia: 62/66] monitor-manager/kms: Inhibit frame clock when power save mode active
- Date: Tue, 8 Jan 2019 22:03:39 +0000 (UTC)
commit 0d4384f3509760eda46c82b78a5dfe5b016f40b7
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Jan 2 12:41:31 2019 +0100
monitor-manager/kms: Inhibit frame clock when power save mode active
We're not going to draw anyway, and when using EGLStreams we'd hit a dead lock
when trying to eglSwapBuffers() after a page flip failed.
src/backends/meta-monitor-manager.c | 3 +++
src/backends/native/meta-gpu-kms.c | 4 ++++
src/backends/native/meta-monitor-manager-kms.c | 29 ++++++++++++++++++++++++++
src/backends/native/meta-monitor-manager-kms.h | 3 +++
4 files changed, 39 insertions(+)
---
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 5bd34ad47..6b44c8a2b 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -332,6 +332,9 @@ power_save_mode_changed (MetaMonitorManager *manager,
return;
}
+ if (manager->power_save_mode == mode)
+ return;
+
klass = META_MONITOR_MANAGER_GET_CLASS (manager);
if (klass->set_power_save_mode)
klass->set_power_save_mode (manager, mode);
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
index 815caf501..94398292b 100644
--- a/src/backends/native/meta-gpu-kms.c
+++ b/src/backends/native/meta-gpu-kms.c
@@ -778,6 +778,8 @@ meta_gpu_kms_read_current (MetaGpu *gpu,
MetaGpuKms *gpu_kms = META_GPU_KMS (gpu);
MetaMonitorManager *monitor_manager =
meta_gpu_get_monitor_manager (gpu);
+ MetaMonitorManagerKms *monitor_manager_kms =
+ META_MONITOR_MANAGER_KMS (monitor_manager);
MetaKmsResources resources;
g_autoptr (GError) local_error = NULL;
@@ -795,6 +797,8 @@ meta_gpu_kms_read_current (MetaGpu *gpu,
gpu_kms->max_buffer_width = resources.resources->max_width;
gpu_kms->max_buffer_height = resources.resources->max_height;
+ meta_monitor_manager_kms_power_save_mode_changed (monitor_manager_kms,
+ META_POWER_SAVE_ON);
monitor_manager->power_save_mode = META_POWER_SAVE_ON;
/* Note: we must not free the public structures (output, crtc, monitor
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c
index 438069110..5a7178753 100644
--- a/src/backends/native/meta-monitor-manager-kms.c
+++ b/src/backends/native/meta-monitor-manager-kms.c
@@ -68,6 +68,10 @@ struct _MetaMonitorManagerKms
GUdevClient *udev;
guint uevent_handler_id;
+
+ struct {
+ gboolean frame_clock_inhibited;
+ } power_save;
};
struct _MetaMonitorManagerKmsClass
@@ -90,10 +94,33 @@ meta_monitor_manager_kms_read_edid (MetaMonitorManager *manager,
return meta_output_kms_read_edid (output);
}
+void
+meta_monitor_manager_kms_power_save_mode_changed (MetaMonitorManagerKms *manager_kms,
+ MetaPowerSave mode)
+{
+ MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_kms);
+ MetaBackend *backend = meta_monitor_manager_get_backend (manager);
+ MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
+
+ if (mode == META_POWER_SAVE_ON &&
+ manager_kms->power_save.frame_clock_inhibited)
+ {
+ meta_backend_native_thaw_frame_clock (backend_native);
+ manager_kms->power_save.frame_clock_inhibited = FALSE;
+ }
+ else if (mode != META_POWER_SAVE_ON &&
+ !manager_kms->power_save.frame_clock_inhibited)
+ {
+ meta_backend_native_freeze_frame_clock (backend_native);
+ manager_kms->power_save.frame_clock_inhibited = TRUE;
+ }
+}
+
static void
meta_monitor_manager_kms_set_power_save_mode (MetaMonitorManager *manager,
MetaPowerSave mode)
{
+ MetaMonitorManagerKms *manager_kms = META_MONITOR_MANAGER_KMS (manager);
uint64_t state;
GList *l;
@@ -120,6 +147,8 @@ meta_monitor_manager_kms_set_power_save_mode (MetaMonitorManager *manager,
meta_gpu_kms_set_power_save_mode (gpu_kms, state);
}
+
+ meta_monitor_manager_kms_power_save_mode_changed (manager_kms, mode);
}
static void
diff --git a/src/backends/native/meta-monitor-manager-kms.h b/src/backends/native/meta-monitor-manager-kms.h
index fea5b63f1..9e43219f5 100644
--- a/src/backends/native/meta-monitor-manager-kms.h
+++ b/src/backends/native/meta-monitor-manager-kms.h
@@ -41,4 +41,7 @@ void meta_monitor_manager_kms_pause (MetaMonitorManagerKms *manager_kms);
void meta_monitor_manager_kms_resume (MetaMonitorManagerKms *manager_kms);
+void meta_monitor_manager_kms_power_save_mode_changed (MetaMonitorManagerKms *manager_kms,
+ MetaPowerSave mode);
+
#endif /* META_MONITOR_MANAGER_KMS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]