Good news regarding tearing and low EmulationStation performance on Pi 4
-
@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.
-
-
@roslof said in Good news regarding tearing and low EmulationStation performance on Pi 4:
@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?
MMAL is incompatible with the KMS driver. These are just msgs that are gracefully saying that it is incompatible.
-
@bluestang said in Good news regarding tearing and low EmulationStation performance on Pi 4:
MMAL is incompatible with the KMS driver. These are just msgs that are gracefully saying that it is incompatible.
Thanks bluestang. By chance, are you aware of a way to suppress these messages?
-
@roslof said in Good news regarding tearing and low EmulationStation performance on Pi 4:
Thanks bluestang. By chance, are you aware of a way to suppress these messages?
Not really...there is ongoing work with the KMS video driver to support hw acceleration video decoding using V4L2 codecs. I believe Kodi is already using them...10-bit and 8-bit HDR hw video decoding are part of the KMS feature set.
MMAL is a Broadcom blob, whereas V4L2 is open-source API and is standard on Linux distros.
I failed to mention to you that using the KMS driver, as it currently stands, disables hw acceleration of video decoding. Eventually, this will be fixed in KMS but I don't see it as too big of a deal since I don't consume a lot of video media on my Pi4. Video snaps in ES typically are not that cpu intensive so it seems to be OK for the time being.
-
@roslof said in Good news regarding tearing and low EmulationStation performance on Pi 4:
@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?
@roslof @akamming I just moved my Pi4 onto the full KMS driver on kernel 5.10.17 and noticed the same errors on my console when I have video snaps on (VLC). Likewise, I don’t experience any audio/video issues and turning off video snaps and rebooting stops the errors.
Been trying to scour the web but nothing came up. Just wanted to share that I’m seeing the same and also looking for a solution.
-
-
@bluestang ah thanks for that clarification!! Much appreciated.
-
I am honestly confused by this whole tearing thing because my Pi4 setup runs a lot of stuff pretty great, even PS1 games, but then Flycast had bad tearing (if you look at the floor of the stage in Soul Calibur). Yet, I see posts and videos raving about Dreamcast performance on Pi4. Is this really an issue for 100% of up-to-date Pi4 builds using all default drivers? It makes me want to start fresh again, which is a royal pain, just to see if something went sideways along the way.
-
@greenhawk84 flycast is especially jittery for me beyond just what normal screen tearing looks like. So I primarily use redream for dreamcast emulation.
-
@greenhawk84
Once I set gpu_freq_min to 500 then Emulationstation didn't cause me any issues, but yes in the 3D emulation like Dreamcast and N64 you will still see tearing. The way around this I found was to go into the video settings and set G-Sync to on. This got rid of the tearing (for some reason!) and now it performs well. Don't set that for 8/16 bit stuff though or you'll see problems there (I found). There are other ways around this (such as setting kms in your config) but for now I prefer this approach until these problems are resolved.
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.