summaryrefslogtreecommitdiff
path: root/src/wayland/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wayland/buffer.c')
-rw-r--r--src/wayland/buffer.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wayland/buffer.c b/src/wayland/buffer.c
index 0d639e6..0b6b028 100644
--- a/src/wayland/buffer.c
+++ b/src/wayland/buffer.c
@@ -305,10 +305,11 @@ static void arm_frame(struct yasl_surface *w)
}
}
-static const int8_t free_buf_lut[3][8] = {
+static const int8_t free_buf_lut[4][8] = {
[0] = { 1, 1, 2, 2, 1, 1, 0, -1 },
[1] = { 0, 2, 0, 2, 0, 1, 0, -1 },
[2] = { 0, 1, 0, 2, 0, 1, 0, -1 },
+ [3] = { 0, 1, 0, 2, 0, 1, 0, -1 },
};
int buffer_pick_free_index(const struct buffer *bufs, int cur)
@@ -316,9 +317,7 @@ int buffer_pick_free_index(const struct buffer *bufs, int cur)
unsigned busy = ((unsigned)bufs[0].busy) |
(((unsigned)bufs[1].busy) << 1) |
(((unsigned)bufs[2].busy) << 2);
- unsigned c = (unsigned)cur;
- if (unlikely(c >= 3)) c = 0;
- return free_buf_lut[c][busy];
+ return free_buf_lut[(unsigned)cur & 3][busy];
}
struct latency_feedback {