zed icon indicating copy to clipboard operation
zed copied to clipboard

[unofficial] Linux port via Blade

Open kvark opened this issue 1 year ago • 12 comments

Motivation

I :heart: Zed! It's lightning fast and has great UX. I want it to run as well on all major platforms. I'm currently using Linux most actively. Blade is a good candidate for providing GPU access: it supports Vulkan, Metal, and GLES/WebGL. Its abstraction is extremely thin, while having one of the nicest GPU APIs. Codebase is also tiny. Checkout the meetup recording from a year ago. I believe these projects make a good match :rocket: !

Closes #7015

Why this is a bad idea

If Zed team wants to use off-the-shelf components from Rust ecosystem, then Blade is certainly at disadvantage here, since it's not widely used. It would rely on Zed team adding necessary features in a branch, then maybe upstreaming some of them. That is to say, it's unclear if this can be avoided with more popular alternatives - being flexible with any local changes is a good ability.

Why it's not too bad

Blade uses WGSL shaders, similar to wgpu and arcana, but without the binding decorations. So this aspect of the product is nicely portable.

Progress

  • [ ] Platforms
    • [x] X11 (via xcb)
      • [ ] input handling
      • [ ] get proper content size
    • [ ] Windows
    • [ ] Replace the existing Metal backend
  • [ ] Text System
    • [ ] shaping
    • [ ] glyph rasterization
  • [x] Texture atlas
  • [ ] Rendering
    • [x] basic primitives
    • [x] path rendering
    • [x] sprite rendering
  • [ ] media surfaces
  • [ ] CI

Current status

Zed starts up but crashes on text-system related checks. zed-linux-1

kvark avatar Feb 03 '24 22:02 kvark

We require contributors to sign our Contributor License Agreement, and we don't have @kvark on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

cla-bot[bot] avatar Feb 03 '24 22:02 cla-bot[bot]

@cla-bot check

kvark avatar Feb 03 '24 22:02 kvark

The cla-bot has been summoned, and re-checked this pull request!

cla-bot[bot] avatar Feb 03 '24 22:02 cla-bot[bot]

I can confirm it builds on Debian 12. But I had to revert b7ced394 because the compiling never ends. (/cc @d1y do you know why ?)

For anyone needed this, here is my list of commands I kept in my notes to get zed to build:

sudo apt install libclang-dev

wget https://snapshot.debian.org/archive/debian/20221113T151655Z/pool/main/libd/libdispatch/libdispatch-dev_0~svn197-4_amd64.
wget https://snapshot.debian.org/archive/debian/20221113T151655Z/pool/main/libd/libdispatch/libdispatch0_0~svn197-4_amd64.deb
wget http://ftp.debian.org/debian/pool/main/libk/libkqueue/libkqueue-dev_2.3.1-1_amd64.deb
wget http://ftp.debian.org/debian/pool/main/libk/libkqueue/libkqueue0_2.3.1-1_amd64.deb
wget http://ftp.debian.org/debian/pool/main/libp/libpthread-workqueue/libpthread-workqueue0_0.9.1-1_amd64.deb
wget http://ftp.debian.org/debian/pool/main/libp/libpthread-workqueue/libpthread-workqueue-dev_0.9.1-1_amd64.deb

sudo apt install ./libdispatch-dev_0~svn197-4_amd64.deb ./libdispatch0_0~svn197-4_amd64.deb ./libkqueue-dev_2.3.1-1_amd64.deb ./libpthread-workqueue-dev_0.9.1-1_amd64.deb ./libkqueue0_2.3.1-1_amd64.deb ./libpthread-workqueue0_0.9.1-1_amd64.deb


sudo apt install  gobjc-12

# -> GPU
sudo apt install libfontconfig-dev

/cc @aminya

williamdes avatar Feb 04 '24 21:02 williamdes

gdb

sudo apt install libc6-dev

I applied this diff but still get a segfault:

diff --git a/crates/collab/Cargo.toml b/crates/collab/Cargo.toml
index 0fb8cb929..1e1d0f916 100644
--- a/crates/collab/Cargo.toml
+++ b/crates/collab/Cargo.toml
@@ -37,7 +37,7 @@ parking_lot.workspace = true
 prometheus = "0.13"
 prost.workspace = true
 rand.workspace = true
