Good news regarding tearing and low EmulationStation performance on Pi 4
-
@philcsf Quite a bummer. It is a pre-release kernel I guess so I can only hope that these problems get sorted or clarified some time soon.
-
If you unplug your controller/joystick for about 3-5 secs and then replug it back in does the framerate jump back to 60 FPS again? Anytime the framerate dips to 30 FPS in the main menu if I unplug/replug my controller the framerate will go back to 60 FPS.
My Setup:
- RPi4 4GB, stock clock speeds.
- 64-bit RPiOS with RetroPie built from the setup script.
- Cosmic Rise theme (Hursty)
-- this theme seems to cause the 30 FPS anomaly fairly quickly. - I'm using emulationstation-dev.sh from the master RetroPie branch with the build flag
-DUSE_MESA_GLES=On
instead of-DGL=On
in emulationstation.sh
-- this will link the GLESv2 driver vs GL one. - RetroPie's SDL v2.0.10
- Stock 19.3.2 MESA drivers
What has been true in all my testing is that the clock speeds of the ARM or GPU will influence the framerate, if either one dips below a certain threshold the framerate will be reduced. (seems obvious =] )
Thresholds to trigger 30 FPS:
GPU MHz < 450 Mhz
ARM MHz < 900 MhzWhat befuddles me is that the framerate is not affected when you go to the options menu or a game system w/ roms menu. Every time you are in those menus the framerate is 60 FPS.
-
So the latest update is supposed to fix this? I've updated everything but NES games like Metroid stil get me frustrated.
-
@borisvivienne update of what? nothing is included in retropie as yet.
-
I was able to get the ES menu scrolling smoothly by placing force_turbo=1 in Boot config.txt. Probably already been said but just confirming here. I guess it will do until things are fixed under the hood.
-
@greenhawk84 You can force the gpu to a min frequency which will fix the 30 FPS issue in Emulation Station with the caveat that the GPU frequency will always be at 500 Mhz.
gpu_freq_min=500
in your/boot/config.txt
will do the trick and you remove theforce_turbo=1
option. -
@bluestang would there be any greater advantage to using the GPU freq option vs turbo?
-
@greenhawk84 just forcing the min frequency will still allow for other components to downclock especially if you are overclocked.
-
@bluestang okay, I switched over to the gpu freq at 500 for the slow ES menu, and it works the same as you said. I also tried Soul Calibur on Flycast using the KMS driver, and the tearing was resolved. I also tried Tekken 3 on psxrearmed and it seemed good. Just testing this out some more. I am not sure if these hiccups/tears were present in early Pi4 Retropie, because I wanted to see what users reported, such as this video on Youtube:
This reviewer does not seem to notice or mention anything about tearing which was highly noticeable for me in Flycast/Soul Calibur before testing the KMS driver. Was there some sort of regression as things were updated?
One last thing, since there is a lot of editing of config.txt, is there a place to get the true default file in case we mess something up?
-
@greenhawk84 said in Good news regarding tearing and low EmulationStation performance on Pi 4:
This reviewer does not seem to notice or mention anything about tearing which was highly noticeable for me in Flycast/Soul Calibur before testing the KMS driver. Was there some sort of regression as things were updated?
The FKMS driver has always had the issue of screen tearing in emulators. I think people are just noticing it more as the Pi4 userbase grows and threads like this one continue to get more posts seeking for help.
The crux of the problem has always been that the Raspberry Pi dev team had no easy way of fixing the proprietary Broadcom firmware that controls the GPU in FKMS. Early attempts were made but were unsuccessful. FKMS was dubbed "Fake Kernel Mode Setting", where the firmware wraps the Linux display API - KMS/DRM calls from the MESA driver to the GPU.
Since the Broadcom software was not an easy fix, the Raspberry Pi team decided to ditch the firmware altogether and create a display kernel driver that uses KMS/DRM the standard Linux way. This effort is now what is being referred to as the KMS driver. All the display controls are executed by the ARM CPU and directly through the Linux display API - KMS/DRM bypassing the Broadcom firmware altogether. You can also enable the KMS sound driver as well which can passthrough multi-channel HDMI sources.
In the end, KMS will have more features and will offer several options for the user to configure.
One last thing, since there is a lot of editing of config.txt, is there a place to get the true default file in case we mess something up?
https://github.com/RPi-Distro/pi-gen/blob/master/stage1/00-boot-files/files/config.txt
-
That is fantastic info and thanks for sharing this. Count me as a new Pi 4 (400 actually) user who has been a bit confused by the tearing. We seem to have had lots of people saying the Pi 4 is great for emulation and quite powerful but few talking about the tearing issue, so yes it was a bit of a surprise. I'm glad it's known and that work is being done on it, and I can't wait for it to bear fruit. I long to be able to place the Pi 400 as my main machine in the living room, but I'm resolved to waiting for now. Luckily my Pi 3 punches above it's weight thanks to the Retropie team and I am very thankful indeed for that. :-)
-
Does anyone know if KMS is now at a stage where it is possible and practical to use the new audio drivers with it rather than the legacy ones?
-
@george-spiggott said in Good news regarding tearing and low EmulationStation performance on Pi 4:
Does anyone know if KMS is now at a stage where it is possible and practical to use the new audio drivers with it rather than the legacy ones?
Yes. I’ve been using the vc4-hdmi driver without any issues.
-
@bluestang Great news, How did you set it up in your config file?
-
@george-spiggott said in Good news regarding tearing and low EmulationStation performance on Pi 4:
@bluestang Great news, How did you set it up in your config file?
In order to use the KMS video and audio driver you need to do the following after doing a full sudo apt update and full-upgrade:
-
Edit vc4-hdmi.conf as posted here. Requires sudo privileges to edit the file.
-
Comment out the dtparam=audio=on
-
Enable dtoverlay=vc4-kms-v3d (remove noaudio)
-
Reboot. You may need to start the desktop to select the audio output i.e. - HDMI
-
-
@bluestang I did all that apart from starting the desktop. I have no desktop AFAIK on Retropie. I currently am not getting any sound.
After the upgrade I have the following:
Kernel: 5.10.17-v7l+
Mesa: 19.3.2-1~bpo10+1~rpt3 -
@george-spiggott said in Good news regarding tearing and low EmulationStation performance on Pi 4:
@bluestang I did all that apart from starting the desktop. I have no desktop AFAIK on Retropie. I currently am not getting any sound.
After the upgrade I have the following:
Kernel: 5.10.17-v7l+
Mesa: 19.3.2-1~bpo10+1~rpt3I had to install the desktop and then make sure that the sound output was enabled by clicking the sound applet in the desktop taskbar.
I don’t believe there is an option in raspi-config for this yet as the KMS driver is still in testing.
Although this specific sound issue, is something I’ve come across before and warrants a fix by the RPi dev team IMHO.
-
Today I was playing around with overclocks by monitoring the ARM freq live while I flipped the ES menu and started games. I noticed that Mortal Kombat 2 Plus (mk2p) on Mame2003 Plus had significant tearing vs. Mortal Kombat 2 (regular mk2) on Mame2016. Not sure if maybe different cores are handling this differently? Just something I noticed.
FYI I have decided to leave my ARM clock as default for now.
-
@akamming said in Good news regarding tearing and low EmulationStation performance on Pi 4:
I noticed some errors on the console. Haven't noticed them before. The only change i lately did was the move to 5.4 using the kms driver. So i think it is related.
mmal: mmal_vc_component_create: failed to create component 'vc.ril.hvs' (1:ENOMEM) mmal: mmal_component_create_core: could not create component 'vc.ril.hvs' (1)
All works fine, dos anyone know what they mean and how to fix (or how they can be supressed, alle seems to work fine...)?
@akamming I just started tinkering with KMS and my console also displays these errors each time a video snap plays (using VLC). Like you, I'm having no visual/audio issues, but these errors appear on the console. The Interwebs were not much help. Were you ever able to find a solution?
-
@george-spiggott said in Good news regarding tearing and low EmulationStation performance on Pi 4:
@bluestang I did all that apart from starting the desktop. I have no desktop AFAIK on Retropie. I currently am not getting any sound.
After the upgrade I have the following:
Kernel: 5.10.17-v7l+
Mesa: 19.3.2-1~bpo10+1~rpt3Update - @George-Spiggott
There are 2 routes you can choose:
-
The most simplest one is to delete the
.asoundrc
file in your home directory. This will enable audio output from the KMS audio driver, however, mixing is not available. So if you have a BGM or any other music audio playing in the background it will not play as this configuration only allows for a single audio source output. -
The PulseAudio solution will overcome the mixing limitation as described above. Check to see if you have PulseAudio installed --
apt policy pulseaudio
. If not, install from apt and then runsystemctl --user enable pulseaudio
. Reboot and you should have sound from the KMS audio driver.
RPiOS ditched the default ALSA sound configs in favor of PulseAudio back in Dec '20.
-
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.