output: Set output mode during main commit

Removes duplication across all the backends to finally apply the mode
to the output.
This commit is contained in:
Alexander Orzechowski 2023-06-26 18:02:02 -04:00
parent 530e58b96e
commit 8243399385
5 changed files with 14 additions and 21 deletions

View File

@ -762,19 +762,6 @@ bool drm_connector_commit_state(struct wlr_drm_connector *conn,
conn->cursor_enabled = false; conn->cursor_enabled = false;
conn->crtc = NULL; conn->crtc = NULL;
} }
if (pending.base->committed & WLR_OUTPUT_STATE_MODE) {
switch (pending.base->mode_type) {
case WLR_OUTPUT_STATE_MODE_FIXED:
wlr_output_update_mode(&conn->output, pending.base->mode);
break;
case WLR_OUTPUT_STATE_MODE_CUSTOM:
wlr_output_update_custom_mode(&conn->output,
pending.base->custom_mode.width,
pending.base->custom_mode.height,
pending.base->custom_mode.refresh);
break;
}
}
if (flags & DRM_MODE_PAGE_FLIP_EVENT) { if (flags & DRM_MODE_PAGE_FLIP_EVENT) {
conn->pending_page_flip_crtc = conn->crtc->id; conn->pending_page_flip_crtc = conn->crtc->id;

View File

@ -27,7 +27,6 @@ static bool output_set_custom_mode(struct wlr_headless_output *output,
output->frame_delay = 1000000 / refresh; output->frame_delay = 1000000 / refresh;
wlr_output_update_custom_mode(&output->wlr_output, width, height, refresh);
return true; return true;
} }

View File

@ -566,11 +566,6 @@ static bool output_commit(struct wlr_output *wlr_output,
wl_display_flush(output->backend->remote_display); wl_display_flush(output->backend->remote_display);
if (state->committed & WLR_OUTPUT_STATE_MODE) {
wlr_output_update_custom_mode(wlr_output,
state->custom_mode.width, state->custom_mode.height, 0);
}
return true; return true;
} }

View File

@ -74,8 +74,6 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output,
return false; return false;
} }
wlr_output_update_custom_mode(&output->wlr_output, width, height, 0);
// Move the pointer to its new location // Move the pointer to its new location
update_x11_pointer_position(output, output->x11->time); update_x11_pointer_position(output, output->x11->time);

View File

@ -814,6 +814,20 @@ bool wlr_output_commit_state(struct wlr_output *output,
wlr_swapchain_set_buffer_submitted(output->swapchain, pending.buffer); wlr_swapchain_set_buffer_submitted(output->swapchain, pending.buffer);
} }
if (pending.committed & WLR_OUTPUT_STATE_MODE) {
switch (pending.mode_type) {
case WLR_OUTPUT_STATE_MODE_FIXED:
wlr_output_update_mode(output, pending.mode);
break;
case WLR_OUTPUT_STATE_MODE_CUSTOM:
wlr_output_update_custom_mode(output,
pending.custom_mode.width,
pending.custom_mode.height,
pending.custom_mode.refresh);
break;
}
}
struct wlr_output_event_commit event = { struct wlr_output_event_commit event = {
.output = output, .output = output,
.committed = pending.committed, .committed = pending.committed,