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.3k 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 @Brunnis
      last edited by SeraphisCain

      Tested 5.9 myself a couple days ago. A couple observations:

      • The micro-stuttering/jerkiness that I would frequently notice (especially in 2D games) when using the 5.4 KMS driver seems to be completely resolved now. This was my biggest barrier to using KMS, so I'm happy to see that it's no longer an issue.

      • This one's emulator-specific, but Amiberry seems to be completely broken when using KMS on 5.9. It boots to a black screen, and while there is audio, it's extremely slow/choppy. Reverting to FKMS resolves the issue completely.

      • The new Alsa driver causes frequent audio drop-outs in more demanding games/less optimized emulators (3DO, Jaguar, N64, CAVE games on MAME 2015/2016).

      EDIT: I guess I hadn't noticed or hadn't tested Amiberry on 5.4 KMS, because I just did and it's also broken there as well, although in a different way compared to 5.9 KMS. On 5.4, the TV/monitor completely loses signal when Amiberry boots. Exiting the emulator brings the signal back. And once again, switching back to FKMS resolves the problem.

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

        @SeraphisCain Amiberry uses the dispmanx api for display, so it won't work with the full KMS driver, regardless of the kernel version used.

        S B DarksaviorD 3 Replies Last reply Reply Quote 0
        • S
          SeraphisCain @mitu
          last edited by

          @mitu Yeah, I discovered as much earlier today after searching around on Github a bit. Are there any other emulators in RetroPie that use dispmanx in the way Amiberry does? Thus far it's been the only one I've found that doesn't work with KMS.

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

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

            Are there any other emulators in RetroPie that use dispmanx in the way Amiberry does? Thus far it's been the only one I've found that doesn't work with KMS.

            Yes - dosbox, SDL1 based emulators that don't have SDL2 support (fuse, openbor, daphne just to name a few).

            1 Reply Last reply Reply Quote 0
            • Z
              zerojay
              last edited by

              And then there's also the problem of not being able to change the framebuffer, so you can't use tvservice nor use the resolution switching from runcommand.

              Otherwise, I never saw screen tearing ever during my testing, but the drawbacks were too much in my opinion.

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

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

                @SeraphisCain Amiberry uses the dispmanx api for display, so it won't work with the full KMS driver, regardless of the kernel version used.

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

                @mitu Yeah, I discovered as much earlier today after searching around on Github a bit. Are there any other emulators in RetroPie that use dispmanx in the way Amiberry does? Thus far it's been the only one I've found that doesn't work with KMS.

                Is their wiki out of date?

                https://github.com/midwan/amiberry/wiki/First-Installation

                If you want to use Full KMS driver, then you should pick the SDL2 target instead.

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

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

                  Is their wiki out of date?

                  No, but SDL2 can use various video drivers and Amiberry supports both (KMS and Dispmanx).

                  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 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.

                    I am not able to get any tearing in emulators with this setup (i.e. Linux 5.9 64-bit, full KMS, Mesa 20.3-devel). I've tested with and without v3d_freq_min=500, with and without threaded video and with max swapchain images 2 and 3. No tearing observed in emulators.

                    During my testing, v3d_freq_min=500 has effectively cured the EmulationStation 30 FPS issue. The issue is very easy to reproduce once v3d_freq_min=500 is removed from config.txt.

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

                      This comment from Dom at Raspberry Pi serves as additional confirmation:

                      “The fkms driver does suffer from tearing. We are in the process of moving to the kms (fully arm side) driver which doesn't have this issue.”

                      https://www.raspberrypi.org/forums/viewtopic.php?p=1745410&sid=aa92eea8ecb7815b4496546f7a697857#p1745410

                      So it seems tearing will be history once the switch to full KMS is made. I will try to find some time to look into the 30 FPS issue, which appears to be completely separate.

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

                        I Just experimented a little:

                        • Removed v3d_freq_min=500 from my config.txt.
                        • Performed a cold reboot and started EmulationStation
                        • Logged into the Pi using SSH from my PC and ran bcmstat to print clock frequency info (see https://github.com/MilhouseVH/bcmstat):
                        ./bcmstat.sh xgpd1 -o+V3D
                        
                        • Started another SSH session and installed cpufrequtils:
                        sudo apt install cpufrequtils
                        
                        • Started scrolling left and right in EmulationStation. The 30 FPS was immediately present at all times. Then started changing between the "ondemand" and "performance" CPU governors:
                        for ((i=0;i<$(nproc);i++)); do sudo cpufreq-set -c $i -r -g performance; done
                        for ((i=0;i<$(nproc);i++)); do sudo cpufreq-set -c $i -r -g ondemand; done
                        
                        • With "performance", the CPU and V3D (GPU 3D core) frequencies are clocked up to 1500 and 500 MHz respectively. I changed between the governors while holding left or right on the D-pad to keep scrolling in EmulationStation. Every time the performance governor is set, the FPS immediately jumps up to 60 FPS. Every time the "ondemand" governor is set, the FPS goes back doen to 30 FPS.

                        Below is the output from bcmstat. At the bottom, where the V3D frequency jumps to 500 MHz is where I set the "performance" CPU governor and where the FPS jumps from 30 to 60 FPS.

                        67a06a27-79a0-473a-9615-5f55efadeb2a-image.png

                        This was pretty much expected, but I thought I'd detail the testing anyway if you want to experiment. The next step should be to prepare an image for the Raspberry Pi devs and supply these steps to them for reproducing and hopefully solving the issue.

                        1 Reply Last reply Reply Quote 3
                        • DarksaviorD
                          Darksavior
                          last edited by

                          Oh sweet. Compiling the 5.10 kernel also installs its headers. My snes pads works :D

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

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

                            @SeraphisCain Amiberry uses the dispmanx api for display, so it won't work with the full KMS driver, regardless of the kernel version used.

                            Semi offtopic, but is that why daphne gives me a black screen with the full kms driver? I can hear the audio.

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

                              @Darksavior https://retropie.org.uk/forum/topic/25370/good-news-regarding-tearing-and-low-emulationstation-performance-on-pi-4/125?_=1603777936887

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

                                I just created an issue for this at the Raspberry Pi github: https://github.com/raspberrypi/linux/issues/3935

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

                                  @brunnis @dankcushions

                                  Give upstream SDL2 a whirl and fresh build of MESA too, it seems to improve if not fix the Pi4 30 FPS EmulationStation issue.
                                  In a rom selection screen with video snaps, I am getting upwards of 120 fps!

                                  stooS B 2 Replies Last reply Reply Quote 1
                                  • stooS
                                    stoo @bluestang
                                    last edited by

                                    @bluestang Hey, could you give me a quick tutorial for installing upstream SDL2 and MESA to test them out?

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

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

                                      @brunnis @dankcushions

                                      Give upstream SDL2 a whirl and fresh build of MESA too, it seems to improve if not fix the Pi4 30 FPS EmulationStation issue.
                                      In a rom selection screen with video snaps, I am getting upwards of 120 fps!

                                      That's quite an interesting change. No time to test at the moment, but looking forward to seeing more reports from people using it. By the way, how well does RetroPie keep up with upstream SDL2?

                                      BuZzB B 2 Replies Last reply Reply Quote 0
                                      • B
                                        bluestang @stoo
                                        last edited by

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

                                        @bluestang Hey, could you give me a quick tutorial for installing upstream SDL2 and MESA to test them out?

                                        Not a quick tutorial and it will break your current image. RetroPie will adopt these things when they are ready, and at this point SDL2 upstream is a constant WIP.

                                        1 Reply Last reply Reply Quote 1
                                        • BuZzB
                                          BuZz administrators @Brunnis
                                          last edited by BuZz

                                          @brunnis regarding keeping up to date. It depends on whether we encounter issues with upstream. We will update when we are sure everything is ok and our rebased customisations work etc. Until recently sdl2 Kms driver had issues so we were waiting.

                                          To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                                          1 Reply Last reply Reply Quote 2
                                          • S
                                            Setiawan
                                            last edited by

                                            Anyone have any luck using the full KMS driver over composite? I've created a support topic regarding this, but perhaps someone here has had some luck with it?

                                            P 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.