mirror of
https://github.com/nestriness/nestri.git
synced 2026-11-19 05:29:49 +02:00
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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user