Skip to content

Commit

Permalink
DRMBackend: Fix mode fallback on connector changes
Browse files Browse the repository at this point in the history
  • Loading branch information
misyltoad committed Aug 2, 2024
1 parent f1963e9 commit e31b8de
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Backends/DRMBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,9 @@ static bool setup_best_connector(struct drm_t *drm, bool force, bool initial)
return false;
}

// Don't allow rollback of mode_id after connector change
drm->current.mode_id = drm->pending.mode_id;

const struct wlserver_output_info wlserver_output_info = {
.description = description,
.phys_width = (int) best->GetModeConnector()->mmWidth,
Expand Down Expand Up @@ -2876,6 +2879,11 @@ bool drm_set_connector( struct drm_t *drm, gamescope::CDRMConnector *conn )
return false;
}

// If we are changing connector, zero out the current and pending mode IDs.
// So we don't try to use one mode from the old connector on the new one if we roll back.
drm->pending.mode_id = nullptr;
drm->current.mode_id = nullptr;

drm->pConnector = conn;
drm->needs_modeset = true;

Expand Down

0 comments on commit e31b8de

Please sign in to comment.