[mutter] backends/crtc: Keep a pointer to the monitor manager



commit cfee58798e8b75e5bec8f4fda9a8d4a621060fdf
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Jul 4 15:58:44 2017 +0800

    backends/crtc: Keep a pointer to the monitor manager
    
    Instead of passing it around or fetching the singleton, keep a pointer
    to the monitor manager that owns the CRTC. This will eventually be
    replaced with a per GPU/graphics card object.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785381

 src/backends/meta-crtc.c                       |    6 ++++++
 src/backends/meta-crtc.h                       |    4 ++++
 src/backends/meta-monitor-manager-dummy.c      |    1 +
 src/backends/native/meta-monitor-manager-kms.c |    1 +
 src/backends/x11/meta-monitor-manager-xrandr.c |    1 +
 src/tests/meta-monitor-manager-test.c          |    2 ++
 6 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-crtc.c b/src/backends/meta-crtc.c
index ae92a7e..f19e6b8 100644
--- a/src/backends/meta-crtc.c
+++ b/src/backends/meta-crtc.c
@@ -25,6 +25,12 @@ G_DEFINE_TYPE (MetaCrtc, meta_crtc, G_TYPE_OBJECT)
 
 G_DEFINE_TYPE (MetaCrtcMode, meta_crtc_mode, G_TYPE_OBJECT)
 
+MetaMonitorManager *
+meta_crtc_get_monitor_manager (MetaCrtc *crtc)
+{
+  return crtc->monitor_manager;
+}
+
 static void
 meta_crtc_finalize (GObject *object)
 {
diff --git a/src/backends/meta-crtc.h b/src/backends/meta-crtc.h
index d9eef4f..cb92d8d 100644
--- a/src/backends/meta-crtc.h
+++ b/src/backends/meta-crtc.h
@@ -50,6 +50,8 @@ struct _MetaCrtc
 {
   GObject parent;
 
+  MetaMonitorManager *monitor_manager;
+
   glong crtc_id;
   MetaRectangle rect;
   MetaCrtcMode *current_mode;
@@ -91,4 +93,6 @@ G_DECLARE_FINAL_TYPE (MetaCrtc, meta_crtc, META, CRTC, GObject)
 #define META_TYPE_CRTC_MODE (meta_crtc_mode_get_type ())
 G_DECLARE_FINAL_TYPE (MetaCrtcMode, meta_crtc_mode, META, CRTC_MODE, GObject)
 
+MetaMonitorManager * meta_crtc_get_monitor_manager (MetaCrtc *crtc);
+
 #endif /* META_CRTC_H */
diff --git a/src/backends/meta-monitor-manager-dummy.c b/src/backends/meta-monitor-manager-dummy.c
index 14cdb3b..8f9f8fa 100644
--- a/src/backends/meta-monitor-manager-dummy.c
+++ b/src/backends/meta-monitor-manager-dummy.c
@@ -218,6 +218,7 @@ append_tiled_monitor (MetaMonitorManager *manager,
       MetaCrtc *crtc;
 
       crtc = g_object_new (META_TYPE_CRTC, NULL);
+      crtc->monitor_manager = manager;
       crtc->crtc_id = g_list_length (*crtcs) + i + 1;
       crtc->all_transforms = ALL_TRANSFORMS;
       new_crtcs = g_list_append (new_crtcs, crtc);
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c
index 8b0f85d..cb10c43 100644
--- a/src/backends/native/meta-monitor-manager-kms.c
+++ b/src/backends/native/meta-monitor-manager-kms.c
@@ -422,6 +422,7 @@ create_crtc (MetaMonitorManager *manager,
 
   crtc = g_object_new (META_TYPE_CRTC, NULL);
 
+  crtc->monitor_manager = manager;
   crtc->crtc_id = drm_crtc->crtc_id;
   crtc->rect.x = drm_crtc->x;
   crtc->rect.y = drm_crtc->y;
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 1d9701e..5f78c6a 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -833,6 +833,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
 
       crtc = g_object_new (META_TYPE_CRTC, NULL);
 
+      crtc->monitor_manager = manager;
       crtc->crtc_id = resources->crtcs[i];
       crtc->rect.x = xrandr_crtc->x;
       crtc->rect.y = xrandr_crtc->y;
diff --git a/src/tests/meta-monitor-manager-test.c b/src/tests/meta-monitor-manager-test.c
index 942b5e1..44187ee 100644
--- a/src/tests/meta-monitor-manager-test.c
+++ b/src/tests/meta-monitor-manager-test.c
@@ -97,6 +97,8 @@ meta_monitor_manager_test_read_current (MetaMonitorManager *manager)
 
   for (l = manager_test->test_setup->outputs; l; l = l->next)
     META_OUTPUT (l->data)->monitor_manager = manager;
+  for (l = manager_test->test_setup->crtcs; l; l = l->next)
+    META_CRTC (l->data)->monitor_manager = manager;
 
   manager->modes = manager_test->test_setup->modes;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]