backend/drm: preserve mode order from kernel

The kernel orders the mode list from highest to lowest. Preserve
this ordering in the wlr_output.modes list.
This commit is contained in:
Simon Ser 2021-07-30 23:02:30 +02:00 committed by Simon Zeni
parent f12bacf4b4
commit 923258b0be
2 changed files with 3 additions and 3 deletions

View file

@ -1385,7 +1385,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
mode->wlr_mode.refresh, mode->wlr_mode.refresh,
mode->wlr_mode.preferred ? "(preferred)" : ""); mode->wlr_mode.preferred ? "(preferred)" : "");
wl_list_insert(&wlr_conn->output.modes, &mode->wlr_mode.link); wl_list_insert(wlr_conn->output.modes.prev, &mode->wlr_mode.link);
} }
wlr_conn->possible_crtcs = get_possible_crtcs(drm->fd, res, drm_conn); wlr_conn->possible_crtcs = get_possible_crtcs(drm->fd, res, drm_conn);

View file

@ -457,8 +457,8 @@ struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output) {
} }
} }
// No preferred mode, choose the last one // No preferred mode, choose the first one
return wl_container_of(output->modes.prev, mode, link); return wl_container_of(output->modes.next, mode, link);
} }
static void output_state_clear_buffer(struct wlr_output_state *state) { static void output_state_clear_buffer(struct wlr_output_state *state) {