MangoHud icon indicating copy to clipboard operation
MangoHud copied to clipboard

Mangohud doesn't work with vkcube-wayland ?

Open SpidFightFR opened this issue 1 year ago • 16 comments

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

List relevant hardware/software information

  • Void-Linux
  • MangoHud 0.7.2
  • RX 7900XTX

To Reproduce Steps to reproduce the behavior:

  1. execute mangohud vkcube-wayland
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 avatar Jun 14 '24 11:06 SpidFightFR

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

SpidFightFR avatar Jun 14 '24 11:06 SpidFightFR

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.

TeusLollo avatar Jun 16 '24 20:06 TeusLollo

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

flightlessmango avatar Jun 20 '24 09:06 flightlessmango

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

shmerl avatar Jun 21 '24 22:06 shmerl

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 avatar Jun 29 '24 11:06 SpidFightFR

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?

SpidFightFR avatar Aug 12 '24 20:08 SpidFightFR

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

shmerl avatar Aug 12 '24 20:08 shmerl

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 ...

SpidFightFR avatar Aug 16 '24 08:08 SpidFightFR

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.

shmerl avatar Aug 16 '24 08:08 shmerl

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 !

SpidFightFR avatar Aug 16 '24 16:08 SpidFightFR

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

hmaarrfk avatar Sep 10 '24 12:09 hmaarrfk

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

Etaash-mathamsetty avatar Sep 14 '24 23:09 Etaash-mathamsetty

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

SpidFightFR avatar Sep 15 '24 10:09 SpidFightFR

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.

shmerl avatar Sep 15 '24 10:09 shmerl

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...

SpidFightFR avatar Sep 15 '24 10:09 SpidFightFR

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

Etaash-mathamsetty avatar Sep 15 '24 19:09 Etaash-mathamsetty

Assuming this has been resolved

flightlessmango avatar Mar 09 '25 12:03 flightlessmango