mamedev / mame

MAME
https://www.mamedev.org/
Other
7.95k stars 1.98k forks source link

fullscreen video stops updating when using bgfx vulkan backend on linux #7820

Closed belegdol closed 2 years ago

belegdol commented 3 years ago

I have just noticed that at least 0.228 and 0.229 will stop updating fullscreen window after a second or so when using vulkan backend on Linux:

$ mame -nowindow -video bgfx -bgfx_debug -bgfx_backend vulkan mvsc -verbose
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of horizont.ini
Attempting load of arcade.ini
Attempting load of raster.ini
Attempting load of source/cps2.ini
Attempting load of mvsc.ini
Reading translation file English: 1 strings, original table at word offset 7, translated table at word offset 9
Loaded 0 translations from file English
Starting plugin data...
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of horizont.ini
Attempting load of arcade.ini
Attempting load of raster.ini
Attempting load of source/cps2.ini
Attempting load of mvsc.ini
Available videodrivers: x11 wayland KMSDRM KMSDRM_LEGACY dummy 
Current Videodriver: x11
    Display #0
        Renderdrivers:
                opengl (0x0)
             opengles2 (0x0)
              opengles (0x0)
              software (0x0)
Available audio drivers: 
    pulseaudio          
    alsa                
    dsp                 
    jack                
    disk                
    dummy               
Build version:      0.229 (unknown)
Build architecure:  
Build defines 1:    SDLMAME_UNIX=1 SDLMAME_X11=1 SDLMAME_LINUX=1 
Build defines 1:    LSB_FIRST=1 PTR64=1 
SDL/OpenGL defines: SDL_COMPILEDVERSION=2014 USE_OPENGL=1 
Compiler defines A: __GNUC__=10 __GNUC_MINOR__=2 __GNUC_PATCHLEVEL__=1 __VERSION__="10.2.1 20201125 (Red Hat 10.2.1-9)" 
Compiler defines B: __amd64__=1 __x86_64__=1 __unix__=1 
Compiler defines C: _FORTIFY_SOURCE=2 __USE_FORTIFY_LEVEL=2 
Enter init_monitors
Adding monitor screen0 (1920 x 1200)
Leave init_monitors
Enter sdlwindow_init

Hints:
    SDL_FRAMEBUFFER_ACCELERATION             (NULL)
    SDL_RENDER_DRIVER                        (NULL)
    SDL_RENDER_OPENGL_SHADERS                (NULL)
    SDL_RENDER_SCALE_QUALITY                 (NULL)
    SDL_RENDER_VSYNC                         (NULL)
    SDL_VIDEO_X11_XVIDMODE                   (NULL)
    SDL_VIDEO_X11_XINERAMA                   (NULL)
    SDL_VIDEO_X11_XRANDR                     (NULL)
    SDL_GRAB_KEYBOARD                        (NULL)
    SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS         0
    SDL_IOS_IDLE_TIMER_DISABLED              (NULL)
    SDL_IOS_ORIENTATIONS                     (NULL)
    SDL_XINPUT_ENABLED                       (NULL)
    SDL_GAMECONTROLLERCONFIG                 (NULL)
    SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS     (NULL)
    SDL_ALLOW_TOPMOST                        (NULL)
    SDL_TIMER_RESOLUTION                     (NULL)
    SDL_RENDER_DIRECT3D_THREADSAFE           (NULL)
    SDL_VIDEO_ALLOW_SCREENSAVER              (NULL)
    SDL_ACCELEROMETER_AS_JOYSTICK            (NULL)
    SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK   (NULL)
    SDL_VIDEO_WIN_D3DCOMPILER                (NULL)
    SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT      (NULL)
    SDL_VIDEO_MAC_FULLSCREEN_SPACES          (NULL)
    SDL_MOUSE_RELATIVE_MODE_WARP             (NULL)
    SDL_RENDER_DIRECT3D11_DEBUG              (NULL)
    SDL_VIDEO_HIGHDPI_DISABLED               (NULL)
    SDL_WINRT_PRIVACY_POLICY_URL             (NULL)
    SDL_WINRT_PRIVACY_POLICY_LABEL           (NULL)
    SDL_WINRT_HANDLE_BACK_BUTTON             (NULL)
