backend/drm: fix adaptive sync no-op changes

When a compositors submits a wlr_output_state with
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED set and
adaptive_sync_enabled = false on an output which doesn't support
adaptive sync, we'd fail the commit. Fix this.

This bug was previously hidden because wlr_output_commit() drops
no-op changes from wlr_output_state.committed.
This commit is contained in:
Simon Ser 2024-02-16 18:05:45 +01:00 committed by Kenny Levinsen
parent 35737ab00c
commit d41b5efc65
2 changed files with 4 additions and 3 deletions

View File

@ -276,7 +276,7 @@ bool drm_atomic_connector_prepare(struct wlr_drm_connector_state *state, bool mo
output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
bool vrr_enabled = prev_vrr_enabled;
if ((state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED)) {
if (!drm_connector_supports_vrr(conn)) {
if (state->base->adaptive_sync_enabled && !drm_connector_supports_vrr(conn)) {
return false;
}
vrr_enabled = state->base->adaptive_sync_enabled;

View File

@ -110,10 +110,11 @@ static bool legacy_crtc_commit(const struct wlr_drm_connector_state *state,
}
if (state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
if (!drm_connector_supports_vrr(conn)) {
if (state->base->adaptive_sync_enabled && !drm_connector_supports_vrr(conn)) {
return false;
}
if (drmModeObjectSetProperty(drm->fd, crtc->id, DRM_MODE_OBJECT_CRTC,
if (crtc->props.vrr_enabled != 0 &&
drmModeObjectSetProperty(drm->fd, crtc->id, DRM_MODE_OBJECT_CRTC,
crtc->props.vrr_enabled,
state->base->adaptive_sync_enabled) != 0) {
wlr_drm_conn_log_errno(conn, WLR_ERROR,