libretro / flycast

Flycast is a multiplatform Sega Dreamcast emulator. NOTE: No longer actively developed, use upstream repo for libretro from now on - https://github.com/flyinghead/flycast
http://reicast.com
GNU General Public License v2.0
155 stars 77 forks source link

Segmentation fault when input_driver = "udev" #1118

Closed rtomasa closed 8 months ago

rtomasa commented 2 years ago

I'm testing Flycast core on a Pi4 Raspbian Buster 32 bits Lite (CLI) and KMS driver.

When configuring retroarch input_driver = "udev" I get a Segmentation Fault when launching games, but it works if I set it to input_driver = "sdl2".

This issue is not happening with any other core, but I've previously opened this same issue in the Flycats GIT repo and the creator suggested that could be a Libretro error instead. Here the steps I followed to reproduce the issue:

  1. Installed a fresh copy of 2022-04-04-raspios-buster-armhf-lite (apt update/upgrade not executed)
  2. Changed from FKMS to KMS in config.txt
  3. Enabled SSH via raspi-config
  4. Installed GIT via apt
  5. Installed RetroPie-Setup
  6. Installed Retroarch via RetroPie-Setup
  7. Installed Flycast via RetroPie-Setup
  8. Copied Metropolis Street Racer to SD
  9. Copied .sh launcher to SD. This is the command: /opt/retropie/emulators/retroarch/bin/retroarch --verbose -L /opt/retropie/libretrocores/lr-flycast/flycast_libretro.so "/home/pi/RetroPie/roms/dreamcast/[GDI] Metropolis Street Racer (US)/Metropolis Street Racer v1.010 (2000)(Sega)(NTSC)(US)[!].gdi"
  10. Run .sh from Pi4 (not from SSH)
  11. Retroarch crash with Segmentation Fault. Here the full log:
    [INFO] RetroArch 1.10.0 (Git e9e85f3)
    [INFO] === Build =======================================
    [INFO] Capabilities:  NEON VFPv3 VFPv4
    [INFO] Built: Jan 30 2022
    [INFO] Version: 1.10.0
    [INFO] Git: e9e85f3
    [INFO] =================================================
    [INFO] [Input]: Found input driver: "x".
    [INFO] [Core]: Loading dynamic libretro core from: "/opt/retropie/libretrocores/lr-flycast/flycast_libretro.so"
    [INFO] [Overrides]: No core-specific overrides found at "/home/pi/.config/retroarch/config/Flycast/Flycast.cfg".
    [INFO] [Overrides]: No content-dir-specific overrides found at "/home/pi/.config/retroarch/config/Flycast/[GDI] Metropolis Street Racer (US).cfg".
    [INFO] [Overrides]: No game-specific overrides found at "/home/pi/.config/retroarch/config/Flycast/Metropolis Street Racer v1.010 (2000)(Sega)(NTSC)(US)[!].cfg".
    [INFO] [Environ]: GET_LANGUAGE: "0".
    [INFO] [Remaps]: Remap directory: "/home/pi/.config/retroarch/config/remaps".
    [INFO] [Overrides]: Redirecting save file to "/home/pi/RetroPie/roms/dreamcast/[GDI] Metropolis Street Racer (US)/Metropolis Street Racer v1.010 (2000)(Sega)(NTSC)(US)[!].srm".
    [INFO] [Overrides]: Redirecting save state to "/home/pi/RetroPie/roms/dreamcast/[GDI] Metropolis Street Racer (US)/Metropolis Street Racer v1.010 (2000)(Sega)(NTSC)(US)[!].state".
    [INFO] [Environ]: SET_PIXEL_FORMAT: XRGB8888.
    [INFO] [Content]: Content loading skipped. Implementation will load it on its own.
    [WARN] [Environ]: SYSTEM DIR is empty, assume CONTENT DIR /home/pi/RetroPie/roms/dreamcast/[GDI] Metropolis Street Racer (US)/Metropolis Street Racer v1.010 (2000)(Sega)(NTSC)(US)[!].gdi
    [INFO] [Environ]: SYSTEM_DIRECTORY: "".
    [INFO] [Environ]: SET_SAVE_STATE_IN_BACKGROUND: yes.
    [libretro INFO] File extension is: .gdi
    [INFO] [Environ]: GET_PREFERRED_HW_RENDER, video driver name: gl.
    [INFO] [Environ]: GET_PREFERRED_HW_RENDER - Context callback set to RETRO_HW_CONTEXT_OPENGL.
    [INFO] [Environ]: SET_HW_RENDER, context type: gl.
    [INFO] Requesting OpenGLES2 context.
    [INFO] Reached end of SET_HW_RENDER.
    [libretro INFO] hw/mem/_vmem.cpp:482 N[VMEM]: Info: nvmem is enabled, with addr space of size 512MB
    [libretro ERROR] Unable to find bios in /home/pi/RetroPie/roms/dreamcast/[GDI] Metropolis Street Racer (US)//dc/. Exiting...
    [libretro WARN] nullDC.cpp:429 W[COMMON]: Did not load bios, using reios
    [libretro INFO] nullDC.cpp:145 N[BOOT]: [LUT]: Product number: MK-51012  .
    [libretro INFO] hw/maple/maple_devs.cpp:603 N[MAPLE]: Loaded VMU from file "/home/pi/RetroPie/roms/dreamcast/[GDI] Metropolis Street Racer (US)//dc/vmu_save_A1.bin"
    [libretro INFO] hw/maple/maple_devs.cpp:603 N[MAPLE]: Loaded VMU from file "/home/pi/RetroPie/roms/dreamcast/[GDI] Metropolis Street Racer (US)//dc/vmu_save_B1.bin"
    [libretro INFO] hw/maple/maple_devs.cpp:603 N[MAPLE]: Loaded VMU from file "/home/pi/RetroPie/roms/dreamcast/[GDI] Metropolis Street Racer (US)//dc/vmu_save_C1.bin"
    [libretro INFO] hw/maple/maple_devs.cpp:603 N[MAPLE]: Loaded VMU from file "/home/pi/RetroPie/roms/dreamcast/[GDI] Metropolis Street Racer (US)//dc/vmu_save_D1.bin"
    [INFO] [Environ]: SET_ROTATION: 0
    [INFO] [SRAM]: Skipping SRAM load.
    [INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
    [INFO] [Audio]: Set audio input rate to: 44100.00 Hz.
    [INFO] [Video]: Set video size to: 1440x1080.
    [INFO] [Video]: Using HW render, OpenGL driver forced.
    [INFO] [Video]: Using configured "gl" driver for GL HW render.
    [INFO] [DRM]: Found 2 connectors.
    [INFO] [DRM]: Connector 0 connected: yes
    [INFO] [DRM]: Connector 0 has 18 modes.
    [INFO] [DRM]: Connector 0 assigned to monitor index: #1.
    [INFO] [DRM]: Connector 1 connected: no
    [INFO] [DRM]: Connector 1 has 0 modes.
    [INFO] [DRM]: Mode 0: (1024x768) 1024 x 768, 75.028579 Hz
    [INFO] [DRM]: Mode 1: (1920x1080) 1920 x 1080, 60.000000 Hz
    [INFO] [DRM]: Mode 2: (1920x1080) 1920 x 1080, 59.940200 Hz
    [INFO] [DRM]: Mode 3: (1280x720) 1280 x 720, 60.000000 Hz
    [INFO] [DRM]: Mode 4: (1280x720) 1280 x 720, 59.940200 Hz
    [INFO] [DRM]: Mode 5: (1024x768) 1024 x 768, 70.069358 Hz
    [INFO] [DRM]: Mode 6: (1024x768) 1024 x 768, 60.003837 Hz
    [INFO] [DRM]: Mode 7: (832x624) 832 x 624, 74.551261 Hz
    [INFO] [DRM]: Mode 8: (800x600) 800 x 600, 75.000000 Hz
    [INFO] [DRM]: Mode 9: (800x600) 800 x 600, 72.187568 Hz
    [INFO] [DRM]: Mode 10: (800x600) 800 x 600, 60.316539 Hz
    [INFO] [DRM]: Mode 11: (800x600) 800 x 600, 56.250000 Hz
    [INFO] [DRM]: Mode 12: (640x480) 640 x 480, 75.000000 Hz
    [INFO] [DRM]: Mode 13: (640x480) 640 x 480, 72.808799 Hz
    [INFO] [DRM]: Mode 14: (640x480) 640 x 480, 66.666664 Hz
    [INFO] [DRM]: Mode 15: (640x480) 640 x 480, 60.000000 Hz
    [INFO] [DRM]: Mode 16: (640x480) 640 x 480, 59.940475 Hz
    [INFO] [DRM]: Mode 17: (720x400) 720 x 400, 70.081657 Hz
    [INFO] [GL]: Found GL context: "kms".
    [INFO] [GL]: Detecting screen resolution: 1024x768.
    [INFO] [EGL] Found EGL client version >= 1.5, trying eglGetPlatformDisplay
    [INFO] [EGL]: EGL version: 1.4
    [INFO] [EGL]: Current context: 0x1a1e828.
    [INFO] [KMS]: New FB: 1024x768 (stride: 4096).
    [INFO] [GL]: Vendor: Broadcom, Renderer: V3D 4.2.
    [INFO] [GL]: Version: OpenGL ES 3.1 Mesa 19.3.2.
    [INFO] [GL]: Using resolution 1024x768.
    [INFO] [GL]: Default shader backend found: glsl.
    [INFO] [Shader driver]: Using GLSL shader backend.
    [WARN] [GL]: Stock GLSL shaders will be used.
    [INFO] [GLSL]: Found GLSL vertex shader.
    [INFO] [GLSL]: Found GLSL fragment shader.
    [INFO] [GLSL]: Linking GLSL program.
    [INFO] [GLSL]: Found GLSL vertex shader.
    [INFO] [GLSL]: Found GLSL fragment shader.
    [INFO] [GLSL]: Linking GLSL program.
    [INFO] [GLSL]: Found GLSL vertex shader.
    [INFO] [GLSL]: Found GLSL fragment shader.
    [INFO] [GLSL]: Linking GLSL program.
    [INFO] [GL]: Using 1 textures.
    [INFO] [GL]: Loaded 1 program(s).
    [INFO] [GL]: Initializing HW render (1024x1024).
    [INFO] [GL]: Max texture size: 4096 px, renderbuffer size: 4096 px.
    [INFO] [GL]: Supports FBO (render-to-texture).
    [INFO] [udev]: Keyboard #0: "Dell Dell USB Keyboard" (/dev/input/event0).
    [INFO] [udev]: Keyboard #1: "vc4" (/dev/input/event1).
    [INFO] [udev]: Keyboard #2: "vc4" (/dev/input/event2).
    [INFO] [Joypad]: Found joypad driver: "udev".
    [INFO] [Font]: Using font rendering backend: "stb-unicode".
    [INFO] [Video]: Found display server: "null".
    [INFO] ALSA: Using floating point format.
    [INFO] ALSA: Period size: 480 frames
    [INFO] ALSA: Buffer size: 1536 frames
    [INFO] [Display]: Found display driver: "gl".
    [INFO] [Playlist]: Loading history file: "/home/pi/.config/retroarch/content_history.lpl".
    [INFO] [Playlist]: Loading history file: "/home/pi/.config/retroarch/content_music_history.lpl".
    [INFO] [Playlist]: Loading history file: "/home/pi/.config/retroarch/content_video_history.lpl".
    [INFO] [Playlist]: Loading history file: "/home/pi/.config/retroarch/content_image_history.lpl".
    [INFO] [Playlist]: Loading favorites file: "/home/pi/.config/retroarch/content_favorites.lpl".
    *** Segmentation Fault ***

    NOTE: here the driver is set to X because I wanted to test it fully vanilla, but even in this way it crashes. Only SDL2 input driver works.

rtomasa commented 2 years ago

I found a workaround to make it work! flycast_libretro.so </dev/null No idea why </dev/null makes it work. I saw it in the latest RetroPie runcommand and it made the trick.