aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-10-07 14:15:27 +0200
committerKenny Levinsen <kl@kl.wtf>2022-10-07 19:21:20 +0000
commit7d8284ec1095057b8cd3e14f38982f14cb1f99c4 (patch)
treeeec6b664ede8632706c2745adab40e8fbddb751d
parent7eedbde878d4022efd54868bdaef309cc2aa2fe6 (diff)
output/render: early return in output_ensure_buffer()
Slightly simplify the logic here.
-rw-r--r--types/output/render.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/types/output/render.c b/types/output/render.c
index 0228c0cd..9e0b77c3 100644
--- a/types/output/render.c
+++ b/types/output/render.c
@@ -186,6 +186,11 @@ bool output_ensure_buffer(struct wlr_output *output,
bool *new_back_buffer) {
assert(*new_back_buffer == false);
+ // If we already have a buffer, we don't need to allocate a new one
+ if (state->committed & WLR_OUTPUT_STATE_BUFFER) {
+ return true;
+ }
+
// If we're lighting up an output or changing its mode, make sure to
// provide a new buffer
bool needs_new_buffer = false;
@@ -198,7 +203,7 @@ bool output_ensure_buffer(struct wlr_output *output,
if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
needs_new_buffer = true;
}
- if (!needs_new_buffer || (state->committed & WLR_OUTPUT_STATE_BUFFER)) {
+ if (!needs_new_buffer) {
return true;
}