Open nonetrix opened 5 months ago
I haven't tried on commit before XWayland rewrite, will in a moment. But I did this on GNOME a while back with no real issues even on Wayland pretty sure on NVIDIA
Issue persists before rewrite + crash
And on a perhaps unrelated side note what in God's holy name has happened to my login screen?
Can't reproduce issue in Sway, I suspect something is hogging one of the threads or something
I am able to reproduce this issue with FL Studio 2024 in wine on Hyprland 0.42.0.
System Info and Version
Like OP mentioned, a project of sufficient size must be loaded for the effect to become noticeable. However, it is still observable in CPU monitoring tools even without, as unlike what OP described, I can pinpoint the lag to Hyprland pinning a single CPU core to 100% whenever the mouse cursor is moved (similar to #3747, however without the high idle usage). This only lags the wm when FL Studio is running, otherwise the passive CPU load tends to stay within a 20%-60% single core load while moving the cursor only, thus not impacting framerates.
The project I used to test this has a ~30% CPU consumption for the FL Studio process, distributed across all 16 threads for an average system load of around 2%. Hyprland itself will idle between 0.6% and 1.3% in htop when cursor is not moved, even with FL Studio running.
FL Studio 21 also showed the same behavior in testing.
I have tried to narrow down the issue further, but to little success. The only other potential lead I found was a lot of Hyprland log spam when opening the test project.
I was successfully using FL Studio (then 21) last summer with Hyprland, however, I cannot remember the last known good version I can confirm did not have this issue. A bisection across this timeframe is infeasible for me because Hyprland has had breaking config changes across this period.
I decided to post here because the issue appears to be fundamentally the same, at least at face value. It could however also simply be #3747 presenting itself in a new way. Please let me know if there is anything else I can do that may help in resolving this problem.
After playing around a bit more, I noticed two more interesting behaviors:
Maybe @nonetrix can confirm whether this behavior is consistent with their observations, otherwise this may be a separate issue.
(1) I swear I read a similar sounding report somewhere before while trying to find information on this issue. If I find it again, I'll edit this comment with a link. EDIT: Literally found it seconds after posting smh (#7294)
I have got another small update. In what was perhaps a sudden bout of idiocy, I decided to compile Hyprland from source with the if branch at src/managers/input/InputManager.cpp#327
patched out. This breaks window focusing with the mouse (duh), however, it resolves the high CPU / cursor lag issue when running FL Studio in another workspace. Very large projects such as the NewStuff demo project will still lag while inside the application window, but switching to other workspaces will no longer negatively affect the performance. Lighter projects such as the one I was using for testing previously are entirely fixed.
While this isn't a usable workaround, it does point in a general area. I am still trying to wrap my head around what the code inside that branch is supposed to do (besides the obvious finding a window to focus bit), and the fact vscode cpptools
has an aneurysm every time I try and open the repository folder is slowing me down a lot. But with some trial and error I might be able to narrow it down further to a specific function call.
EDIT: It's the call to Compositor::vectorToWindowUnified()
in https://github.com/hyprwm/Hyprland/blob/main/src/managers/input/InputManager.cpp#L353
Also tbf, this probably results in pFoundWindow
being null most of the time and thus skips a bunch of stuff further down. I have not yet done nearly enough debugging to be able to say anything with certainty.
EDIT 2: All I can say for certain is that with the demo project, the length of m_vWindows
jumps up to over 600. Still not a terribly large number though...
I have found a workaround... sort of. From my extremely limited knowledge of display server magic, it seems like to me xwayland is spamming subwindows for every single plugin in the project file. Even if this behavior is intentional, it does not appear to be very useful. Using the experimental wayland native graphics backend for wine, the size of m_vWindows
drops from 622 to 6 with the same test setup and the high CPU consumption and lag is gone:
DISPLAY= wine64 FL64.exe
This is not without its caveats. I am using wine-staging
so if you are not, your mileage may vary. Menus are invisible when in fullscreen and open as separate windows otherwise. Some of this insanity may be addressable with windowrules but as it stands, this renders the application entirely unusable.
Based on this analysis, my naive interpretation of the issue is thus as follows: xwayland is spamming the compositor with new subwindows, the code path converting mouse coordinates to window handles isn't setup to scale along with this and the whole thing grinds to a halt. I can see three potential solutions to this problem:
This could all be completely wrong. I do not know what I'm doing or talking about.
Ok actual workaround time, get ready for the jank:
DISPLAY= wine64 /path/to/FL64.exe
windowrulev2 = float,class:^(fl64.exe)$ # Make all FL Windows floating by default (for menus)
windowrulev2 = move cursor, class:^(fl64.exe)$,title:^()$ # Make submenus spawn at cursor location (most of the time)
Now you should be able to use menus, though the placement will be slightly different. Also, the cursor will jump into the center of the screen randomly, but that is probably a different bug entirely. Cursor should no longer lag.
EDIT:
EDIT 2: Fixed via updated window rule above.
Key repeating will break things. Turn it off in the Hyprland config file if you use the typing keyboard virtual midi device. Probably best to make a keybind for this as well.
Remember that all menus are now floating windows, so you can grab that shit and move it to wherever you want in case a menu spawns under the screen or something similar.
No solution yet, probably a bug in wine-wayland driver. Just press fullscreen keybind again and it should unfreeze.
EDIT 3:
Again no solution yet, no idea what is up with this one. However, if you experience weird bugs with UI elements not being responsive in a certain area of the screen, it's probably an invisible WaveCandy window that is in the way. Right-click to bring up the menu and close it.
I'll look into it again soon btw just been putting it off honestly
I have the same problem with Enterprise Architect using Wine with Hyprland. The lag is caused by very high cpu usage when moving the cursor. Strangely with the touchpad the cpu usage is high but much less than using an external mouse. I confirm that @fredi-68's workaround works but there are several usability problems.
System Info and Version
System/Version info
```sh ♥ ❯ hyprctl systeminfo -c Hyprland, built from branch at commit 553232a3e4c112c8511309e6b685cb614895e714 (). Date: 2024-05-25 Tag: , commits: flags: (if any) System Information: System name: Linux Node name: nixos Release: 6.9.1 Version: #1-NixOS SMP PREEMPT_DYNAMIC Fri May 17 10:18:09 UTC 2024 GPU information: 09:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] [1002:73bf] (rev c3) (prog-if 00 [VGA controller]) os-release: ANSI_COLOR="1;34" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUILD_ID="24.11.20240524.bfb7a88" DOCUMENTATION_URL="https://nixos.org/learn.html" HOME_URL="https://nixos.org/" ID=nixos IMAGE_ID="" IMAGE_VERSION="" LOGO="nix-snowflake" NAME=NixOS PRETTY_NAME="NixOS 24.11 (Vicuña)" SUPPORT_URL="https://nixos.org/community.html" VERSION="24.11 (Vicuña)" VERSION_CODENAME="vicuña" VERSION_ID="24.11" plugins: hyprsplit by shezdy ver 1.0 ======Config-Start====== Config File: /home/noah/.config/hypr/hyprland.conf: Read Succeeded exec-once = /nix/store/bnipzdfv788l7yvgn7k7s7gp76sd1zpz-dbus-1.14.10/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target plugin=/nix/store/35mw5a8w380q08ga51l6y50vj1pmvvgk-hyprsplit-0.1/lib/libhyprsplit.so $mod=SUPER debug { disable_logs=false enable_stdout_logs=true } decoration { blur { enabled=true passes=3 size=5 } blurls=bar-0 blurls=bar-1 blurls=launcher blurls=notifications0 blurls=notifications1 blurls=mpris rounding=8 } device { name=wacom-intuos-s-pen } dwindle { preserve_split=true } general { border_size=2 col.active_border=rgba(74c7ecff) col.inactive_border=rgba(1e1e2eff) gaps_in=5 gaps_out=10 } input { accel_profile=flat follow_mouse=1 mouse_refocus=false } misc { disable_hyprland_logo=true } animation=workspaces, 1, 5, default, slidevert animation=windows, 1, 5, default, slide animation=layers, 1, 5, default, slide bind=, XF86AudioPlay, exec, playerctl play-pause bind=, XF86AudioNext, exec, playerctl next bind=, XF86AudioPrev, exec, playerctl previous bind=CTRL, Print, exec, satty-shot bind=, Print, exec, hyprshot -m output -o ~/Pictures/Screenshots bind=$mod, p, exec, wl-copy $(hyprpicker) bind=$mod, h, movefocus, l bind=$mod, l, movefocus, r bind=$mod, k, movefocus, u bind=$mod, j, movefocus, d bind=$mod SHIFT, h, movewindow, l bind=$mod SHIFT, l, movewindow, r bind=$mod SHIFT, k, movewindow, u bind=$mod SHIFT, j, movewindow, d bind=$mod, slash, togglesplit bind=$mod, mouse_down, split:workspace, e-1 bind=$mod, mouse_up, split:workspace, e+1 bind=$mod, t, togglefloating bind=$mod, c, killactive bind=$mod, q, exec, shutdown-menu bind=$mod, B, exec, firefox bind=$mod, y, exec, kitty -e yazi bind=alt, f4, exec, hyprctl kill bind=$mod, Return, exec, kitty bind=$mod, Space, exec, fuzzel bind=$mod, E, exec, bemoji -n bind=$mod, a, exec, kitty -e ollama run mixtral bind=$mod SHIFT, a, exec, llm-actions bind=$mod, 1, split:workspace, 1 bind=$mod SHIFT, 1, split:movetoworkspace, 1 bind=$mod, 2, split:workspace, 2 bind=$mod SHIFT, 2, split:movetoworkspace, 2 bind=$mod, 3, split:workspace, 3 bind=$mod SHIFT, 3, split:movetoworkspace, 3 bind=$mod, 4, split:workspace, 4 bind=$mod SHIFT, 4, split:movetoworkspace, 4 bind=$mod, 5, split:workspace, 5 bind=$mod SHIFT, 5, split:movetoworkspace, 5 bind=$mod, 6, split:workspace, 6 bind=$mod SHIFT, 6, split:movetoworkspace, 6 bind=$mod, 7, split:workspace, 7 bind=$mod SHIFT, 7, split:movetoworkspace, 7 bind=$mod, 8, split:workspace, 8 bind=$mod SHIFT, 8, split:movetoworkspace, 8 bind=$mod, 9, split:workspace, 9 bind=$mod SHIFT, 9, split:movetoworkspace, 9 bind=$mod, 0, split:workspace, 10 bind=$mod SHIFT, 0, split:movetoworkspace, 10 binde=, XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 1%+ binde=, XF86AudioLowerVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 1%- binde=$mod CTRL, l, resizeactive, 10 0 binde=$mod CTRL, h, resizeactive, -10 0 binde=$mod CTRL, k, resizeactive, 0 -10 binde=$mod CTRL, j, resizeactive, 0 10 bindm=$mod, mouse:272, movewindow bindm=$mod, mouse:273, resizewindow exec-once=ags exec-once=fcitx5 exec-once=wpaperd exec-once=mpv --no-video --volume=150 /nix/store/ag6v7p7x8ksxirkyqjl9xfsmhzr45w31-start.wav layerrule=ignorealpha, bar-0 layerrule=ignorealpha, bar-1 layerrule=ignorealpha, notifications0 layerrule=ignorealpha, notifications1 layerrule=ignorealpha, mpris layerrule=ignorealpha, launcher layerrule=noanim,selection monitor=DP-2, 1920x1200, 1920x0, 1 monitor=DP-1, 1920x1080@165, 0x0, 1, vrr, 1 windowrulev2=noanim, class:^(com.gabm.satty)$ windowrulev2=size 640 360, title:(Picture-in-Picture) windowrulev2=pin, title:^(Picture-in-Picture)$ windowrulev2=move 1906 14, title:(Picture-in-Picture) windowrulev2=float, title:^(Picture-in-Picture)$ ======Config-End======== ```Bug or Regression?
Bug
Description
Trying to use FLStudio in Wine running on XWayland inside Bottles Flatpak for some reason makes Hyprland lag like crazy, not sure what is going on or how to debug this really. It should be noted that CPU usage or GPU usage doesn't go up much but the desktop lags like mad regardless, also FLStudio itself seems largely uneffected. My L somewhat for using proprietary software for audio stuff, but should be fixed
How to reproduce
I'm awake
template is enough)Hopefully should be able to reproduce with trial version as I imagine most don't have a license
Crash reports, logs, images, videos
https://github.com/hyprwm/Hyprland/assets/45698918/9e2c6b28-970e-480e-9805-098e26368e3f