Skip to content
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

Event loop freezes on Wayland #3551

Closed
GenericConfluent opened this issue Mar 2, 2024 · 8 comments
Closed

Event loop freezes on Wayland #3551

GenericConfluent opened this issue Mar 2, 2024 · 8 comments
Labels
A - needs repro waiting for a way to reproduce DS - wayland

Comments

@GenericConfluent
Copy link

I'm on Wayland (Hyprland and river) with NVIDIA (proprietary drivers) and running something similar to the following seems to freeze the cursor first leaves the window for the first time after the window opens (I was thinking its the CursorLeft event, but could be the RedrawRequest or something). I'm not super familiar with winit. Here is my sample:

use pollster::FutureExt as _;
use winit::{
    event::{Event, WindowEvent},
    event_loop::{ControlFlow, EventLoop},
    window::WindowBuilder,
};

fn main() {
    let event_loop = EventLoop::new().unwrap();
    let window = WindowBuilder::new().build(&event_loop).unwrap();

    // BEGIN WGPU setup
    let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::default());

    let surface = instance.create_surface(&window).unwrap();
    let adapter = instance
        .request_adapter(&wgpu::RequestAdapterOptions {
            compatible_surface: Some(&surface),
            ..Default::default()
        })
        .block_on()
        .unwrap();

    let (device, queue) = adapter
        .request_device(&wgpu::DeviceDescriptor::default(), None)
        .block_on()
        .unwrap();

    let surface_caps = surface.get_capabilities(&adapter);
    let size = window.inner_size();
    let config = wgpu::SurfaceConfiguration {
        usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
        format: surface_caps.formats[0],
        width: size.width,
        height: size.height,
        present_mode: surface_caps.present_modes[0],
        alpha_mode: surface_caps.alpha_modes[0],
        view_formats: vec![],
        desired_maximum_frame_latency: 2,
    };
    surface.configure(&device, &config);
    // END WGPU SETUP

    event_loop.set_control_flow(ControlFlow::Wait);
    let _ = event_loop.run(move |event, elwt| match event {
        Event::WindowEvent {
            event: WindowEvent::CloseRequested,
            ..
        } => elwt.exit(),
        Event::WindowEvent { window_id, event } => {
            dbg!(&window_id);
            dbg!(&event);
            if event == WindowEvent::RedrawRequested {
                let output = surface.get_current_texture().unwrap();
                let view = output
                    .texture
                    .create_view(&wgpu::TextureViewDescriptor::default());
                let mut encoder =
                    device.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
                {
                    let _ = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
                        color_attachments: &[Some(wgpu::RenderPassColorAttachment {
                            view: &view,
                            resolve_target: None,
                            ops: wgpu::Operations {
                                load: wgpu::LoadOp::Clear(wgpu::Color::RED),
                                store: wgpu::StoreOp::Store,
                            },
                        })],
                        ..Default::default()
                    });
                }
                queue.submit(std::iter::once(encoder.finish()));
                output.present();
            }
        }
        _ => (),
    });
}

I'm pretty sure this is a winit problem. I recently upgraded my NVIDIA drivers and the winit version on my project, so it could be the drivers, except all the other windowing on my system is working without issue. This issue is causing downstream stuff like iced to freeze (see iced-rs/iced#2297) and I think may also be the cause of an issue I'm having where bevy will panic when I switch my workspace on Hyprland (though that may be unrelated):

