libretro / RetroArch

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

Linux wayland nvidia - high cpu usage when starting game #13623

Open andrewfader opened 2 years ago

andrewfader commented 2 years ago

So I have it recognizing vk_wayland but when I load a game I have high cpu usage like it's not using the gpu for vulkan rendering. Using the bsnes hd core.

[INFO] [Vulkan]: Found vulkan context: "vk_wayland".
[INFO] [Vulkan]: Detecting screen resolution: 2560x1440.
[INFO] [Vulkan]: Found GPU at index 0: "NVIDIA GeForce GTX 970".
[INFO] [Vulkan]: Using GPU index 0.
[INFO] [Vulkan]: Using fences for WSI acquire.
[INFO] [Vulkan]: Using GPU: "NVIDIA GeForce GTX 970".
[INFO] [Vulkan]: Queue family 0 supports 16 sub-queues.
[INFO] [Vulkan]: Using resolution 1864x1080.
[INFO] [Vulkan]: Using BGRA8888 format.
[INFO] [Vulkan]: Loading stock shader.
[WARN] [SDL]: Couldn't open haptic device of the joypad #0: Haptic: There are 0 haptic devices available
[INFO] [Joypad]: Found joypad driver: "sdl2".
[INFO] [Font]: Using font rendering backend: "freetype".
[INFO] [Video]: Found display server: "null".
[INFO] [PulseAudio]: Requested 24576 bytes buffer, got 18432.
[INFO] [Display]: Found display driver: "vulkan".
[INFO] [Environ]: SET_SUBSYSTEM_INFO.

Same problem with glcore

[INFO] [Video]: Set video size to: 1864x1080.
[WARN] [Wayland]: Compositor doesn't support zwp_idle_inhibit_manager_v1 protocol!
[WARN] [Wayland]: Compositor doesn't support zxdg_decoration_manager_v1 protocol!
[INFO] [EGL] Found EGL client version >= 1.5, trying eglGetPlatformDisplay
[INFO] [EGL]: EGL version: 1.5
[INFO] [GLCore]: Found GL context: "wayland".
[INFO] [GLCore]: Detecting screen resolution: 2560x1440.
[INFO] [EGL]: Current context: 0x3ce5ab68b51.
[INFO] [GLCore]: Vendor: NVIDIA Corporation, Renderer: NVIDIA GeForce GTX 970/PCIe/SSE2.
[INFO] [GLCore]: Version: 3.2.0 NVIDIA 510.47.03.
[INFO] [GLCore]: Using resolution 1864x1080.
[WARN] [SDL]: Couldn't open haptic device of the joypad #0: Haptic: There are 0 haptic devices available
[INFO] [Joypad]: Found joypad driver: "sdl2".
[INFO] [GLCore]: Loading stock shader.
[INFO] [slang]: Building pass #0 (N/A)
[INFO] [GLCore]: Not using frame history.
[INFO] [GLCore]: Not using framebuffer feedback.
[INFO] [Font]: Using font rendering backend: "freetype".
[INFO] [Video]: Found display server: "null".
[INFO] [PulseAudio]: Requested 24576 bytes buffer, got 18432.
[INFO] [Display]: Found display driver: "glcore".
[INFO] [Environ]: SET_SUBSYSTEM_INFO.
gouchi commented 2 years ago

Can you give us some feedback about high cpu usage with something like

while true; do echo -n "RetroArch ";ps -p `pidof retroarch` -o %cpu,%mem ; sleep 5; done

or

watch ps -p `pidof retroarch` -o %cpu,%mem

Thank you.

andrewfader commented 2 years ago
❯ while true; do echo -n "RetroArch ";ps -p `pidof retroarch` -o %cpu,%mem ; sleep 5; done
RetroArch %CPU %MEM
57.3  0.6
RetroArch %CPU %MEM
40.8  0.6
RetroArch %CPU %MEM
41.2  0.7
RetroArch %CPU %MEM
 196  2.8
RetroArch %CPU %MEM
 442  2.8
RetroArch %CPU %MEM
 572  2.8
RetroArch %CPU %MEM
 656  2.8
RetroArch %CPU %MEM
 718  2.9
RetroArch %CPU %MEM
 763  2.8
RetroArch %CPU %MEM
 808  2.8
RetroArch %CPU %MEM
 836  2.9
RetroArch %CPU %MEM
 861  2.8
RetroArch %CPU %MEM
 869  2.8
