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

backends/output: 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 output. This will eventually be
replaced with a per GPU/graphics card object.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
parent d3efd734
......@@ -89,10 +89,11 @@ create_mode (CrtcModeSpec *spec,
}
static void
append_monitor (GList **modes,
GList **crtcs,
GList **outputs,
float scale)
append_monitor (MetaMonitorManager *manager,
GList **modes,
GList **crtcs,
GList **outputs,
float scale)
{
CrtcModeSpec mode_specs[] = {
{
......@@ -140,6 +141,7 @@ append_monitor (GList **modes,
number = g_list_length (*outputs) + 1;
output->monitor_manager = manager;
output->winsys_id = number;
output->name = g_strdup_printf ("LVDS%d", number);
output->vendor = g_strdup ("MetaProducts Inc.");
......@@ -174,10 +176,11 @@ append_monitor (GList **modes,
}
static void
append_tiled_monitor (GList **modes,
GList **crtcs,
GList **outputs,
int scale)
append_tiled_monitor (MetaMonitorManager *manager,
GList **modes,
GList **crtcs,
GList **outputs,
int scale)
{
CrtcModeSpec mode_specs[] = {
{
......@@ -242,6 +245,7 @@ append_tiled_monitor (GList **modes,
output = g_object_new (META_TYPE_OUTPUT, NULL);
output->monitor_manager = manager;
output->winsys_id = number;
output->name = g_strdup_printf ("LVDS%d", number);
output->vendor = g_strdup ("MetaProducts Inc.");
......@@ -385,9 +389,10 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
for (i = 0; i < num_monitors; i++)
{
if (tiled_monitors)
append_tiled_monitor (&modes, &crtcs, &outputs, monitor_scales[i]);
append_tiled_monitor (manager,
&modes, &crtcs, &outputs, monitor_scales[i]);
else
append_monitor (&modes, &crtcs, &outputs, monitor_scales[i]);
append_monitor (manager, &modes, &crtcs, &outputs, monitor_scales[i]);
}
manager->modes = modes;
......
......@@ -23,6 +23,12 @@
G_DEFINE_TYPE (MetaOutput, meta_output, G_TYPE_OBJECT)
MetaMonitorManager *
meta_output_get_monitor_manager (MetaOutput *output)
{
return output->monitor_manager;
}
static void
meta_output_finalize (GObject *object)
{
......
......@@ -62,6 +62,8 @@ struct _MetaOutput
{
GObject parent;
MetaMonitorManager *monitor_manager;
/* The CRTC driving this output, NULL if the output is not enabled */
MetaCrtc *crtc;
......@@ -117,4 +119,6 @@ struct _MetaOutput
#define META_TYPE_OUTPUT (meta_output_get_type ())
G_DECLARE_FINAL_TYPE (MetaOutput, meta_output, META, OUTPUT, GObject)
MetaMonitorManager * meta_output_get_monitor_manager (MetaOutput *output);
#endif /* META_OUTPUT_H */
......@@ -730,6 +730,7 @@ create_output (MetaMonitorManager *manager,
output->driver_private = output_kms;
output->driver_notify = (GDestroyNotify)meta_output_destroy_notify;
output->monitor_manager = manager;
output->winsys_id = connector->connector_id;
output->name = make_output_name (connector);
output->width_mm = connector->mmWidth;
......
......@@ -872,6 +872,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
continue;
output = g_object_new (META_TYPE_OUTPUT, NULL);
output->monitor_manager = manager;
if (xrandr_output->connection != RR_Disconnected)
{
......
......@@ -91,9 +91,13 @@ static void
meta_monitor_manager_test_read_current (MetaMonitorManager *manager)
{
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (manager);
GList *l;
g_assert (manager_test->test_setup);
for (l = manager_test->test_setup->outputs; l; l = l->next)
META_OUTPUT (l->data)->monitor_manager = manager;
manager->modes = manager_test->test_setup->modes;
manager->crtcs = manager_test->test_setup->crtcs;
......
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