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.65k stars 830 forks source link

Low GPU usage, Low FPS in games #3094

Closed techyporcupine closed 1 year ago

techyporcupine commented 1 year ago

Hyprland Version

Hyprland, built from branch at commit 4a41d013a27c9919ed41a50c43c4224d8443a415

Bug or Regression?

Bug

Description

When playing different games, my dedicated GPU (Nvidia GT840M) may turbo up to its full clock speed for a couple seconds, before dropping to around the minimum clock speed (~135mhz). In both Gnome and Sway this issue is not present. Sorry if this issue has already been reported, I could not find one identical to this though.

How to reproduce

Launch a game on dedicated GPU, observe low FPS.

Crash reports, logs, images, videos

image Example shown: Minecraft launched via PrismLauncher, MangoHud showing clocks.

alspinu commented 1 year ago

What is your full spec? Did it work differently before under the same setup or hardware? Did something change since then apart from the hyprland version?

It sounds very similar to a bottle neck.

LE: I see the issue is not happening in sway.

Do you use a different set of env variables in sway and hyprland? Can you share them?

techyporcupine commented 1 year ago

This is the first time that I have attempted this with NixOS (23.05) and Hyprland. I only enabled sway for a quick test, so it was using a completely stock config. In Hyprland I didn't have any env vars set, but in attempt to troubleshoot this issue, I added the following ones:

        env = LIBVA_DRIVER_NAME,nvidia
        env = XDG_SESSION_TYPE,wayland
        env = WLR_NO_HARDWARE_CURSORS,1
techyporcupine commented 1 year ago

Sorry, I realize I didn't say my full spec. OS: NixOS 23.05 Host Device: Dell Latitude E7450 Kernel: 6.4.12 WM: Hyprland CPU: i7-5600U GPU (Integrated): Intel HD Graphics 5500 GPU (Dedicated): Nvidia Geforce 840M RAM: 8GB

techyporcupine commented 1 year ago

Updated to 9c4f776757d673e5fb73716c874afbe20c66f045, still not working.

Guanran928 commented 1 year ago

Can reproduce, issue is not present on Sway or GNOME. OS: NixOS GPU: nVidia GTX 1050Ti Mobile Hyprland version: (using nix flake)

Hyprland, built from branch  at commit 4a41d013a27c9919ed41a50c43c4224d8443a415  ().
Tag: ?

flags: (if any)
debug
techyporcupine commented 1 year ago

Did you have to do anything special to get it to have this issue? Mine is also built using nix flakes.

Guanran928 commented 1 year ago

Did you have to do anything special to get it to have this issue? Mine is also built using nix flakes.

No, I got this issue after updating Hyprland.

techyporcupine commented 1 year ago

Do you know what version the issue started at?

Guanran928 commented 1 year ago

Do you know what version the issue started at?

Not really, I was using Sway for the past few days.

techyporcupine commented 1 year ago

Ok, good to know it's not just me with the issue.

Guanran928 commented 1 year ago

Ok, good to know it's not just me with the issue.

The nixpkgs version of Hyprland works fine for me, maybe you could try using that temporally.

techyporcupine commented 1 year ago

Did you just override the package with the one in nixpkgs?

techyporcupine commented 1 year ago

Do you think it may be worth it to roll back a couple versions and progress forward to see what version caused this issue?

memchr commented 1 year ago

Try git bisect

Is this specific to certain games?

techyporcupine commented 1 year ago

I'm not sure that I know enough to debug using that, but I can attempt it. I'll need to find a version that does not have the issue first.

Is this specific to certain games

As far as I know, it is not. I have only tried it in two "games". One was Minecraft as I noted above, and the other was Dolphin Emulator, both exhibited the same issue, so I assume it is not just an issue with one game.

memchr commented 1 year ago

my dedicated GPU (Nvidia GT840M)

Given NVIDIA's hostility to Linux, I'd rather check if it's a driver issue first.

techyporcupine commented 1 year ago

It worked on Sway though, so I would be inclined to say it's not, but I'm not sure if I'm totally correct on that. And according to @Guanran928 it works with the version of Hyprland in nixpkgs.

techyporcupine commented 1 year ago

Just found something new that may relate to this issue. I noticed I also got poor video performance launching Minecraft using my integrated GPU, which is somewhat expected, but it was also around the 10-20ish fps mark that I saw on my dedicated GPU. I decided to look further and noticed that Minecraft said the render device was "llvmpipe", when I was expecting it to be "Mesa Intel(R) HD Graphics 5500" that is listed when Minecraft is launched in Sway. Could there be some relation between these two issues?

GrabbenD commented 1 year ago

This is why I stopped using NixOS a couple of months ago. It's a reoccuring bug or more precisely a design flaw So much for reproducible builds

Here'a the best workaround fix: https://github.com/hyprwm/Hyprland/issues/2170#issuecomment-1528163470

techyporcupine commented 1 year ago

I have attempted adding inputs.nixpkgs.follows = "nixpkgs-unstable"; already.

techyporcupine commented 1 year ago

Actually, if its an issue with a MESA mismatch, I have to use nixpkgs, not nixpkgs-unstable because my system is on stable.

GrabbenD commented 1 year ago

Yes Anyhow, the proper fix is to update flake.lock in Hyprland repo Pinging @fufexan

techyporcupine commented 1 year ago

The reason I was using the unstable repos was because wayland-protocols is too old for Hyprland in the stable repo.

techyporcupine commented 1 year ago

Is my only real solution to use NixOS Unstable?

techyporcupine commented 1 year ago

This issue is technically not fixed for NixOS Stable users, but a good fix for now is using NixOS Unstable (I was planning on doing so already, but this jumpstarted that) I will close this issue now.