Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Good news regarding tearing and low EmulationStation performance on Pi 4


  • Hi everyone! There appears to be some good news for RetroPie regarding the tearing and performance issues that have plagued the RetroPie build for Pi 4 so far. The Raspberry Pi guys have just begun public testing of Linux kernel 5.4, which will be released in a couple of months if testing goes as planned. This test release includes the full KMS GPU driver, which moves some functionality that was previously run on the VideoCore GPU out to the ARM cluster. This is a more standard implementation that will replace the firmware based "fake KMS" driver.

    Anyway, this kernel can now be tested by end users. See instructions here for upgrading and also for changing from the fake KMS to the full KMS video driver: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=269769

    NOTE: This is for testing bleeding edge software! Expect issues and make sure you have a backup of any crirical stuff.

    I've made some quick tests of the latest RetroPie weekly build upgraded according to the link above and have seen some interesting stuff:

    • The EmulationStation issue where the framerate would intermittently get cut in half to 30 FPS is no longer reproducible.
    • When disabling threaded video and setting max swapchain images to 2 in RetroArch, in order to reduce input lag, the old video driver would frequently cause major tearing. This is no longer reproducible.
    • I did a quick test in GoldenEye and the framerate is mostly unchanged. However, subjectively I seemed to be getting much less massive framrate hitches when going around the corner in the tunnel at the start of the first level. Needs more testing, but maybe there's some bottleneck that's been reduced/removed.

    These are my results from a quick test session, so hopefully they hold up after some additional testing. Please feel free to try yourself and report here. One thing to remember, when setting max swapchain images to 2 in RetroArch, don't forget to also change RetroPie's run command setting to use the "Performance" CPU governor. Otherwise you will experience performance issues.


  • kernel=kernel8.img
    arm_64bit=1
    over_voltage=6
    arm_freq=2147
    gpu_freq=750
    dtoverlay= vc4-v3d-pi4
    
    Linux raspberrypi 5.4.29-v8 aarch64
    
    Mesa - 20.0.0-devel (git-f21b31a0db)
    

    I was feeling experimental and had compiled Mesa 20.0 shortly before stumbling across the Linux 5.4 public test. In my testing so far, everything is slightly faster, both in I/O and in 3D performance.

    • Redream: Sonic Adventure 2 still has its infamous slowdown spots, namely every part of the downhill dashes exhibits slowdown into a framerate in the 40s. More a known pain point in Redream than anything, but I wanna see just how much I can squeeze out of this Pi right now.

    • Redream: Ikaruga just works. All 60fps, all the time. Not a ton of experience with the game pre-update, so I'm not certain whether this was ever even an issue.

    • Redream: Marvel vs Capcom 2 is super smooth after a lot of caching.

  • Global Moderator

    @GigaCat AFAIK Redream comes with it's own Mesa driver, so if you're not launching the binary directly, without EmulationStation, you'll get the same MESA version as shipped with the package.


  • How does it handle N64 Shadows of the Empire? It is a good example of a game that nearly runs well on a Pi4 but not quite. Does the extra speed available benefit other areas like sound cutting out?


  • I can't get RetroPie to build here. Is there something I need to do to manually first compile Mesa or such, or any additional packages I need to install?

    Clean Raspbian Buster install on RPi 4.
    RetroPie Setup 4.5.18 (3a95bc6).
    Kernel: 5.4.29-v8+ #1302 SMP PREEMPT Thu Apr 2 18:05:46 BST 2020 aarch64 GNU/Linux
    Added to /boot/config.txt:

    • dt-overlay=vc4-kms-v3d-pi4
    • arm_64bit=1

    Returned error:

    Could not successfully build retroarch - RetroArch - frontend to the libretro emulator cores - required by all lr-* emulators (/home/pi/RetroPie-Setup/tmp/build/retroarch/retroarch not found).

    First error details in log:

    /usr/bin/ld: obj-unix/release/gfx/drivers_shader/shader_gl_core.o: in function `gl_core::Framebuffer::init()':
    shader_gl_core.cpp:(.text+0x8a0): undefined reference to `glTexStorage2D'
    /usr/bin/ld: shader_gl_core.cpp:(.text+0x9f0): undefined reference to `glTexStorage2D'
    

    (Going to try to go back to the old / stable kernel for now.)

  • Global Moderator

    This post is deleted!
  • Global Moderator

    @Picard We don't support running on the 64bit kernel.


  • @mitu Thanks, I'll undo that. (Mistaken assumption from GigaCat's response above.)
    Edit: No immediate help after going back to 32-bit kernel, then uninstalling and attempting to re-install RetroPie. Going back to a clean re-image to re-attempt...
    Edit: Worked after reverting to a clean re-image.


  • @George-Spiggott can you give an example of a level that plays poorly on SOTE? Which emulator are you using specifically? I feel like this game ran fullspeed last I played it.


  • Noob question, does rpi-update offer kernel headers now? I need them to build the gamecon pad driver.

  • Global Moderator

    @Picard then the error could be from a source Mesa install and not from the kernel upgrade.
    @Darksavior I don't think so, you'll need rpi-source, but it downloads the full kernel sources and not just the headers.


  • @mitu Thanks, but not sure what to do with the instructions on that page.


  • Thanks @quicksilver. The fps drops to around 45 at times during the Hoth missions but this may be the normal frame rate for the game as the game doesn't seem that slow. I understand that some slowdowns can be expected with high end N64 games even on native hardware. The sound cuts in and out from the intro sequence onwards into at least as far as the Hoth missions. I'm using lr-mupen64plus-next.

    I'm overclocked with the specs in my sig and running the emulator unmodified.


  • @Darksavior To install 5.4 kernel headers, run the rpi-source to get the kernel source, go into the kernel dir (should be /home/pi/linux-xxxxx) and run:

    make headers_install INSTALL_HDR_PATH=/usr
    

  • @George-Spiggott Without getting too far off topic. Try mupen64plus-gliden64. It seems to run full speed for me. Generally it is faster than lr-mupen64plus-next.


  • @Rascas said in Good news regarding tearing and low EmulationStation performance on Pi 4:

    make headers_install INSTALL_HDR_PATH=/usr

    Thanks, but that did not work.


  • @Darksavior Works fine here. With that command, headers are installed to /usr/include/ like it is normal but you can change the path to where you want to install them.


  • @Rascas There might be an issue with the pad driver compiling with it, I really have no idea what I'm doing. I'll create a new thread and see if anyone can help.


  • Ignoring my gamepad problem, I briefly tried these drivers.
    It doesn't support 4k60? 4k30 makes ES's menu glitch out and it eventually crashes to the terminal. 1080p seems fine and smooth.
    No audio since it defaults to this new hdmi audio driver. I found some way to make the old driver the default in alsamixer, but it didn't last.


  • First tests with raspberry pi 4 and kernel 5.4 and no problems so far.
    I can confirm, that emulationstation runs in full speed now.

    Till now, I didn't test all emulators. I will post again, if I find any problems.

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.