Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Cube example fails on Ubuntu 20.10 with Nvidia graphics card enabled #673

Closed
rikvdkleij opened this issue Dec 12, 2020 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@rikvdkleij
Copy link

Directly after executing
cargo run --example cube
the program crashes with following trace:

cargo run --example cube                  

    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/examples/cube`
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

Using Intel(R) UHD Graphics 630 (CFL GT2) (Vulkan)
[0.133259 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
[0.133316 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
[0.133340 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
[0.133360 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
[0.133384 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
[0.134928 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
[0.134969 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
[0.134994 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
[0.135019 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
[0.135044 ERROR]()(no module): X11 error: XError {
    description: "BadDrawable (invalid Pixmap or Window parameter)",
    error_code: 9,
    request_code: 149,
    minor_code: 4,
}
thread 'main' panicked at 'Failed to focus input context: XError { description: "BadDrawable (invalid Pixmap or Window parameter)", error_code: 9, request_code: 149, minor_code: 4 }', /home/rik/.cargo/registry/src/garden.eu.org-1ecc6299db9ec823/winit-0.23.0/src/platform_impl/linux/x11/event_processor.rs:884:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`: Allocator dropped before all sets were deallocated', /home/rik/.cargo/git/checkouts/gpu-descriptor-a05b99db0270c787/df74fd8/gpu-descriptor/src/allocator.rs:117:9
stack backtrace:
   0:     0x55e955e0b020 - std::backtrace_rs::backtrace::libunwind::trace::h72c2fb8038f1bbee
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x55e955e0b020 - std::backtrace_rs::backtrace::trace_unsynchronized::h1e3b084883f1e78c
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x55e955e0b020 - std::sys_common::backtrace::_print_fmt::h3bf6a7ebf7f0394a
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:79
   3:     0x55e955e0b020 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2e8cb764b7fe02e7
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:58
   4:     0x55e955e2cd8c - core::fmt::write::h7a1184eaee6a8644
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/fmt/mod.rs:1080
   5:     0x55e955e07932 - std::io::Write::write_fmt::haeeb374d93a67eac
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/io/mod.rs:1516
   6:     0x55e955e0d42d - std::sys_common::backtrace::_print::h1d14a7f6ad632dc8
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:61
   7:     0x55e955e0d42d - std::sys_common::backtrace::print::h301abac8bb2e3e81
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:48
   8:     0x55e955e0d42d - std::panicking::default_hook::{{closure}}::hde0cb80358a6920a
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:208
   9:     0x55e955e0d0d8 - std::panicking::default_hook::h9b1a691049a0ec8f
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:227
  10:     0x55e955e0db11 - std::panicking::rust_panic_with_hook::h2bdec87b60580584
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:577
  11:     0x55e955e0d6b9 - std::panicking::begin_panic_handler::{{closure}}::h101ca09d9df5db47
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:484
  12:     0x55e955e0b48c - std::sys_common::backtrace::__rust_end_short_backtrace::h3bb85654c20113ca
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:153
  13:     0x55e955e0d679 - rust_begin_unwind
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
  14:     0x55e955e0d62b - std::panicking::begin_panic_fmt::hf0503558fbe5b251
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
  15:     0x55e95515311d - <gpu_descriptor::allocator::DescriptorBucket<P> as core::ops::drop::Drop>::drop::hd93501e92a21b65d
                               at /home/rik/.cargo/git/checkouts/gpu-descriptor-a05b99db0270c787/df74fd8/gpu-descriptor/src/allocator.rs:117
  16:     0x55e95513b106 - core::ptr::drop_in_place::hd10630277255a421
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  17:     0x55e955134076 - core::ptr::drop_in_place::h8fa5d06997de7394
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  18:     0x55e955109d0b - core::ptr::mut_ptr::<impl *mut T>::drop_in_place::h6f84cbb554f61fba
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:963
  19:     0x55e95526b98f - hashbrown::raw::inner::Bucket<T>::drop::h17276dc4931a1e33
                               at /home/rik/.cargo/registry/src/garden.eu.org-1ecc6299db9ec823/hashbrown-0.9.1/src/raw/mod.rs:334
  20:     0x55e9551512a6 - <hashbrown::raw::inner::RawTable<T> as core::ops::drop::Drop>::drop::h3ff04b58779d2c7d
                               at /home/rik/.cargo/registry/src/garden.eu.org-1ecc6299db9ec823/hashbrown-0.9.1/src/raw/mod.rs:1387
  21:     0x55e955126c6f - core::ptr::drop_in_place::h17bc7f73769adb26
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  22:     0x55e955137036 - core::ptr::drop_in_place::hab0ee94e99409b1a
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  23:     0x55e95512f12a - core::ptr::drop_in_place::h62eb629a64f264db
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  24:     0x55e95513c9bf - core::ptr::drop_in_place::hdfa9aab5bf60af95
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  25:     0x55e95513b5ff - core::ptr::drop_in_place::hd4ef9d532a928186
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  26:     0x55e95512c5d6 - core::ptr::drop_in_place::h496f4f950640dd13
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  27:     0x55e955131316 - core::ptr::drop_in_place::h71955abd2eed0974
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  28:     0x55e955128814 - core::ptr::drop_in_place::h2560ba6ccdd65237
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  29:     0x55e955130ee1 - core::ptr::drop_in_place::h704d243d8d5e0bc5
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  30:     0x55e955140c55 - <alloc::vec::Vec<T> as core::ops::drop::Drop>::drop::h1dc2e52d258ac344
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec.rs:2636
  31:     0x55e955128d26 - core::ptr::drop_in_place::h27e386d18395b90b
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  32:     0x55e95512e98f - core::ptr::drop_in_place::h5e0855bccf8a9fdc
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  33:     0x55e95513e03f - core::ptr::drop_in_place::hed0a925f31cc9dba
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  34:     0x55e95513c8c6 - core::ptr::drop_in_place::hdf90102f8718eaab
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  35:     0x55e9551358d1 - core::ptr::drop_in_place::h9d42256c7662901d
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  36:     0x55e95513886e - core::ptr::drop_in_place::hbaafee54b8adda3f
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  37:     0x55e955132726 - core::ptr::drop_in_place::h7cea781741307a6f
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  38:     0x55e9551341c5 - core::ptr::drop_in_place::h9057094486f4dfa0
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  39:     0x55e95512fc35 - core::ptr::drop_in_place::h66afcba8560b00f8
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  40:     0x55e95502db54 - alloc::sync::Arc<T>::drop_slow::he54f5b2ada70df54
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:934
  41:     0x55e955143316 - <alloc::sync::Arc<T> as core::ops::drop::Drop>::drop::hdd269b0ae6ea6a38
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1454
  42:     0x55e955137d5f - core::ptr::drop_in_place::hb4fb38d3e86c8748
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  43:     0x55e954c1f15f - core::ptr::drop_in_place::h921d89da3e511743
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  44:     0x55e954c1bd25 - core::ptr::drop_in_place::h05ba4f91a8f6e57d
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175
  45:     0x55e954c8ae79 - winit::platform_impl::platform::x11::EventLoop<T>::run_return::h0b9e5216a6f768aa
                               at /home/rik/.cargo/registry/src/garden.eu.org-1ecc6299db9ec823/winit-0.23.0/src/platform_impl/linux/x11/mod.rs:380
  46:     0x55e954c8c47b - winit::platform_impl::platform::x11::EventLoop<T>::run::h73d5b4eaba2e7e08
                               at /home/rik/.cargo/registry/src/garden.eu.org-1ecc6299db9ec823/winit-0.23.0/src/platform_impl/linux/x11/mod.rs:386
  47:     0x55e954c5797b - winit::platform_impl::platform::EventLoop<T>::run::h2fa0d1e53ac41061
                               at /home/rik/.cargo/registry/src/garden.eu.org-1ecc6299db9ec823/winit-0.23.0/src/platform_impl/linux/mod.rs:642
  48:     0x55e954c7e7d3 - winit::event_loop::EventLoop<T>::run::h14cdb7055ff5bc9c
                               at /home/rik/.cargo/registry/src/garden.eu.org-1ecc6299db9ec823/winit-0.23.0/src/event_loop.rs:154
  49:     0x55e954c7d9ce - cube::framework::start::h116f29a38fa2206f
                               at /home/rik/graphics/wgpu-rs/examples/cube/../framework.rs:247
  50:     0x55e954c7e74d - cube::framework::run::h57d47a69bc4e0e20
                               at /home/rik/graphics/wgpu-rs/examples/cube/../framework.rs:324
  51:     0x55e954c70665 - cube::main::h33a11770b02a6826
                               at /home/rik/graphics/wgpu-rs/examples/cube/main.rs:427
  52:     0x55e954c1ad4b - core::ops::function::FnOnce::call_once::h0273add32a71053d
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
  53:     0x55e954bf853e - std::sys_common::backtrace::__rust_begin_short_backtrace::hadd308882283dde8
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:137
  54:     0x55e954c61341 - std::rt::lang_start::{{closure}}::hcb02ec10ac68e672
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:66
  55:     0x55e955e0df37 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::he179d32a5d10d957
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/ops/function.rs:259
  56:     0x55e955e0df37 - std::panicking::try::do_call::hcb3d5e7be089b2b4
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:381
  57:     0x55e955e0df37 - std::panicking::try::h7ac93b0cd56fb701
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:345
  58:     0x55e955e0df37 - std::panic::catch_unwind::h7b40e396c93a4fcd
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panic.rs:382
  59:     0x55e955e0df37 - std::rt::lang_start_internal::h142b9cc66267fea1
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/rt.rs:51
  60:     0x55e954c61317 - std::rt::lang_start::h2dee52443416c13d
                               at /home/rik/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:65
  61:     0x55e954c7069a - main
  62:     0x7f8499427cb2 - __libc_start_main
  63:     0x55e954bf55fe - _start
  64:                0x0 - <unknown>
