kms/connector: Properly predict connectors turning off

The connector state wasn't properly predicted, as it earlied out if
the connector wasn't part of a mode set connector list.

Instead use the old CRTC to check whether it was used in any mode set,
and whether the connector was part of any new mode set, to predict
whether the connector is inactive or active.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1821>
This commit is contained in:
Jonas Ådahl 2021-04-10 21:14:44 +02:00 committed by Marge Bot
parent 4b78c8d84f
commit e956078052

View File

@ -498,28 +498,34 @@ void
meta_kms_connector_predict_state (MetaKmsConnector *connector, meta_kms_connector_predict_state (MetaKmsConnector *connector,
MetaKmsUpdate *update) MetaKmsUpdate *update)
{ {
MetaKmsConnectorState *current_state;
GList *mode_sets; GList *mode_sets;
GList *l; GList *l;
current_state = connector->current_state;
if (!connector->current_state) if (!current_state)
return; return;
mode_sets = meta_kms_update_get_mode_sets (update); mode_sets = meta_kms_update_get_mode_sets (update);
for (l = mode_sets; l; l = l->next) for (l = mode_sets; l; l = l->next)
{ {
MetaKmsModeSet *mode_set = l->data; MetaKmsModeSet *mode_set = l->data;
MetaKmsCrtc *crtc; MetaKmsCrtc *crtc = mode_set->crtc;
if (!g_list_find (mode_set->connectors, connector))
continue;
crtc = mode_set->crtc;
if (crtc)
connector->current_state->current_crtc_id = meta_kms_crtc_get_id (crtc);
else
connector->current_state->current_crtc_id = 0;
if (current_state->current_crtc_id == meta_kms_crtc_get_id (crtc))
{
if (g_list_find (mode_set->connectors, connector))
break; break;
else
current_state->current_crtc_id = 0;
}
else
{
if (g_list_find (mode_set->connectors, connector))
{
current_state->current_crtc_id = meta_kms_crtc_get_id (crtc);
break;
}
}
} }
} }