From 824339938530a3f13c006fa4eefa263a974a3cab Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Mon, 26 Jun 2023 18:02:02 -0400 Subject: [PATCH] output: Set output mode during main commit Removes duplication across all the backends to finally apply the mode to the output. --- backend/drm/drm.c | 13 ------------- backend/headless/output.c | 1 - backend/wayland/output.c | 5 ----- backend/x11/output.c | 2 -- types/output/output.c | 14 ++++++++++++++ 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 384971d1..c07b7e13 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -762,19 +762,6 @@ bool drm_connector_commit_state(struct wlr_drm_connector *conn, conn->cursor_enabled = false; 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) { conn->pending_page_flip_crtc = conn->crtc->id; diff --git a/backend/headless/output.c b/backend/headless/output.c index b2be6a0d..a233bf6b 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -27,7 +27,6 @@ static bool output_set_custom_mode(struct wlr_headless_output *output, output->frame_delay = 1000000 / refresh; - wlr_output_update_custom_mode(&output->wlr_output, width, height, refresh); return true; } diff --git a/backend/wayland/output.c b/backend/wayland/output.c index a7facb7b..d147de4e 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -566,11 +566,6 @@ static bool output_commit(struct wlr_output *wlr_output, 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; } diff --git a/backend/x11/output.c b/backend/x11/output.c index 807b5569..d1426b6f 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -74,8 +74,6 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, return false; } - wlr_output_update_custom_mode(&output->wlr_output, width, height, 0); - // Move the pointer to its new location update_x11_pointer_position(output, output->x11->time); diff --git a/types/output/output.c b/types/output/output.c index 76fa87e3..4bd2f243 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -814,6 +814,20 @@ bool wlr_output_commit_state(struct wlr_output *output, 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 = { .output = output, .committed = pending.committed,