backend/drm: fill scratch wlr_output_state for set_mode

Populate the wlr_output_state when setting a mode. This will allow
drm_connector_set_mode to stop relying on ephemeral fields in
wlr_drm_crtc. Also drm_connector_set_mode will be able to apply
both a new buffer and a new mode atomically.
This commit is contained in:
Simon Ser 2021-04-06 16:57:42 +02:00 committed by Kenny Levinsen
parent 1a9701cd7c
commit c9c2d7539c
2 changed files with 23 additions and 7 deletions

View file

@ -118,12 +118,17 @@ static void handle_session_active(struct wl_listener *listener, void *data) {
struct wlr_drm_connector *conn;
wl_list_for_each(conn, &drm->outputs, link) {
struct wlr_output_state state = {0};
struct wlr_output_mode *mode = NULL;
if (conn->output.enabled && conn->output.current_mode != NULL) {
drm_connector_set_mode(conn, &state, conn->output.current_mode);
} else {
drm_connector_set_mode(conn, &state, NULL);
mode = conn->output.current_mode;
}
struct wlr_output_state state = {
.committed = WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_ENABLED,
.enabled = mode != NULL,
.mode_type = WLR_OUTPUT_STATE_MODE_FIXED,
.mode = mode,
};
drm_connector_set_mode(conn, &state, mode);
}
} else {
wlr_log(WLR_INFO, "DRM fd paused");