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

Input lag when typing when webgpu is enabled #3122

Closed
MZauchner opened this issue Feb 17, 2023 · 12 comments
Closed

Input lag when typing when webgpu is enabled #3122

MZauchner opened this issue Feb 17, 2023 · 12 comments
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. Wayland

Comments

@MZauchner
Copy link

MZauchner commented Feb 17, 2023

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

arch linux wayland with Hyprland compositor.

WezTerm version

20230212-103106-a5c2b1f3

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

Input lag when typing. It's hard to show an example, but there seems to be a 100-200ms delay when I type into wezterm for the first few characters. I suspect it has to do with the error about the unhandled OSC 12 escape sequence.
The shell I use is zsh. No issues when using Alacritty or Kitty. I recently downloaded wezterm and only have a minimal configuration.
Apart from the input lag, the colors seem to be off. Here is a screenshot of alacritty (left), wezterm (middle) and kitty (right) with the same neovim config side by side.
20230217_17h43m53s_grim

When I open neovim, I get the following error in the debug overlay:
17:50:18.803 WARN wezterm_term::terminalstate::performer > Unhandled OSC 12

To Reproduce

Install wezterm-git via the aur and launch it with a minimal config on a wlr-based compositor.
I also tried the the binary included in standard arch repos. No difference.

Configuration

local wezterm = require 'wezterm'
--local scheme = wezterm.color.get_builtin_schemes()['Gruvbox Light']
--scheme.background = 'red'
wezterm.gui.enumerate_gpus()
return {
    font_dirs = { '/usr/share/fonts' },
    --    disable_default_key_bindings = true,
    --font = wezterm.font('Sauce Code Pro Mono Nerd Font'),
    font = wezterm.font('Victor Mono Nerd Font', { weight = "Medium" }),
    font_size = 15.3,
    window_background_opacity = 0.90,
    color_scheme = "Afterglow",
    default_prog = { '/usr/bin/zsh', '-l' },
    colors = {

        foreground = '#d0d0d0',
        --background = '#000000',
        background = "#606060",
    },
}

Expected Behavior

No response

Logs

Debug Overlay
wezterm version: 20230212-103106-a5c2b1f3 x86_64-unknown-linux-gnu
Window Environment: Wayland
OpenGL version: NVIDIA GeForce RTX 3090/PCIe/SSE2 4.6.0 NVIDIA 525.89.02
Enter lua statements or expressions and hit Enter.
Press ESC or CTRL-D to exit
17:56:17.218 WARN wezterm_term::terminalstate::performer > Unhandled OSC  12
17:56:17.218 WARN wezterm_term::terminalstate::performer > Unhandled OSC  12
17:56:17.893 WARN wezterm_term::terminalstate::performer > Unhandled OSC  12
17:56:18.232 WARN wezterm_term::terminalstate::performer > Unhandled OSC  12

Anything else?

No

@MZauchner MZauchner added the bug Something isn't working label Feb 17, 2023
@wez wez added the Wayland label Feb 17, 2023
@gegoune
Copy link

gegoune commented Feb 18, 2023

I think I am getting the same issue on MacOS (delay). It must have started pretty recently as I have never noticed that before.

wezterm version: 20230217-120342-3b39aa55 x86_64-apple-darwin
Window Environment: macOS 13.2.1 (22D68)
OpenGL version: WebGPU: name=AMD Radeon Pro 555X, device_type=DiscreteGpu, backend=Metal, vendor=0, device=0

Lag is noticable/only occurs after few moments of inactivity.

Lag is gone when

  front_end = 'WebGpu',
  webgpu_power_preference = 'HighPerformance',

are removed from configuration.

Also, I am not getting those OSC warnings, only message printed in debug overlay is

00:34:01.193 WARN wezterm_term::terminalstate > unhandled DecPrivateMode SetDecPrivateMode(Unspecified(1034))

@MZauchner
Copy link
Author

