DISPMANX - triple buffer disable likely cause of extreme slowdown
Description
Removal of triple buffer in dispmanx driver is believe to be causing severe slowdowns on RPI across all cores when retroarch.cfg video_driver is set to 'dispmanx'.
Expected behavior
Dispmanx is the preferred video driver for reducing input lag compared to the default gl as shown by testing user brunnis performed. As of the release of RetroPie 4.1, use of dispmanx as the video driver worked perfectly and reduced input lag by one frame across all cores. No slowdown or screen stutter was experienced due to using dispmanx compared to the default video driver gl.
Actual behavior
In the RetroPie 4.2 build, the commit https://github.com/libretro/RetroArch/commit/0b75671c21ec1e891779031b6435ad18debe3e60 is believed to have caused the severe slowdown across all cores on RPI. For example, The Lost Levels on lr-snes98x2010 is unplayable with extreme slowdown and screen stutter. This is verified in other cores such as lr-nestopia and others.
Steps to reproduce the bug
-
Clean install of RetroPie 4.1 on a Raspberry Pi 3
-
Change video_driver to 'dispmanx'
-
All cores work great, no slowdown caused by video driver
-
Clean install of RetroPie 4.2 on same Raspberry Pi 3
-
Change video_driver to 'dispmanx'
-
All cores are choppy, some unplayable. The Lost Levels on lr-snes98x2010 is a great showcase of this.
Bisect Results
This occurred sometime between Nov. 5, 2016 and Mar. 20, 2017, most likely with commit https://github.com/libretro/RetroArch/commit/0b75671c21ec1e891779031b6435ad18debe3e60 on Feb 12, 2017.
Version/Commit
https://github.com/libretro/RetroArch/commit/0b75671c21ec1e891779031b6435ad18debe3e60
Environment information
- OS: Retropie 4.2
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Any chance you could try reverting that commit and re-build to see if that indeed resolves it?
I am new to Git, so I will have to research how to do that on my Pi, but as soon as I learn, I will do that and report back.
Looks like it reverts cleanly, so you'll just need to do:
git clone https://github.com/libretro/RetroArch.git
cd RetroArch
git revert 0b75671
and then build as normal.
From a quick look, vc_dispmanx_update_submit_sync() might be causing this.
If we assume a refresh rate of e.g. 60Hz, then the interval between frames is around 16ms. Under the assumption that the calls to dispmanx_surface_update() are equally distributed in this interval, then submit_sync() blocks for 8ms on average. Which is quite a lot.
seems to work fine following https://github.com/libretro/RetroArch/pull/4862
won't be in retropie as that builds 1.5.0, but retropie seems to have its own solution.
This seems to be a fixed issue so I am going to close it.