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.
Simon Ser 2 years ago committed by Simon Zeni
parent 679d5ba699
commit 0213da60bb

@ -751,15 +751,12 @@ bool wlr_output_commit_state(struct wlr_output *output,
// important to do before calling impl->commit(), because this marks an // important to do before calling impl->commit(), because this marks an
// implicit rendering synchronization point. The backend needs it to avoid // implicit rendering synchronization point. The backend needs it to avoid
// displaying a buffer when asynchronous GPU work isn't finished. // displaying a buffer when asynchronous GPU work isn't finished.
struct wlr_buffer *back_buffer = NULL;
if ((pending.committed & WLR_OUTPUT_STATE_BUFFER) && if ((pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
output->back_buffer != NULL) { output->back_buffer != NULL) {
back_buffer = wlr_buffer_lock(output->back_buffer);
output_clear_back_buffer(output); output_clear_back_buffer(output);
} }
if (!output->impl->commit(output, &pending)) { if (!output->impl->commit(output, &pending)) {
wlr_buffer_unlock(back_buffer);
if (new_back_buffer) { if (new_back_buffer) {
wlr_buffer_unlock(pending.buffer); wlr_buffer_unlock(pending.buffer);
} }
@ -825,8 +822,8 @@ bool wlr_output_commit_state(struct wlr_output *output,
output->needs_frame = false; output->needs_frame = false;
} }
if (back_buffer != NULL) { if (pending.committed & WLR_OUTPUT_STATE_BUFFER) {
wlr_swapchain_set_buffer_submitted(output->swapchain, back_buffer); wlr_swapchain_set_buffer_submitted(output->swapchain, pending.buffer);
} }
struct wlr_output_event_commit event = { 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); wl_signal_emit_mutable(&output->events.commit, &event);
wlr_buffer_unlock(back_buffer);
if (new_back_buffer) { if (new_back_buffer) {
wlr_buffer_unlock(pending.buffer); wlr_buffer_unlock(pending.buffer);
} }

Loading…
Cancel
Save