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

Immediate crash on Winit wayland backend and wgpu Vulkan renderer #1618

Open
2 tasks done
Jaakkonen opened this issue Dec 23, 2022 · 18 comments
Open
2 tasks done

Immediate crash on Winit wayland backend and wgpu Vulkan renderer #1618

Jaakkonen opened this issue Dec 23, 2022 · 18 comments
Labels
bug Something isn't working

Comments

@Jaakkonen
Copy link

Jaakkonen commented Dec 23, 2022

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

All Iced programs (in the panic sample the game of life example) immediately crash when having vulkan & wayland backends chosen.

Environment:
Sway 1.7
Intel alder lake graphics with Mesa 22.3.1

What is the expected behavior?

The application doesn't crash or errors that vulkan & wayland is an unsupported combination (-> Use x11 & vulkan for actually working experience or wayland & gl for experience where most things excluding images work)

Version

master

Operative System

Linux

Do you have any log output?

RUST_BACKTRACE=1 WINIT_UNIX_BACKEND=wayland WGPU_BACKEND=vulkan cargo run --features iced/wgpu --package game_of_life
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/game_of_life`
thread 'main' panicked at 'Error in Surface::configure: parent device is lost', /home/jaakko/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.14.2/src/backend/direct.rs:274:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/b569c9dc57ee22b6ff94563af856909763dfa24b/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/b569c9dc57ee22b6ff94563af856909763dfa24b/library/core/src/panicking.rs:64:14
   2: wgpu::backend::direct::Context::handle_error_fatal
             at /home/jaakko/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.14.2/src/backend/direct.rs:274:9
   3: <wgpu::backend::direct::Context as wgpu::Context>::surface_configure
             at /home/jaakko/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.14.2/src/backend/direct.rs:1017:13
   4: wgpu::Surface::configure
             at /home/jaakko/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.14.2/src/lib.rs:3715:9
   5: <iced_wgpu::window::compositor::Compositor<Theme> as iced_graphics::window::compositor::Compositor>::configure_surface
             at ./wgpu/src/window/compositor.rs:157:9
   6: iced_winit::application::run_instance::{{closure}}
             at ./winit/src/application.rs:258:5
   7: iced_winit::application::run::{{closure}}
             at ./winit/src/application.rs:218:24
   8: winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run_return
             at /home/jaakko/.local/share/cargo/git/checkouts/winit-57d3141eaf559308/9404575/src/platform_impl/linux/wayland/event_loop/mod.rs:233:9
   9: winit::platform_impl::platform::EventLoop<T>::run_return
             at /home/jaakko/.local/share/cargo/git/checkouts/winit-57d3141eaf559308/9404575/src/platform_impl/linux/mod.rs:748:56
  10: <winit::event_loop::EventLoop<T> as winit::platform::run_return::EventLoopExtRunReturn>::run_return
             at /home/jaakko/.local/share/cargo/git/checkouts/winit-57d3141eaf559308/9404575/src/platform/run_return.rs:62:9
  11: iced_winit::application::platform::run
             at ./winit/src/application.rs:749:17
  12: iced_winit::application::run
             at ./winit/src/application.rs:193:5
  13: iced::application::Application::run
             at ./src/application.rs:216:12
  14: game_of_life::main
             at ./examples/game_of_life/src/main.rs:23:5
  15: core::ops::function::FnOnce::call_once
             at /rustc/b569c9dc57ee22b6ff94563af856909763dfa24b/library/core/src/ops/function.rs:507:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@Jaakkonen Jaakkonen added the bug Something isn't working label Dec 23, 2022
@KentaTheBugMaker
Copy link

no problem on kabylake GT2 with mesa 22.3.1 kernel 5.15 + sway-im-git 1.9

@KentaTheBugMaker
Copy link

if you can run with LIBGL_ALWAYS_SOFTWARE=1. there is problem in sway or mesa .

@kaimast
Copy link

kaimast commented Jan 12, 2023

I had this problem for a few months on my GNOME desktop. I assumed it was related to my hybrid graphics card setup (Intel+Nvidia), but you only seem to have one card and the same problem.

@ids1024
Copy link
Contributor

ids1024 commented Jan 12, 2023

There seem to be a few issues reported on winit with the error message: https://github.com/gfx-rs/wgpu/issues?q=is%3Aissue+parent+device+is+lost+is%3Aopen

Likely using the Iced glow feature (to use OpenGL instead of wgpu) will work. It may be worth testing if wgpus own examples have the same issue, and reporting there with any relevant details.

Presumably it's a driver or wgpu issue rather than something in iced. (Though if other things using wgpu seem to work reliably, that assumption may be wrong.)

@AAlieZZ
Copy link

AAlieZZ commented Jun 2, 2023

same problem on KDE Plasma Arch Linux

@kaimast
Copy link

kaimast commented Jun 3, 2023

same problem on KDE Plasma Arch Linux

What GPU(s) do you have?

@AAlieZZ
Copy link

AAlieZZ commented Jun 5, 2023

same problem on KDE Plasma Arch Linux

What GPU(s) do you have?

NVIDIA GeForce RTX 3060 Laptop GPU

@genusistimelord
Copy link

this sounds like either the screen format is wrong or not supported, its attempting to use wgpu Opengl and missing features, a bad driver for the nvidia, or its using the processors built in GPU over the dedicated GPU.

@kaimast
Copy link

kaimast commented Jun 5, 2023

same problem on KDE Plasma Arch Linux

What GPU(s) do you have?

NVIDIA GeForce RTX 3060 Laptop GPU

Do you also have an integrated GPU? If so, you might be encountering this bug gfx-rs/wgpu#2519.

My current "workaround" is to use the integrated GPU.

@probablySophie
Copy link

My current "workaround" is to use the integrated GPU.

Sorry to dredge up an old thread, but how do you use the integrated GPU? Is there a RUSTFLAGS or compile target?

@kaimast
Copy link

kaimast commented Jul 3, 2023

When you set up your wgpu adapter you can set the power preference to "low" which should pick the integrated GPU.

You can also make your application check for the WGPU_POWER_PREF environment variable if you initialize your adapter like here: https://github.com/gfx-rs/wgpu/blob/trunk/wgpu/src/util/init.rs#L71

@AmmarAbouZor
Copy link

Setting the following environment variable made it work for my machine (Sway on Hybrid laptop with Intel + NVIDIA GPU.

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json. For using Intel graphics
Or VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.x86_64.json. for Nvidia

I got to this workaround from #1185

I think the problem is in trying to figure out which file to use on hybrid systems with sway

@Dunckleosteus
Copy link

Same problem here, running anything on my Nvidia GPU. It seem to run on the integrated GPU.
Here is the error message:
thread 'main' panicked at 'Failed to call XMapRaised: XError { description: "BadMatch (invalid parameter attributes)", error_code: 8, request_code: 149, minor_code: 4 }', /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/window.rs:983:18
stack backtrace:
0: rust_begin_unwind
at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
1: core::panicking::panic_fmt
at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
2: core::result::unwrap_failed
at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1750:5
3: core::result::Result<T,E>::expect
at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1047:23
4: winit::platform_impl::platform::x11::window::UnownedWindow::set_visible
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/window.rs:981:13
5: winit::platform_impl::platform::Window::set_visible
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/mod.rs:343:50
6: winit::window::Window::set_visible
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/window.rs:631:9
7: iced_winit::application::run_instance::{{closure}}
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_winit-0.9.1/src/application.rs:309:9
8: iced_winit::application::run::{{closure}}
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_winit-0.9.1/src/application.rs:251:24
9: winit::platform_impl::platform::sticky_exit_callback
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/mod.rs:849:9
10: winit::platform_impl::platform::x11::EventLoop::run_return::single_iteration
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:329:13
11: winit::platform_impl::platform::x11::EventLoop::run_return
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:448:31
12: winit::platform_impl::platform::EventLoop::run_return
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/mod.rs:748:56
13: <winit::event_loop::EventLoop as winit::platform::run_return::EventLoopExtRunReturn>::run_return
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform/run_return.rs:62:9
14: iced_winit::application::platform::run
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_winit-0.9.1/src/application.rs:870:17
15: iced_winit::application::run
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_winit-0.9.1/src/application.rs:226:5
16: iced::application::Application::run
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/iced-0.9.0/src/application.rs:209:12
17: iced::sandbox::Sandbox::run
at /home/throgg/.cargo/registry/src/github.com-1ecc6299db9ec823/iced-0.9.0/src/sandbox.rs:153:9
18: yew::main
at /home/throgg/Documents/Code/Rust/yew/src/main.rs:5:5
19: core::ops::function::FnOnce::call_once
at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

And here is my system information (in case it can help solve the problem in the future):

OS: Pop!_OS 22.04 LTS x86_64
Host: TUXEDO Stellaris/Polaris AMD Gen4 Standard
Kernel: 6.2.6-76060206-generic
Uptime: 1 hour, 39 mins
Resolution: 1920x1080
DE: Unity
WM: Mutter
WM Theme: Adwaita
CPU: AMD Ryzen 7 6800H with Radeon Graphics (16) @ 3.200GHz
GPU: AMD ATI 05:00.0 Rembrandt
GPU: NVIDIA GeForce RTX 3060 Mobile / Max-Q
Memory: 7866MiB / 15218MiB

@Dunckleosteus
Copy link

Hi, I fixed it with the following command:

export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json

Cheers @AmmarAbouZor

@kaimast
Copy link

kaimast commented Jul 11, 2023

There also is a potential fix in an upcoming NVIDIA driver (545). See here.

@i509VCB
Copy link

i509VCB commented Jul 12, 2023

Hi, I fixed it with the following command:

export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json

@Dunckleosteus this is likely an issue with your vulkan and or driver installation. You shouldn't be needing to tell libvulkan where to find icds.

@Dunckleosteus
Copy link

Dunckleosteus commented Jul 12, 2023

Hi, I fixed it with the following command:

export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json

@Dunckleosteus this is likely an issue with your vulkan and or driver installation. You shouldn't be needing to tell libvulkan where to find icds.

Hi, thank you for your reply. How should I go about fixing the problem ? This may a be silly question but I am a complete linux beginner.
Cheers !

@kaimast
Copy link

kaimast commented Nov 4, 2023

There also is a potential fix in an upcoming NVIDIA driver (545). See here.

This update did indeed fix my problem. I have another unrelated issue now (gfx-rs/wgpu#4627) though.

Maybe this issue can be closed unless other folks can still reproduce it?

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

No branches or pull requests

10 participants