RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Good news regarding tearing and low EmulationStation performance on Pi 4

    Scheduled Pinned Locked Moved General Discussion and Gaming
    performancevsyncpi 4kernel 5.4
    194 Posts 38 Posters 58.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      SeraphisCain @beerninja
      last edited by

      @beerninja Last I heard, the FBNeo team definitely want to add cv1k support, they just need someone who can write the required sh4 dynarec for the CPU emulation.

      1 Reply Last reply Reply Quote 0
      • X
        xanstin
        last edited by

        So is the latest update suppose to fix this? I updated everything and still get tearing on NES games such as Metroid and even punch out.

        1 Reply Last reply Reply Quote 0
        • R
          RetroWhirl
          last edited by

          @xanstin Not really, and I'm pretty sure we are not getting a fix anytime soon. Most "retro enthusiasts" on youtube are happy with PI4 performance, so fixing stuff like this seems to be pretty low priority.

          dankcushionsD 1 Reply Last reply Reply Quote 0
          • dankcushionsD
            dankcushions Global Moderator @RetroWhirl
            last edited by

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

            @xanstin Not really, and I'm pretty sure we are not getting a fix anytime soon. Most "retro enthusiasts" on youtube are happy with PI4 performance, so fixing stuff like this seems to be pretty low priority.

            what will expedite a fix is someone logging the issue with the raspberry pi firmware team, but to do that someone needs to recreate the issue in a small test program, not something with so many other factors like emulationstation/emulation.

            right now i don't think this issue is on their radar.

            1 Reply Last reply Reply Quote 1
            • B
              Brunnis
              last edited by

              I’m currently trying to put together a RetroPie installation consisting of:

              • Linux kernel 5.9 64-bit
              • Mesa 20.3

              I started from the latest Raspberry Pi OS 64-bit desktop beta. Upgraded to kernel 5.9, which is simple now since it’s available in the ”next” branch of rpi-update since a few days. Upgrading from the almost year-old Mesa 19.3 to 20.3 was a bit more involved, but was successful. Currently installing RetroPie from source and hoping it will work as expected.

              Testing this will be interesting, since it contains major updates to both the full-KMS driver as well as Mesa. Also, using 64-bit for RetroPie will be a first for me, so that is interesting as well.

              DarksaviorD 1 Reply Last reply Reply Quote 0
              • DarksaviorD
                Darksavior @Brunnis
                last edited by

                @Brunnis Are they still not providing kernel headers even if it's in the "next" branch? My snes pad driver needs it. It's why I've never bothered using bleeding edge kernels.

                B 1 Reply Last reply Reply Quote 0
                • B
                  Brunnis @Darksavior
                  last edited by

                  @Darksavior I’m not sure about that. I haven’t seen that they do, though, so maybe not then.

                  EmulationStation started up fine on my build, but there’s no sound. Need to get that working before I do any testing.

                  B 1 Reply Last reply Reply Quote 0
                  • B
                    bluestang @Brunnis
                    last edited by bluestang

                    @Brunnis If you are using the KMS audio driver then you need to replace the code in vc4-hdmi.conf in usr/share/alsa/cards with the following:

                    # Configuration for the VC4-HDMI sound card using software IEC958
                    # subframe conversion
                    
                    <confdir:pcm/hdmi.conf>
                    vc4-hdmi.pcm.hdmi.0 {
                    	@args [ CARD AES0 AES1 AES2 AES3 ]
                    	@args.CARD {
                    		type string
                    	}
                    	@args.AES0 {
                    		type integer
                    	}
                    	@args.AES1 {
                    		type integer
                    	}
                    	@args.AES2 {
                    		type integer
                    	}
                    	@args.AES3 {
                    		type integer
                    	}
                    	type iec958
                    	slave {
                    		format IEC958_SUBFRAME_LE
                    		pcm {
                    			type hooks
                    			slave.pcm {
                    				type hw
                    				card $CARD
                    				device 0
                    			}
                    			hooks.0 {
                    				type ctl_elems
                    				hook_args [
                    				{
                    					name "IEC958 Playback Default"
                    					optional true
                    					lock true
                    					preserve true
                    					value [ $AES0 $AES1 $AES2 $AES3 ]
                    				}
                    				]
                    			}
                    		}
                    	}
                    	status [ $AES0 $AES1 $AES2 $AES3 ]
                    }
                    
                    # default with plug
                    vc4-hdmi.pcm.default {
                    	@args [ CARD ]
                    	@args.CARD {
                    		type string
                    	}
                    	type plug
                    	slave.pcm {
                    		type softvol
                    		slave.pcm {
                    			@func concat
                    			strings [ "hdmi:" $CARD ]
                    		}
                    		control {
                    			name "PCM Playback Volume"
                    			card $CARD
                    		}
                    	}
                    }
                    

                    If you are trying to use the firmware Broadcom audio driver with the KMS audio disabled (vc4-kms-v3d,noaudio) then at present the 5.9 kernel is broken. A fix has been committed, but rpi-update has not been updated with the latest change.

                    B 1 Reply Last reply Reply Quote 0
                    • B
                      Brunnis @bluestang
                      last edited by

                      @bluestang Ahh, thanks, that worked nicely! So, compared to current RetroPie images, I now have an installation that runs:

                      • 64-bit kernel and userland
                      • Linux kernel 5.9
                      • Bleeding edge Mesa ("20.3")
                      • The full KMS video driver
                      • The new ARM-side HDMI audio driver

                      That's quite a lot of under the hood changes. Despite this, I actually once again ran into the dreaded 30 FPS issue in EmulationStation. To the best of my knowledge, this only plagues the Pi 4, right? No other Pi and no other platform has this issue?

                      DarksaviorD B 2 Replies Last reply Reply Quote 0
                      • DarksaviorD
                        Darksavior @Brunnis
                        last edited by Darksavior

                        @Brunnis Last time I checked, ES runs at 60fps on my pi3b+ using the default low-res scraped box art. I switched to the pegasus-frontend with higher res box art, and it really lags on my pi3b+ (because of the box art) but on my pi4 it's butter smooth.

                        Also, Is there a real reason to go bleeding edge? I thought that in time, the pi4 would have drivers to handle the crt-pi shader at 4k, or at least the pc crt shaders at 1080p. I expected too much, I suppose.

                        1 Reply Last reply Reply Quote 0
                        • B
                          bluestang @Brunnis
                          last edited by

                          @Brunnis the "30 FPS issue" in EmulationStation on a Pi4 is something that requires a more in-depth investigation.

                          The only way I can overcome this issue is by setting v3d_freq_min=500 in /boot/config.txt, however, this is not a solution that works for everyone.

                          What I found out is that once v3d_freq is downclocked (~200-250MHz) when at idle the FPS will drop to 30 FPS in EmulationStation. Once v3d is taken off of idle (i.e. video playback, 3D game, etc) EmulationStation's FPS will jump up back to 60 FPS.

                          I've spent more time than I care to admit trying see what is the cause but have come up empty.

                          The one thing I have not tried is Batocera's implementation of EmulationStation. I'd be curious to know if it also has the same FPS issue. The reasoning behind my curiousity is that Batocera's OpenGLES implementation of EmulationStation was completely re-done.

                          If Batocera's EmulationStation doesn't have the same issue than that would narrow down what is causing the FPS problem.

                          DarksaviorD B 2 Replies Last reply Reply Quote 0
                          • DarksaviorD
                            Darksavior @bluestang
                            last edited by

                            @bluestang I'd test out batocera but I get a black screen. Might be the usb boot, I don't know (I'm not opening up my snes case to use the microsd).

                            1 Reply Last reply Reply Quote 0
                            • B
                              Brunnis @bluestang
                              last edited by

                              @bluestang Interesting. It would make sense and could also explain the intermittent/unpredictable behavior. For example, at one point (when I started this thread) I could no longer reproduce the issue. Then it came back, perhaps after firmware changes to the clock frequency scaling were made. I know this part of the firmware has received several changes over the course of the 16 months since the Pi 4 was released.

                              I wonder why the Pi 4 can't determine that it needs to clock the V3D up in these situations... Have you had any discussions with the Raspberry Pi folks (i.e. 6by9) regarding this issue?

                              @Darksavior Real reason to go bleeding edge? Only for testing out what might become the future of RetroPie and report issues found to the involved parties. I wouldn't attempt it on a system I intend to actually use for gaming.

                              B 1 Reply Last reply Reply Quote 0
                              • B
                                bluestang @Brunnis
                                last edited by

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

                                @bluestang
                                I wonder why the Pi 4 can't determine that it needs to clock the V3D up in these situations... Have you had any discussions with the Raspberry Pi folks (i.e. 6by9) regarding this issue?

                                I did bring it up in the RPi forums but without a solid example of duplicating the problem it’s hard for the engineers to diagnose it. Especially since the driver behavior norms are to downclock when it is idle.

                                I also managed to run a fresh install of Batocera on my Pi4 and it’s based on the 5.4 kernel and the KMS driver. Considering that the 5.4 KMS is WIP that will never progress like 5.9 I was pleased with the results I saw.

                                I need to do some further investigating.

                                B 1 Reply Last reply Reply Quote 0
                                • George SpiggottG
                                  George Spiggott
                                  last edited by George Spiggott

                                  Not sure if this info has already been posted.

                                  https://www.raspberrypi.org/blog/vulkan-update-merged-to-mesa/

                                  BTW: How do you find which version of Mesa you currently have installed on your Pi?

                                  Currently running:
                                  Retropie 4.8.9 on a Pi Zero 2W (Overclock Settings: CPU 1400Mhz)
                                  ES-DE on a GMKtec K6 (Windows 11, 32GB RAM)

                                  mituM 1 Reply Last reply Reply Quote 0
                                  • mituM
                                    mitu Global Moderator @George Spiggott
                                    last edited by

                                    @George-Spiggott You run one of

                                    apt show libglapi-mesa
                                    dpkg -l | grep mesa
                                    
                                    1 Reply Last reply Reply Quote 2
                                    • B
                                      Brunnis @bluestang
                                      last edited by Brunnis

                                      @bluestang I just tried setting v3d_freq_min=500 and sure enough it seems to fully cure the problem on my side. I tried rebooting a couple of times with and without the setting and could easily reproduce the issue without it.

                                      I can also report that N64 with mupen64plus-next is pretty terrible with this setup. Tried GoldenEye and Shadows of the Empire and the audio issues are massive. Instead of audio artifacts like I'm used to, the audio simply cuts out and can be gone for long stretches of time.

                                      dankcushionsD B 2 Replies Last reply Reply Quote 0
                                      • dankcushionsD
                                        dankcushions Global Moderator @Brunnis
                                        last edited by

                                        @Brunnis n64 is bad WITH v3d_freq_min=500? that doesn't seem very intuitive.

                                        if it's an improvement, and if we can get a collection of results (via different emulators/programs) before/after this change i think we might have enough to submit as a firmware bug.

                                        B 1 Reply Last reply Reply Quote 0
                                        • B
                                          Brunnis @dankcushions
                                          last edited by

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

                                          @Brunnis n64 is bad WITH v3d_freq_min=500? that doesn't seem very intuitive.

                                          if it's an improvement, and if we can get a collection of results (via different emulators/programs) before/after this change i think we might have enough to submit as a firmware bug.

                                          Sorry, I was talking about two different things. 500MHz minimum V3D solved the EmulationStation bug. This has no effect on N64. It's bad either way with this setup. I'm guessing the new HDMI audio driver plays a part in that.

                                          dankcushionsD 1 Reply Last reply Reply Quote 0
                                          • dankcushionsD
                                            dankcushions Global Moderator @Brunnis
                                            last edited by

                                            @Brunnis one issue at a time... does it (v3d_min) solve the tearing issues in other emulators? it's difficult to recreate as they seem to be sporadic.

                                            B B Z 4 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            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.