-reqwest = { version = "0.11", features = ["json"], optional = true }
+reqwest = { version = "0.11", features = ["json", "rustls-tls"], optional = true, no-default-features = true }
 rpc = { path = "../rpc" }
 scrypt = "0.7"
 sea-orm = { version = "0.12.x", features = ["sqlx-postgres", "postgres-array", "runtime-tokio-rustls", "with-uuid"] }
diff --git a/crates/live_kit_server/Cargo.toml b/crates/live_kit_server/Cargo.toml
index 63b4fe106..a4b1334db 100644
--- a/crates/live_kit_server/Cargo.toml
+++ b/crates/live_kit_server/Cargo.toml
@@ -19,7 +19,7 @@ jwt = "0.16"
 log.workspace = true
 prost = "0.8"
 prost-types = "0.8"
-reqwest = "0.11"
+reqwest = { version = "0.11", features = ["rustls-tls"], no-default-features = true }
 serde.workspace = true
 serde_derive.workspace = true
 sha2 = "0.10"

Do you know why ? How to you debug crashes ?

Here is my gdb output:

Reading symbols from ./target/debug/Zed...
(gdb) run
Starting program: /mnt/Dev/@williamdes/@forked-repos/zed/target/debug/Zed 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000001 in ?? ()
(gdb) bt
#0  0x0000000000000001 in ?? ()
#1  0x00007fffffffe217 in ?? ()
#2  0x0000000000000000 in ?? ()
strace

openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libbsd.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=84840, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 86224, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ffa3e85a000
mmap(0x7ffa3e85e000, 49152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7ffa3e85e000
mmap(0x7ffa3e86a000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7ffa3e86a000
mmap(0x7ffa3e86d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13000) = 0x7ffa3e86d000
mmap(0x7ffa3e86f000, 208, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7ffa3e86f000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libmd.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=47312, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 49384, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ffa3e84d000
mmap(0x7ffa3e84f000, 28672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7ffa3e84f000
mmap(0x7ffa3e856000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9000) = 0x7ffa3e856000
mmap(0x7ffa3e858000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7ffa3e858000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffa3f089000
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffa3f086000
arch_prctl(ARCH_SET_FS, 0x7ffa3f0867c0) = 0
set_tid_address(0x7ffa3f086a90)         = 384596
set_robust_list(0x7ffa3f086aa0, 24)     = 0
rseq(0x7ffa3f0870e0, 0x20, 0, 0x53053053) = 0
mprotect(0x7ffa3eacf000, 16384, PROT_READ) = 0
mprotect(0x7ffa3e858000, 4096, PROT_READ) = 0
mprotect(0x7ffa3e86d000, 4096, PROT_READ) = 0
mprotect(0x7ffa3e891000, 4096, PROT_READ) = 0
mprotect(0x7ffa3e804000, 4096, PROT_READ) = 0
mprotect(0x7ffa3f420000, 4096, PROT_READ) = 0
mprotect(0x7ffa3e89e000, 4096, PROT_READ) = 0
mprotect(0x7ffa3ebfe000, 4096, PROT_READ) = 0
mprotect(0x7ffa3ebbf000, 4096, PROT_READ) = 0
mprotect(0x7ffa3e8d4000, 4096, PROT_READ) = 0
mprotect(0x7ffa3e8fe000, 8192, PROT_READ) = 0
mprotect(0x7ffa3ebdf000, 4096, PROT_READ) = 0
mprotect(0x7ffa3f01b000, 397312, PROT_READ) = 0
mprotect(0x7ffa3f127000, 40960, PROT_READ) = 0
mprotect(0x7ffa3f44e000, 4096, PROT_READ) = 0
mprotect(0x7ffa3f1f7000, 32768, PROT_READ) = 0
mprotect(0x7ffa3f498000, 8192, PROT_READ) = 0
mprotect(0x7ffa3f59b000, 32768, PROT_READ) = 0
mprotect(0x7ffa3f409000, 45056, PROT_READ) = 0
mprotect(0x5617e6685000, 20480, PROT_READ) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffa3f084000
mprotect(0x7ffa3f5f3000, 8192, PROT_READ) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
munmap(0x7ffa3f5a4000, 116470)          = 0
getrandom("\x2c\xf7\x2e\xf3\x7e\xf5\xe6\x12", 8, GRND_NONBLOCK) = 8
brk(NULL)                               = 0x5617e7751000
brk(0x5617e7772000)                     = 0x5617e7772000
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x1} ---
+++ killed by SIGSEGV (core dumped) +++
Erreur de segmentation (core dumped)

williamdes avatar Feb 04 '24 22:02 williamdes

For anyone needed this, here is my list of commands I kept in my notes to get zed to build:

sudo apt install libclang-dev

wget https://snapshot.debian.org/archive/debian/20221113T151655Z/pool/main/libd/libdispatch/libdispatch-dev_0~svn197-4_amd64.
wget https://snapshot.debian.org/archive/debian/20221113T151655Z/pool/main/libd/libdispatch/libdispatch0_0~svn197-4_amd64.deb
wget http://ftp.debian.org/debian/pool/main/libk/libkqueue/libkqueue-dev_2.3.1-1_amd64.deb
wget http://ftp.debian.org/debian/pool/main/libk/libkqueue/libkqueue0_2.3.1-1_amd64.deb
wget http://ftp.debian.org/debian/pool/main/libp/libpthread-workqueue/libpthread-workqueue0_0.9.1-1_amd64.deb
wget http://ftp.debian.org/debian/pool/main/libp/libpthread-workqueue/libpthread-workqueue-dev_0.9.1-1_amd64.deb

sudo apt install ./libdispatch-dev_0~svn197-4_amd64.deb ./libdispatch0_0~svn197-4_amd64.deb ./libkqueue-dev_2.3.1-1_amd64.deb ./libpthread-workqueue-dev_0.9.1-1_amd64.deb ./libkqueue0_2.3.1-1_amd64.deb ./libpthread-workqueue0_0.9.1-1_amd64.deb


sudo apt install  gobjc-12

# -> GPU
sudo apt install libfontconfig-dev

If there are system dependencies, they should be added to this script so that they are installed during the bootstrap: https://github.com/zed-industries/zed/blob/main/script/linux

aminya avatar Feb 04 '24 22:02 aminya

After https://github.com/kvark/zed/pull/1, the Zed CLI runs without an error, but I cannot see any UI.

aminya avatar Feb 05 '24 07:02 aminya

Does this work with Wayland too? If not, are you planning to add Wayland support?

Rhelvetican avatar Feb 05 '24 08:02 Rhelvetican

I now have this crash and a white window that shows 1 second. Merged kvark/zed#2 locally. This is awesome progress ! 🎉

output

Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: ERROR_LAYER_NOT_PRESENT" at /home/williamdes/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/62eb18d/blade-graphics/src/vulkan/init.rs:281:55
   0: Zed::init_panic_hook::{closure#0}
             at crates/zed/src/main.rs:583:29
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2021:9
      std::panicking::rust_panic_with_hook
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:783:13
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:657:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:170:18
   4: rust_begin_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
   5: core::panicking::panic_fmt
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
   6: core::result::unwrap_failed
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5
   7: <core::result::Result<ash::instance::Instance, ash::vk::enums::Result>>::unwrap
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1077:23
   8: <blade_graphics::hal::Context>::init_impl
             at /home/williamdes/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/62eb18d/blade-graphics/src/vulkan/init.rs:281:13
   9: <blade_graphics::hal::Context>::init_windowed::<gpui::platform::linux::window::RawWindow>
             at /home/williamdes/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/62eb18d/blade-graphics/src/vulkan/init.rs:562:9
  10: <gpui::platform::linux::window::LinuxWindowState>::new
             at crates/gpui/src/platform/linux/window.rs:196:17
  11: <gpui::platform::linux::platform::LinuxPlatform as gpui::platform::Platform>::open_window
             at crates/gpui/src/platform/linux/platform.rs:193:35
  12: <gpui::window::Window>::new
             at crates/gpui/src/window.rs:332:31
  13: <gpui::app::AppContext>::open_window::<workspace::Workspace, <workspace::Workspace>::new_local::{closure#0}::{closure#0}::{closure#5}>::{closure#0}
             at crates/gpui/src/app.rs:482:30
  14: <gpui::app::AppContext>::update::<gpui::window::WindowHandle<workspace::Workspace>, <gpui::app::AppContext>::open_window<workspace::Workspace, <workspace::Workspace>::new_local::{closure#0}::{closure#0}::{closure#5}>::{closure#0}>
             at crates/gpui/src/app.rs:357:22
  15: <gpui::app::AppContext>::open_window::<workspace::Workspace, <workspace::Workspace>::new_local::{closure#0}::{closure#0}::{closure#5}>
             at crates/gpui/src/app.rs:479:9
  16: <gpui::app::async_context::AsyncAppContext>::open_window::<workspace::Workspace, <workspace::Workspace>::new_local::{closure#0}::{closure#0}::{closure#5}>
             at crates/gpui/src/app/async_context.rs:133:12
  17: <workspace::Workspace>::new_local::{closure#0}::{closure#0}
             at crates/workspace/src/workspace.rs:838:17
  18: <core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = core::result::Result<(gpui::window::WindowHandle<workspace::Workspace>, alloc::vec::Vec<core::option::Option<core::result::Result<alloc::boxed::Box<dyn workspace::item::ItemHandle>, anyhow::Error>>>), anyhow::Error>>>> as core::future::future::Future>::poll
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/future/future.rs:125:9
  19: <<async_task::runnable::Builder<_>>::spawn_local::Checked<core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = core::result::Result<(gpui::window::WindowHandle<workspace::Workspace>, alloc::vec::Vec<core::option::Option<core::result::Result<alloc::boxed::Box<dyn workspace::item::ItemHandle>, anyhow::Error>>>), anyhow::Error>>>>> as core::future::future::Future>::poll
             at /home/williamdes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:455:26
  20: <async_task::raw::RawTask<<async_task::runnable::Builder<_>>::spawn_local::Checked<core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = core::result::Result<(gpui::window::WindowHandle<workspace::Workspace>, alloc::vec::Vec<core::option::Option<core::result::Result<alloc::boxed::Box<dyn workspace::item::ItemHandle>, anyhow::Error>>>), anyhow::Error>>>>>, core::result::Result<(gpui::window::WindowHandle<workspace::Workspace>, alloc::vec::Vec<core::option::Option<core::result::Result<alloc::boxed::Box<dyn workspace::item::ItemHandle>, anyhow::Error>>>), anyhow::Error>, <gpui::executor::ForegroundExecutor>::spawn::inner<core::result::Result<(gpui::window::WindowHandle<workspace::Workspace>, alloc::vec::Vec<core::option::Option<core::result::Result<alloc::boxed::Box<dyn workspace::item::ItemHandle>, anyhow::Error>>>), anyhow::Error>>::{closure#0}, ()>>::run
             at /home/williamdes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:557:17
  21: <async_task::runnable::Runnable>::run
             at /home/williamdes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:781:18
  22: <gpui::platform::linux::platform::LinuxPlatform as gpui::platform::Platform>::run
             at crates/gpui/src/platform/linux/platform.rs:144:17
  23: <gpui::app::App>::run::<Zed::main::{closure#3}>
             at crates/gpui/src/app.rs:138:9
  24: Zed::main
             at crates/zed/src/main.rs:124:5
  25: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
  26: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:154:18
  27: std::rt::lang_start::<()>::{closure#0}
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:167:18
  28: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:284:13
      std::panicking::try::do_call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
      std::panicking::try
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
      std::panic::catch_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:48
      std::panicking::try::do_call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
      std::panicking::try
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
      std::panic::catch_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
      std::rt::lang_start_internal
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:20
  29: std::rt::lang_start::<()>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:166:17
  30: main
  31: <unknown>
  32: __libc_start_main
  33: _start


williamdes avatar Feb 05 '24 10:02 williamdes

I now have this crash and a white window that shows 1 second. Merged kvark#2 locally. This is awesome progress ! 🎉

output

Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: ERROR_LAYER_NOT_PRESENT" at /home/williamdes/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/62eb18d/blade-graphics/src/vulkan/init.rs:281:55

You'll need to install vulkan-validationlayers:

sudo apt install vulkan-validationlayers*

nhemsley avatar Feb 05 '24 11:02 nhemsley

After https://github.com/kvark/zed/pull/2, I also get a white screen for a second. This is the error I get then resulting in a crash:

Details
> ./target/debug/Zed
VUID-VkSwapchainCreateInfoKHR-imageExtent-01274(ERROR / SPEC): msgNum: 2094043421 - Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x564c8fd0e4e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (3840,3240), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (3840,2076), minImageExtent = (3840,2076), maxImageExtent = (3840,2076). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
    Objects: 1
        [0] 0x564c8fd0e4e0, type: 3, name: NULL
[2024-02-05T10:47:19-08:00 ERROR client::telemetry] Failed to send events: HTTP 403
Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: ERROR_SURFACE_LOST_KHR" at /home/aminya/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/62eb18d/blade-graphics/src/vulkan/init.rs:717:18
   0: Zed::init_panic_hook::{closure#0}
             at crates/zed/src/main.rs:583:29
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2021:9
      std::panicking::rust_panic_with_hook
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:783:13
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:657:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:170:18
   4: rust_begin_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
   5: core::panicking::panic_fmt
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
   6: core::result::unwrap_failed
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5
   7: <core::result::Result<(u32, bool), ash::vk::enums::Result>>::unwrap
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1077:23
   8: <blade_graphics::hal::Context>::acquire_frame
             at /home/aminya/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/62eb18d/blade-graphics/src/vulkan/init.rs:714:13
   9: <gpui::platform::linux::blade_renderer::BladeRenderer>::draw
             at crates/gpui/src/platform/linux/blade_renderer.rs:359:21
  10: <gpui::platform::linux::window::LinuxWindow as gpui::platform::PlatformWindow>::draw
             at crates/gpui/src/platform/linux/window.rs:397:9
  11: <gpui::window::WindowContext>::draw
             at crates/gpui/src/window.rs:1074:9
  12: <gpui::window::Window>::new::{closure#0}::{closure#0}::{closure#0}
             at crates/gpui/src/window.rs:345:52
  13: <gpui::app::AppContext as gpui::Context>::update_window::<(), <gpui::window::Window>::new::{closure#0}::{closure#0}::{closure#0}>::{closure#0}
             at crates/gpui/src/app.rs:1225:26
  14: <gpui::app::AppContext>::update::<core::result::Result<(), anyhow::Error>, <gpui::app::AppContext as gpui::Context>::update_window<(), <gpui::window::Window>::new::{closure#0}::{closure#0}::{closure#0}>::{closure#0}>
             at crates/gpui/src/app.rs:357:22
  15: <gpui::app::AppContext as gpui::Context>::update_window::<(), <gpui::window::Window>::new::{closure#0}::{closure#0}::{closure#0}>
             at crates/gpui/src/app.rs:1216:9
  16: <gpui::app::async_context::AsyncAppContext as gpui::Context>::update_window::<(), <gpui::window::Window>::new::{closure#0}::{closure#0}::{closure#0}>
             at crates/gpui/src/app/async_context.rs:70:9
  17: <gpui::window::AnyWindowHandle>::update::<gpui::app::async_context::AsyncAppContext, (), <gpui::window::Window>::new::{closure#0}::{closure#0}::{closure#0}>
             at crates/gpui/src/window.rs:2561:9
  18: <gpui::window::Window>::new::{closure#0}::{closure#0}
             at crates/gpui/src/window.rs:345:21
  19: util::measure::<(), <gpui::window::Window>::new::{closure#0}::{closure#0}>
             at crates/util/src/util.rs:175:9
  20: <gpui::window::Window>::new::{closure#0}
             at crates/gpui/src/window.rs:344:17
  21: <alloc::boxed::Box<dyn core::ops::function::FnMut<(), Output = ()>> as core::ops::function::FnMut<()>>::call_mut
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2014:9
  22: <gpui::platform::linux::window::LinuxWindowState>::expose
             at crates/gpui/src/platform/linux/window.rs:246:13
  23: <gpui::platform::linux::platform::LinuxPlatform as gpui::platform::Platform>::run
             at crates/gpui/src/platform/linux/platform.rs:121:21
  24: <gpui::app::App>::run::<Zed::main::{closure#3}>
             at crates/gpui/src/app.rs:138:9
  25: Zed::main
             at crates/zed/src/main.rs:124:5
  26: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
  27: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:154:18
  28: std::rt::lang_start::<()>::{closure#0}
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:167:18
  29: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:284:13
      std::panicking::try::do_call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
      std::panicking::try
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
      std::panic::catch_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:48
      std::panicking::try::do_call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
      std::panicking::try
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
      std::panic::catch_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
      std::rt::lang_start_internal
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:20
  30: std::rt::lang_start::<()>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:166:17
  31: main
  32: __libc_start_call_main
             at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  33: __libc_start_main_impl
             at ./csu/../csu/libc-start.c:392:3
  34: _start

aminya avatar Feb 05 '24 18:02 aminya

Thank you, after https://github.com/kvark/zed/pull/2/commits/88dfb35346c370257b33faa9dbf15160aeb08ef2 that installed the missing dependency.

I now have this crash:

trace

VUID-VkSwapchainCreateInfoKHR-imageExtent-01274(ERROR / SPEC): msgNum: 2094043421 - Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x5650fc2070c0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (1920,1080), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (1920,1024), minImageExtent = (1920,1024), maxImageExtent = (1920,1024). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.3-khr-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
    Objects: 1
        [0] 0x5650fc2070c0, type: 3, name: NULL
Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: glyph not found for character 'm'" at crates/editor/src/element.rs:1907:18
   0: Zed::init_panic_hook::{closure#0}
             at crates/zed/src/main.rs:583:29
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2021:9
      std::panicking::rust_panic_with_hook

williamdes avatar Feb 05 '24 22:02 williamdes

@williamdes yes, that's the big boss of the text system missing. Looks like the suggested path to it is implementing cosmic_text.

kvark avatar Feb 06 '24 06:02 kvark

I do not know where https://github.com/zed-industries/zed/pull/7343/commits/7509677003da3398d0df796eca9c5435a12f576e comes from but:

  • libxcb-dev should be libxcb1-dev
  • alsa-base was removed in oldstable: https://tracker.debian.org/pkg/alsa-base see https://bugs.debian.org/852455 reading the changelog of the package mentioned it was replaced by kmod

/cc @mikayla-maki The packages in the commit do not exist on Debian 12

williamdes avatar Feb 06 '24 08:02 williamdes

@aminya: Can you try the following branch: https://github.com/h3mosphere/zed/tree/resize-on-draw

I had the same issue, this is probably a performance killer until @kvark can work out a better solution. But it works for me.

After kvark#2, I also get a white screen for a second. This is the error I get then resulting in a crash:

h3mosphere avatar Feb 06 '24 09:02 h3mosphere

I do not know where 7509677 comes from but:

/cc @mikayla-maki The packages in the commit do not exist on Debian 12

It reverted it in https://github.com/kvark/zed/pull/2. cause it also causes conflicts. @mikayla-maki was this commit intended? If so, could you create pull requests instead of directly pushing?

aminya avatar Feb 06 '24 10:02 aminya

do we have support for linux if this PR gets merged ?

bhavya3024 avatar Feb 06 '24 13:02 bhavya3024

@aminya, sorry about that meant to push to a branch. Thanks for fixing things :)

mikayla-maki avatar Feb 06 '24 17:02 mikayla-maki

@bhavya3024 No, there is still missing essential functionality. E.g. font rendering.

noverby avatar Feb 06 '24 18:02 noverby

@noverby ok, waiting for the day when I can have this as an alternative to vscode.

bhavya3024 avatar Feb 07 '24 09:02 bhavya3024

Zed team wants to use off-the-shelf components from Rust ecosystem, then Blade is certainly at disadvantage here, since it's not widely used. It would rely on Zed team adding necessary features in a branch, then maybe upstreaming some of them.

they could also just offer its developer a full-time, work-at-home job as theyre more proficient with linux and they could then gear blade into its direction rather than other way round. just throwing the idea out there

RustoMCSpit avatar Mar 01 '24 20:03 RustoMCSpit