crtc: Move logical monitor pointer to MetaMonitor

Since the last code fetching the logical monitor state directly from the
CRTC has been removed, we can move the logical monitor pointer to a more
natural place.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1042
This commit is contained in:
Jonas Ådahl 2020-01-16 10:10:42 +01:00
parent 1c98f01a65
commit 2d6665950c
8 changed files with 21 additions and 26 deletions

View File

@ -65,7 +65,6 @@ struct _MetaCrtc
glong crtc_id;
unsigned int all_transforms;
MetaLogicalMonitor *logical_monitor;
MetaCrtcConfig *config;
/* Used when changing configuration */

View File

@ -177,16 +177,14 @@ meta_logical_monitor_add_monitor (MetaLogicalMonitor *logical_monitor,
for (l_output = outputs; l_output; l_output = l_output->next)
{
MetaOutput *output = l_output->data;
MetaCrtc *crtc;
is_presentation = is_presentation && output->is_presentation;
crtc = meta_output_get_assigned_crtc (output);
if (crtc)
crtc->logical_monitor = logical_monitor;
}
}
logical_monitor->is_presentation = is_presentation;
meta_monitor_set_logical_monitor (monitor, logical_monitor);
}
gboolean

View File

@ -548,8 +548,6 @@ apply_crtc_assignments (MetaMonitorManager *manager,
{
MetaCrtc *crtc = l->data;
crtc->logical_monitor = NULL;
if (crtc->is_dirty)
{
crtc->is_dirty = FALSE;

View File

@ -66,6 +66,8 @@ typedef struct _MetaMonitorPrivate
MetaMonitorSpec *spec;
MetaLogicalMonitor *logical_monitor;
/*
* The primary or first output for this monitor, 0 if we can't figure out.
* It can be matched to a winsys_id of a MetaOutput.
@ -1448,16 +1450,9 @@ meta_monitor_get_spec (MetaMonitor *monitor)
MetaLogicalMonitor *
meta_monitor_get_logical_monitor (MetaMonitor *monitor)
{
MetaOutput *output;
MetaCrtc *crtc;
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
output = meta_monitor_get_main_output (monitor);
crtc = meta_output_get_assigned_crtc (output);
if (crtc)
return crtc->logical_monitor;
else
return NULL;
return priv->logical_monitor;
}
MetaMonitorMode *
@ -1895,3 +1890,12 @@ meta_monitor_get_display_name (MetaMonitor *monitor)
return monitor_priv->display_name;
}
void
meta_monitor_set_logical_monitor (MetaMonitor *monitor,
MetaLogicalMonitor *logical_monitor)
{
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
priv->logical_monitor = logical_monitor;
}

View File

@ -283,4 +283,7 @@ void meta_monitor_spec_free (MetaMonitorSpec *monitor_id);
const char * meta_monitor_get_display_name (MetaMonitor *monitor);
void meta_monitor_set_logical_monitor (MetaMonitor *monitor,
MetaLogicalMonitor *logical_monitor);
#endif /* META_MONITOR_H */

View File

@ -221,8 +221,6 @@ apply_crtc_assignments (MetaMonitorManager *manager,
{
MetaCrtc *crtc = k->data;
crtc->logical_monitor = NULL;
if (crtc->is_dirty)
{
crtc->is_dirty = FALSE;

View File

@ -177,8 +177,6 @@ apply_crtc_assignments (MetaMonitorManager *manager,
{
MetaCrtc *crtc = l->data;
crtc->logical_monitor = NULL;
if (crtc->is_dirty)
{
crtc->is_dirty = FALSE;

View File

@ -520,7 +520,7 @@ check_current_monitor_mode (MetaMonitor *monitor,
g_assert (monitor_crtc_mode->crtc_mode == crtc_config->mode);
logical_monitor = crtc->logical_monitor;
logical_monitor = meta_monitor_get_logical_monitor (monitor);
g_assert_nonnull (logical_monitor);
}
@ -618,7 +618,8 @@ check_logical_monitor (MonitorTestCase *test_case,
}
crtc = meta_output_get_assigned_crtc (output);
g_assert (!crtc || crtc->logical_monitor == logical_monitor);
g_assert (!crtc ||
meta_monitor_get_logical_monitor (monitor) == logical_monitor);
g_assert_cmpint (logical_monitor->is_presentation,
==,
output->is_presentation);
@ -831,7 +832,6 @@ check_monitor_configuration (MonitorTestCase *test_case)
}
else
{
MetaLogicalMonitor *logical_monitor = crtc->logical_monitor;
MetaCrtcMode *expected_current_mode;
g_assert_nonnull (crtc_config);
@ -845,9 +845,6 @@ check_monitor_configuration (MonitorTestCase *test_case)
==,
test_case->expect.crtcs[i].transform);
logical_monitor = crtc->logical_monitor;
g_assert_nonnull (logical_monitor);
g_assert_cmpfloat_with_epsilon (crtc_config->layout.origin.x,
test_case->expect.crtcs[i].x,
FLT_EPSILON);