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 59.8k 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.
    • A
      akamming @JUM
      last edited by

      @JUM you should really the link which was provided by @dankcushions. Instead of updating the previous post you now made another one, making the thread even more unreadable….

      anyway. Another suggestion is that if you make changes in files like config.txt you should know what you are doing and not just copy / past what you got from the last forum post, but check the entire thread and/or study the official documentation before making the changes. Making the wrong changes can brick your pi (e.g. too aggessive overclock settings) !

      The original forum posts contains links which quite clearly describe how to modify the config.txt. Also a lot of info on overclock settings can be found here.

      anyway if it helps: Here's my current config.txt:

      # For more options and information see
      # http://rpf.io/configtxt
      # Some settings may impact device functionality. See link above for details
      
      # uncomment if you get no picture on HDMI for a default "safe" mode
      #hdmi_safe=1
      
      # uncomment this if your display has a black border of unused pixels visible
      # and your display can output without overscan
      #disable_overscan=1
      
      # uncomment the following to adjust overscan. Use positive numbers if console
      # goes off screen, and negative if there is too much border
      #overscan_left=16
      #overscan_right=16
      #overscan_top=16
      #overscan_bottom=16
      
      # uncomment to force a console size. By default it will be display's size minus
      # overscan.
      #framebuffer_width=1920
      #framebuffer_height=1080
      
      # uncomment if hdmi display is not detected and composite is being output
      hdmi_force_hotplug=1
      
      # uncomment to force a specific HDMI mode (this will force VGA)
      hdmi_group=2
      hdmi_mode=82
      
      # uncomment to force a HDMI mode rather than DVI. This can make audio work in
      # DMT (computer monitor) modes
      #hdmi_drive=2
      
      # uncomment to increase signal to HDMI, if you have interference, blanking, or
      # no display
      #config_hdmi_boost=4
      
      # uncomment for composite PAL
      #sdtv_mode=2
      
      #uncomment to overclock the arm. 700 MHz is the default.
      over_voltage=6
      arm_freq=2100
      v3d_freq=800
      gpu_freq=750
      hdmi_enable_4kp60=1
      
      
      # Uncomment some or all of these to enable the optional hardware interfaces
      #dtparam=i2c_arm=on
      #dtparam=i2s=on
      #dtparam=spi=on
      
      # Uncomment this to enable infrared communication.
      #dtoverlay=gpio-ir,gpio_pin=17
      #dtoverlay=gpio-ir-tx,gpio_pin=18
      
      # Additional overlays and parameters are documented /boot/overlays/README
      
      # Enable audio (loads snd_bcm2835)
      dtparam=audio=on
      
      [pi4]
      # Enable DRM VC4 V3D driver on top of the dispmanx display stack
      #dtoverlay=vc4-fkms-v3d
      dtoverlay=vc4-kms-v3d-pi4,noaudio
      max_framebuffers=2
      
      [all]
      #dtoverlay=vc4-fkms-v3d
      
      # NOOBS Auto-generated Settings:
      gpu_mem=256
      
      
      J 1 Reply Last reply Reply Quote 1
      • J
        JUM @akamming
        last edited by

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

        @JUM you should really the link which was provided by @dankcushions. Instead of updating the previous post you now made another one, making the thread even more unreadable….

        anyway. Another suggestion is that if you make changes in files like config.txt you should know what you are doing and not just copy / past what you got from the last forum post, but check the entire thread and/or study the official documentation before making the changes. Making the wrong changes can brick your pi (e.g. too aggessive overclock settings) !

        The original forum posts contains links which quite clearly describe how to modify the config.txt. Also a lot of info on overclock settings can be found here.

        anyway if it helps: Here's my current config.txt:

        # For more options and information see
        # http://rpf.io/configtxt
        # Some settings may impact device functionality. See link above for details
        
        # uncomment if you get no picture on HDMI for a default "safe" mode
        #hdmi_safe=1
        
        # uncomment this if your display has a black border of unused pixels visible
        # and your display can output without overscan
        #disable_overscan=1
        
        # uncomment the following to adjust overscan. Use positive numbers if console
        # goes off screen, and negative if there is too much border
        #overscan_left=16
        #overscan_right=16
        #overscan_top=16
        #overscan_bottom=16
        
        # uncomment to force a console size. By default it will be display's size minus
        # overscan.
        #framebuffer_width=1920
        #framebuffer_height=1080
        
        # uncomment if hdmi display is not detected and composite is being output
        hdmi_force_hotplug=1
        
        # uncomment to force a specific HDMI mode (this will force VGA)
        hdmi_group=2
        hdmi_mode=82
        
        # uncomment to force a HDMI mode rather than DVI. This can make audio work in
        # DMT (computer monitor) modes
        #hdmi_drive=2
        
        # uncomment to increase signal to HDMI, if you have interference, blanking, or
        # no display
        #config_hdmi_boost=4
        
        # uncomment for composite PAL
        #sdtv_mode=2
        
        #uncomment to overclock the arm. 700 MHz is the default.
        over_voltage=6
        arm_freq=2100
        v3d_freq=800
        gpu_freq=750
        hdmi_enable_4kp60=1
        
        
        # Uncomment some or all of these to enable the optional hardware interfaces
        #dtparam=i2c_arm=on
        #dtparam=i2s=on
        #dtparam=spi=on
        
        # Uncomment this to enable infrared communication.
        #dtoverlay=gpio-ir,gpio_pin=17
        #dtoverlay=gpio-ir-tx,gpio_pin=18
        
        # Additional overlays and parameters are documented /boot/overlays/README
        
        # Enable audio (loads snd_bcm2835)
        dtparam=audio=on
        
        [pi4]
        # Enable DRM VC4 V3D driver on top of the dispmanx display stack
        #dtoverlay=vc4-fkms-v3d
        dtoverlay=vc4-kms-v3d-pi4,noaudio
        max_framebuffers=2
        
        [all]
        #dtoverlay=vc4-fkms-v3d
        
        # NOOBS Auto-generated Settings:
        gpu_mem=256
        
        

        Thanks

        You have Raspbian Buster installed or Raspberry Pi OS?

        A 1 Reply Last reply Reply Quote 0
        • B
          beerninja @akamming
          last edited by

          @akamming with your new clock settings are you able to play Cave shooters with lr-mame2016 without slowdown/audio stutter? For example espgal2 or futaribl both of those make the pi4 cry

          A 1 Reply Last reply Reply Quote 0
          • A
            akamming @JUM
            last edited by

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

            You have Raspbian Buster installed or Raspberry Pi OS?

            raspbian buster, but i think that's now called raspberry pi os ;-)

            1 Reply Last reply Reply Quote 0
            • A
              akamming @beerninja
              last edited by

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

              @akamming with your new clock settings are you able to play Cave shooters with lr-mame2016 without slowdown/audio stutter? For example espgal2 or futaribl both of those make the pi4 cry

              don't know, haven't tried that. i use lr-mame2003 for most games. lr-mame2016 is much slower...

              B 1 Reply Last reply Reply Quote 0
              • B
                beerninja @akamming
                last edited by

                @akamming I would use that too (or FBN) except those games were released after 2003 :-( Maybe one day we'll get an optimized cv1000 Cave game emulator that works on pi

                S 1 Reply Last reply Reply Quote 0
                • 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
                                            • 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.