Leave sdlwindow_init
Enter sdl_info::create
Audio: Start initialization
Audio: Driver is pulseaudio
Audio: frequency: 48000, channels: 2, samples: 256
sdl_create_buffers: creating stream buffer of 25600 bytes
Audio: End initialization
Keyboard: Start initialization
Input: Adding keyboard #0: System keyboard (device id: System keyboard)
Keyboard: Registered System keyboard
Keyboard: End initialization
Mouse: Start initialization
Input: Adding mouse #0: System mouse (device id: System mouse)
Mouse: Registered System mouse
Mouse: End initialization
Lightgun: Begin initialization
Lightgun: End initialization
Joystick: Start initialization
Joystick: End initialization
Searching font Liberation Sans in -/usr/share/mame/fonts path/s
Matching font: 0x55670db637f0
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip ECD
unzip: /mnt/openmediavault/emu/mame/roms/mvsc.zip has no ZIP64 ECD locator
unzip: read /mnt/openmediavault/emu/mame/roms/mvsc.zip central directory
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: found /mnt/openmediavault/emu/mame/roms/mvsc.zip in cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/mvsc.zip and sending to cache
unzip: opened archive file /mnt/openmediavault/emu/mame/roms/qsound_hle.zip
unzip: found /mnt/openmediavault/emu/mame/roms/qsound_hle.zip ECD
unzip: /mnt/openmediavault/emu/mame/roms/qsound_hle.zip has no ZIP64 ECD locator
unzip: read /mnt/openmediavault/emu/mame/roms/qsound_hle.zip central directory
unzip: closing archive file /mnt/openmediavault/emu/mame/roms/qsound_hle.zip and sending to cache
Optional memory region ':stars' not found
Optional device ':soundlatch2' not found
Optional device ':soundlatch' not found
Optional device ':m48t35' not found
Optional device ':oki' not found
Optional shared pointer ':mainram' not found
Optional memory region ':eeprom' not found
Optional memory region ':screen' not found
Starting Marvel Vs. Capcom: Clash of Super Heroes (Euro 980123) ':'
  (missing dependencies; rescheduling)
Starting Motorola MC68000 ':maincpu'
Starting Timer ':scantimer'
Starting Zilog Z80 ':audiocpu'
Starting Serial EEPROM 93C46 (64x16) ':eeprom'
Starting Video Screen ':screen'
  (missing dependencies; rescheduling)
Starting gfxdecode ':gfxdecode'
Starting palette ':palette'
Starting Speaker ':lspeaker'
  (missing dependencies; rescheduling)
Starting Speaker ':rspeaker'
  (missing dependencies; rescheduling)
Starting QSound (HLE) ':qsound'
Starting Marvel Vs. Capcom: Clash of Super Heroes (Euro 980123) ':'
  (missing dependencies; rescheduling)
Starting Video Screen ':screen'
Starting Speaker ':lspeaker'
Starting Speaker ':rspeaker'
Starting Marvel Vs. Capcom: Clash of Super Heroes (Euro 980123) ':'
Attempting to parse: default.cfg
Attempting to parse: mvsc.cfg
Enter sdl_info::create
Skipped window event due to missing window param from SDL
Skipped window event due to missing window param from SDL
Skipped window event due to missing window param from SDL
Skipped window event due to missing window param from SDL
Enter sdl_info::create
Skipped window event due to missing window param from SDL
Skipped window event due to missing window param from SDL
Average speed: 91.49% (11 seconds)
sdl_kill: closing audio
Sound buffer: overflows=0 underflows=242
Enter sdlwindow_exit
Leave sdlwindow_exit

The music keeps playing and switching to window with alt-enter resumes the video updates. Switching back to fullscreen repeats the issue. With opengl backend everything works as expected. Is this a known problem? Is there any other info I can provide? Thanks.

belegdol commented 3 years ago

This appears to be specific to nvidia drivers. My other machine running radeon via wayland is slow AF when in fullscreen but the image keeps updating.

belegdol commented 3 years ago

I tried to bisect this but I got as far back as 0.215 which is the oldest release I am able to get to compile and it also exhibits the problem. This would seem to indicate that the problem is with the enviroment change and not a mame change.

belegdol commented 3 years ago

This does not happen under wayland, only under x11. Which is convenient, because opengl does not work on wayland with nvidia binary drivers.

belegdol commented 3 years ago

https://github.com/mamedev/mame/pull/8469 does not fix this. It did not say it would, but it we could have been lucky.

belegdol commented 2 years ago

This seems fixed as of 510.47.03 nvidia driver. From 510.39.01 changelog [1]:

Worked around an issue that prevented some games from flipping (and therefore taking advantage of G-SYNC and G-SYNC Compatible monitors) on certain desktops such as GNOME.

[1] https://forums.developer.nvidia.com/t/linux-solaris-and-freebsd-driver-510-39-01-beta/200220