If the two settings you mentioned to the configuration, the lag becomes significantly worse, to the point where wezterm basically freezes.
Without the settings it appears as if the input processing is somehow behind the rendering. If I smash a key several times, at some point it registers all the keystrokes I put in previously. For example, sometimes I have to press backspace several times before something happens, and then, the amount of characters that are deleted at once align with the amount of times I pressed backspace.

@DeafeX
Copy link

DeafeX commented Mar 3, 2023

I was having the same problem as you, but on a nvidia card. I fixed it by launching wezterm with:
wezterm start --always-new-process

Btw, I'm also using webgpu front end.

@MZauchner
Copy link
Author

I was having the same problem as you, but on a nvidia card. I fixed it by launching wezterm with: wezterm start --always-new-process

Btw, I'm also using webgpu front end.

Unfortunately that doesn't fix it for me. I also tried different shells, just in case it's to do with one of my zsh plugins. But it even happens with sh.

@emctoo
Copy link

emctoo commented Mar 8, 2023

For my case, it's fixed when I changed front_end to OpenGL.

@wez wez changed the title Input lag when typing Input lag when typing when webgpu is enabled Apr 16, 2023
@wez
Copy link
Owner

wez commented Apr 16, 2023

This should be resolved now in main.

It typically takes about an hour before commits are available as nightly builds for all platforms. Linux builds are the fastest to build and are often available within about 20 minutes. Windows and macOS builds take a bit longer.

Please take a few moments to try out the fix and let me know how that works out. You can find the nightly downloads for your system in the wezterm installation docs.

If you prefer to use packages provided by your distribution or package manager of choice and don't want to replace that with a nightly download, keep in mind that you can download portable packages (eg: a .dmg file on macOS, a .zip file on Windows and an .AppImage file on Linux) that can be run without permanently installing or replacing an existing package, and can then simply be deleted once you no longer need them.

If you are eager and can build from source then you may be able to try this out more quickly.

@wez wez added the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Apr 16, 2023
@bleomycin
Copy link

I'm still experiencing the exact behavior OP described on arch linux, wayland, KDE, nvidia gpu drivers, and wezterm 20230423-141957-9ec79733 run via the WezTerm-nightly-Ubuntu20.04.AppImage

Colors are substantially off as well as very noticeable input lag. Happy to provide any logs that could be helpful!

@wez
Copy link
Owner

wez commented Apr 24, 2023

@bleomycin Some users have reported performance problems when running the AppImage that are not present when using packages built for their system. Can you try a non-flatpak, non-appimage package to rule that out?

@bleomycin
Copy link

@bleomycin Some users have reported performance problems when running the AppImage that are not present when using packages built for their system. Can you try a non-flatpak, non-appimage package to rule that out?

Happy to! I just tested again with the binary from "wezterm-nightly.Ubuntu20.04.tar.xz" as well as compiling the latest from master:

cargo run --release --bin wezterm -- --version
wezterm 20230423-174840-5c2e3fe8

Both of these versions, as well as the latest version available from the arch repo all exhibit the same behavior:

wezterm --version
wezterm 20230408-112425-69ae8472

@gegoune
Copy link

gegoune commented Apr 24, 2023

I am also still experiencing it on

  front_end = 'WebGpu',
  webgpu_power_preference = 'HighPerformance',
wezterm version: 20230420-215610-ff153a92 x86_64-apple-darwin
Window Environment: macOS 13.3.1 (22E261)
WebGPU: name=AMD Radeon Pro 555X, device_type=DiscreteGpu, backend=Metal, vendor=0, device=0

Any kids/debug information I can provide on top of that?

@wez
Copy link
Owner

wez commented Apr 24, 2023

I'm going to close this issue as the one that we were tracking with this has been resolved.

If you are using macOS, please open a separate issue: the original issue was entirely Wayland specific and there's no way it can be the same root cause.

If you are using nvidiva + wayland note that there are several open issues:

If you are experiencing an issue, please open a new issue so that we can work through it effectively.

@wez wez closed this as completed Apr 24, 2023
@github-actions
Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. Wayland
Projects
None yet
Development

No branches or pull requests

6 participants