From d26ae5b895c642c1c4dd373b7a0c1cfe302fbedd Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 9 Jan 2024 03:28:08 -0800 Subject: [PATCH] wayland: Fix buffer age We need to reset the age of the *new* front buffer to 1, not the old one. It turns out they're easy to mix up right when you're about to swap them. --- src/wayland/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wayland/mod.rs b/src/wayland/mod.rs index 762202d..8984872 100644 --- a/src/wayland/mod.rs +++ b/src/wayland/mod.rs @@ -186,14 +186,14 @@ impl WaylandImpl { .dispatch_pending(&mut State); if let Some((front, back)) = &mut self.buffers { + // Swap front and back buffer + std::mem::swap(front, back); + front.age = 1; if back.age != 0 { back.age += 1; } - // Swap front and back buffer - std::mem::swap(front, back); - front.attach(self.surface.as_ref().unwrap()); // Like Mesa's EGL/WSI implementation, we damage the whole buffer with `i32::MAX` if