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

Noticeable latency on Asahi Linux #13734

Closed
1 task done
jvoisin opened this issue Jul 2, 2024 · 10 comments
Closed
1 task done

Noticeable latency on Asahi Linux #13734

jvoisin opened this issue Jul 2, 2024 · 10 comments
Labels
defect [core label] linux linux-wayland Linux Wayland performance Feedback for performance issues, speed, memory usage, etc

Comments

@jvoisin
Copy link

jvoisin commented Jul 2, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

  1. Get an Apple M2 laptop
  2. Install Asahi Linux on it
  3. Install Zed via curl https://zed.dev/install.sh | bash
  4. Open a file in Zed
  5. Move the cursor around
  6. Notice that there is a noticeable input lag.
  7. Notice that the opening of menu is also lagging
  8. Notice that clicks are also laggy

I asked a couple of non-tech people "Does the movement seem more sluggish in this window (Zed) or this window (neovim in a terminal)?" and all of them said that the neovim window had instantaneous cursor movement, while the Zed one was a bit lagging.

Environment

Zed: v0.142.3 (Zed Preview)
OS: Linux Wayland fedora-asahi-remix 40
Memory: 23.2 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

2024-07-02T12:21:43+02:00 [INFO] ========== starting zed ==========
2024-07-02T12:21:43+02:00 [INFO] perform;
2024-07-02T12:21:43+02:00 [INFO] read_command;
2024-07-02T12:21:43+02:00 [INFO] read_command;
2024-07-02T12:21:43+02:00 [INFO] Opening main db
2024-07-02T12:21:43+02:00 [INFO] socket reader;
2024-07-02T12:21:43+02:00 [INFO] new;
2024-07-02T12:21:43+02:00 [INFO] keep_updated;
2024-07-02T12:21:43+02:00 [INFO] Using git binary path: None
2024-07-02T12:21:43+02:00 [INFO] extensions updated. loading 1, reloading 0, unloading 0
2024-07-02T12:21:43+02:00 [INFO] activate is not implemented on Linux, ignoring the call
2024-07-02T12:21:43+02:00 [INFO] Opening main db
2024-07-02T12:21:43+02:00 [INFO] perform;
2024-07-02T12:21:43+02:00 [INFO] read_command;
2024-07-02T12:21:43+02:00 [INFO] read_command;
2024-07-02T12:21:43+02:00 [INFO] socket reader;
2024-07-02T12:21:43+02:00 [INFO] building git repository, `.git` path in the worktree: ".git"
2024-07-02T12:21:43+02:00 [INFO] Enabling Vulkan Portability
2024-07-02T12:21:43+02:00 [INFO] Enabling color space support
2024-07-02T12:21:43+02:00 [INFO] Adapter "llvmpipe (LLVM 18.1.6, 128 bits)"
2024-07-02T12:21:43+02:00 [INFO] Ray tracing is supported
2024-07-02T12:21:43+02:00 [INFO] Using surface present mode MAILBOX
2024-07-02T12:21:43+02:00 [WARN] Unable to forbid exclusive full screen
2024-07-02T12:21:43+02:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-07-02T12:21:43+02:00 [INFO] Creating a descriptor pool for at most 16 sets
2024-07-02T12:21:43+02:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: Ignored }
2024-07-02T12:21:44+02:00 [INFO] Using surface present mode MAILBOX
2024-07-02T12:21:44+02:00 [WARN] Unable to forbid exclusive full screen
2024-07-02T12:21:44+02:00 [INFO] Using surface present mode MAILBOX
2024-07-02T12:21:44+02:00 [WARN] Unable to forbid exclusive full screen
2024-07-02T12:21:44+02:00 [INFO] set environment variables from shell:/bin/bash, path:/home/jvoisin/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/local/go/bin:/home/jvoisin/go/bin:/home/jvoisin/.cargo/bin:/home/jvoisin/app/
2024-07-02T12:21:44+02:00 [INFO] Opening main db
2024-07-02T12:21:44+02:00 [INFO] Opening main db
2024-07-02T12:21:44+02:00 [INFO] Initializing default prettier with plugins {}
2024-07-02T12:21:44+02:00 [INFO] starting language servers for Markdown: 
2024-07-02T12:21:44+02:00 [INFO] Node runtime install_if_needed
2024-07-02T12:21:44+02:00 [ERROR] crates/workspace/src/persistence/model.rs:353: No path stored for this editor
2024-07-02T12:21:44+02:00 [INFO] Wayland does not support this API
2024-07-02T12:21:44+02:00 [INFO] starting language server. binary path: "/home/jvoisin/.local/share/zed/node/node-v18.15.0-linux-arm64/bin/node", working directory: "/", args: ["/home/jvoisin/.local/share/zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"]
2024-07-02T12:21:44+02:00 [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-07-02T10:21:44.879Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-07-02T10:21:44.879Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-07-02T12:21:44+02:00 [INFO] Language server with id 0 sent unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "90666579-52f1-4202-a0c6-661b458a7608",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-07-02T12:21:45+02:00 [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-07-02T10:21:44.947Z] Telemetry initialized",
  "metadataStr": "[DEBUG] [agent] [2024-07-02T10:21:44.947Z]",
  "extra": [
    "Telemetry initialized"
  ]
}
@jvoisin jvoisin added admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue labels Jul 2, 2024
@SomeoneToIgnore