thread 'Compute Task Pool (4)' panicked at crates/bevy_render/src/view/window/mod.rs:324:26:
Error reconfiguring surface: Outdated
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::prepare_windows`!
thread 'Compute Task Pool (5)' panicked at crates/bevy_render/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError
thread '<unnamed>' panicked at /rustc/c475e2303b551d726307c646181e0677af1e0069/library/std/src/thread/local.rs:260:26:
cannot access a Thread Local Storage value during or after destruction: AccessError

Also just a note: I tried using ControlFlow::Poll and still had the same issue.

@kchibisov
Copy link
Member

Try 0.29.12 and ensure to use the latest wayland-client (cargo update basically everything).

@kchibisov kchibisov added DS - wayland A - needs repro waiting for a way to reproduce labels Mar 2, 2024
@GenericConfluent
Copy link
Author

I was experiencing the issue with 0.29.12. Then I ran cargo update and tried running again and had the same problem (wayland-client didn't update but winit went to 0.29.13). Here's what it looked like after the cargo update:

output.mp4

On the first one after the window loses focus I need to send an interrupt to close it, and on the second I never let it lose focus so closing it works just fine. Is there any information about my system that would help reproduce this? Here is some info on my card and drivers if that helps:

# lspci -v | grep VGA -A 10
01:00.0 VGA compatible controller: NVIDIA Corporation GA104 [GeForce RTX 3060 Ti Lite Hash Rate] (rev a1) (prog-if 00 [VGA controller])
	Subsystem: Micro-Star International Co., Ltd. [MSI] GA104 [GeForce RTX 3060 Ti Lite Hash Rate]
	Flags: bus master, fast devsel, latency 0, IRQ 40, IOMMU group 7
	Memory at fb000000 (32-bit, non-prefetchable) [size=16M]
	Memory at d0000000 (64-bit, prefetchable) [size=256M]
	Memory at e0000000 (64-bit, prefetchable) [size=32M]
	I/O ports at f000 [size=128]
	Expansion ROM at fc000000 [virtual] [disabled] [size=512K]
	Capabilities: <access denied>
	Kernel driver in use: nvidia
	Kernel modules: nouveau, nvidia_drm, nvidia

# pacman -Q | grep nvidia
lib32-nvidia-utils 550.54.14-1
libva-nvidia-driver-git 0.0.11.r1.gea6d862-1
nvidia-dkms 550.54.14-2
nvidia-settings 550.54.14-1
nvidia-utils 550.54.14-2
opencl-nvidia 550.54.14-2

@kchibisov
Copy link
Member

kchibisov commented Mar 2, 2024

Post WAYLAND_DEBUG=1, but it really looks like a bug in nvidia driver and it holds the queue?

Better probably a video with WAYLAND_DEBUG and remove winit events.

@kchibisov
Copy link
Member

Also, could you see where it's getting stuck? It feels like it's getting stuck inside the drawing actually? Use gdb for that, so it's not polling, but rather blocked on calling to nvidia driver, if that's the case, bring it to nvidia and it's not related to winit in any way.

@GenericConfluent
Copy link
Author

On Hyprland the window never opened, and a couple of seconds later Hyprland crashed ("Exiting due to channel error"), but I got:

[2565314.661]  -> [email protected]_registry(new id wl_registry@2)
[2565314.681]  -> [email protected](new id wl_callback@3)
[2565319.415] [email protected]_id(3)
[2565319.426] [email protected](1, "wl_shm", 1)
[2565319.470] [email protected](2, "wl_drm", 2)
[2565319.478] [email protected](3, "zwp_linux_dmabuf_v1", 4)
[2565319.485] [email protected](4, "wl_compositor", 6)
[2565319.491] [email protected](5, "wl_subcompositor", 1)
[2565319.497] [email protected](6, "wl_data_device_manager", 3)
[2565319.504] [email protected](7, "zwlr_export_dmabuf_manager_v1", 1)
[2565319.510] [email protected](8, "zwlr_data_control_manager_v1", 2)
[2565319.515] [email protected](9, "zwp_primary_selection_device_manager_v1", 1)
[2565319.522] [email protected](10, "wp_viewporter", 1)
[2565319.528] [email protected](11, "zwlr_gamma_control_manager_v1", 1)
[2565319.534] [email protected](12, "zwlr_output_power_manager_v1", 1)
[2565319.540] [email protected](13, "xdg_wm_base", 6)
[2565319.546] [email protected](14, "wl_seat", 9)
[2565319.552] [email protected](15, "wp_presentation", 1)
[2565319.558] [email protected](16, "ext_idle_notifier_v1", 1)
[2565319.564] [email protected](17, "zwlr_layer_shell_v1", 4)
[2565319.570] [email protected](18, "org_kde_kwin_server_decoration_manager", 1)
[2565319.577] [email protected](19, "zxdg_decoration_manager_v1", 1)
[2565319.585] [email protected](20, "zwlr_output_manager_v1", 4)
[2565319.591] [email protected](21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[2565319.597] [email protected](22, "zwp_pointer_constraints_v1", 1)
[2565319.603] [email protected](23, "zwp_relative_pointer_manager_v1", 1)
[2565319.609] [email protected](24, "zwp_virtual_keyboard_manager_v1", 1)
[2565319.615] [email protected](25, "zwlr_virtual_pointer_manager_v1", 2)
[2565319.621] [email protected](26, "zwlr_foreign_toplevel_manager_v1", 3)
[2565319.627] [email protected](27, "wp_drm_lease_device_v1", 1)
[2565319.633] [email protected](28, "zwp_tablet_manager_v2", 1)
[2565319.639] [email protected](29, "zwp_idle_inhibit_manager_v1", 1)
[2565319.645] [email protected](30, "zxdg_exporter_v1", 1)
[2565319.650] [email protected](31, "zxdg_importer_v1", 1)
[2565319.656] [email protected](32, "zxdg_exporter_v2", 1)
[2565319.662] [email protected](33, "zxdg_importer_v2", 1)
[2565319.668] [email protected](34, "zwp_pointer_gestures_v1", 3)
[2565319.674] [email protected](35, "zwp_text_input_manager_v3", 1)
[2565319.680] [email protected](36, "zwp_input_method_manager_v2", 1)
[2565319.686] [email protected](37, "xdg_activation_v1", 1)
[2565319.692] [email protected](38, "ext_session_lock_manager_v1", 1)
[2565319.698] [email protected](39, "wp_cursor_shape_manager_v1", 1)
[2565319.704] [email protected](40, "wp_tearing_control_manager_v1", 1)
[2565319.710] [email protected](41, "wp_single_pixel_buffer_manager_v1", 1)
[2565319.715] [email protected](42, "xwayland_shell_v1", 1)
[2565319.721] [email protected](43, "hyprland_toplevel_export_manager_v1", 2)
[2565319.727] [email protected](44, "wp_fractional_scale_manager_v1", 1)
[2565319.733] [email protected](45, "zwp_text_input_manager_v1", 1)
[2565319.739] [email protected](46, "hyprland_global_shortcuts_manager_v1", 1)
[2565319.745] [email protected](47, "zwlr_screencopy_manager_v1", 3)
[2565319.751] [email protected](48, "zxdg_output_manager_v1", 3)
[2565319.757] [email protected](49, "wl_output", 4)
[2565319.763] [email protected](20513)
[2565319.858]  -> [email protected](4, "wl_compositor", 6, new id [unknown]@3)
[2565319.879]  -> [email protected](5, "wl_subcompositor", 1, new id [unknown]@4)
[2565319.892]  -> [email protected](49, "wl_output", 4, new id [unknown]@5)
[2565319.929]  -> [email protected](48, "zxdg_output_manager_v1", 3, new id [unknown]@6)
[2565319.966]  -> [email protected]_xdg_output(new id zxdg_output_v1@7, wl_output@5)
[2565319.989]  -> [email protected](14, "wl_seat", 7, new id [unknown]@8)
[2565320.038]  -> [email protected](44, "wp_fractional_scale_manager_v1", 1, new id [unknown]@9)
[2565320.055]  -> [email protected](10, "wp_viewporter", 1, new id [unknown]@10)
[2565320.065]  -> [email protected](1, "wl_shm", 1, new id [unknown]@11)
[2565320.074]  -> [email protected](13, "xdg_wm_base", 6, new id [unknown]@12)
[2565320.082]  -> [email protected](19, "zxdg_decoration_manager_v1", 1, new id [unknown]@13)
[2565320.093]  -> [email protected](37, "xdg_activation_v1", 1, new id [unknown]@14)
[2565320.106]  -> [email protected](35, "zwp_text_input_manager_v3", 1, new id [unknown]@15)
[2565320.114]  -> [email protected](23, "zwp_relative_pointer_manager_v1", 1, new id [unknown]@16)
[2565320.126]  -> [email protected](22, "zwp_pointer_constraints_v1", 1, new id [unknown]@17)
[2565320.135]  -> [email protected](new id wl_callback@18)
[2565320.247] [email protected]_id(18)
[2565320.253] [email protected](0, 0, 600, 340, 0, "Microstep", "MSI G27C5", 0)
[2565320.265] [email protected](1, 1920, 1080, 60000)
[2565320.269] [email protected](1)
[2565320.272] [email protected]("DP-1")
[2565320.275] [email protected]("Microstep MSI G27C5 0x000018EB (DP-1)")
[2565320.281] [email protected]()
[2565320.284] [email protected]("DP-1")
[2565320.288] [email protected]("Microstep MSI G27C5 0x000018EB (DP-1)")
[2565320.291] [email protected]_position(0, 0)
[2565320.296] [email protected]_size(1920, 1080)
[2565320.300] [email protected]()
[2565320.303] [email protected]("seat0")
[2565320.307] [email protected](3)
[2565320.310] [email protected](0)
[2565320.314] [email protected](1)
[2565320.316] [email protected](875709016)
[2565320.319] [email protected](875708993)
[2565320.324] [email protected](875710274)
[2565320.327] [email protected](842094674)
[2565320.330] [email protected](842088786)
[2565320.332] [email protected](892426322)
[2565320.335] [email protected](892420434)
[2565320.338] [email protected](909199186)
[2565320.341] [email protected](1211384408)
[2565320.344] [email protected](1211384385)
[2565320.347] [email protected](942948952)
[2565320.350] [email protected](942948929)
[2565320.352] [email protected](20513)
[2565320.399]  -> [email protected]_keyboard(new id wl_keyboard@18)
[2565322.304]  -> [email protected]_text_input(new id zwp_text_input_v3@19, wl_seat@8)
[2565322.321]  -> [email protected]_surface(new id wl_surface@20)
[2565322.331]  -> [email protected]_pointer(new id wl_pointer@21)
[2565322.340]  -> [email protected](39, "wp_cursor_shape_manager_v1", 1, new id [unknown]@22)
[2565322.351]  -> [email protected]_pointer(new id wp_cursor_shape_device_v1@23, wl_pointer@21)
[2565322.363]  -> [email protected]_relative_pointer(new id zwp_relative_pointer_v1@24, wl_pointer@21)
[2565322.424]  -> [email protected]_surface(new id wl_surface@25)
[2565322.439]  -> [email protected]_xdg_surface(new id xdg_surface@26, wl_surface@25)
[2565322.447]  -> [email protected]_toplevel(new id xdg_toplevel@27)
[2565322.456]  -> [email protected]_toplevel_decoration(new id zxdg_toplevel_decoration_v1@28, xdg_toplevel@27)
[2565322.464]  -> [email protected]_mode(2)
[2565322.472]  -> [email protected]_viewport(new id wp_viewport@29, wl_surface@25)
[2565322.481]  -> [email protected]_fractional_scale(new id wp_fractional_scale_v1@30, wl_surface@25)
[2565322.496]  -> [email protected]_region(new id wl_region@31)
[2565322.504]  -> [email protected](0, 0, 2147483647, 2147483647)
[2565322.511]  -> [email protected]_opaque_region(wl_region@31)
[2565322.515]  -> [email protected]()
[2565322.525]  -> [email protected]_title("winit window")
[2565322.540]  -> [email protected]_min_size(2, 1)
[2565322.545]  -> [email protected]_max_size(0, 0)
[2565322.550]  -> [email protected]()
[2565322.562]  -> [email protected](new id wl_callback@32)
[2565322.708] [email protected]_id(31)
[2565322.715] [email protected]_id(32)
[2565322.718] [email protected](1, fd 9, 64756)
[2565322.726] [email protected]_info(25, 600)
[2565322.729] [email protected]_scale(120)
[2565322.733] [email protected](20514)
[2565322.738] [email protected]_capabilities(array[16])
[2565322.743] [email protected](960, 1050, array[0])
[2565322.747] [email protected](2)
[2565322.751] [email protected](20514)
[2565324.098]  -> [email protected]_configure(20514)
[2565324.114]  -> [email protected]_region(new id wl_region@32)
[2565324.123]  -> [email protected](0, 0, 2147483647, 2147483647)
[2565324.129]  -> [email protected]_opaque_region(wl_region@32)
[2565324.133]  -> [email protected]()
[2565324.141]  -> [email protected]_window_geometry(0, 0, 960, 1050)
[2565324.147]  -> [email protected]_destination(960, 1050)
[2565486.426]  -> [email protected]_registry(new id wl_registry@2)
[2565486.438]  -> [email protected](new id wl_callback@3)
[2565486.545] [email protected]_id(3)
[2565486.554] [email protected](1, "wl_shm", 1)
[2565486.559] [email protected](2, "wl_drm", 2)
[2565486.563]  -> [email protected](2, "wl_drm", 2, new id [unknown]@4)
[2565486.568] [email protected](3, "zwp_linux_dmabuf_v1", 4)
[2565486.573] [email protected](4, "wl_compositor", 6)
[2565486.578] [email protected](5, "wl_subcompositor", 1)
[2565486.583] [email protected](6, "wl_data_device_manager", 3)
[2565486.587] [email protected](7, "zwlr_export_dmabuf_manager_v1", 1)
[2565486.591] [email protected](8, "zwlr_data_control_manager_v1", 2)
[2565486.595] [email protected](9, "zwp_primary_selection_device_manager_v1", 1)
[2565486.599] [email protected](10, "wp_viewporter", 1)
[2565486.603] [email protected](11, "zwlr_gamma_control_manager_v1", 1)
[2565486.608] [email protected](12, "zwlr_output_power_manager_v1", 1)
[2565486.612] [email protected](13, "xdg_wm_base", 6)
[2565486.617] [email protected](14, "wl_seat", 9)
[2565486.620] [email protected](15, "wp_presentation", 1)
[2565486.624] [email protected](16, "ext_idle_notifier_v1", 1)
[2565486.628] [email protected](17, "zwlr_layer_shell_v1", 4)
[2565486.632] [email protected](18, "org_kde_kwin_server_decoration_manager", 1)
[2565486.636] [email protected](19, "zxdg_decoration_manager_v1", 1)
[2565486.641] [email protected](20, "zwlr_output_manager_v1", 4)
[2565486.645] [email protected](21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[2565486.649] [email protected](22, "zwp_pointer_constraints_v1", 1)
[2565486.653] [email protected](23, "zwp_relative_pointer_manager_v1", 1)
[2565486.657] [email protected](24, "zwp_virtual_keyboard_manager_v1", 1)
[2565486.661] [email protected](25, "zwlr_virtual_pointer_manager_v1", 2)
[2565486.665] [email protected](26, "zwlr_foreign_toplevel_manager_v1", 3)
[2565486.669] [email protected](27, "wp_drm_lease_device_v1", 1)
[2565486.673] [email protected](28, "zwp_tablet_manager_v2", 1)
[2565486.677] [email protected](29, "zwp_idle_inhibit_manager_v1", 1)
[2565486.681] [email protected](30, "zxdg_exporter_v1", 1)
[2565486.685] [email protected](31, "zxdg_importer_v1", 1)
[2565486.689] [email protected](32, "zxdg_exporter_v2", 1)
[2565486.693] [email protected](33, "zxdg_importer_v2", 1)
[2565486.697] [email protected](34, "zwp_pointer_gestures_v1", 3)
[2565486.700] [email protected](35, "zwp_text_input_manager_v3", 1)
[2565486.704] [email protected](36, "zwp_input_method_manager_v2", 1)
[2565486.708] [email protected](37, "xdg_activation_v1", 1)
[2565486.712] [email protected](38, "ext_session_lock_manager_v1", 1)
[2565486.716] [email protected](39, "wp_cursor_shape_manager_v1", 1)
[2565486.720] [email protected](40, "wp_tearing_control_manager_v1", 1)
[2565486.723] [email protected](41, "wp_single_pixel_buffer_manager_v1", 1)
[2565486.727] [email protected](42, "xwayland_shell_v1", 1)
[2565486.731] [email protected](43, "hyprland_toplevel_export_manager_v1", 2)
[2565486.735] [email protected](44, "wp_fractional_scale_manager_v1", 1)
[2565486.739] [email protected](45, "zwp_text_input_manager_v1", 1)
[2565486.741] [email protected](46, "hyprland_global_shortcuts_manager_v1", 1)
[2565486.744] [email protected](47, "zwlr_screencopy_manager_v1", 3)
[2565486.746] [email protected](48, "zxdg_output_manager_v1", 3)
[2565486.749] [email protected](49, "wl_output", 4)
[2565486.751] [email protected](20514)
[2565486.755]  -> [email protected](new id wl_callback@3)
[2565486.805] [email protected]_id(3)
[2565486.810] [email protected]("/dev/dri/renderD128")
[2565486.814] [email protected](1)
[2565486.817] [email protected](875708993)
[2565486.820] [email protected](875709016)
[2565486.823] [email protected](538982482)
[2565486.827] [email protected](943212370)
[2565486.830] [email protected](540422482)
[2565486.833] [email protected](842221394)
[2565486.836] [email protected](1498831189)
[2565486.839] [email protected](842093121)
[2565486.843] [email protected](842089025)
[2565486.846] [email protected](842088786)
[2565486.849] [email protected](842088770)
[2565486.852] [email protected](892424792)
[2565486.855] [email protected](892420696)
[2565486.859] [email protected](892426322)
[2565486.861] [email protected](892426306)
[2565486.865] [email protected](892424769)
[2565486.868] [email protected](892420673)
[2565486.872] [email protected](892420434)
[2565486.875] [email protected](892420418)
[2565486.879] [email protected](1211384385)
[2565486.882] [email protected](1211384408)
[2565486.886] [email protected](875713089)
[2565486.889] [email protected](875713345)
[2565486.891] [email protected](875713368)
[2565486.893] [email protected](875713112)
[2565486.895] [email protected](943867730)
[2565486.897] [email protected](909199186)
[2565486.899] [email protected](909199170)
[2565486.901] [email protected](875710290)
[2565486.903] [email protected](875710274)
[2565486.905] [email protected](808669761)
[2565486.907] [email protected](875714642)
[2565486.909] [email protected](875714626)
[2565486.912] [email protected](875708754)
[2565486.914] [email protected](875708738)
[2565486.915] [email protected](808669784)
[2565486.917] [email protected](808665688)
[2565486.919] [email protected](808671314)
[2565486.921] [email protected](808671298)
[2565486.923] [email protected](808665426)
[2565486.926] [email protected](808665410)
[2565486.929] [email protected](825241938)
[2565486.931] [email protected](808464722)
[2565486.933] [email protected](808665665)
[2565486.935] [email protected](825241922)
[2565486.937] [email protected](808464706)
[2565486.939] [email protected](842093913)
[2565486.941] [email protected](842094158)
[2565486.943] [email protected](825382478)
[2565486.945] [email protected](909203022)
[2565486.947] [email protected](875714126)
[2565486.949] [email protected](808530000)
[2565486.951] [email protected](808530512)
[2565486.953] [email protected](842084432)
[2565486.955] [email protected](825246792)
[2565486.957] [email protected](809781333)
[2565486.959] [email protected](20514)
[2565487.623]  -> [email protected]_registry(new id wl_registry@3)
[2565487.630]  -> [email protected](new id wl_callback@5)
[2565487.701] [email protected]_id(5)
[2565487.705] [email protected](1, "wl_shm", 1)
[2565487.708] [email protected](2, "wl_drm", 2)
[2565487.711] [email protected](3, "zwp_linux_dmabuf_v1", 4)
[2565487.715]  -> [email protected](3, "zwp_linux_dmabuf_v1", 4, new id [unknown]@6)
[2565487.719] [email protected](4, "wl_compositor", 6)
[2565487.723] [email protected](5, "wl_subcompositor", 1)
[2565487.727] [email protected](6, "wl_data_device_manager", 3)
[2565487.730] [email protected](7, "zwlr_export_dmabuf_manager_v1", 1)
[2565487.734] [email protected](8, "zwlr_data_control_manager_v1", 2)
[2565487.737] [email protected](9, "zwp_primary_selection_device_manager_v1", 1)
[2565487.741] [email protected](10, "wp_viewporter", 1)
[2565487.745] [email protected](11, "zwlr_gamma_control_manager_v1", 1)
[2565487.749] [email protected](12, "zwlr_output_power_manager_v1", 1)
[2565487.753] [email protected](13, "xdg_wm_base", 6)
[2565487.757] [email protected](14, "wl_seat", 9)
[2565487.760] [email protected](15, "wp_presentation", 1)
[2565487.764]  -> [email protected](15, "wp_presentation", 1, new id [unknown]@7)
[2565487.768] [email protected](16, "ext_idle_notifier_v1", 1)
[2565487.772] [email protected](17, "zwlr_layer_shell_v1", 4)
[2565487.775] [email protected](18, "org_kde_kwin_server_decoration_manager", 1)
[2565487.779] [email protected](19, "zxdg_decoration_manager_v1", 1)
[2565487.782] [email protected](20, "zwlr_output_manager_v1", 4)
[2565487.786] [email protected](21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[2565487.790] [email protected](22, "zwp_pointer_constraints_v1", 1)
[2565487.794] [email protected](23, "zwp_relative_pointer_manager_v1", 1)
[2565487.798] [email protected](24, "zwp_virtual_keyboard_manager_v1", 1)
[2565487.802] [email protected](25, "zwlr_virtual_pointer_manager_v1", 2)
[2565487.806] [email protected](26, "zwlr_foreign_toplevel_manager_v1", 3)
[2565487.811] [email protected](27, "wp_drm_lease_device_v1", 1)
[2565487.816] [email protected](28, "zwp_tablet_manager_v2", 1)
[2565487.820] [email protected](29, "zwp_idle_inhibit_manager_v1", 1)
[2565487.823] [email protected](30, "zxdg_exporter_v1", 1)
[2565487.826] [email protected](31, "zxdg_importer_v1", 1)
[2565487.830] [email protected](32, "zxdg_exporter_v2", 1)
[2565487.834] [email protected](33, "zxdg_importer_v2", 1)
[2565487.837] [email protected](34, "zwp_pointer_gestures_v1", 3)
[2565487.840] [email protected](35, "zwp_text_input_manager_v3", 1)
[2565487.844] [email protected](36, "zwp_input_method_manager_v2", 1)
[2565487.849] [email protected](37, "xdg_activation_v1", 1)
[2565487.852] [email protected](38, "ext_session_lock_manager_v1", 1)
[2565487.856] [email protected](39, "wp_cursor_shape_manager_v1", 1)
[2565487.859] [email protected](40, "wp_tearing_control_manager_v1", 1)
[2565487.863] [email protected](41, "wp_single_pixel_buffer_manager_v1", 1)
[2565487.867] [email protected](42, "xwayland_shell_v1", 1)
[2565487.871] [email protected](43, "hyprland_toplevel_export_manager_v1", 2)
[2565487.874] [email protected](44, "wp_fractional_scale_manager_v1", 1)
[2565487.877] [email protected](45, "zwp_text_input_manager_v1", 1)
[2565487.881] [email protected](46, "hyprland_global_shortcuts_manager_v1", 1)
[2565487.885] [email protected](47, "zwlr_screencopy_manager_v1", 3)
[2565487.888] [email protected](48, "zxdg_output_manager_v1", 3)
[2565487.892] [email protected](49, "wl_output", 4)
[2565487.896] [email protected](20514)
[2565487.901]  -> [email protected]_default_feedback(new id zwp_linux_dmabuf_feedback_v1@5)
[2565487.906]  -> [email protected](new id wl_callback@8)
[2565487.944] [email protected]_id(8)
[2565487.947] [email protected]_device(array[8])
[2565487.950] [email protected]_table(fd 26, 12544)
[2565487.970] [email protected]_target_device(array[8])
[2565487.973] [email protected]_flags(0)
[2565487.978] [email protected]_formats(array[1568])
[2565488.030] [email protected]_done()
[2565488.033] [email protected]()
[2565488.036] [email protected](20514)
[2565492.888]  -> [email protected]_registry(new id wl_registry@31)
[2565492.897]  -> [email protected](new id wl_callback@33)

so then I tried running it on river, which didn't crash and allowed me to replicate the issue properly. The output is here. One interesting (or maybe trivially unimportant) difference between the river and Hyprland runs was that on river the clear colour didn't fill the entire window.

@GenericConfluent
Copy link
Author

Also, could you see where it's getting stuck? It feels like it's getting stuck inside the drawing actually? Use gdb for that, so it's not polling, but rather blocked on calling to nvidia driver, if that's the case, bring it to nvidia and it's not related to winit in any way.

I'll give it a good run-through in the debugger and try to see where the freeze happens.

@GenericConfluent
Copy link
Author

GenericConfluent commented Mar 2, 2024

I pulled in the master branch and rewrote the sample with the necessary updates for debugging. I went to run it and... everything worked. Went back to the crates.io version and it crashed again. I'm not sure why it works but it does, regardless this doesn't need a fix.

@hannesojala
Copy link

hannesojala commented Mar 20, 2024

I'm on the same setup as you (prop. NVIDIA and Hyprland) and still having the same issue using winit = { git = "https://github.com/rust-windowing/winit.git", branch = "master" } in a wgpu app.

Pausing in the debugger yields this call stack, which lines up with what @kchibisov says. (Probably not a winit issue)

__poll (@__poll:23)
___lldb_unnamed_symbol36075 (@___lldb_unnamed_symbol36075:42)
___lldb_unnamed_symbol44333 (@___lldb_unnamed_symbol44333:22)
___lldb_unnamed_symbol44144 (@___lldb_unnamed_symbol44144:158)
___lldb_unnamed_symbol42740 (@___lldb_unnamed_symbol42740:10)
DispatchWaitForFences(VkDevice_T*, unsigned int, VkFence_T* const*, unsigned int, unsigned long) (@DispatchWaitForFences(VkDevice_T*, unsigned int, VkFence_T* const*, unsigned int, unsigned long):78)
vulkan_layer_chassis::WaitForFences(VkDevice_T*, unsigned int, VkFence_T* const*, unsigned int, unsigned long) (@vulkan_layer_chassis::WaitForFences(VkDevice_T*, unsigned int, VkFence_T* const*, unsigned int, unsigned long):180)
ash::device::Device::wait_for_fences
wgpu_hal::vulkan::instance::<impl wgpu_hal::Surface<wgpu_hal::vulkan::Api> for wgpu_hal::vulkan::Surface>::acquire_texture
wgpu_core::present::<impl wgpu_core::global::Global<G>>::surface_get_current_texture
<wgpu::backend::wgpu_core::ContextWgpuCore as wgpu::context::Context>::surface_get_current_texture
<T as wgpu::context::DynContext>::surface_get_current_texture
wgpu::Surface::get_current_texture
...

@GenericConfluent Can you think of anything else other than updating winit that changed for you? I'm not having any luck with updating.

EDIT: It seems like my problem was related to gfx-rs/wgpu#4775. Using the latest commit of wgpu did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A - needs repro waiting for a way to reproduce DS - wayland
Development

No branches or pull requests

3 participants