RetroArch %CPU %MEM
 880  2.8
RetroArch %CPU %MEM
 894  2.8
RetroArch %CPU %MEM
 909  2.8
RetroArch %CPU %MEM
 917  2.9
RetroArch %CPU %MEM
 923  2.8
RetroArch %CPU %MEM
 931  2.8
RetroArch %CPU %MEM
 941  2.8
RetroArch %CPU %MEM
 949  2.8
RetroArch %CPU %MEM
 957  2.8
RetroArch %CPU %MEM
 963  2.8
RetroArch %CPU %MEM
 970  2.8
RetroArch %CPU %MEM
 975  2.8
RetroArch %CPU %MEM
 976  2.8
RetroArch %CPU %MEM
 975  2.8
RetroArch %CPU %MEM
 981  2.8
RetroArch %CPU %MEM
 986  2.8
RetroArch %CPU %MEM
 991  2.8
RetroArch %CPU %MEM
 995  2.8
RetroArch %CPU %MEM
 998  2.8
RetroArch %CPU %MEM
1000  2.9
RetroArch %CPU %MEM
1003  2.8
RetroArch %CPU %MEM
1006  2.8
RetroArch %CPU %MEM
1007  2.8
RetroArch %CPU %MEM
1010  2.8
RetroArch %CPU %MEM
1013  2.8
gouchi commented 3 months ago

@andrewfader Is still an issue with latest stable ? Thank you.

andrew-fader-discovery commented 3 months ago

Yes, it's still reproducible with bsnes-hd beta core, but if I switch to bsnes-mercury performance, the cpu usage is acceptable (100% of one core and 10% of a 2nd) as opposed to pegging all those cores.

gouchi commented 3 months ago

Which package are you using distro ? Flatpak ? Snap ? AppImage ? May you provide full log ?

Thank you for your test.

andrew-fader-discovery commented 3 months ago

Using retroarch from the archlinux repos

❯ retroarch 
[INFO] [Config]: Looking for config in: "/home/andrew/.config/retroarch/retroarch.cfg".
[INFO] RetroArch 1.19.1 (Git 0792144fe3)
[INFO] === Build =======================================
[INFO] CPU Model Name: Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz
[INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX AVX2 
[INFO] Version: 1.19.1
[INFO] Git: 0792144fe3
[INFO] Built: Jun 16 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] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Core]: Geometry: 320x240, Aspect: 1.333, FPS: 59.95, Sample rate: 48000.00 Hz.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: 960x720.
[INFO] [Wayland]: Compositor doesn't support zxdg_decoration_manager_v1 protocol
[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 2060".
[INFO] [Vulkan]: Using GPU index 0.
[INFO] [Vulkan]: Using fences for WSI acquire.
[INFO] [Vulkan]: Using GPU: "NVIDIA GeForce RTX 2060".
[INFO] [Vulkan]: Queue family 0 supports 16 sub-queues.
[INFO] [Vulkan]: Got 3 swapchain images.
[INFO] [Vulkan]: Using resolution 1680x1260.
[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.12
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "vulkan".
[INFO] [Playlist]: Loading history file: "/home/andrew/.config/retroarch/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/andrew/.config/retroarch/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/andrew/.config/retroarch/content_video_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/andrew/.config/retroarch/content_image_history.lpl".
[INFO] [Playlist]: Loading favorites file: "/home/andrew/.config/retroarch/content_favorites.lpl".
[INFO] [PulseAudio]: Pausing.
[INFO] [Environ]: SET_SUBSYSTEM_INFO.
[INFO] [Core]: Using content: "/home/andrew/Downloads/Donkey Kong Country 3 - Dixie Kong's Double Trouble! (USA) (En,Fr).sfc".
[INFO] [Core]: Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
[INFO] RetroArch 1.19.1 (Git 0792144fe3)
[INFO] === Build =======================================
[INFO] CPU Model Name: Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz
[INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX AVX2 
[INFO] Version: 1.19.1
[INFO] Git: 0792144fe3
[INFO] Built: Jun 16 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/andrew/.config/retroarch/cores/bsnes_hd_beta_libretro.so"
[INFO] [Overrides]: Core-specific overrides found at "/home/andrew/.config/retroarch/config/bsnes-hd beta/bsnes-hd beta.cfg".

(retroarch:35764): Gtk-WARNING **: 17:39:28.434: gtk_disable_setlocale() must be called before gtk_init()