-
Notifications
You must be signed in to change notification settings - Fork 943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set_inner_size called from inside the event loop causes issues on wayland #1571
Comments
Could you retest with latest winit? |
This appears to still be present on latest winit 49bcec1 |
Ok, it shouldn't block and seems like a bug in winit + Wayland backend for now. Using However it doesn't justify winit bug. |
Could you provide an example for me to repro it? |
Ok, I've see the issue, so maybe you don't need to provide an example for me. It seems like calling anything window frame related from the event_loop on Wayland could block, since run_return also holding a lock on a window frame. |
Unzip this: Place it somewhere, e.g. in
|
The issue is indeed here: https://github.com/gfx-rs/wgpu/blob/000bf85a20c00e88b847acf74701a325386edac0/player/src/main.rs#L540 I've tried mitigating this by scanning the action list, and popping the swapchain creation call, but there can technically be more than 1, and they're a stream, where the previous gpu state, iiuc, requires the previous dimensions, and points after require the newer dimensions, etc. So wasn't as straightforward as workaround as I thought |
I'll try to create some patch to fix it now. I'm not sure if it'll be the way to go, but I guess winit can just release the lock on a frame. |
e.g., here is what i added before the winit event loop: // because: https://github.com/rust-windowing/winit/issues/1571
while let Some(idx) = actions
.iter()
.position(|action| matches!(action, trace::Action::CreateSwapChain { .. }))
{
if let trace::Action::CreateSwapChain { id, desc } = actions.remove(idx) {
log::info!("Initializing the swapchain");
assert_eq!(id.to_surface_id(), surface);
window.set_inner_size(winit::dpi::PhysicalSize::new(desc.width, desc.height));
gfx_select!(device => global.device_create_swap_chain(device, surface, &desc));
}
} this will panic though, because there are two swapchain creations, one with 570, another with 600:
|
It seems like it's somehow getting the size with decorations, which it shouldn't get in any way. Just ensuring, are you testing against |
I'm on master afaik: diff --git a/player/Cargo.toml b/player/Cargo.toml
index cb16543..3cf5829 100644
--- a/player/Cargo.toml
+++ b/player/Cargo.toml
@@ -20,7 +20,7 @@ log = "0.4"
raw-window-handle = "0.3"
renderdoc = { version = "0.8", optional = true, default_features = false }
ron = "0.5"
-winit = { version = "0.22", optional = true }
+winit = { git = "https://github.com/rust-windowing/winit", version = "0.22", optional = true }
[dependencies.wgt]
path = "../wgpu-types" |
Can you try #1572 with |
yup confirmed, this fixes it! |
Trying to repro some wgpu-rs traces using wgpu player: https://github.com/gfx-rs/wgpu/blob/000bf85a20c00e88b847acf74701a325386edac0/player/src/main.rs#L540
Only on archlinux wayland, do I get what appears to be a deadlock of some kind? Specifically, an application icon becomes present, but no window is displayed; stopping in debugger reveals:
@kvark was wondering if the set inner size is allowed in the inner loop there, or what could be going wrong here on wayland?
Any suggestions would be great, thanks!
The text was updated successfully, but these errors were encountered: