aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-06-26 18:02:02 -0400
committerAlexander Orzechowski <alex@ozal.ski>2023-06-27 11:47:58 -0400
commit824339938530a3f13c006fa4eefa263a974a3cab (patch)
treeb81e1991cc1fe9b2a9634a62765be5de899db7ce
parent530e58b96e00ffc6a35fc7d72e1b0d45fe928528 (diff)
output: Set output mode during main commit
Removes duplication across all the backends to finally apply the mode to the output.
-rw-r--r--backend/drm/drm.c13
-rw-r--r--backend/headless/output.c1
-rw-r--r--backend/wayland/output.c5
-rw-r--r--backend/x11/output.c2
-rw-r--r--types/output/output.c14
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,