flightlessmango / MangoHud

A Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more. Discord: https://discordapp.com/invite/Gj5YmBb
MIT License
6.11k stars 263 forks source link

Wrong GPU device usage #1293

Open ngraham20 opened 2 months ago

ngraham20 commented 2 months ago

Describe the bug A clear and concise description of what the bug is.

The GPU usage % that is displayed is of the wrong device. I have a dGPU and an iGPU, and while the gpu_name shows the dedicated GPU, the percentage is of the iGPU.

List relevant hardware/software information

To Reproduce Steps to reproduce the behavior: Run Mangohud

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. The percentage MangoHUD shows against AMDGPU top. The Graphics card shown is labeled next to Info image image

Lassebq commented 1 month ago

Have you already tried using pci_dev config option?

emansom commented 4 weeks ago

Also experiencing this on a RX 7600 (CPU+iGPU) + RX 580 (GPU) combo. Weirdly enough it only seems to trigger in one game of mine: Need for Speed Most Wanted 2012, where as in GTA 5 it picks up the RX 580 fine.

All Lutris settings across both games matched, no PRIME enabled.

I think it has to with the way the latest GNOME version uses the iGPU to render by default for all applications, and MangoHud incorrectly assuming that this then also applies to DXVK.

--

Update: Ensured GNOME runs on the primary GPU (RX 580) with a udev rule. More info here:

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1562

/etc/udev/rules.d/61-mutter-primary-gpu.rules

ENV{DEVNAME}=="/dev/dri/card0", TAG+="mutter-device-preferred-primary"

Could use some better matching logic, e.g. vendor and device ID.

GNOME Settings now correctly informs me it's running on the RX 580. However, MangoHud still favors the Radeon Integrated Graphics for some reason, while it's not being rendered there.

emansom commented 4 weeks ago

nvtop has some sort mechanism to determine which application belongs to which GPU, could this be leveraged in MangoHud to identify which GPU is rendering the game?

flightlessmango commented 4 weeks ago

Yes it is possible to figure out which GPU is being used using said method. I'm leaning towards implementing that or just going ahead and support multiple GPUs

ngraham20 commented 4 weeks ago

Have you already tried using pci_dev config option?

It does appear that using the pci_dev config option has the desired result. Goverlay made that change for me, so I hadn't realized I was utilizing that feature