Fixing Screen Tearing issues on RPI4
-
v3d_freq_min only addresses the low/30 fps framerate issue that happens within EmulationStation.
The screen tearing issue from this thread is a separate issue is appears.
With the kernel setting set to ondemand, the expected behavior of the gpu clock is to ramp up the frequency to the default and then downclock to 300 Mhz when not used to conserve resources.
Also RetroArch v.1.8.9 and above made a lot of changes to the graphics side of their drivers. Once RetroPie devs update the setup script to implement those changes it may be worth waiting to see if the screen tearing has been fixed in those versions.
-
Maybe I'll look into installing the newest version of retroarch from source to see if it helps. Thanks for the suggestion @bluestang!
-
@bluestang I'm using the retropie draft build script for 1.9.0 and there is no change with the screen tearing.
-
Well darn, there has to be something we can do. I guess we should just keep waiting for better firmware? For the meantime, maybe I can go back to my pi3, or just suck it up and enjoy the pi4 with tearing.
Has anyone tried turning on the compositor? Does that affect retroarch if you are not running a desktop environment?
-
For anyone looking for a solution to this, I have found this thread.
Enabling the kms driver (although a work in progress) has fixed all tearing I was having. The tearing is replaced with some stuttering in some games, but I am more than okay with this.
To enable, I went to /boot/config.txt and edited this part:
[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
Basically, comment out dtoverlay=vc4-fkms-v3d with a #, and then put in the the dtoverlay=vc4-kms-v3d-pi4,noaudio line. For my setup, I was getting a black screen until I added the ,noaudio part to it.
Also, under [all] comment out the other dtoverlay underneath it if it is not commented out.I hope this helps others!
-
@brandflake11 Thank you, this absolutely fixed the really weird screen tearing issues I was having even with NES games. Thank you so very much.
-
@zerojay You're welcome, I'm glad it helped you. I hope having a clear topic like this addressing this issue helps others as well.
-
@brandflake11
I applied your changes to the /boot/config.txt and it helped a lot.
But some tearing was still visible when many sprites and layers were active in some situations. (Aliens 3 / SNES)What helped for me was reducing the overclocking from 2250 to 1950.
Now I cannot reproduce the tearing any more. -
That is very interesting @hgill that overclocking would affect that. I don't use overclocking on my pi and so I don't get any screen tearing. But, that's good to hear to keep note of for others!
-
@brandflake11 said in Fixing Screen Tearing issues on RPI4:
vc4-kms-v3d-pi4
This solution works great in my case in terms of fixing the screen tearing issues - thanks a lot.
However, I noticed that after applying such settings, the hardware accelerated OMXPlayer no longer plays video inside EmulationStation (but the sound plays just fine), which is a deal breaker for me.
-
@huey Yeah, there are definitely compromises with the experimental driver. I found kodi and the pixel desktop don't work super well with the kms driver either. If you don't want to play n64 and Dreamcast, honestly the pi3 may have a better experience at the moment. Maybe we'll get a complete kms driver eventually that fixes everything!
-
@brandflake11 said in Fixing Screen Tearing issues on RPI4:
@huey Yeah, there are definitely compromises with the experimental driver. I found kodi and the pixel desktop don't work super well with the kms driver either. If you don't want to play n64 and Dreamcast, honestly the pi3 may have a better experience at the moment. Maybe we'll get a complete kms driver eventually that fixes everything!
Thanks for confirming. I also read something along the same lines in the following RPi post and it seems to be an ongoing effort.
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=269769
"Note: kms won’t ever support applications that use firmware apis for display like dispmanx, or mmal/openmax video_render, including omxplayer, raspivid and non-gbm kodi. Similarly tvservice is not useful in this environment."
-
@brandflake11 Unfortunately, enabling the KMS driver in my config file gives me no video on startup. I’m also updated as of today on the latest version of RetroPie and still getting tearing in NES, SNES, every emulator I’ve tried. Did anyone else experience this? Is it really as simple as commenting out
[pi4] #dtoverlay=vc4-fkms-v3d
and then adding the experimental one?
dtoverlay=vc4-kms-v3d-pi4,noaudio
I’ve also seen some other posts where there’s a space after the “=“ sign and others that don’t use pi4 at the end at all.
Is there some documentation about this somewhere? -
@lolkthxbai Yes, it should be as simple as putting that line in your config. When you updated, did you update your packages too, not just the retropie/gaming stuff?
Maybe post your config and we can look at what may need to be changed.
Also, I don't know about the space between the = thing. I would just follow what the config file already has when it comes to spacing for the safest route.
-
@lolkthxbai
This simple guide should get you up and running with KMS driver. -
@bluestang I don't think you need to do rpi-update to get the kms driver anymore (double check me on that though!) I think it ships with the standard software. rpi-update can sometimes be a pain, because it can be difficult to go backwards after getting pre-release software with it. I wouldn't recommend it.
-
@brandflake11 said in Fixing Screen Tearing issues on RPI4:
@bluestang I don't think you need to do rpi-update to get the kms driver anymore (double check me on that though!) I think it ships with the standard software. rpi-update can sometimes be a pain, because it can be difficult to go backwards after getting pre-release software with it. I wouldn't recommend it.
You absolutely need to do rpi-update because the KMS driver in the 5.4 kernel is broken and will not be fixed.
All your doing is going from one broke driver to the other if you do not update your kernel.
If you need to revert back to the 5.4 kernel you can always do this:
sudo apt install --reinstall raspberrypi-bootloader raspberrypi-kernel
-
@bluestang Ah, I did not know about this. Thank you for the details!
How broken is the kms driver in the mainline packages?
-
@brandflake11 said in Fixing Screen Tearing issues on RPI4:
@bluestang Ah, I did not know about this. Thank you for the details!
How broken is the kms driver in the mainline packages?
It’s missing many patches that were merged from upstream Linux because they started to appear in 5.9 and then were carried over to 5.10. which is the next LTS release.
Eventually RPiOS will make the switch to 5.10 and all of this will be moot.
But if you are trying to test things out, you need to be on the latest kernel to take advantage of the patches.
-
@bluestang Thank you for explaining and provided a way to revert because I did a lot of work on this installation lol
Anyways, I just started withsudo rpi-update
It mentioned the bootloader EEPROM has a firmware update available. Should I do that after the kernel update is complete?
UPDATE: So after editing my config.txt file following the instructions in the link you posted I have no video. I can't even see the raspberry pi on my network anymore so I can't SSH either. It does turn on, I can see the ethernet port LED is flashing. Yikes.
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.