From 0213da60bbc7b534c0f37965a3984b11cf8e1cd1 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 18 Sep 2022 16:26:42 +0200 Subject: [PATCH] output: drop back_buffer variable in wlr_output_commit_state() We can just use pending.buffer instead. It's completely fine to call wlr_swapchain_set_buffer_submitted() with a buffer which doesn't come from the swapchain, in which case it's a no-op. --- types/output/output.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/types/output/output.c b/types/output/output.c index cd0cc934..26122f93 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -751,15 +751,12 @@ bool wlr_output_commit_state(struct wlr_output *output, // important to do before calling impl->commit(), because this marks an // implicit rendering synchronization point. The backend needs it to avoid // displaying a buffer when asynchronous GPU work isn't finished. - struct wlr_buffer *back_buffer = NULL; if ((pending.committed & WLR_OUTPUT_STATE_BUFFER) && output->back_buffer != NULL) { - back_buffer = wlr_buffer_lock(output->back_buffer); output_clear_back_buffer(output); } if (!output->impl->commit(output, &pending)) { - wlr_buffer_unlock(back_buffer); if (new_back_buffer) { wlr_buffer_unlock(pending.buffer); } @@ -825,8 +822,8 @@ bool wlr_output_commit_state(struct wlr_output *output, output->needs_frame = false; } - if (back_buffer != NULL) { - wlr_swapchain_set_buffer_submitted(output->swapchain, back_buffer); + if (pending.committed & WLR_OUTPUT_STATE_BUFFER) { + wlr_swapchain_set_buffer_submitted(output->swapchain, pending.buffer); } struct wlr_output_event_commit event = { @@ -837,7 +834,6 @@ bool wlr_output_commit_state(struct wlr_output *output, }; wl_signal_emit_mutable(&output->events.commit, &event); - wlr_buffer_unlock(back_buffer); if (new_back_buffer) { wlr_buffer_unlock(pending.buffer); }