libretro / RetroArch

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

[Linux-wayland] random freezes #15268

Open jmfergeau opened 1 year ago

jmfergeau commented 1 year ago

Description

Retroarch tends to randomly freeze the game completely, simply during gameplay.

Expected behavior

The game should never freeze.

Actual behavior

Retroarch freeze the game completely at random intervals. It unfreezes after a while or sometimes when losing and getting back focus. Nothing related left in the logs.

Steps to reproduce the bug

  1. Start Retroarch on Wayland environment
  2. Launch a game
  3. Play and wait for it to freeze
  4. Wait for it to unfreeze or possibly try to change program focus to unfreeze it

Bisect Results

Happens only on Wayland. On X11, the freezes never happen.

Noticed on the cores mesen and pcsx2. I don't know yet if it happens on other cores.

Version/Commit

Environment information

i30817 commented 1 year ago

I'm not a dev, but first thing to check is if you're using a built that is really using wayland, or one that is for x11 and using xwayland.

In the wayland desktop, open retroarch and put it in windowed mode, and run the program 'xeyes' (install it if you need to). If the eyes move when you hover the mouse cursor over a window (for instance, the xeyes window itself) the program is using xwayland (in a wayland desktop). So move the cursor over the retroarch window and see if the eyes move.

jmfergeau commented 1 year ago

All I know is that Retroarch behaves differently on wayland. When it loads itself or loads a game, the window displays retroarch icon for a second before it displays the game or the menu, moving the window's corner awkwardly to the center of the screen. This never happens on X11. Also, in the system info, the line about wayland support is on "yes". I'm on Arch and retroarch is installed using the main package repos.

gouchi commented 1 year ago

@jmfergeau Will it possible to provide some log ?

Also can you try to make some test with latest commit ? It may or may not fix your issue but there are two commits since version 1.15.0 about Wayland.

git clone https://github.com/libretro/RetroArch.git
cd RetroArch
./configure --enable-wayland 
make -j$(nproc)

Thank you.

jmfergeau commented 1 year ago

I would gladly give logs if it was bringing any relevant logs because, as i said in the first post, "Nothing related left in the logs." I noticed retroarch can spit big loads of logs for anything but it's rare it says anything about errors.

I just tried with the latest commit as you suggested but the problem still occurs. And still no error repported ever. :/

gouchi commented 1 year ago

Thank you for the test.

At least if we have the log, we will have some information (resolution, gpu ...) and we can compare if somebody else makes some test also on Wayland.

april83c commented 1 year ago

