output: drop front_buffer

This lets backends immediately release committed buffers if they
want to.
This commit is contained in:
Simon Ser 2021-12-01 08:49:48 +01:00 committed by Simon Zeni
parent 45069fb623
commit efeb8346cf
2 changed files with 5 additions and 15 deletions

View file

@ -188,7 +188,7 @@ struct wlr_output {
struct wlr_allocator *allocator; struct wlr_allocator *allocator;
struct wlr_renderer *renderer; struct wlr_renderer *renderer;
struct wlr_swapchain *swapchain; struct wlr_swapchain *swapchain;
struct wlr_buffer *back_buffer, *front_buffer; struct wlr_buffer *back_buffer;
struct wl_listener display_destroy; struct wl_listener display_destroy;

View file

@ -393,9 +393,6 @@ void wlr_output_destroy(struct wlr_output *output) {
return; return;
} }
wlr_buffer_unlock(output->front_buffer);
output->front_buffer = NULL;
wl_list_remove(&output->display_destroy.link); wl_list_remove(&output->display_destroy.link);
wlr_output_destroy_global(output); wlr_output_destroy_global(output);
output_clear_back_buffer(output); output_clear_back_buffer(output);
@ -716,15 +713,6 @@ bool wlr_output_commit(struct wlr_output *output) {
output->cursor_swapchain = NULL; 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) { if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
output->frame_pending = true; output->frame_pending = true;
output->needs_frame = false; output->needs_frame = false;
@ -732,8 +720,6 @@ bool wlr_output_commit(struct wlr_output *output) {
if (back_buffer != NULL) { if (back_buffer != NULL) {
wlr_swapchain_set_buffer_submitted(output->swapchain, back_buffer); 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; 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); wlr_signal_emit_safe(&output->events.commit, &event);
if (back_buffer != NULL) {
wlr_buffer_unlock(back_buffer);
}
return true; return true;
} }