From 7215bd1e0f911fcedea802a76edfcde33240daaf Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 20 Feb 2023 12:00:18 +0100 Subject: [PATCH] output: expose wlr_output_state_set_buffer() --- include/types/wlr_output.h | 2 -- include/wlr/types/wlr_output.h | 2 ++ types/output/output.c | 13 +++---------- types/output/state.c | 7 +++++++ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/types/wlr_output.h b/include/types/wlr_output.h index 082df5e32..30c3e45ff 100644 --- a/include/types/wlr_output.h +++ b/include/types/wlr_output.h @@ -6,8 +6,6 @@ void output_pending_resolution(struct wlr_output *output, const struct wlr_output_state *state, int *width, int *height); -void output_state_attach_buffer(struct wlr_output_state *state, - struct wlr_buffer *buffer); bool output_is_direct_scanout(struct wlr_output *output, struct wlr_buffer *buffer); diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index cfd213253..9ea1188f4 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -559,6 +559,8 @@ void wlr_output_state_set_render_format(struct wlr_output_state *state, uint32_t format); void wlr_output_state_set_subpixel(struct wlr_output_state *state, enum wl_output_subpixel subpixel); +void wlr_output_state_set_buffer(struct wlr_output_state *state, + struct wlr_buffer *buffer); /** diff --git a/types/output/output.c b/types/output/output.c index db69f0167..dc9aa6ad0 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -743,7 +743,7 @@ bool wlr_output_commit_state(struct wlr_output *output, } if (new_back_buffer) { assert((pending.committed & WLR_OUTPUT_STATE_BUFFER) == 0); - output_state_attach_buffer(&pending, output->back_buffer); + wlr_output_state_set_buffer(&pending, output->back_buffer); output_clear_back_buffer(output); } @@ -872,7 +872,7 @@ bool wlr_output_commit(struct wlr_output *output) { // implicit rendering synchronization point. The backend needs it to avoid // displaying a buffer when asynchronous GPU work isn't finished. if (output->back_buffer != NULL) { - output_state_attach_buffer(&state, output->back_buffer); + wlr_output_state_set_buffer(&state, output->back_buffer); output_clear_back_buffer(output); } @@ -886,16 +886,9 @@ void wlr_output_rollback(struct wlr_output *output) { output_state_clear(&output->pending); } -void output_state_attach_buffer(struct wlr_output_state *state, - struct wlr_buffer *buffer) { - output_state_clear_buffer(state); - state->committed |= WLR_OUTPUT_STATE_BUFFER; - state->buffer = wlr_buffer_lock(buffer); -} - void wlr_output_attach_buffer(struct wlr_output *output, struct wlr_buffer *buffer) { - output_state_attach_buffer(&output->pending, buffer); + wlr_output_state_set_buffer(&output->pending, buffer); } void wlr_output_send_frame(struct wlr_output *output) { diff --git a/types/output/state.c b/types/output/state.c index d81f928af..b54c251e6 100644 --- a/types/output/state.c +++ b/types/output/state.c @@ -66,3 +66,10 @@ void wlr_output_state_set_subpixel(struct wlr_output_state *state, state->committed |= WLR_OUTPUT_STATE_SUBPIXEL; state->subpixel = subpixel; } + +void wlr_output_state_set_buffer(struct wlr_output_state *state, + struct wlr_buffer *buffer) { + state->committed |= WLR_OUTPUT_STATE_BUFFER; + wlr_buffer_unlock(state->buffer); + state->buffer = wlr_buffer_lock(buffer); +}