same issue here with the flatpak (don't know where to find logs, ~/.var/app/org.libretro.RetroArch/config/retroarch/logs is empty)

gouchi commented 1 year ago

@april83c Please check the documentation about generating logs.

Thank you.

theguy159 commented 1 year ago

I think I'm experiencing the same issue.

When I disabled the "Pause Content When Not Active" option in the User Interface settings it seems to take longer for it to freeze but it still does. It unfreezes as soon as I move the mouse a bit.

xeyes does not move when I move the mouse over the RetroArch window.

muffinjets commented 9 months ago

I can corroborate this issue, mouse activity over the window will unfreeze, happens on every core I use, GBC-Gambette, bsnes-hd, Dolphin, Duckstation, and mupen. I can also confirm using xeyes that my install isn't using XWayland and this behavior never happens when using an X11 session.

FAYZER77 commented 8 months ago

I'm also experiencing this on a fresh build from git source. The difference for me is I can't get it to unfreeze once it happens. Got into the second loop of the attract mode of Super Mario RPG in BSNES Mercury for the lockup to happen on the last run I did.

Martmists-GH commented 7 months ago

Having a similar issue, though just getting in-game is difficult. Log in dropdown.

retroarch-verbose.log
[INFO] [Config]: Looking for config in: "/home/mart/.config/retroarch/retroarch.cfg".
[INFO] RetroArch 1.17.0 (Git ad8975cb5a)
[INFO] === Build =======================================
[INFO] CPU Model Name: AMD Ryzen 9 7900X 12-Core Processor            
[INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX AVX2 
[INFO] Version: 1.17.0
[INFO] Git: ad8975cb5a
[INFO] Built: Feb  8 2024
[INFO] =================================================
[INFO] [Input]: Found input driver: "x".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Core]: Geometry: 320x240, Aspect: 1.333, FPS: 60.00, Sample rate: 48000.00 Hz.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: 960x720.
[INFO] [Wayland]: fractional_scale_v1 enabled
[INFO] [Vulkan]: Vulkan dynamic library loaded.
[INFO] [Vulkan]: Found vulkan context: "vk_wayland".
[INFO] [Vulkan]: Detecting screen resolution: 3840x2160.
[INFO] [Vulkan]: Found GPU at index 0: "NVIDIA GeForce RTX 4080 SUPER".
[INFO] [Vulkan]: Using GPU index 0.
[INFO] [Vulkan]: Using fences for WSI acquire.
[INFO] [Vulkan]: Using GPU: "NVIDIA GeForce RTX 4080 SUPER".
[INFO] [Vulkan]: Queue family 0 supports 16 sub-queues.
[INFO] [Vulkan]: Got 3 swapchain images.
[INFO] [Vulkan]: Using resolution 960x720.
[INFO] [Vulkan]: Using RGB565 format.
[INFO] [Vulkan]: Loading stock shader.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [Wayland]: Enabling idle inhibitor
[INFO] [Video]: Found display server: "null".
[INFO] [PulseAudio]: Requested 24576 bytes buffer, got 18432.
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA]: Using ALSA version 1.2.11
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "vulkan".
[INFO] [NetCMD]: bringing_up_command_interface_at_port 55355.
[INFO] [Playlist]: Loading history file: "/home/mart/.config/retroarch/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/mart/.config/retroarch/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/mart/.config/retroarch/content_video_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/mart/.config/retroarch/content_image_history.lpl".
[INFO] [Playlist]: Loading favorites file: "/home/mart/.config/retroarch/content_favorites.lpl".
[INFO] [udev]: Pad #0 (/dev/input/event24) supports force feedback.
[INFO] [udev]: Pad #0 (/dev/input/event24) supports 16 force feedback effects.
[INFO] [Environ]: SET_SUBSYSTEM_INFO.
[INFO] [Content]: Updating firmware status for: "/usr/lib/libretro/bsnes_mercury_performance_libretro.so" on "/home/mart/.config/retroarch/system".
[INFO] [Core]: Using content: "/home/mart/roms/snes/VARIA_Randomizer_ADFX218529487953843863_veteran_VARIAble.sfc".
[INFO] [Core]: Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] [PulseAudio]: Pausing.
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
[INFO] [Video]: Does not have enough samples for monitor refresh rate estimation. Requires to run for at least 4096 frames.
[INFO] RetroArch 1.17.0 (Git ad8975cb5a)
[INFO] === Build =======================================
[INFO] CPU Model Name: AMD Ryzen 9 7900X 12-Core Processor            
[INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX AVX2 
[INFO] Version: 1.17.0
[INFO] Git: ad8975cb5a
[INFO] Built: Feb  8 2024
[INFO] =================================================
[INFO] [Input]: Found input driver: "x".
[INFO] [Core]: Loading dynamic libretro core from: "/usr/lib/libretro/bsnes_mercury_performance_libretro.so"
[INFO] [Overrides]: Redirecting save file to "/home/mart/.config/retroarch/saves/bsnes-mercury/VARIA_Randomizer_ADFX218529487953843863_veteran_VARIAble.srm".
[INFO] [Overrides]: Redirecting save state to "/home/mart/.config/retroarch/states/bsnes-mercury/VARIA_Randomizer_ADFX218529487953843863_veteran_VARIAble.state".
[INFO] [Environ]: SET_VARIABLES.
[INFO] [Environ]: GET_LOG_INTERFACE.
[INFO] [Environ]: SET_CONTROLLER_INFO.
[INFO] [Content]: Loading content file: "/home/mart/roms/snes/VARIA_Randomizer_ADFX218529487953843863_veteran_VARIAble.sfc".
[INFO] [Environ]: SET_INPUT_DESCRIPTORS:
[libretro INFO] BML map:
[libretro INFO] cartridge region=NTSC
[libretro INFO]   rom name=program.rom size=0x300000
[libretro INFO]   ram name=save.ram size=0x2000
[libretro INFO]   map id=rom address=00-7f,80-ff:8000-ffff mask=0x8000
[libretro INFO]   map id=ram address=70-7f,f0-ff:0000-7fff
[libretro INFO] [Memory]: ID 7, Request "manifest.bml".
[libretro INFO] Complete load request.
[libretro INFO] [Memory]: ID 8, Request "program.rom".
[libretro INFO] Load ROM.
[libretro INFO] Complete load request.
[libretro INFO] [Memory]: ID 9, Request "save.ram".
[libretro INFO] Complete load request.
[libretro INFO] [Memory]: ID 6, Request "".
[libretro INFO] Complete load request.
[INFO] [Environ]: SET_MEMORY_MAPS.
[INFO] [Replay]: Found last replay slot: #0
[libretro INFO] SRAM memory size: 8192.
[libretro INFO] SRAM memory size: 8192.
[INFO] [SRAM]: Skipping SRAM load.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Environ]: SET_PIXEL_FORMAT: XRGB8888.
[INFO] [Core]: Geometry: 256x224, Aspect: 1.306, FPS: 60.10, Sample rate: 32040.50 Hz.
[INFO] [Audio]: Set audio input rate to: 32040.50 Hz.
[INFO] [Video]: Game FPS > Monitor FPS. Cannot rely on VSync.
[INFO] [Video]: Set video size to: 879x672.
[INFO] [Wayland]: fractional_scale_v1 enabled

