Commit cfee5879 authored by Jonas Ådahl's avatar Jonas Ådahl
Browse files

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
parent 7ea01693
......@@ -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)
{
......
......@@ -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 */
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment