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.41k stars 286 forks source link

Getting segmentation fault when using with gamescope #822

Closed hartmark closed 1 year ago

hartmark commented 2 years ago

I'm using latest from main on arch.

I get segmentation fault when used with gamescope:

% AMD_VULKAN_ICD=RADV gamescope glxgears
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
[2022-08-17 01:15:12.937] [MANGOHUD] [info] [config.cpp:118] skipping config: '/usr/bin/MangoHud.conf' [ not found ]
[2022-08-17 01:15:12.937] [MANGOHUD] [info] [config.cpp:118] skipping config: '/home/markus/.config/MangoHud/gamescope.conf' [ not found ]
[2022-08-17 01:15:12.937] [MANGOHUD] [info] [config.cpp:123] parsing config: '/home/markus/.config/MangoHud/MangoHud.conf'
vulkan: selecting physical device 'AMD RADV VEGA10': queue family 1
vulkan: physical device supports DRM format modifiers
[2022-08-17 01:15:12.998] [MANGOHUD] [error] [file_utils.cpp:43] Error opening directory '/sys/class/drm/card0-HDMI-A-1/device/hwmon/': No such file or directory
[2022-08-17 01:15:12.998] [MANGOHUD] [error] [file_utils.cpp:43] Error opening directory '/sys/class/drm/card0-DVI-D-1/device/hwmon/': No such file or directory
[2022-08-17 01:15:12.998] [MANGOHUD] [error] [file_utils.cpp:43] Error opening directory '/sys/class/drm/card0-DP-2/device/hwmon/': No such file or directory
[2022-08-17 01:15:12.998] [MANGOHUD] [error] [file_utils.cpp:43] Error opening directory '/sys/class/drm/card0-HDMI-A-2/device/hwmon/': No such file or directory
[2022-08-17 01:15:12.998] [MANGOHUD] [info] [overlay.cpp:768] Uploading is disabled (permit_upload = 0)
vulkan: supported DRM formats for sampling usage:
vulkan:   0x34325241
vulkan:   0x34325258
vulkan:   0x3231564E
[1]    5591 segmentation fault (core dumped)  AMD_VULKAN_ICD=RADV gamescope glxgears

gdb trace:

(gdb) bt full
#0  0x00007fffe8dd163a in  () at /usr/lib/libMangoHud.so
#1  0x000055555559bca2 in  ()
#2  0x0000555555587d75 in  ()
#3  0x00005555555604c9 in  ()
#4  0x00007ffff74952d0 in __libc_start_call_main (main=main@entry=0x55555555f190, argc=argc@entry=1, argv=argv@entry=0x7fffffffdbc8) at ../sysdeps/nptl/libc_start_call_main.h:58
        self = <optimized out>
        result = <optimized out>

                      unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737488346056, -2738145751233012003, 0, 140737488346072, 93824992966616, 140737354125312, 2738145752197947101, 2738127417259908829}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x7fffffffdbc8, 0x1}, data = {prev = 0x0, cleanup = 0x0, canceltype = -9272}}}
        not_first_call = <optimized out>
#5  0x00007ffff749538a in __libc_start_main_impl (main=0x55555555f190, argc=1, argv=0x7fffffffdbc8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdbb8) at ../csu/libc-start.c:381
#6  0x0000555555563095 in  ()
gort818 commented 2 years ago

use it like thisgamescope -- mangohud glxgears you must have mangohud globally enabled?

MANGOHUD=0 gamescope -- mangohud glxgears

hartmark commented 2 years ago

Yes, I'm having it globally enabled.

I'm aware of the workaround but the application should exit with an error instead of segmentation fault if it's not supported.

Also the workaround makes mangohud use opengl instead of vulkan, a subtle difference. The linked issue has another workaround which uses vkbasalt and are successfully working using vulkan.

gort818 commented 2 years ago

It is not a workaround, it is the correct way to use mangohud with gamescope. glxgears is an opengl application, so if it is reporting OpenGL then that is correct.

hartmark commented 2 years ago

Alright, then this can be closed if we can live with a segmentation fault instead of an error

jackun commented 2 years ago

gamescope has an exception for vkBasalt so it won't try to just use compute queues.

hartmark commented 2 years ago

Aha, so that's the reason I got it working if I used ENABLE_VKBASALT=1

neondeex commented 11 months ago

i do echo $ENABLE_VKBASALT 1 and still got the same error

flightlessmango commented 11 months ago

and still got the same error

You're not supposed to use mangohud with gamescope. This is what mangoapp is for