This comment was marked as off-topic.

@AlexDaniel
Copy link

AlexDaniel commented Jul 2, 2024

Just to be clear, #13203 is about Zed being “half the time just as slow as VS Code, and sometimes 1 frame slower”. In other words, it's pretty fast. If you feel that Zed is truly lagging, then it's possibly a different issue.

Are you sure that you're able to run Vulkan apps? I see:

2024-07-02T12:21:43+02:00 [INFO] Adapter "llvmpipe (LLVM 18.1.6, 128 bits)"

Doesn't that mean that you're using a software renderer?

What happens when you run vkcube or vkgears?

@mrnugget I don't know who else to ping, but this is this issue again: #13154. Even though Zed is not wrong in this case, and it's probably a good idea to fall back to a software renderer, I'm now 100% convinced that Zed should show a warning to the user when that happens. Otherwise people start assuming that zed is lagging, while they're simply using the software renderer.

@AlexDaniel
Copy link

How to detect software rendering:
image

@someone13574
Copy link
Contributor

Asahi doesn’t have a public Vulkan driver so you are almost certainly running llvmpipe. Try using the OpenGL backend: #13305. There’s a chance it will not work because it’s very new and not many people use it.

@jvoisin
Copy link
Author

jvoisin commented Jul 2, 2024

I'm indeed running llmvpipe:

$ vulkaninfo  | grep -i llvmpipe
		GPU id = 0 (llvmpipe (LLVM 18.1.6, 128 bits))
GPU id : 0 (llvmpipe (LLVM 18.1.6, 128 bits)):
GPU id : 0 (llvmpipe (LLVM 18.1.6, 128 bits)):
	deviceName        = llvmpipe (LLVM 18.1.6, 128 bits)
	driverID                                             = DRIVER_ID_MESA_LLVMPIPE
	driverName                                           = llvmpipe
$

Having a warning about this would be nice indeed.

On the bright side, @alyssarosenzweig has a working vulkan implementation that should land into Asahi Linux at some point.

@notpeter notpeter added performance Feedback for performance issues, speed, memory usage, etc linux and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Jul 2, 2024
@lukaslihotzki
Copy link
Contributor

Zed works well on Asahi Linux when compiling with RUSTFLAGS="--cfg gles". Installing the Vulkan driver somehow also should work.

@tindzk
Copy link

tindzk commented Jul 5, 2024

@lukaslihotzki Thanks for the hint! I am seeing the following error on Asahi Linux:

❯ target/debug/zed
libEGL warning: bad surface attribute 0x3034
Thread "main" panicked with "called `Result::unwrap()` on an `Err` value: BadAttribute" at /home/tim/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/gles/egl.rs:448:18
[...]
      blade_graphics::hal::platform::Context::resize
             at /home/tim/.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

It seems that transparency is not working correctly. With the following changes, the error disappears and Zed is fully functional:

diff --git a/crates/gpui/src/platform/blade/blade_renderer.rs b/crates/gpui/src/platform/blade/blade_renderer.rs
index 1830d0cd0..06e1d62cb 100644
--- a/crates/gpui/src/platform/blade/blade_renderer.rs
+++ b/crates/gpui/src/platform/blade/blade_renderer.rs
@@ -365,7 +365,7 @@ impl BladeRenderer {
             display_sync: gpu::DisplaySync::Recent,
             color_space: gpu::ColorSpace::Linear,
             allow_exclusive_full_screen: false,
-            transparent: config.transparent,
+            transparent: false,
         };
         let surface_info = gpu.resize(surface_config);
 
@@ -431,15 +431,7 @@ impl BladeRenderer {
         }
     }
 
-    pub fn update_transparency(&mut self, transparent: bool) {
-        if transparent != self.surface_config.transparent {
-            self.wait_for_gpu();
-            self.surface_config.transparent = transparent;
-            let surface_info = self.gpu.resize(self.surface_config);
-            self.pipelines = BladePipelines::new(&self.gpu, surface_info);
-            self.alpha_mode = surface_info.alpha;
-        }
-    }
+    pub fn update_transparency(&mut self, transparent: bool) {}
 
     #[cfg_attr(target_os = "macos", allow(dead_code))]
     pub fn viewport_size(&self) -> gpu::Extent {

@ydalton
Copy link

ydalton commented Oct 11, 2024

The Honeykrisp driver (Vulkan driver for Asahi Linux) is now released for general availability, @jvoisin can you test again if you have this issue? For me, it is working perfectly.

@tombh
Copy link

tombh commented Oct 11, 2024

I'm on Asahi too and have been playing with Zed for the first time since the Honeykrisp release yesterday. Everything seems smoooth 🥳

@jvoisin
Copy link
Author

jvoisin commented Oct 11, 2024

Yup, it's working well now :)

@jvoisin jvoisin closed this as completed Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect [core label] linux linux-wayland Linux Wayland performance Feedback for performance issues, speed, memory usage, etc
Projects
None yet
Development

No branches or pull requests

9 participants