(retroarch:3646): Gtk-WARNING **: 19:25:26.970: gtk_disable_setlocale() must be called before gtk_init()
[INFO] [Vulkan]: Vulkan dynamic library loaded.
[INFO] [Vulkan]: Found vulkan context: "vk_wayland".
[INFO] [Vulkan]: Detecting screen resolution: 3840x2160.
[INFO] [Vulkan]: Found GPU at index 0: "NVIDIA GeForce RTX 4080 SUPER".
[INFO] [Vulkan]: Using GPU index 0.
[INFO] [Vulkan]: Using fences for WSI acquire.
[INFO] [Vulkan]: Using GPU: "NVIDIA GeForce RTX 4080 SUPER".
[INFO] [Vulkan]: Queue family 0 supports 16 sub-queues.
[INFO] [Vulkan]: Got 3 swapchain images.
[INFO] [Vulkan]: Using resolution 879x672.
[INFO] [Vulkan]: Using BGRA8888 format.
[INFO] [Vulkan]: Loading stock shader.
[INFO] [udev]: Pad #0 (/dev/input/event24) supports force feedback.
[INFO] [udev]: Pad #0 (/dev/input/event24) supports 16 force feedback effects.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [Wayland]: Enabling idle inhibitor
[INFO] [Video]: Found display server: "null".
[INFO] [PulseAudio]: Requested 24576 bytes buffer, got 18432.
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA]: Using ALSA version 1.2.11
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "vulkan".
[INFO] [Environ]: SET_SUBSYSTEM_INFO.
[INFO] [NetCMD]: bringing_up_command_interface_at_port 55355.
[INFO] [Playlist]: Loading history file: "/home/mart/.config/retroarch/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/mart/.config/retroarch/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/mart/.config/retroarch/content_video_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/mart/.config/retroarch/content_image_history.lpl".
[INFO] [Playlist]: Loading favorites file: "/home/mart/.config/retroarch/content_favorites.lpl".
gouchi commented 3 months ago

I made a test on Fedora 40 on Wayland using Gnome 46 on Mesa (Intel HD 4000) with Vulkan driver and I could not reproduce this issue.

