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.54k stars 291 forks source link

Mangohud doesn't work with vkcube-wayland ? #1354

Open SpidFightFR opened 5 months ago

SpidFightFR commented 5 months ago

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

List relevant hardware/software information

To Reproduce Steps to reproduce the behavior:

  1. execute mangohud vkcube-wayland
  2. Cannot connect to wayland.
    Exiting ...

Expected behavior [should work, it works on my laptop with same specs]

Screenshots N.A

Additional context works with vkcube classic (xwayland).

SpidFightFR commented 5 months ago

for some reasons when i rollback to 0.7.0 release it works...

TeusLollo commented 5 months ago

Those are also relevant for testing purposes:

https://github.com/void-linux/void-packages/issues/50846#issuecomment-2171801496 https://github.com/void-linux/void-packages/issues/50846#issuecomment-2171872642

The above were on an RX580 GPU with mesa-vulkan-radeon-24.1.1_2 userspace driver package on a linux6.6 kernel version.

flightlessmango commented 5 months ago

can't repro this. works fine on my system with sway

shmerl commented 5 months ago

Works for me in Plasma 5.27.11. Could be your compositor specific issue.

SpidFightFR commented 4 months ago

Hey there, i finally found the issue: amdvlk was taking a higher priority over mesa RADV.

So i had 2 solutions:

Force RADV By default and force AMDVLK on a per-app basis (preferred method)

  1. edit /etc/environment
  2. add VK_ICD_FILENAMES='/usr/share/vulkan/icd.d/radeon_icd.x86_64.json'
  3. reboot
  4. If you need an app with AMDVLK, in my case, CP77 works better in path tracing with AMDVLK, then use env VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_icd64.json on each game.

Uninstall AMDVLK and only keep mesa radv.

  1. [See with your distro Package manager]
SpidFightFR commented 3 months ago

The issue got back, despite amdvlk being absent.

Although this time, it happens only when i launch mangohud as an executable (e.g : mangohud vkcube-wayland doesn't work), however when i run it as an env var, it works (e.g: env MANGOHUD=1 vkcube-wayland works).

Something is wrong somewhere...

Also i do note it does works both ways on xwayland apps (e.g: regular vkcube).

And it doesn't work as well on other wayland native apps (e.g: Minecraft with Vulkanmod, which adds native wayland support to the game).

I hope this will help!

EDIT: is there a way for me to enable more verbose inputs or enable logs to facilitate bug tracking?

shmerl commented 3 months ago

If you want to check what's going on, run it with VK_LOADER_DEBUG=all.

SpidFightFR commented 3 months ago

If you want to check what's going on, run it with VK_LOADER_DEBUG=all.

Hey, i had the occasion to try and i get this:

$ env VK_LOADER_DEBUG=all mangohud vkcube-wayland
INFO:             Vulkan Loader Version 1.3.268
Cannot connect to wayland.
Exiting ...
shmerl commented 3 months ago

Not sure, the only difference is that script is doing some LD_PRELOAD stuff which normal Vulkan loader isn't. You don't need it except for OpenGL, so look into that script, it has some DISABLE_LD_PRELOAD and etc.

SpidFightFR commented 3 months ago

Not sure, the only difference is that script is doing some LD_PRELOAD stuff which normal Vulkan loader isn't. You don't need it except for OpenGL, so look into that script, it has some DISABLE_LD_PRELOAD and etc.

yep can confirm, changing disable_preload=false to disable_preload=true makes it work.

EDIT: in my case, i just added java below cs2.sh. It now works. Hope that helps, adding vkcube-wayland works as well !

hmaarrfk commented 2 months ago

Hope that helps, adding vkcube-wayland works as well !

I'm wondering if preload is necessary at all...

maybe we can add a flag? similar to the --version?

diff --git a/bin/mangohud.in b/bin/mangohud.in
index 96468bd..d805d5a 100755
--- a/bin/mangohud.in
+++ b/bin/mangohud.in
@@ -32,6 +32,11 @@ command_line="$*"
 # flag for disable_preload
 disable_preload=false

+if [ "$1" = "--disable-preload" ]; then
+    disable_preload=true
+    shift
+fi
+
 # Check if the script name or any of the executables in DISABLE_LD_PRELOAD are in the command line
 for exe in $DISABLE_LD_PRELOAD; do
     if echo "$command_line" | grep -q "$exe"; then
Etaash-mathamsetty commented 2 months ago

is this fixed in mangohud-git? I can't test it's been working fine on my machine since forever

SpidFightFR commented 2 months ago

I'm sorry, i'm unable to test the git build, especially since this issue happens on production install... 😕

shmerl commented 2 months ago

It's a bug in the script, not in the library. Simply check if the script stopped doing the pointless LD preloading in Vulkan case. Or don't use the script in the first place, it's unnecessary in Vulkan case anyway and is only useful for OpenGL.

SpidFightFR commented 2 months ago

It's a bug in the script, not in the library. Simply check if the script stopped doing the pointless LD preloading in Vulkan case. Or don't use the script in the first place, it's unnecessary in Vulkan case anyway and is only useful for OpenGL.

when using the env var it doesn't seem to use the script, in that case: yes it does work. EDIT: it does work, even with the 0.7.2 release build. Also as mentioned here, i modified the script, adding the processes to the "disabled ld preloading list" also fixes the issue.

So in that case, the default for this LD preloading system should be disabled, and only enabled for OGL if it's only important for OGL...

Etaash-mathamsetty commented 2 months ago

I'm sorry, i'm unable to test the git build, especially since this issue happens on production install... 😕

that's ok, what I meant to say was that it works on 0.7.2 for me. -git overloads different functions so it might alleviate the problem