From a73c0c4cfc0caa50451a05a4529432208ae33d09 Mon Sep 17 00:00:00 2001 From: Wanjohi Date: Thu, 15 Oct 2026 10:28:44 +0300 Subject: [PATCH] fix(nescope): answer every commit, not only a mapped window's A Vulkan client presenting FIFO waits in the driver for its frame callback. Chromium's GPU process draws for a window another process owns, which Wine's Wayland driver gives a surface with no role, so no window here matched it and the game presented one frame and waited forever: Sheepy's black screen. Nothing here paces against a display, so every commit now gets its frame callbacks and feedback. --- apps/nescope/src/handlers.rs | 27 ++++++++++++++++----------- apps/nescope/src/state.rs | 5 +++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/apps/nescope/src/handlers.rs b/apps/nescope/src/handlers.rs index 7d4cdcf6..075ec57f 100644 --- a/apps/nescope/src/handlers.rs +++ b/apps/nescope/src/handlers.rs @@ -101,21 +101,26 @@ impl CompositorHandler for NescopeState { }; // Matched on the window's surface, not its xdg toplevel: an Xwayland - // window has no toplevel, and matching on one left every Proton game - // without frame callbacks. Xwayland then completes a flip only on its - // one-second fallback timer, and a game presenting FIFO stalls. - let Some(window) = self + // window has no toplevel. + let window = self .space .elements() .find(|w| w.wl_surface().is_some_and(|s| *s == root)) - .cloned() - else { - return; - }; + .cloned(); + if let Some(window) = &window { + window.on_commit(); + self.game_frame_count += 1; + } - window.on_commit(); - self.game_frame_count += 1; - self.present_now(&root, &window); + // Every commit is answered, mapped window or not. A Vulkan client + // presenting FIFO waits in the driver for this frame callback, and + // not every surface a game draws to is a window here: Chromium's GPU + // process draws for a window another process owns, which Wine's + // Wayland driver gives a surface of its own with no role. Unanswered, + // that game presents one frame and waits forever. There is no screen + // here to pace against -- capture paces itself -- so answering every + // commit costs nothing a mapped window does not already get. + self.present_now(&root); } fn destroyed(&mut self, surface: &WlSurface) { diff --git a/apps/nescope/src/state.rs b/apps/nescope/src/state.rs index b3d13fb6..b682ae66 100644 --- a/apps/nescope/src/state.rs +++ b/apps/nescope/src/state.rs @@ -735,13 +735,14 @@ impl NescopeState { } } - pub(crate) fn present_now(&mut self, root: &WlSurface, window: &Window) { + pub(crate) fn present_now(&mut self, root: &WlSurface) { let output = self.output.clone(); let now = self.clock.now(); self.presentation_seq += 1; let mut fb = OutputPresentationFeedback::new(&output); - window.take_presentation_feedback( + take_presentation_feedback_surface_tree( + root, &mut fb, |_, _| Some(output.clone()), |_, _| wp_presentation_feedback::Kind::Vsync,