Zed GLES backend panic: create_platform_window_surface during resize
someone13574 opened this issue · 4 comments
The GLES backend for Zed is crashing for me under both X11 and Wayland. This has been occuring since at least zed-industries/zed#13114 but has probably been present for much longer. This occurs whenever you resize the window (if doing the hello_world example, which has been there the whole time) or at startup if running Zed (though I don't think this has always been the case).
This is what gets printed out:
libEGL warning: DRI3: Screen seems not DRI3 capable
libEGL warning: DRI2: failed to authenticate
libEGL warning: DRI3: Screen seems not DRI3 capable
Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: BadAlloc" at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/gles/egl.rs:448:18
0: zed::reliability::init_panic_hook::{{closure}}
at crates/zed/src/reliability.rs:58:29
1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/boxed.rs:2036:9
std::panicking::rust_panic_with_hook
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:799:13
2: std::panicking::begin_panic_handler::{{closure}}
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:664:13
3: std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:171:18
4: rust_begin_unwind
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
5: core::panicking::panic_fmt
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
6: core::result::unwrap_failed
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1654:5
7: core::result::Result<T,E>::unwrap
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1077:23
blade_graphics::hal::platform::Context::resize
at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/gles/egl.rs:442:17
8: gpui::platform::blade::blade_renderer::BladeRenderer::update_drawable_size
at crates/gpui/src/platform/blade/blade_renderer.rs:430:13
9: gpui::platform::linux::x11::window::X11WindowStatePtr::configure
at crates/gpui/src/platform/linux/x11/window.rs:913:17
10: gpui::platform::linux::x11::client::X11Client::handle_event
at crates/gpui/src/platform/linux/x11/client.rs:544:17
11: gpui::platform::linux::x11::client::X11Client::process_x11_events
at crates/gpui/src/platform/linux/x11/client.rs:506:17
12: <gpui::platform::linux::x11::client::X11Client as gpui::platform::linux::platform::LinuxClient>::run
at crates/gpui/src/platform/linux/x11/client.rs:1231:17
13: gpui::platform::linux::platform::<impl gpui::platform::Platform for P>::run
at crates/gpui/src/platform/linux/platform.rs:153:9
14: gpui::app::App::run
at crates/gpui/src/app.rs:140:9
15: zed::main
at crates/zed/src/main.rs:382:5
16: core::ops::function::FnOnce::call_once
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
17: std::sys_common::backtrace::__rust_begin_short_backtrace
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:155:18
18: std::rt::lang_start::{{closure}}
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:159:18
19: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:284:13
std::panicking::try::do_call
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
std::panicking::try
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
std::panic::catch_unwind
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
std::rt::lang_start_internal::{{closure}}
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:48
std::panicking::try::do_call
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
std::panicking::try
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
std::panic::catch_unwind
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
std::rt::lang_start_internal
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:20
20: std::rt::lang_start
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:158:17
21: main
22: __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
23: __libc_start_main_impl
at ./csu/../csu/libc-start.c:360:3
24: _start
at /builddir/glibc-2.39/csu/../sysdeps/x86_64/start.S:115
And on wayland I get this:
Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: BadAttribute" at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/gles/egl.rs:448:18
0: zed::reliability::init_panic_hook::{{closure}}
at crates/zed/src/reliability.rs:58:29
1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/boxed.rs:2036:9
std::panicking::rust_panic_with_hook
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:799:13
2: std::panicking::begin_panic_handler::{{closure}}
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:664:13
3: std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:171:18
4: rust_begin_unwind
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
5: core::panicking::panic_fmt
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
6: core::result::unwrap_failed
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1654:5
7: core::result::Result<T,E>::unwrap
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1077:23
blade_graphics::hal::platform::Context::resize
at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/gles/egl.rs:442:17
8: gpui::platform::blade::blade_renderer::BladeRenderer::new
at crates/gpui/src/platform/blade/blade_renderer.rs:370:28
9: gpui::platform::linux::wayland::window::WaylandWindowState::new
at crates/gpui/src/platform/linux/wayland/window.rs:167:23
10: gpui::platform::linux::wayland::window::WaylandWindow::new
at crates/gpui/src/platform/linux/wayland/window.rs:282:41
11: <gpui::platform::linux::wayland::client::WaylandClient as gpui::platform::linux::platform::LinuxClient>::open_window
at crates/gpui/src/platform/linux/wayland/client.rs:588:36
12: gpui::platform::linux::platform::<impl gpui::platform::Platform for P>::open_window
at crates/gpui/src/platform/linux/platform.rs:256:9
13: gpui::window::Window::new
at crates/gpui/src/window.rs:652:35
14: gpui::app::AppContext::open_window::{{closure}}
at crates/gpui/src/app.rs:478:19
15: gpui::app::AppContext::update
at crates/gpui/src/app.rs:343:22
16: gpui::app::AppContext::open_window
at crates/gpui/src/app.rs:475:9
17: gpui::app::async_context::AsyncAppContext::open_window
at crates/gpui/src/app/async_context.rs:154:9
18: workspace::Workspace::new_local::{{closure}}::{{closure}}
at crates/workspace/src/workspace.rs:1012:17
19: <core::pin::Pin<P> as core::future::future::Future>::poll
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/future/future.rs:123:9
20: <async_task::runnable::Builder<M>::spawn_local::Checked<F> as core::future::future::Future>::poll
at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:455:26
21: async_task::raw::RawTask<F,T,S,M>::run
at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:557:17
22: async_task::runnable::Runnable<M>::run
at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:781:18
23: gpui::platform::linux::wayland::client::WaylandClient::new::{{closure}}::{{closure}}
at crates/gpui/src/platform/linux/wayland/client.rs:418:29
24: calloop::loop_logic::LoopHandle<Data>::insert_idle::{{closure}}
at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:156:17
25: <core::option::Option<F> as calloop::sources::IdleDispatcher<Data>>::dispatch
at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/sources/mod.rs:597:13
26: calloop::loop_logic::EventLoop<Data>::dispatch_idles
at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:542:13
27: calloop::loop_logic::EventLoop<Data>::dispatch
at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:560:9
28: calloop::loop_logic::EventLoop<Data>::run
at /home/owen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.13.0/src/loop_logic.rs:596:13
29: <gpui::platform::linux::wayland::client::WaylandClient as gpui::platform::linux::platform::LinuxClient>::run
at crates/gpui/src/platform/linux/wayland/client.rs:655:9
30: gpui::platform::linux::platform::<impl gpui::platform::Platform for P>::run
at crates/gpui/src/platform/linux/platform.rs:153:9
31: gpui::app::App::run
at crates/gpui/src/app.rs:140:9
32: zed::main
at crates/zed/src/main.rs:382:5
33: core::ops::function::FnOnce::call_once
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
34: std::sys_common::backtrace::__rust_begin_short_backtrace
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:155:18
35: std::rt::lang_start::{{closure}}
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:159:18
36: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:284:13
std::panicking::try::do_call
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
std::panicking::try
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
std::panic::catch_unwind
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
std::rt::lang_start_internal::{{closure}}
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:48
std::panicking::try::do_call
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
std::panicking::try
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
std::panic::catch_unwind
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
std::rt::lang_start_internal
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:20
37: std::rt::lang_start
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:158:17
38: main
39: __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
40: __libc_start_main_impl
at ./csu/../csu/libc-start.c:360:3
41: _start
at /builddir/glibc-2.39/csu/../sysdeps/x86_64/start.S:115
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
Dedicated video memory: 6144 MB
Total available memory: 6144 MB
Currently available dedicated video memory: 5259 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 550.90.07
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.6.0 NVIDIA 550.90.07
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 550.90.07
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
My DE is gnome.
Zed works fine when disabling transparency:
zed-industries/zed#13734 (comment)
Interesting, so these attributes are incorrect
attributes.push(egl::TRANSPARENT_TYPE);
attributes.push(egl::TRANSPARENT_RGB);
Just tried building Zed with the changes in #145 and it still crashes with the same error. Can this be reopened?
libEGL warning: DRI3: Screen seems not DRI3 capable
libEGL warning: DRI2: failed to authenticate
libEGL warning: DRI3: Screen seems not DRI3 capable
Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: BadAlloc" at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/d4b395e/blade-graphics/src/gles/egl.rs:449:18
0: zed::reliability::init_panic_hook::{{closure}}
at crates/zed/src/reliability.rs:58:29
1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/boxed.rs:2036:9
std::panicking::rust_panic_with_hook
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:799:13
2: std::panicking::begin_panic_handler::{{closure}}
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:664:13
3: std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:171:18
4: rust_begin_unwind
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
5: core::panicking::panic_fmt
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
6: core::result::unwrap_failed
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1654:5
7: core::result::Result<T,E>::unwrap
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:1077:23
blade_graphics::hal::platform::Context::resize
at /home/owen/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/d4b395e/blade-graphics/src/gles/egl.rs:443:17
8: gpui::platform::blade::blade_renderer::BladeRenderer::update_drawable_size
at crates/gpui/src/platform/blade/blade_renderer.rs:430:13
9: gpui::platform::linux::x11::window::X11WindowStatePtr::configure
at crates/gpui/src/platform/linux/x11/window.rs:913:17
10: gpui::platform::linux::x11::client::X11Client::handle_event
at crates/gpui/src/platform/linux/x11/client.rs:544:17
11: gpui::platform::linux::x11::client::X11Client::process_x11_events
at crates/gpui/src/platform/linux/x11/client.rs:506:17
12: <gpui::platform::linux::x11::client::X11Client as gpui::platform::linux::platform::LinuxClient>::run
at crates/gpui/src/platform/linux/x11/client.rs:1231:17
13: gpui::platform::linux::platform::<impl gpui::platform::Platform for P>::run
at crates/gpui/src/platform/linux/platform.rs:153:9
14: gpui::app::App::run
at crates/gpui/src/app.rs:140:9
15: zed::main
at crates/zed/src/main.rs:382:5
16: core::ops::function::FnOnce::call_once
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
17: std::sys_common::backtrace::__rust_begin_short_backtrace
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:155:18
18: std::rt::lang_start::{{closure}}
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:159:18
19: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:284:13
std::panicking::try::do_call
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
std::panicking::try
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
std::panic::catch_unwind
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
std::rt::lang_start_internal::{{closure}}
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:48
std::panicking::try::do_call
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40
std::panicking::try
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19
std::panic::catch_unwind
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14
std::rt::lang_start_internal
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:20
20: std::rt::lang_start
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:158:17
21: main
22: __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
23: __libc_start_main_impl
at ./csu/../csu/libc-start.c:360:3
24: _start
at /builddir/glibc-2.39/csu/../sysdeps/x86_64/start.S:115
If you can build, it would help if you could narrow it down a bit by playing with this section
let mut attributes = vec![
egl::RENDER_BUFFER,
// We don't want any of the buffering done by the driver, because we
// manage a swapchain on our side.
// Some drivers just fail on surface creation seeing `EGL_SINGLE_BUFFER`.
if cfg!(any(target_os = "android", target_os = "macos", windows)) {
egl::BACK_BUFFER
} else {
egl::SINGLE_BUFFER
},
];
//TODO: detect if linear color space is supported
match inner.egl.srgb_kind {
SrgbFrameBufferKind::None => {}
SrgbFrameBufferKind::Core | SrgbFrameBufferKind::Khr => {
attributes.push(egl::GL_COLORSPACE);
attributes.push(egl::GL_COLORSPACE_SRGB);
}
}