snowballEarth
Posts: 95
Joined: Wed Feb 18, 2015 9:05 pm

Re: Extreame screen tearing on Raspberry Pi 4

Sun Apr 12, 2020 10:28 am

Can confirm that:

Code: Select all

sudo raspi-config -> Advanced Options -> Compositor -> then choosing "no" to xcompmgr composition manager
fixes screen tearing on fullscreen video, at websites in Chromium browser like YouTube and BBC IPlayer. It is widely reported to work with other streaming services too.
It only works in fullscreen and after the mouse cursor / video toolbar has faded away after a couple seconds.
It works up to 1080p30fps, but get occasional dropped frames and tearing at 60fps. I blocked 60fps video using h264ify plugin.

(No idea how to install and configure compton compositor in it's place or whether I need to or not.)

hectorkvs
Posts: 51
Joined: Tue Jan 21, 2020 1:23 pm

Re: Extreame screen tearing on Raspberry Pi 4

Sun Apr 12, 2020 11:11 am

Ryarg wrote:
Thu Apr 09, 2020 2:32 pm
I fixed screen tearing for watching full screen video by first disabling the default compositor via raspi-config, then I installed compton, you can configure compton using a compton.conf file by adding it to the .config folder in your home directory. https://packages.debian.org/buster/compton

I've also read that just disabling the built in compositor works and compton isn't required, try this first, if there's no improvement try compton.

I'm also using compton on Manjaro KDE for the Pi 4 and it works - https://wiki.archlinux.org/index.php/Picom
Just go to https://blog.vpetkov.net/ and install his script ..no more screen tearing..

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32227
Joined: Sat Jul 30, 2011 7:41 pm

Re: Extreame screen tearing on Raspberry Pi 4

Sun Apr 12, 2020 11:44 am

snowballEarth wrote:
Sun Apr 12, 2020 10:28 am
Can confirm that:

Code: Select all

sudo raspi-config -> Advanced Options -> Compositor -> then choosing "no" to xcompmgr composition manager
fixes screen tearing on fullscreen video, at websites in Chromium browser like YouTube and BBC IPlayer. It is widely reported to work with other streaming services too.
It only works in fullscreen and after the mouse cursor / video toolbar has faded away after a couple seconds.
It works up to 1080p30fps, but get occasional dropped frames and tearing at 60fps. I blocked 60fps video using h264ify plugin.

(No idea how to install and configure compton compositor in it's place or whether I need to or not.)
Interesting. We've not had time to investigate the tearing yet, but this is a good pointer. Thanks!
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

User avatar
sonicmouse
Posts: 9
Joined: Tue Feb 25, 2020 7:14 pm

Re: Extreame screen tearing on Raspberry Pi 4

Fri Apr 24, 2020 2:14 pm

This is very exciting.. I can confirm this fix works for chrome! No more screen tearing.

One thing to keep in mind, if you are using chrome to play videos, you may need to start chrome with this flag:

Code: Select all

--use-gl=egl

I was still getting lag and tearing (albeit a lot less) without that flag with xcompmgr off.

Thank you guys so much -- appreciate it!

K9spud
Posts: 29
Joined: Fri Nov 22, 2019 5:38 am

Re: Extreame screen tearing on Raspberry Pi 4

Fri May 08, 2020 4:10 am

So, I gave the compton compositor a try. And yes, it does "fix" the screen tearing issue on my Pi 4. But it seems to reduce overall screen drawing performance. Dragging windows feels a little laggy. Video playback seems a little laggy and perhaps even dropping frames... So, I think I prefer leaving compton off and just enduring the screen tearing for now.

Screwing around some more, I found that I can use VLC to play 1080p video from the framebuffer console (no X11). This plays very smoothly -- no lag, no screen tearing, no dropped video frames. Clearly the Pi 4 hardware can perform well, just X11 fails to do it.

Searching the web, a lot of x86 X11 drivers (for Intel graphics, AMD, etc) provide options for TripleBuffering and other techniques in the xorg.conf file to avoid screen tearing in X11. Unfortunately, I don't see any evidence of those being available for us on the Pi 4. I'm not even exactly sure what X11 is using for a driver on Pi 4, I'm guessing "fbdev"? I also saw an "fbturbo" driver on my system that seems to mostly work, but doesn't solve the screen tearing problem.

I wonder how hard it would be to modify the X11 video driver on Pi 4 to have "triple buffering" or otherwise do some vsync synchronization? What is the preferred X11 video driver on Pi 4 and where do I get the source code?

gkreidl
Posts: 6345
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Extreame screen tearing on Raspberry Pi 4

Fri May 08, 2020 8:16 am

K9spud wrote:
Fri May 08, 2020 4:10 am
So, I gave the compton compositor a try. And yes, it does "fix" the screen tearing issue on my Pi 4. But it seems to reduce overall screen drawing performance. Dragging windows feels a little laggy. Video playback seems a little laggy and perhaps even dropping frames... So, I think I prefer leaving compton off and just enduring the screen tearing for now.

Screwing around some more, I found that I can use VLC to play 1080p video from the framebuffer console (no X11). This plays very smoothly -- no lag, no screen tearing, no dropped video frames. Clearly the Pi 4 hardware can perform well, just X11 fails to do it.

Searching the web, a lot of x86 X11 drivers (for Intel graphics, AMD, etc) provide options for TripleBuffering and other techniques in the xorg.conf file to avoid screen tearing in X11. Unfortunately, I don't see any evidence of those being available for us on the Pi 4. I'm not even exactly sure what X11 is using for a driver on Pi 4, I'm guessing "fbdev"? I also saw an "fbturbo" driver on my system that seems to mostly work, but doesn't solve the screen tearing problem.

I wonder how hard it would be to modify the X11 video driver on Pi 4 to have "triple buffering" or otherwise do some vsync synchronization? What is the preferred X11 video driver on Pi 4 and where do I get the source code?
Regarding VLC: use X11 MMAL splitter for video output. As soon as you switch to full screen mode (f key), the video is shown in an overlay created by the GPU. No screen tearing or lost frames any more.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

unlusaboy
Posts: 3
Joined: Wed Aug 05, 2020 8:51 pm

Re: Extreame screen tearing on Raspberry Pi 4

Fri Aug 07, 2020 7:58 am

Ryarg wrote:
Thu Apr 09, 2020 2:32 pm
I fixed screen tearing for watching full screen video by first disabling the default compositor via raspi-config, then I installed compton, you can configure compton using a compton.conf file by adding it to the .config folder in your home directory. https://packages.debian.org/buster/compton

I've also read that just disabling the built in compositor works and compton isn't required, try this first, if there's no improvement try compton.

I'm also using compton on Manjaro KDE for the Pi 4 and it works - https://wiki.archlinux.org/index.php/Picom
maybe your will share your config for noobs like me? :roll:

bunklung
Posts: 109
Joined: Tue Jun 25, 2019 12:10 pm

Re: Extreame screen tearing on Raspberry Pi 4

Sun Aug 30, 2020 11:47 am

jamesh wrote:
Sun Apr 12, 2020 11:44 am
snowballEarth wrote:
Sun Apr 12, 2020 10:28 am
Can confirm that:

Code: Select all

sudo raspi-config -> Advanced Options -> Compositor -> then choosing "no" to xcompmgr composition manager
fixes screen tearing on fullscreen video, at websites in Chromium browser like YouTube and BBC IPlayer. It is widely reported to work with other streaming services too.
It only works in fullscreen and after the mouse cursor / video toolbar has faded away after a couple seconds.
It works up to 1080p30fps, but get occasional dropped frames and tearing at 60fps. I blocked 60fps video using h264ify plugin.

(No idea how to install and configure compton compositor in it's place or whether I need to or not.)
Interesting. We've not had time to investigate the tearing yet, but this is a good pointer. Thanks!
Have you been able to identify why there is screen tearing? It's as if the window manager doesn't have vsync turned on unless it's running in full screen video mode. It really makes the RPi seem very unpolished when used as a desktop OS. I think someone reported this as a bug at one point. Maybe it's not a bug, but I find it to be a usability issues since it's so widespread in X. I think that's deserving of a report and a fix.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32227
Joined: Sat Jul 30, 2011 7:41 pm

Re: Extreame screen tearing on Raspberry Pi 4

Sun Aug 30, 2020 12:10 pm

bunklung wrote:
Sun Aug 30, 2020 11:47 am
jamesh wrote:
Sun Apr 12, 2020 11:44 am
snowballEarth wrote:
Sun Apr 12, 2020 10:28 am
Can confirm that:

Code: Select all

sudo raspi-config -> Advanced Options -> Compositor -> then choosing "no" to xcompmgr composition manager
fixes screen tearing on fullscreen video, at websites in Chromium browser like YouTube and BBC IPlayer. It is widely reported to work with other streaming services too.
It only works in fullscreen and after the mouse cursor / video toolbar has faded away after a couple seconds.
It works up to 1080p30fps, but get occasional dropped frames and tearing at 60fps. I blocked 60fps video using h264ify plugin.

(No idea how to install and configure compton compositor in it's place or whether I need to or not.)
Interesting. We've not had time to investigate the tearing yet, but this is a good pointer. Thanks!
Have you been able to identify why there is screen tearing? It's as if the window manager doesn't have vsync turned on unless it's running in full screen video mode. It really makes the RPi seem very unpolished when used as a desktop OS. I think someone reported this as a bug at one point. Maybe it's not a bug, but I find it to be a usability issues since it's so widespread in X. I think that's deserving of a report and a fix.
If we knew how to fix it easily it would already be fixed. It's not as simple as "sync updates to vsync".

We are spending most dev time in this area on the KMS driver, which should work fine in this respect. Fixing the older legacy stuff would be a waste at this stage.

Just as a interesting aside, I have a Samsung HD Smart TV that occasionally shows tearing when playing back Prime or Netflix shows. If Samsung with their resources have issues getting rid of it, it shows it can be a difficult problem to sort out.
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

bunklung
Posts: 109
Joined: Tue Jun 25, 2019 12:10 pm

Re: Extreame screen tearing on Raspberry Pi 4

Sun Aug 30, 2020 12:52 pm

jamesh wrote:
Sun Aug 30, 2020 12:10 pm
bunklung wrote:
Sun Aug 30, 2020 11:47 am
jamesh wrote:
Sun Apr 12, 2020 11:44 am


Interesting. We've not had time to investigate the tearing yet, but this is a good pointer. Thanks!
Have you been able to identify why there is screen tearing? It's as if the window manager doesn't have vsync turned on unless it's running in full screen video mode. It really makes the RPi seem very unpolished when used as a desktop OS. I think someone reported this as a bug at one point. Maybe it's not a bug, but I find it to be a usability issues since it's so widespread in X. I think that's deserving of a report and a fix.
If we knew how to fix it easily it would already be fixed. It's not as simple as "sync updates to vsync".

We are spending most dev time in this area on the KMS driver, which should work fine in this respect. Fixing the older legacy stuff would be a waste at this stage.

Just as a interesting aside, I have a Samsung HD Smart TV that occasionally shows tearing when playing back Prime or Netflix shows. If Samsung with their resources have issues getting rid of it, it shows it can be a difficult problem to sort out.
I'm grateful that it's still on the radar. I too wish it was an easy fix. There are always trade-offs and priorities that need to be balanced in all effort to improve and fix issues. This one seems to have a very large trade off for little improvement to the overall experience. But again, I do hope it gets fixed :) Perhaps it will be one of those side effect fixes that just happens when you work on something that seems unrelated.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32227
Joined: Sat Jul 30, 2011 7:41 pm

Re: Extreame screen tearing on Raspberry Pi 4

Sun Aug 30, 2020 2:01 pm

bunklung wrote:
Sun Aug 30, 2020 12:52 pm
jamesh wrote:
Sun Aug 30, 2020 12:10 pm
bunklung wrote:
Sun Aug 30, 2020 11:47 am


Have you been able to identify why there is screen tearing? It's as if the window manager doesn't have vsync turned on unless it's running in full screen video mode. It really makes the RPi seem very unpolished when used as a desktop OS. I think someone reported this as a bug at one point. Maybe it's not a bug, but I find it to be a usability issues since it's so widespread in X. I think that's deserving of a report and a fix.
If we knew how to fix it easily it would already be fixed. It's not as simple as "sync updates to vsync".

We are spending most dev time in this area on the KMS driver, which should work fine in this respect. Fixing the older legacy stuff would be a waste at this stage.

Just as a interesting aside, I have a Samsung HD Smart TV that occasionally shows tearing when playing back Prime or Netflix shows. If Samsung with their resources have issues getting rid of it, it shows it can be a difficult problem to sort out.
I'm grateful that it's still on the radar. I too wish it was an easy fix. There are always trade-offs and priorities that need to be balanced in all effort to improve and fix issues. This one seems to have a very large trade off for little improvement to the overall experience. But again, I do hope it gets fixed :) Perhaps it will be one of those side effect fixes that just happens when you work on something that seems unrelated.
As I said, KMS should fix it, so that is where work is being done. But KMS isn't ready as somethings still don't work correctly. You could try it - the driver is available.
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

bunklung
Posts: 109
Joined: Tue Jun 25, 2019 12:10 pm

Re: Extreame screen tearing on Raspberry Pi 4

Sun Aug 30, 2020 11:46 pm

jamesh wrote:
Sun Aug 30, 2020 2:01 pm
As I said, KMS should fix it, so that is where work is being done. But KMS isn't ready as somethings still don't work correctly. You could try it - the driver is available.
Blank screen when I boot :( At least I tried.

For anyone else who wants to test the KMS driver:

viewtopic.php?f=29&t=269769

...switch to dtoverlay=vc4-kms-v3d-pi4 on a pi4, or dtoverlay=vc4-kms-v3d on Pi2/3 (not recommended on Pi0/1).

ottoson
Posts: 1
Joined: Wed Jan 06, 2021 1:34 pm

Re: Extreame screen tearing on Raspberry Pi 4

Sat Jan 09, 2021 10:38 pm

Hello,

I also have tearing isses with the Pi 4.
I want to use the Pi 4 as a Media Center for my dads TV with KODI + a Browser, so tearing is a big issue.

I already tried most potential fixes without getting completely rid of the problem.
Is there any news of a reliable fix for this issues?

Please help!

Cheers,
Christian

Here my specs:

Code: Select all

pi@raspberrypi:~ $ lsb_release -irdc
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

pi@raspberrypi:~ $ uname -r
5.4.83-v7l+

pi@raspberrypi:~ $ cat /sys/firmware/devicetree/base/model
Raspberry Pi 4 Model B Rev 1.4

pi@raspberrypi:~ $ /opt/vc/bin/vcgencmd version
Jan  8 2021 14:31:16 
Copyright (c) 2012 Broadcom
version 194a85abd768c7334bbadc3f1911c10a7d18ed14 (clean) (release) (start)

pi@raspberrypi:~ $ cat /boot/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=1280
#framebuffer_height=720

# 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=1
#hdmi_mode=1

# 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.
#arm_freq=800

# 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
max_framebuffers=2

[all]
dtoverlay=vc4-fkms-v3d
gpu_mem=128

pi@raspberrypi:~ $ vcgencmd version
Jan  8 2021 14:31:16 
Copyright (c) 2012 Broadcom
version 194a85abd768c7334bbadc3f1911c10a7d18ed14 (clean) (release) (start)

pi@raspberrypi:~ $ vcgencmd get_config int
arm_freq=1500
audio_pwm_mode=514
config_hdmi_boost=5
core_freq=500
core_freq_min=200
disable_commandline_tags=2
disable_l2cache=1
disable_overscan=1
display_hdmi_rotate=-1
display_lcd_rotate=-1
enable_gic=1
force_eeprom_read=1
force_pwm_open=1
framebuffer_ignore_alpha=1
framebuffer_swap=1
gpu_freq=500
gpu_freq_min=250
init_uart_clock=0x2dc6c00
lcd_framerate=60
mask_gpu_interrupt0=1024
mask_gpu_interrupt1=0x10000
max_framebuffers=2
over_voltage_avs=-20000
pause_burst_frames=1
program_serial_random=1
total_mem=8192
hdmi_force_cec_address:0=65535
hdmi_force_cec_address:1=65535
hdmi_pixel_freq_limit:0=0x11e1a300
hdmi_pixel_freq_limit:1=0x11e1a300

Return to “Troubleshooting”