From efeb8346cfc6a18d2d9341460033883e4f89c28a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 1 Dec 2021 08:49:48 +0100 Subject: [PATCH] output: drop front_buffer This lets backends immediately release committed buffers if they want to. --- include/wlr/types/wlr_output.h | 2 +- types/output/output.c | 18 ++++-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 689b8158..fd8e6556 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -188,7 +188,7 @@ struct wlr_output { struct wlr_allocator *allocator; struct wlr_renderer *renderer; struct wlr_swapchain *swapchain; - struct wlr_buffer *back_buffer, *front_buffer; + struct wlr_buffer *back_buffer; struct wl_listener display_destroy; diff --git a/types/output/output.c b/types/output/output.c index 8655ef98..9a715d12 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -393,9 +393,6 @@ void wlr_output_destroy(struct wlr_output *output) { return; } - wlr_buffer_unlock(output->front_buffer); - output->front_buffer = NULL; - wl_list_remove(&output->display_destroy.link); wlr_output_destroy_global(output); output_clear_back_buffer(output); @@ -716,15 +713,6 @@ bool wlr_output_commit(struct wlr_output *output) { output->cursor_swapchain = NULL; } - // Unset the front-buffer when a new buffer will replace it or when the - // output is getting disabled - if ((output->pending.committed & WLR_OUTPUT_STATE_BUFFER) || - ((output->pending.committed & WLR_OUTPUT_STATE_ENABLED) && - !output->pending.enabled)) { - wlr_buffer_unlock(output->front_buffer); - output->front_buffer = NULL; - } - if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { output->frame_pending = true; output->needs_frame = false; @@ -732,8 +720,6 @@ bool wlr_output_commit(struct wlr_output *output) { if (back_buffer != NULL) { wlr_swapchain_set_buffer_submitted(output->swapchain, back_buffer); - wlr_buffer_unlock(output->front_buffer); - output->front_buffer = back_buffer; } uint32_t committed = output->pending.committed; @@ -747,6 +733,10 @@ bool wlr_output_commit(struct wlr_output *output) { }; wlr_signal_emit_safe(&output->events.commit, &event); + if (back_buffer != NULL) { + wlr_buffer_unlock(back_buffer); + } + return true; }