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.
This commit is contained in:
Simon Ser 2022-09-18 16:26:42 +02:00 committed by Simon Zeni
parent 679d5ba699
commit 0213da60bb
1 changed files with 2 additions and 6 deletions

View File

@ -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);
}