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

Panics in submit when running under X11 #139

Open
ConradIrwin opened this issue Jul 12, 2024 · 7 comments
Open

Panics in submit when running under X11 #139

ConradIrwin opened this issue Jul 12, 2024 · 7 comments

Comments

@ConradIrwin
Copy link
Contributor

After the zed launch, we're seeing a number of crashes in ::submit:

  • Aquire image error ERROR_SURFACE_LOST_KHR
  • GPU has crashed, and no debug information is available.

It seems like these are exclusive (or at least very much more common) on Zed's X11 implementation vs the Wayland one, so I wonder if we've messed something up on our side.

I haven't seen this locally, but it happens across a wide range of linux distributions in the wild.

Do you have an idea for what I should look for to try and debug this?

@ConradIrwin
Copy link
Contributor Author

See for example zed-industries/zed#14225.

I wonder if it's specific to the combination of KDE + X11. Will try that tomorrow

@kvark
Copy link
Owner

kvark commented Jul 16, 2024

That linked Zed issue sounds a lot like the Intel + Nvidia systems issue we've been looking at for a while, e.g. #88
It's a platform issue, and we have a workaround that basically make us not use the Intel GPU in this case.
Users can confirm if it's a platform issue by running vkcube --gpu_number X to force Intel and seeing it failing as well.

We need to figure out the scope of affected systems and extend the workaround. Right now it's based on PRIME config -

//Note: this is somewhat broad across X11/Wayland and different drivers.
// It could be narrower, but at the end of the day if the user forced Prime
// for GLX it should be safe to assume they want it for Vulkan as well.
intel_unable_to_present: is_nvidia_prime_forced() && vendor_id == db::intel::VENDOR,

@kvark
Copy link
Owner

kvark commented Jul 18, 2024

I wrote a general fix for this in #144. It's unfortunately verbose, but it should be 100% correct unlike the current heuristics.

I'd really like a strong signal from people having Intel+Nvidia configuration before merging. This includes both those affected and not. Here is what we'd need:

  1. check out Blade Try to actually acquire a frame on Intel/Linux upon adapter inspection #144
  2. run RUST_LOG=blade_graphics=info cargo run --example bunnymark and share the output
  3. of course vulkaninfo output if they haven't provided it elsewhere

@lemtea8 would you be able to try this out?
cc @flukejones for ideas

@lemtea8
Copy link

lemtea8 commented Jul 18, 2024

@kvark Sadly the pr is still not working for my machine.
What I got from RUST_LOG=blade_graphics=info cargo run --example bunnymark:

➜  blade git:(90c6da2) RUST_LOG=blade_graphics=info RUST_BACKTRACE=1 cargo run --example bunnymark
warning: `/home/user/Download/blade/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/examples/bunnymark`
[2024-07-18T06:15:11Z WARN  blade_graphics::hal::init] Requested layer is not found: "VK_LAYER_KHRONOS_validation"
[2024-07-18T06:15:11Z WARN  blade_graphics::hal::init] Requested layer is not found: "VK_LAYER_MESA_overlay"
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::init] Enabling Vulkan Portability
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::init] Enabling color space support
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::init] Testing presentation capability on Linux/Intel
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::init] Adapter "Intel(R) UHD Graphics 630 (CFL GT2)"
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::init] No ray tracing extensions are supported
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::init] Using surface present mode MAILBOX
[2024-07-18T06:15:11Z WARN  blade_graphics::hal::init] Unable to forbid exclusive full screen
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::resource] Creating texture 0x560a7f9ccb80 of size 1x1x1 and format Rgba8Unorm, name 'texutre', handle 0
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::resource] Creating buffer 0x560a7f882c70 of size 4, name 'staging', handle 1
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::resource] Creating buffer 0x560a7f9cca20 of size 32, name 'vertex', handle 2
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::descriptor] Creating a descriptor pool for at most 16 sets
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::descriptor] Creating a descriptor pool for at most 16 sets
[2024-07-18T06:15:11Z INFO  blade_graphics::hal::resource] Destroying buffer 0x560a7f882c70, handle 1
thread 'main' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/event_processor.rs:1319:18:
Failed to focus input context: XError { description: "BadMatch (invalid parameter attributes)", error_code: 8, request_code: 149, minor_code: 4 }
stack backtrace:
   0: rust_begin_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
   1: core::panicking::panic_fmt
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1654:5
   3: core::result::Result<T,E>::expect
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1034:23
   4: winit::platform_impl::platform::x11::event_processor::EventProcessor<T>::xinput2_focused
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/event_processor.rs:1317:13
   5: winit::platform_impl::platform::x11::event_processor::EventProcessor<T>::process_xevent
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/event_processor.rs:239:25
   6: winit::platform_impl::platform::x11::event_processor::EventProcessor<T>::process_event
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/event_processor.rs:80:9
   7: winit::platform_impl::platform::x11::EventLoop<T>::drain_events
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:626:13
   8: winit::platform_impl::platform::x11::EventLoop<T>::single_iteration
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:557:9
   9: winit::platform_impl::platform::x11::EventLoop<T>::pump_events
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:441:13
  10: winit::platform_impl::platform::x11::EventLoop<T>::run_on_demand
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:408:19
  11: winit::platform_impl::platform::EventLoop<T>::run_on_demand
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:829:56
  12: winit::platform_impl::platform::EventLoop<T>::run
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:822:9
  13: winit::event_loop::EventLoop<T>::run
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/event_loop.rs:249:9
  14: bunnymark::main
             at ./examples/bunnymark/main.rs:368:5
  15: core::ops::function::FnOnce::call_once
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


And the full output of vulkaninfo, if needed:
vulkaninfo.txt

@kvark
Copy link
Owner

kvark commented Jul 19, 2024

Thank you for testing, @lemtea8 ! The call stack of this failure is purely inside winit and doesn't have any of the Vulkan code, so it's possible you are seeing something else here.

@lemtea8
Copy link

lemtea8 commented Jul 19, 2024

It's interesting that I can run the examples in winit with the same version (0.29.15), but somehow blade fails...

image

@kvark
Copy link
Owner

kvark commented Jul 20, 2024

Bunnymark example is trying to init a transparent window, maybe that's the main difference. But it's irrelevant to the original issue at hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants