hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.76k stars 840 forks source link

Version 0.38 introduces high GPU use after a while #5426

Closed charlesneimog closed 5 months ago

charlesneimog commented 5 months ago

Hyprland Version

System/Version info ```sh Hyprland, built from branch HEAD at commit 3875679755014997776e091ff8903acfb311dd2f (props: bump ver to 0.38.0). Date: Mon Apr 1 18:30:37 2024 Tag: v0.38.0 flags: (if any) System Information: System name: Linux Node name: arch Release: 6.6.23-1-lts Version: #1 SMP PREEMPT_DYNAMIC Wed, 27 Mar 2024 07:47:20 +0000 GPU information: 00:02.0 VGA compatible controller [0300]: Intel Corporation CometLake-U GT2 [UHD Graphics] [8086:9b41] (rev 02) (prog-if 00 [VGA controller]) os-release: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo plugins: ```

Bug or Regression?

Bug

Description

After reboot and a while using it, Hyprland starts to get a very high GPU use (for me 60%).

The GPU is continuos when I am moving my mouse (60%). Maybe related with https://github.com/hyprwm/Hyprland/issues/4670 (I also had this problem)

How to reproduce

Starts Hyprland and use it for a while (5 minutes). Then it starts.

Crash reports, logs, images, videos

No response

vaxerski commented 5 months ago

if it's just 5 minutes, please do a git bisect

Tristan971 commented 5 months ago

I do observe a similar bug (on n~o~vidia, yes my bad), though it takes >1h rather than 5 minutes to trigger.

Results in high VRAM use and GPU load nonetheless (this is stats with just this Github tab on one workspace and Kitty on another):

$ nvidia-smi
Thu Apr  4 23:25:14 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.67                 Driver Version: 550.67         CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 3080        Off |   00000000:0A:00.0  On |                  N/A |
| 30%   53C    P0             84W /  320W |    6597MiB /  10240MiB |      1%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      3778      G   Hyprland                                     5015MiB |
|    0   N/A  N/A      4323      G   Xwayland                                      855MiB |
|    0   N/A  N/A      4351      G   ...undedTabs --variations-seed-version         80MiB |
|    0   N/A  N/A     72948      G   ...yOnDemand --variations-seed-version         92MiB |
|    0   N/A  N/A    159710      G   ...erProcess --variations-seed-version        232MiB |
|    0   N/A  N/A    212278      G   ...yOnDemand --variations-seed-version         68MiB |
|    0   N/A  N/A    329770      G   kitty                                          49MiB |
+-----------------------------------------------------------------------------------------+

So far I only had it happen with Jetbrains IDEs after a while (1-2 hours), but it is quite consistent at that given enough time. Unfortunately I don't have the time to bisect it given the timeranges. But it is a regression in v0.38.0 as it didn't happen for the past few months of me using Hyprland with these same applications.

Now though I can't bisect it, I experimented a bit and maybe extra info helps.

The workspace in which the issue happened is forever poisoned

Moving any other application there causes that application to drop frames too

The workspace affects other workspaces on the same monitor

But only if that affected workspace is empty.

In this case I have 4 workspaces and 2 monitors with the layout:

When W1 is poisoned, W3 doesn't drop frames at first despite sharing a monitor.

But if I close everything in W1, then W3 is also affected, and opening an empty kitty window on W1 "fixes" W3 (W1 remains poisoned).

vaxerski commented 5 months ago

maybe try -git?

Tristan971 commented 5 months ago

Fair point, I'll give it a try and report back.

Stock44 commented 5 months ago

This is happening to me too, altough I'm using integrated Intel graphics instead of nvidia. It takes around 30 mins for the bug to begin appearing. It behaves exactly as described by @Tristan971 , the workspace remains tainted until I close and reopen Hyprland.

Tristan971 commented 5 months ago

maybe try -git?

Unfortunately it still happens on 0569b9c30099be32f5e0d3b56a050059b9e5a8c1

vaxerski commented 5 months ago

I'll need a bisect then

Tristan971 commented 5 months ago

Understandable, but at 1-4h per occurence here, I am not really close to having the time for it until I find a way to speed it up :/

vaxerski commented 5 months ago

op said 5 mins, someone else 30 mins. That sounds very bisectable.

I am assuming this is a regression here as well, considering the sudden report from multiple people

Tristan971 commented 5 months ago

Yup, just wanted to make it clear to others affected to not wait on me to do it. If it was 5 min I could otherwise at least bisect so far as the builds I get from the COPR I use.

If no one else does it, is there some alternative debugging approach that could help? (perf, strace, enabling extra logs and looking at them when the issue starts manifesting, ...).

charlesneimog commented 5 months ago

I was trying to bisect, but when I compiled the tag v0.38.0 I hadn't the bug, and I couldn't find the high GPU usage. I was using the version from aur also (not the git version). Seems that when I compile it, I don't have the bug.

🤷‍♂️

vaxerski commented 5 months ago

@Tristan971 if it happens when compiling manually, we embed tracy and you can use it to profile provided you enable it at compile time with USE_TRACY and optionally USE_TRACY_GPU for doing gpu profiling too

vaxerski commented 5 months ago

@charlesneimog soo... you're unable to reproduce anymore? Or is there a specific way you can get hyprland to do it again?

charlesneimog commented 5 months ago

Sorry for the noise, I am yet trying to understand this. I can reproduce with aur version.

Using resources (that may not be the best but I have very similar values with intel_gpu_top)

See the history of GPU use from aur and version compiled from tag 0.38. After 10min of use each...

Obs.: From aur the high use starts fast.

Aur paru -S hyprland

1712320880_grim

Compiled using make all && sudo make install

The peaks here are workspace change and the print.

1712321306_grim

Tristan971 commented 5 months ago

I can reproduce with aur version.

Would be good to see how the pkgbuild looks on your end, then it should be reproducible with manual compilation (from what I remember of how the AUR works anyway)

If I'm right, it should be this one: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=hyprland-git&id=2ac9c86856e6984e8f9e1b8205699af68271e2ab

And thus use:

build() {
  cd Hyprland

  meson setup build \
    --prefix     /usr \
    --libexecdir lib \
    --sbindir    bin \
    --buildtype  release \
    --wrap-mode  nodownload \
    -D           b_lto=true \
    -D           b_pie=true \
    -D           default_library=shared \
    -D           xwayland=enabled \
    -D           systemd=enabled

  meson compile -C build
}

GH mirror: https://github.com/archlinux/aur/blob/2ac9c86856e6984e8f9e1b8205699af68271e2ab/PKGBUILD#L104-L120

charlesneimog commented 5 months ago

I am wrong again. It seems to happen with the version compiled also, but I need to use it for more time. For me at least, in aur build, it starts just faster. I little random, sorry for bad report.

I am using the version I built, and passed 1 hour I have the problem. But the GPU use is about 20% not 60% as I had (always different also.)

I will start bisect again, and use each commit for more time, I believe it will be more precise.

vaxerski commented 5 months ago

you can also reset in the pkgbuild if that's more convenient. Just gotta edit it every bisect step

joelmathewthomas commented 5 months ago

I was trying to bisect and was on commit 4ffcdc41 (HEAD) animations: fix layer slide with fade

But i just am not able to make the package

These are the errors i faced.

CMake Error at subprojects/udis86/CMakeLists.txt:15 (configure_file):
  configure_file Problem configuring file
Could not open input file: No such file or directory
Could not open input file: No such file or directory
Could not open input file: No such file or directory
Could not open input file: No such file or directory
-- Checking for module 'tomlplusplus'
--   Found tomlplusplus, version 3.4.0
-- Configuring incomplete, errors occurred!
make[1]: *** [Makefile:14: release] Error 1
make[1]: Leaving directory '/home/joel/Hyprland'
make: *** [Makefile:31: all] Error 2

Is there something i am doing wrong ?

I would very much like to be able to bisect this, to solve this asap.

thejch commented 5 months ago
CMake Error at subprojects/udis86/CMakeLists.txt:15 (configure_file):
  configure_file Problem configuring file

something wrong with the submodule did you do

git submodule update
git reset --hard --recurse-submodules
vaxerski commented 5 months ago

every time git bisect throws you onto a new commit (after you mark one as bad or good) do git reset --hard --recurse-submodules, and then compile

joelmathewthomas commented 5 months ago

Ok

joelmathewthomas commented 5 months ago

I did that and still no change.

Cloning into 'Hyprland'...
remote: Enumerating objects: 29892, done.
remote: Counting objects: 100% (7288/7288), done.
remote: Compressing objects: 100% (766/766), done.
remote: Total 29892 (delta 6900), reused 6741 (delta 6521), pack-reused 22604
Receiving objects: 100% (29892/29892), 65.57 MiB | 4.91 MiB/s, done.
Resolving deltas: 100% (23264/23264), done.
[joel@nitro5 ~]$ cd Hyprland/
[joel@nitro5 Hyprland]$ git bisect
fatal: need a command

usage: git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]
   or: git bisect (good|bad) [<rev>...]
   or: git bisect terms [--term-good | --term-bad]
   or: git bisect skip [(<rev>|<range>)...]
   or: git bisect next
   or: git bisect reset [<commit>]
   or: git bisect visualize
   or: git bisect replay <logfile>
   or: git bisect log
   or: git bisect run <cmd> [<arg>...]

[joel@nitro5 Hyprland]$ git bisect start
status: waiting for both good and bad commits
[joel@nitro5 Hyprland]$ git bisect good 1c460e98f870676b15871fe4e5bfeb1a32a3d6d8
status: waiting for bad commit, 1 good commit known
[joel@nitro5 Hyprland]$ git bisect bad 24734fbf1d341a725d3ed1192b9bf5f55828208f
Bisecting: 138 revisions left to test after this (roughly 7 steps)
[4ffcdc41ff8233a92f02c633475ac3472b0998df] animations: fix layer slide with fade
[joel@nitro5 Hyprland]$ git submodule update
[joel@nitro5 Hyprland]$ git reset --hard --recurse-submodules
HEAD is now at 4ffcdc41 animations: fix layer slide with fade
[joel@nitro5 Hyprland]$ make all && sudo make install
make clear
make[1]: Entering directory '/home/joel/Hyprland'
rm -rf build
rm -f ./protocols/*-protocol.h ./protocols/*-protocol.c
rm -rf ./subprojects/wlroots/build
make[1]: Leaving directory '/home/joel/Hyprland'
make release
make[1]: Entering directory '/home/joel/Hyprland'
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=/usr/local -S . -B ./build -G Ninja
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 13.2.1
-- The CXX compiler identification is GNU 13.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib/ccache/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/ccache/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Gathering git info
CMake Error at CMakeLists.txt:30 (add_subdirectory):
  The source directory

    /home/joel/Hyprland/subprojects/udis86

  does not contain a CMakeLists.txt file.

-- Setting up wlroots
-- Found WaylandScanner at /usr/bin/wayland-scanner
-- Found wayland-protocols at //usr/share/wayland-protocols
-- Configuring Hyprland in Release with CMake
-- Checking deps...
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.1.1")
-- Found OpenGL: /usr/lib/libOpenGL.so
-- Checking for modules 'wayland-server;wayland-client;wayland-cursor;wayland-protocols;cairo;libdrm;xkbcommon;libinput;pango;pangocairo;pixman-1;hyprlang>=0.3.2;hyprcursor'
--   Found wayland-server, version 1.22.0
--   Found wayland-client, version 1.22.0
--   Found wayland-cursor, version 1.22.0
--   Found wayland-protocols, version 1.34
--   Found cairo, version 1.18.0
--   Found libdrm, version 2.4.120
--   Found xkbcommon, version 1.7.0
--   Found libinput, version 1.25.0
--   Found pango, version 1.52.2
--   Found pangocairo, version 1.52.2
--   Found pixman-1, version 0.43.4
--   Found hyprlang, version 0.5.0
--   Found hyprcursor, version 0.1.5
-- Looking for execinfo.h
-- Looking for execinfo.h - found
-- Configuration supports execinfo
-- Looking for backtrace in execinfo
-- Looking for backtrace in execinfo - not found
-- XWAYLAND Enabled (NO_XWAYLAND not defined) checking deps...
-- Checking for module 'xcb'
--   Found xcb, version 1.16.1
-- SYSTEMD support is requested (NO_SYSTEMD not defined) checking deps...
-- Looking for systemd/sd-daemon.h
-- Looking for systemd/sd-daemon.h - found
-- Checking for module 'libsystemd'
--   Found libsystemd, version 255
-- Systemd found
-- Setting precompiled headers
-- Setting link libraries
Could not open input file: No such file or directory
Could not open input file: No such file or directory
Could not open input file: No such file or directory
Could not open input file: No such file or directory
-- Checking for module 'tomlplusplus'
--   Found tomlplusplus, version 3.4.0
-- Configuring incomplete, errors occurred!
make[1]: *** [Makefile:14: release] Error 1
make[1]: Leaving directory '/home/joel/Hyprland'
make: *** [Makefile:31: all] Error 2
vaxerski commented 5 months ago

I think you didnt git clone --recursive the hyprland repo. Also the git submodule updaye command is redundant

joelmathewthomas commented 5 months ago

Ok that did it. Ill bisect and let you know

joelmathewthomas commented 5 months ago
54376d7b5f88bffd96ce9ded26637d83d7aa95b1 is the first bad commit
commit 54376d7b5f88bffd96ce9ded26637d83d7aa95b1
Author: Vaxry <vaxry@vaxry.net>
Date:   Fri Mar 29 19:06:08 2024 +0000

    compositor: remove windows from fading out on destroy

    ref #5321

 src/Compositor.cpp | 2 ++
 1 file changed, 2 insertions(+)

This is what i got after bisecting.

For me , basically just a small task like opening a window or switching a workspace or changing focus, drastically drops the fps from 144fps to around 70 fps.

But before the commit 54376d7b5f88bffd96ce9ded26637d83d7aa95b1, after the animation renders and when there is no animations happening , on the screen , the fps returns to normal. But since commit 54376d7b5f88bffd96ce9ded26637d83d7aa95b1 , the fps gets fixed to half the refresh rate of the screen 72 (144/2) in my case.

Anyways I would like to note that , with an Intel iGPU, there is a very large frame drop with small animations ,which dont happen on AMD iGPU for me.

vaxerski commented 5 months ago

Thanks!

joelmathewthomas commented 5 months ago

Thanks

vaxerski commented 5 months ago

should be fixed with 159444c45b6fa87d250cf694233ce0213a4585bd and f8c22916ab369e13f027b717fa1e505337ec8fd4

I'll backport them and make 38.1 probably.

Tristan971 commented 5 months ago

Fyi I can confirm that the issue is fixed on my end!

Thanks for the quick turnaround both @joelmathewthomas for bisecting and @vaxerski for the patch :heart: