monitor: Add foreach output helper and fix foreach crtc helper
The foreach CRTC monitor mode helper incorrectly iterated over outputs without CRTC when non-tiled modes were set on tiled monitors. This was not expected by callers, so fix the helper to only iterate over active outputs (that has or should have a CRTC). The test cases uses the incorrect behaviour of the foreach CRTC helper to check that the disabled outputs mode are set to NULL, so add a foreach output helper and change the tests to use that instead. https://bugzilla.gnome.org/show_bug.cgi?id=730551
This commit is contained in:
parent
be11c32815
commit
522eec00cd
@ -1594,6 +1594,32 @@ meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
||||
GList *l;
|
||||
int i;
|
||||
|
||||
for (l = monitor_priv->outputs, i = 0; l; l = l->next, i++)
|
||||
{
|
||||
MetaMonitorCrtcMode *monitor_crtc_mode = &mode->crtc_modes[i];
|
||||
|
||||
if (!monitor_crtc_mode->crtc_mode)
|
||||
continue;
|
||||
|
||||
if (!func (monitor, mode, monitor_crtc_mode, user_data, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_monitor_mode_foreach_output (MetaMonitor *monitor,
|
||||
MetaMonitorMode *mode,
|
||||
MetaMonitorModeFunc func,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
MetaMonitorPrivate *monitor_priv =
|
||||
meta_monitor_get_instance_private (monitor);
|
||||
GList *l;
|
||||
int i;
|
||||
|
||||
for (l = monitor_priv->outputs, i = 0; l; l = l->next, i++)
|
||||
{
|
||||
MetaMonitorCrtcMode *monitor_crtc_mode = &mode->crtc_modes[i];
|
||||
|
@ -197,6 +197,12 @@ gboolean meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
gboolean meta_monitor_mode_foreach_output (MetaMonitor *monitor,
|
||||
MetaMonitorMode *mode,
|
||||
MetaMonitorModeFunc func,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
|
||||
|
||||
gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id,
|
||||
|
@ -659,7 +659,7 @@ check_monitor_configuration (MonitorTestCase *test_case)
|
||||
.expect_crtc_mode_iter =
|
||||
test_case->expect.monitors[i].modes[j].crtc_modes
|
||||
};
|
||||
meta_monitor_mode_foreach_crtc (monitor, mode,
|
||||
meta_monitor_mode_foreach_output (monitor, mode,
|
||||
check_monitor_mode,
|
||||
&data,
|
||||
NULL);
|
||||
@ -688,7 +688,7 @@ check_monitor_configuration (MonitorTestCase *test_case)
|
||||
.expect_crtc_mode_iter =
|
||||
test_case->expect.monitors[i].modes[expected_current_mode_index].crtc_modes
|
||||
};
|
||||
meta_monitor_mode_foreach_crtc (monitor, expected_current_mode,
|
||||
meta_monitor_mode_foreach_output (monitor, expected_current_mode,
|
||||
check_current_monitor_mode,
|
||||
&data,
|
||||
NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user