thread panicked while panicking. aborting.
[1]    15115 illegal hardware instruction (core dumped)  cargo run --example cube

I noticed that the trace contains:
Using Intel(R) UHD Graphics 630 (CFL GT2) (Vulkan)

while I would expect that the Nvidia driver would be used.

vkcube works.

nvidia-smi output:

nvidia-smi              

Sat Dec 12 16:51:13 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.38       Driver Version: 455.38       CUDA Version: 11.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 1060    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   60C    P0    29W /  N/A |    487MiB /  6078MiB |      2%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1813      G   /usr/lib/xorg/Xorg                295MiB |
|    0   N/A  N/A      1997      G   /usr/bin/gnome-shell               87MiB |
|    0   N/A  N/A      2273      G   ...AAAAAAAAA= --shared-files        2MiB |
|    0   N/A  N/A      3178      G   ...AAAAAAAA== --shared-files       98MiB |
+-----------------------------------------------------------------------------+

Reinstalled Nvidia graphics drivers (latest version(455)) and updated bios but didn't help.

The example works when I switch to the intel graphics card.

@kvark
Copy link
Member

kvark commented Dec 13, 2020

This is a problem with NV GPU + Intel on Linux, seen quite a lot. It affects all Vulkan applications, not just wgpu-rs.
See https://dev.getsol.us/T6335
There is a workaround - setting the VK_ICD_FILENAMES to point to the NVidia ICD, and that's what I've been using on one of the machines.
Handling this inside wgpu would be nice, but currently your stacktrace shows that it's Winit that panics, not us.