fedora@fedora:~$ flatpak run  org.libretro.RetroArch -v
[INFO] RetroArch 1.19.1 (Git 0792144)
[INFO] === Build =======================================
[INFO] CPU Model Name: Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz
[INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX 
[INFO] Version: 1.19.1
[INFO] Git: 0792144
[INFO] Built: Jun 21 2024
[INFO] =================================================
[INFO] [Input]: Found input driver: "x".
[ERROR] Couldn't find any cloud sync driver named ""
[INFO] Available cloud sync drivers are:
[INFO]  webdav
[INFO]  null
[WARN] Going to default to first cloud sync driver...
[INFO] [Core]: Loading dynamic libretro core from: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/cores/mesen_libretro.so"
[INFO] [Overrides]: Redirecting save file to "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/saves/Mesen/Super Bat Puncher (Demo).srm".
[INFO] [Overrides]: Redirecting save state to "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/states/Mesen/Super Bat Puncher (Demo).state".
[INFO] [Environ]: GET_CORE_OPTIONS_VERSION.
[INFO] [Environ]: GET_LANGUAGE: "0".
[INFO] [Environ]: RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL.
[INFO] [Environ]: SET_CONTROLLER_INFO.
[INFO] [Environ]: RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE.
[INFO] [Content Override]: File Extension: 'nes' - need_fullpath: FALSE, persistent_data: FALSE
[INFO] [Content Override]: File Extension: 'fds' - need_fullpath: FALSE, persistent_data: FALSE
[INFO] [Content Override]: File Extension: 'unf' - need_fullpath: FALSE, persistent_data: FALSE
[INFO] [Content Override]: File Extension: 'unif' - need_fullpath: FALSE, persistent_data: FALSE
[INFO] [Environ]: GET_LOG_INTERFACE.
[INFO] [Content]: Loading content file: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/downloads/Super Bat Puncher (Demo).nes".
[INFO] [Environ]: SYSTEM_DIRECTORY: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/system".
[INFO] [Environ]: SAVE_DIRECTORY: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/saves/Mesen".
[INFO] [Environ]: SET_PIXEL_FORMAT: XRGB8888.
[INFO] [Environ]: SET_GEOMETRY: 256x240, Aspect: 1.219.
[INFO] [Environ]: RETRO_ENVIRONMENT_GET_GAME_INFO_EXT.
[libretro INFO] 
[libretro INFO] Loading rom: Super Bat Puncher (Demo).nes
[libretro INFO] PRG CRC32: 0xF27D2FB5
[libretro INFO] PRG+CHR CRC32: 0xF27D2FB5
[libretro INFO] [iNes] Mapper: 1 Sub:0
[libretro INFO] [iNes] PRG ROM: 128 KB
[libretro INFO] [iNes] CHR ROM: 0 KB
[libretro INFO] [iNes] CHR RAM: 8 KB
[libretro INFO] [iNes] Mirroring: Vertical
[libretro INFO] [iNes] Battery: No
[INFO] [Environ]: SET_INPUT_DESCRIPTORS:
[INFO] [Environ]: SET_MEMORY_MAPS.
[INFO] [SRAM]: Skipping SRAM load.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Core]: Geometry: 256x240, Aspect: 1.219, FPS: 60.10, Sample rate: 48000.00 Hz.
[INFO] [Audio]: Set audio input rate to: 47920.27 Hz.
[INFO] [Video]: Set video size to: fullscreen.
[INFO] [Wayland]: Compositor doesn't support zxdg_decoration_manager_v1 protocol
[INFO] [Wayland]: fractional_scale_v1 enabled

(retroarch:2): Gtk-WARNING **: 21:16:27.052: gtk_disable_setlocale() must be called before gtk_init()
[INFO] [Vulkan]: Vulkan dynamic library loaded.
[INFO] [Vulkan]: Found vulkan context: "vk_wayland".
[INFO] [Vulkan]: Detecting screen resolution: 1366x768.
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
[INFO] [Vulkan]: Found GPU at index 0: "Intel(R) HD Graphics 4000 (IVB GT2)".
[INFO] [Vulkan]: Found GPU at index 1: "llvmpipe (LLVM 17.0.6, 256 bits)".
[INFO] [Vulkan]: Using GPU index 0.
[INFO] [Vulkan]: Using semaphores for WSI acquire.
[INFO] [Vulkan]: Using GPU: "Intel(R) HD Graphics 4000 (IVB GT2)".
[INFO] [Vulkan]: Queue family 0 supports 1 sub-queues.
[INFO] [Vulkan]: Got 3 swapchain images.
[INFO] [Wayland] Failed to specify monitor for fullscreen, letting compositor decide
[INFO] [Vulkan]: Using resolution 1366x768.
[INFO] [Vulkan]: Using BGRA8888 format.
[INFO] [Vulkan]: Loading stock shader.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [Video]: Found display server: "null".
[INFO] [PulseAudio]: Requested 24576 bytes buffer, got 18432.
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA] Using ALSA version 1.2.9
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "vulkan".
[INFO] [Playlist]: Loading history file: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/content_video_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/content_image_history.lpl".
[INFO] [Playlist]: Loading favorites file: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/content_favorites.lpl".
[INFO] [Config]: Saved new config to "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/retroarch.cfg".
[INFO] [Core]: Content ran for a total of: 00 hours, 58 minutes, 49 seconds.
[INFO] [Runtime]: Saving runtime log file: "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/playlists/logs/Mesen/Super Bat Puncher (Demo).lrtl".
[INFO] [Core]: Unloading game..
[INFO] [PulseAudio]: Pausing.
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
[INFO] [Core]: Saved core options file to "/home/fedora/.var/app/org.libretro.RetroArch/config/retroarch/config/Mesen/Mesen.opt".
a-molokodrengo commented 2 months ago

I was having this issue on Wayland. If you installed RetroArch on Flatpak, use Flatseal and disable 'Wayland windowing system'. That seems to have fixed it for me.

Grief commented 1 month ago

I have the same issue. For me, moving mouse helps immediately, but it's very annoything. Any workaround?