libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.31k stars 1.83k forks source link

[Linux] RetroArch crashes when Vulkan video driver enabled #8228

Open DarthBrandon opened 5 years ago

DarthBrandon commented 5 years ago

Description

When trying to launch RetroArch with the Vulkan video driver selected, it crashes immediately.

Expected behavior

RetroArch runs properly.

Actual behavior

RetroArch crashes. Here is the terminal output:

retroarch -v [INFO] === Build ======================================= Capabilities: MMX MMXEXT SSE1 SSE2 SSE3 SSSE3 SSE4 SSE4.2 AVX AES Built: Feb 6 2019 [INFO] Version: 1.7.6 [INFO] ================================================= [INFO] Environ SET_PIXEL_FORMAT: RGB565. [INFO] Version of libretro API: 1 [INFO] Compiled against API: 1 [INFO] [Audio]: Set audio input rate to: 29970.03 Hz. [INFO] [Video]: Video @ 960x720 [ERROR] [Vulkan]: Failed to open Vulkan loader. [WARN] Failed to bind API (#9, version 1.0) on context driver "x-egl". [WARN] Failed to bind API (#9, version 1.0) on context driver "kms". [WARN] Failed to bind API (#9, version 1.0) on context driver "sdl_gl". [ERROR] [Vulkan]: Failed to open Vulkan loader. [ERROR] [Vulkan]: Failed to create Vulkan context. [INFO] [Vulkan]: Detecting screen resolution 320x240. [INFO] [Vulkan]: Using resolution 320x240 Segmentation fault (core dumped)

Steps to reproduce the bug

  1. Try to run RetroArch with the Vulkan driver selected
  2. Crash

Bisect Results

I used RetroArch 1.7.5 on Arch Linux, and it worked just fine. I switched to openSUSE Tumbleweed, and RetroArch 1.7.5 started crashing with the Vulkan driver. Version 1.7.6 still crashes.

Version/Commit

You can find this information under Information/System Information

Environment information

orbea commented 5 years ago

There is something wrong with your system installed vulkan I think, perhaps a tumbleweed bug.

[ERROR] [Vulkan]: Failed to open Vulkan loader.

Fwiw vulkan works fine with v1.7.6 and the master with radv and Slackware current.

DarthBrandon commented 5 years ago

Vulkan seems to be working properly, though. I can run games in Steam using Proton, which uses DXVK to pass DirectX 10 & 11 calls to Vulkan. Also, I ran this program called Refresh2025, and it says it's using Vulkan. (https://imgur.com/a/xdXnkZM) So that seems to be functioning properly. But RetroArch isn't.

orbea commented 5 years ago

Hmm, then maybe something in the specific nvidia driver version installed breaks RetroArch or even exposes a hidden RetroArch bug? I suppose maybe there could be also be other vulkan packages which you need to install?

You could try other programs with vulkan too to make sure, see dolphin-emu or vkquake.

DarthBrandon commented 5 years ago

I don't have any GameCube or Wii ISOs to use with Dolphin, so I tried vkQuake. It seems to run just fine. Can't say I did much with it, because I don't care for the default controls, but what matters is that it runs, right?

orbea commented 5 years ago

Yes, so its RetroArch specific... Can you building the master with debugging symbols and get a backtrace with gdb?

  1. Clone this repo.
  2. ./configure --enable-debug --enable-vulkan && make
  3. gdb ./retrorarch
  4. (reproduce the issue)
  5. In the gdb prompt: bt

This should show where its crashing, but the real issue is earlier and that its not just a problem with your RetroArch package.

DarthBrandon commented 5 years ago

My apologies, but I seem to be having trouble compiling it. I think I managed to get all the dependencies installed, however once it gets to the gfx folder, it starts throwing errors.

CC gfx/display_servers/dispserv_x11.c
gfx/display_servers/dispserv_x11.c: In function ‘x11_display_server_set_resolution’:
gfx/display_servers/dispserv_x11.c:136:12: warning: variable ‘scrn’ set but not used [-Wunused-but-set-variable]
    Screen *scrn             = NULL;
            ^~~~
CC gfx/drivers_context/x_ctx.c
CC input/drivers_keyboard/keyboard_event_xkb.c
CC input/drivers_hid/libusb_hid.c
CC input/drivers_joypad/hid_joypad.c
CC input/connect/joypad_connection.c
CC input/connect/connect_ps2adapter.c
CC input/connect/connect_psxadapter.c
CC input/connect/connect_ps3.c
CC input/connect/connect_ps4.c
CC input/connect/connect_wii.c
CC input/connect/connect_nesusb.c
CC input/connect/connect_snesusb.c
CC input/connect/connect_wiiupro.c
CC input/connect/connect_wiiugca.c
CC input/drivers_joypad/parport_joypad.c
CC gfx/drivers_context/gfx_null_ctx.c
CC gfx/video_state_tracker.c
CC gfx/drivers_context/drm_ctx.c
CC gfx/drivers/gl.c
gfx/drivers/gl.c: In function ‘gl2_begin_debug’:
gfx/drivers/gl.c:3223:30: error: ‘gl_debug_cb’ undeclared (first use in this function); did you mean ‘gl2_debug_cb’?
       glDebugMessageCallback(gl_debug_cb, gl);
                              ^~~~~~~~~~~
                              gl2_debug_cb
gfx/drivers/gl.c:3223:30: note: each undeclared identifier is reported only once for each function it appears in
At top level:
gfx/drivers/gl.c:3129:33: warning: ‘gl2_debug_cb’ defined but not used [-Wunused-function]
 static void DEBUG_CALLBACK_TYPE gl2_debug_cb(GLenum source, GLenum type,
                                 ^~~~~~~~~~~~
make: *** [Makefile:201: obj-unix/debug/gfx/drivers/gl.o] Error 1
DarthBrandon commented 5 years ago

Okay, I figured out how to use git to checkout the 1.7.6 branch, and it compiled properly. But it seems like the version I just compiled works just fine with the Vulkan driver.

So I guess that means it's an issue with whomever is building the packages? I've tried packages from two different openSUSE OBS repositories. So needless to say, I'm a bit annoyed. But thank you for your help in trying to figure this out.

orbea commented 5 years ago

Yes, it sounds like a problem with the opensuse package, I would contact the maintainer and ask them about it.

I'm not sure about the gl2 build error, if you can reproduce this with the master I would suggest making a new issue so it can be fixed. Its working here though.

inactive123 commented 5 years ago

Pushed a buildfix for GL_DEBUG -

https://github.com/libretro/RetroArch/commit/eee2445

orbea commented 5 years ago

Thanks, I just realized it was only with GL_DEBUG too now.

gouchi commented 5 years ago

It seems openSUSE provides a package with those compilation options.

They should update to version 1.7.6 ;-)

orbea commented 5 years ago

Its hard to tell why it would be broken from that spec file, they are using a lot of options which are either enabled by default or should be found by configure and enabled by default which creates extra noise...

I would suggest any opensuse users interested in fixing the spec file to start removing options and paying attention to configure output and config.mk until the culprit is found. It could also be another package on the system?

gouchi commented 2 months ago

@DarthBrandon Is still an issue or we can close this issue ? Thank you.