You just installed a new Linux distribution on you system and video playback on YouTube or Netflix is flickering. Annoying distortion appears in fast scenes, so called screen tearing. Something I noticed quite frequently again and again in all the years of using Linux as my major operating system. It has been present for videos, while playing games or even while scrolling down on a web page. I think i had similar problems on almost any desktop environment I’ve used so far like XFCE, Cinnamon, KDE or Gnome. So here are my short steps which I take to get rid of those visual errors.
1. X11 or Wayland?
Depending on the distribution and desktop environment one of those protocols is in use. You can check this for example with the environment variable $XDG_SESSION_TYPE. Run “echo $XDG_SESSION_TYPE” in your terminal/console and it should return the current type of the session.
Wayland:foo@linux:~> echo $XDG_SESSION_TYPE
wayland
foo@linux:~>
X11:foo@linux:~> echo $XDG_SESSION_TYPE
x11
foo@linux:~>
Right there we may already have a possible solution to our problem. With Wayland tearing is actually a very rare issue compared to the X11 days. I only encountered it because of bad drivers. So if you are on X11 and you are using a more common desktop environment like Gnome or KDE Plasma, you should be able to select the session type on the login screen. There is a good chance this will already fix the problem.
2. X11 with Intel, AMD or Nvidia graphics
Please be careful, only edit configuration files in your system if you know what those options do! Back them up beforehand to be able to revert changes you did!
You are stuck on X11 because Wayland is not supported with the distro or desktop environment your currently using? For X11 there is an option in the xorg configuration file called “Tearfree” which should be set.
Intel:
/etc/X11/xorg.conf.d/20-intel.conf
Section "Device" Identifier "Intel Graphics" Driver "intel" Option "TearFree" "true" EndSection
see https://wiki.archlinux.org/index.php/intel_graphics#Tearing
For AMD the configuration looks almost the same:
/etc/X11/xorg.conf.d/20-amdgpu.conf
Section "Device" Identifier "AMD" Driver "amdgpu" Option "TearFree" "true" EndSection
see https://wiki.archlinux.org/index.php/AMDGPU#Tear_free_rendering
For Nvidia the configuration is a little bit more complicated. Please read the details in the arch wiki about this topic! https://wiki.archlinux.org/index.php/NVIDIA/Troubleshooting#Avoid_screen_tearing
/etc/X11/xorg.conf.d/20-nvidia.conf
Section "Device" Identifier "Nvidia Card" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce GTX 1050 Ti" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" Option "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}" Option "AllowIndirectGLXProtocol" "off" Option "TripleBuffer" "on" EndSection
3. Narrow down the problem and try to describe circumstances under which the problem occurs, look for help
If none of the above points fixed the problem you should try to narrow down the cause of the error. There are good videos to check for screen tearing errors. First thing for me to check would be if the tearing occurs on Chrome/Chromium in the same way as with Firefox. If that’s the case how does video playback look with a offline video from the hard disk with the installed video player? Maybe only distortions while in full screen mode? The more specific you are able to describe the circumstances for the issue, the more easy it will be to find the right solution. This information will be very important if you really need help from someone in a forum, Reddit or from colleagues.
You shouldn’t waste to much time trying to fix the problem by yourself. This can be really frustrating if the problem is something more complicated and only fixable by more experienced users. Its a good idea to search for help if you already did some research on Google, Archwiki, Reddit and in the forum of your distribution. Make post in the forum of your distribution or in a fitting Subreddit. For beginners I would argue you actually don’t need to do much research by yourself, people will point you in the right direction where to search or even give straight up feedback and help. I still recommend mentioning what your level of experience with Linux is. This way the helping person can describe in a (for you) understandable fashion how to proceed. Especially if those errors are related to your graphics in general, its almost impossible for a beginner to fix the issue in an acceptable amount of time. More experienced users will pin point the problem for you with a look onto the configuration and log files.
Here some more possible things to consider which I stumbled upon more than once with the years. Check for graphic issues in general:
- Are the video drivers up-to-date?
- Does the problem occur since the last update? If yes check the forum or the Subreddit, there may be reports from users with the same issue. Consider making a post yourself. This is especially relevant for rolling release distributions like Arch Linux (and every distribution based on Arch like Manjaro), Fedora (semi-rolling) and OpenSuse Tumbleweed.
Specifically to check when experiencing issues like tearing or glitches:
- On Wayland there are several compositor settings you can change to test for improvment (OpenGL version, v-sync etc.)
- For XFCE (and similar desktop environments with custom compositors) the use of Compton as compositor often helps to fix problems like screen tearing, see https://wiki.manjaro.org/index.php?title=Using_Compton_for_a_tear-free_experience_in_Xfce
Use Wayland