kms/crtc: Always log whether we updated CRTC state

Change a few early-outs to handle the state changes without returning.
This means we'll get to log the result in all cases, which might help
debugging.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2097>
This commit is contained in:
Jonas Ådahl 2021-11-18 17:18:12 +01:00
parent 8546ca31ff
commit c765730af7

View File

@ -125,6 +125,9 @@ static MetaKmsUpdateChanges
meta_kms_crtc_state_changes (MetaKmsCrtcState *state, meta_kms_crtc_state_changes (MetaKmsCrtcState *state,
MetaKmsCrtcState *other_state) MetaKmsCrtcState *other_state)
{ {
if (state->is_active != other_state->is_active)
return META_KMS_UPDATE_CHANGE_FULL;
if (!meta_rectangle_equal (&state->rect, &other_state->rect)) if (!meta_rectangle_equal (&state->rect, &other_state->rect))
return META_KMS_UPDATE_CHANGE_FULL; return META_KMS_UPDATE_CHANGE_FULL;
@ -214,35 +217,29 @@ meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
crtc_state.is_active = drm_crtc->mode_valid; crtc_state.is_active = drm_crtc->mode_valid;
} }
if (crtc_state.is_active != crtc->current_state.is_active) if (!crtc_state.is_active)
{ {
changes |= META_KMS_UPDATE_CHANGE_FULL; if (crtc->current_state.is_active)
changes |= META_KMS_UPDATE_CHANGE_FULL;
} }
else if (!crtc_state.is_active) else
{ {
clear_gamma_state (&crtc_state); read_gamma_state (crtc, &crtc_state, impl_device, drm_crtc);
return changes; changes = meta_kms_crtc_state_changes (&crtc->current_state, &crtc_state);
}
read_gamma_state (crtc, &crtc_state, impl_device, drm_crtc);
changes |= meta_kms_crtc_state_changes (&crtc->current_state, &crtc_state);
if (changes == META_KMS_UPDATE_CHANGE_NONE)
{
clear_gamma_state (&crtc_state);
return changes;
} }
clear_gamma_state (&crtc->current_state); clear_gamma_state (&crtc->current_state);
crtc->current_state = crtc_state; crtc->current_state = crtc_state;
meta_topic (META_DEBUG_KMS, meta_topic (META_DEBUG_KMS,
"Read CRTC %u state: active: %d, mode: %s", "Read CRTC %u state: active: %d, mode: %s, changed: %s",
crtc->id, crtc->current_state.is_active, crtc->id, crtc->current_state.is_active,
crtc->current_state.is_drm_mode_valid crtc->current_state.is_drm_mode_valid
? crtc->current_state.drm_mode.name ? crtc->current_state.drm_mode.name
: "(nil)"); : "(nil)",
changes == META_KMS_UPDATE_CHANGE_NONE
? "no"
: "yes");
return changes; return changes;
} }