@kvark
Copy link
Member

kvark commented Dec 13, 2020

vkcube works.

Interesting, on my machine nothing worked for Intel. I guess your vkcube just happens to find the NVidia device and use it?

Could you try running our cube example with WGPU_POWER_PREF=high environment, just for a test?

@kvark kvark added the bug Something isn't working label Dec 13, 2020
@rikvdkleij
Copy link
Author

rikvdkleij commented Dec 13, 2020

@kvark Thanks for your reply!

Interesting, on my machine nothing worked for Intel. I guess your vkcube just happens to find the NVidia device and use it?

Could you try running our cube example with WGPU_POWER_PREF=high environment, just for a test?

vkcube still works when NV driver is disabled.

WGPU_POWER_PREF=high vkcube
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

nvidia-smi

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

@rikvdkleij
Copy link
Author

There is a workaround - setting the VK_ICD_FILENAMES to point to the NVidia ICD, and that's what I've been using on one of the machines.

Yes, that works! Thanks!

How to handle this issue further? Create an issue in Winit repo?

@kvark
Copy link
Member

kvark commented Dec 14, 2020

Please file an issue to winit about the panic.
Also, please try running Ash examples on your machine.

@rikvdkleij
Copy link
Author

@kvark FYI ash-rs/ash#345

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants