aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-09-18 16:26:42 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2022-09-19 10:46:26 +0000
commit0213da60bbc7b534c0f37965a3984b11cf8e1cd1 (patch)
treefe389c30e3d91d1679fc98263c2a58d2058c1879
parent679d5ba699597104c885fbe706d1988da70cb073 (diff)
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.
-rw-r--r--types/output/output.c8
1 files 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);
}