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

winit-femtovg renderer panics on startup with nVidia GPU on Wayland #1724

Closed
Be-ing opened this issue Oct 10, 2022 · 16 comments
Closed

winit-femtovg renderer panics on startup with nVidia GPU on Wayland #1724

Be-ing opened this issue Oct 10, 2022 · 16 comments
Labels
a:backend-winit Winit backend (mS,mO) bug Something isn't working

Comments

@Be-ing
Copy link
Contributor

Be-ing commented Oct 10, 2022

slint on  HEAD (7ec79fb) via △ v3.22.2 via 🦀 v1.64.0 
❯ RUST_BACKTRACE=full SLINT_BACKEND=winit-femtovg cargo run -p memory
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/memory`
thread 'main' panicked at 'Failed to create OpenGL context: could not create GlLatest context : Couldn't find any pixel format that matches the criteria.', internal/backends/winit/glcontext.rs:189:17
stack backtrace:
   0:     0x55d24d9f6d7d - std::backtrace_rs::backtrace::libunwind::trace::h9135f25bc195152c
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x55d24d9f6d7d - std::backtrace_rs::backtrace::trace_unsynchronized::h015ee85be510df51
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55d24d9f6d7d - std::sys_common::backtrace::_print_fmt::h5fad03caa9652a2c
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x55d24d9f6d7d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2b42ca28d244e5c7
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x55d24da19fdc - core::fmt::write::h401e827d053130ed
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/fmt/mod.rs:1198:17
   5:     0x55d24d9f3811 - std::io::Write::write_fmt::hffec93268f5cde32
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/io/mod.rs:1672:15
   6:     0x55d24d9f8335 - std::sys_common::backtrace::_print::h180c4c706ee1d3fb
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x55d24d9f8335 - std::sys_common::backtrace::print::hd0c35d18765761c9
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x55d24d9f8335 - std::panicking::default_hook::{{closure}}::h1f023310983bc730
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:295:22
   9:     0x55d24d9f8051 - std::panicking::default_hook::h188fec3334afd5be
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:314:9
  10:     0x55d24d9f88e6 - std::panicking::rust_panic_with_hook::hf26e9d4f97b40096
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:698:17
  11:     0x55d24d9f87d7 - std::panicking::begin_panic_handler::{{closure}}::hfab912107608087a
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:588:13
  12:     0x55d24d9f7274 - std::sys_common::backtrace::__rust_end_short_backtrace::h434b685ce8d9965b
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:138:18
  13:     0x55d24d9f8509 - rust_begin_unwind
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
  14:     0x55d24da17d23 - core::panicking::panic_fmt::ha6dc7f2ab2479463
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
  15:     0x55d24ce72009 - i_slint_backend_winit::glcontext::OpenGLContext::new_context::{{closure}}::h70f0612afd669450
                               at /home/be/sw/slint/internal/backends/winit/glcontext.rs:189:17
fish: Job 1, 'RUST_BACKTRACE=full SLINT_BACKE…' terminated by signal SIGABRT (Abort)

using NVIDIA Corporation GA106 [GeForce RTX 3060 Lite Hash Rate] (rev a1) with proprietary nVidia driver akmod-nvidia-515.76-1.fc36.x86_64 with Linux 5.19.14-200.fc36.x86_64

This is not reproducible with the same hardware on X11.

@ahayzen-kdab
Copy link

When running Weston on a X11 system to create a Wayland server, this does run for me with a GeForce GTX 1060 and Nvidia 470.141.03 drivers.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 11, 2022

What do you mean by "running Weston on an X11 system"? X applications can run in Wayland via XWayland, but I'm not aware of the other way around existing?

@ahayzen-kdab
Copy link

I did the following, the app then runs inside the weston window using wayland as the protocol. I don't think i have a working Wayland or XWayland on my machine to try though.

$ sudo apt install weston
$ weston
... another terminal ...
$ WAYLAND_DISPLAY=wayland-0 RUST_BACKTRACE=full SLINT_BACKEND=winit-femtovg cargo run -p memory

@ahayzen-kdab
Copy link

It's possible this does end up with different pixel format options though, like with QtWayland how you pick the QT_XCB_GL_INTEGRATION and QT_WAYLAND_CLIENT_BUFFER_INTEGRATION options etc.

@nicolas-guichard
Copy link

I could reproduce the issue with the nvidia driver 515.76 on an RTX A4000. Removing the with_vsync calls in the context_factory_fn functions solved the issue for me.

This points at rust-windowing/glutin#1444.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 11, 2022

Thanks for digging into this @Nico264! I tested checking out the v0.29.1 tag of the glutin repository and adding .with_vsync(true) to the example in this branch and can reproduce the panic:

glutin on  nvidia_wayland_panic via 🦀 v1.64.0 
❯ RUST_BACKTRACE=1 cargo run -p glutin_examples --example window
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/examples/window`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NoAvailablePixelFormat', glutin_examples/examples/window.rs:12:91
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/result.rs:1814:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/result.rs:1107:23
   4: window::main
             at ./glutin_examples/examples/window.rs:12:28
   5: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

As noted in rust-windowing/glutin#1444, glutin's API has been overhauled for the upcoming 0.30 release which I confirm does fix the bug. The example in glutin's master branch does set vsync and I do not get the error message running it with my nVidia GPU on Wayland. So the solution for Slint would be updating to glutin 0.30.0, which could start now with the 0.30.0-beta.2 release.

@tronical
Copy link
Member

I’m hoping for a new glutin release on crates.io so that we can upgrade.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 11, 2022

The 0.30.0-beta.2 release is on crates.io already. A Slint branch could be started using that, then hold off merging it until glutin 0.30.0 is released.

@tronical
Copy link
Member

Thanks - I somehow missed that. Agreed on the branch.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 11, 2022

Maybe you missed that because crates.io doesn't show prereleases without some digging. lib.rs does though.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 27, 2022

Glutin 0.30.0 has been released.

@tronical
Copy link
Member

Yes, I noticed the same yesterday. I'd like to port to that after our next release (in the coming days).

@ogoffart
Copy link
Member

Is that the same as #1507 ?

@ogoffart ogoffart added bug Something isn't working a:backend-winit Winit backend (mS,mO) labels Nov 29, 2022
@Be-ing
Copy link
Contributor Author

Be-ing commented Nov 29, 2022

Is that the same as #1507 ?

Looks like it.

@tronical
Copy link
Member

tronical commented Dec 2, 2022

First attempt at glutin port: #1942

@Be-ing
Copy link
Contributor Author

Be-ing commented Dec 6, 2022

SLINT_BACKEND=winit-femtovg cargo run -p memory works on KDE Wayland with an nVidia GPU now that #1942 was merged. Though there's some other bug affecting the memory example:
image
Before the tiles are clicked, the Slint logo is drawn small, but after being clicked the first time, they are rendered with the proper size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:backend-winit Winit backend (mS,mO) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants