From 927661d246b23a5a9133547209bc155ed501de2f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 24 May 2022 19:29:02 +0200 Subject: [PATCH] output: pass wlr_output_state to output_pending_resolution --- include/types/wlr_output.h | 4 ++-- types/output/output.c | 22 ++++++++++++---------- types/output/render.c | 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/include/types/wlr_output.h b/include/types/wlr_output.h index 1159d00a..a9018da0 100644 --- a/include/types/wlr_output.h +++ b/include/types/wlr_output.h @@ -4,8 +4,8 @@ #include #include -void output_pending_resolution(struct wlr_output *output, int *width, - int *height); +void output_pending_resolution(struct wlr_output *output, + const struct wlr_output_state *state, int *width, int *height); struct wlr_drm_format *output_pick_format(struct wlr_output *output, const struct wlr_drm_format_set *display_formats, uint32_t format); diff --git a/types/output/output.c b/types/output/output.c index d5cc0c64..39d2d12b 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -535,17 +535,17 @@ static void output_state_clear(struct wlr_output_state *state) { state->committed = 0; } -void output_pending_resolution(struct wlr_output *output, int *width, - int *height) { - if (output->pending.committed & WLR_OUTPUT_STATE_MODE) { - switch (output->pending.mode_type) { +void output_pending_resolution(struct wlr_output *output, + const struct wlr_output_state *state, int *width, int *height) { + if (state->committed & WLR_OUTPUT_STATE_MODE) { + switch (state->mode_type) { case WLR_OUTPUT_STATE_MODE_FIXED: - *width = output->pending.mode->width; - *height = output->pending.mode->height; + *width = state->mode->width; + *height = state->mode->height; return; case WLR_OUTPUT_STATE_MODE_CUSTOM: - *width = output->pending.custom_mode.width; - *height = output->pending.custom_mode.height; + *width = state->custom_mode.width; + *height = state->custom_mode.height; return; } abort(); @@ -583,7 +583,8 @@ static bool output_basic_test(struct wlr_output *output) { // If the size doesn't match, reject buffer (scaling is not // supported) int pending_width, pending_height; - output_pending_resolution(output, &pending_width, &pending_height); + output_pending_resolution(output, &output->pending, + &pending_width, &pending_height); if (output->pending.buffer->width != pending_width || output->pending.buffer->height != pending_height) { wlr_log(WLR_DEBUG, "Direct scan-out buffer size mismatch"); @@ -616,7 +617,8 @@ static bool output_basic_test(struct wlr_output *output) { if (enabled && (output->pending.committed & (WLR_OUTPUT_STATE_ENABLED | WLR_OUTPUT_STATE_MODE))) { int pending_width, pending_height; - output_pending_resolution(output, &pending_width, &pending_height); + output_pending_resolution(output, &output->pending, + &pending_width, &pending_height); if (pending_width == 0 || pending_height == 0) { wlr_log(WLR_DEBUG, "Tried to enable an output with a zero mode"); return false; diff --git a/types/output/render.c b/types/output/render.c index 5427b439..e162044a 100644 --- a/types/output/render.c +++ b/types/output/render.c @@ -46,7 +46,7 @@ bool wlr_output_init_render(struct wlr_output *output, static bool output_create_swapchain(struct wlr_output *output, bool allow_modifiers) { int width, height; - output_pending_resolution(output, &width, &height); + output_pending_resolution(output, &output->pending, &width, &height); struct wlr_allocator *allocator = output->allocator; assert(allocator != NULL); @@ -154,7 +154,7 @@ static bool output_attach_empty_buffer(struct wlr_output *output) { } int width, height; - output_pending_resolution(output, &width, &height); + output_pending_resolution(output, &output->pending, &width, &height); struct wlr_renderer *renderer = output->renderer; wlr_renderer_begin(renderer, width, height);