What Is Screen Tearing and How to Get Rid of It on Linux

Stop Screen Tearing On Linux

Unfortunately for Linux fans, screen tearing is, and has been, a persistent annoyance that doesn’t seem to be going anywhere. There are a couple of factors enabling the longevity of the screen tearing issue.

First, and probably most obviously, is the dated, broken, and bloated X server. Even with the progress of Wayland, X is here to stay for the immediate future. Next is the strange and inconsistent graphics driver picture. One of the biggest offenders in causing screen tearing is also the most popular GPU manufacturer on Linux, NVIDIA. Throw in different desktop environments with their own display settings and compositors, and you have a real mess.

These methods will hopefully eliminate screen tearing in most situations, but it’s impossible to provide a one-size-fits-all solution, thanks to the amount of variables involved. Try what applies to your system, and keep in mind that there might be new factors involved.

Also read: Do You Need A 360 Hz Monitor? Ultra-High Refresh Rates Explained

NVIDIA

This isn’t the only solution for NVIDIA, and there are certainly situations that it doesn’t apply to, but it’s one of the better options, and it doesn’t rely on NVIDIA’s graphical utility that doesn’t always play nice with desktop environment configurations.

To start, you’ll need to enable setting for the NVIDIA DRM module (modsetting). Start by making a configuration file in the modprobe directory.

sudo touch /etc/modprobe.d/nvidia-nomodset.conf

Open that file with your favorite text editor, and insert the following line:

options nvidia-drm modset=1

NVIDIA Modsetting Config

Update your kernel’s initramfs to apply your change.

sudo update-initramfs -u

When that’s done, reboot. Your computer will come back up, and everything should be smoother, but you aren’t quite done yet.

Swap can save you in a pinch, but for something like graphics, its pretty terrible. The best thing you can do here to increase performance is reduce your computer’s tendency to use swap space. Start by checking your current “swappiness.”

cat /proc/sys/vm/swappiness

Linux Swappiness

That will probably return “60.” That’s the default value, but you can set it much lower. Open “/etc/sysctl.conf,” and add the following line at the bottom of the file:

vm.swappiness=15

You can set the value based on how much RAM you have. 5 to 15 is usually the range you can safely work with. Reset your computer, and everything should be smoother.

Intel

Intel graphics on Linux usually aren’t too much of a problem. That’s probably because integrated graphics usually have fewer features, and the Intel driver stack is mostly open source. For screen tearing on Intel, the solution usually comes in the form of some additional configuration.

Because Intel uses open source drivers, the Xorg configuration is going to be your most direct route. Create a file at “/etc/X11/xorg.conf.d/20-intel.conf,” then place the following block of code inside:

Section "Device"
 
    Identifier "Intel Graphics"
 
    Driver "intel"
 
    Option "TearFree" "true"
 
EndSection

When you’re done, save and reboot.

VSYNC

Vsync is an attempt to synchronize your software refresh rate to your monitor hardware’s default refresh rate. In theory, it’s a great idea to make everything as smooth as possible. In reality, sometimes it lives up to its potential, and others, it makes your graphics an unstable mess. If you are using Vsync, and you’re experiencing screen tearing, try disabling it. If you aren’t using Vsync, it might be the very thing that gets things in line.

KDE

KDE Compositing Controls

KDE has some fantastic controls, so this can all be done through the KDE Plasma Settings. Open the Settings application, and find “Hardware” on the side. Under that heading you’ll find the display settings. Click on those. The main body of the window will fill up with display settings. The tabs on the side will switch. Pick “Compositor.” Locate the “Tearing prevention” option, and set it to “Full screen repaints.” When you’re done, apply the change.

Kwin, the KDE compositor is sometimes part of the problem, too. It follows its own rules. There’s a simple bit of configuration that you can add to make Kwin smoother.

Create a new file at “/etc/profile.d/kwin.sh.” Open that file, and place the line below in it:

export KWIN_TRIPLE_BUFFER=1

Log out of KDE, and log back in for the change to take effect.

GNOME

This is a pretty terrible answer, but there isn’t a setting directly in GNOME to manage vsync, but it can still really help. If you’re running GNOME with either Intel or NVIDIA graphics, follow the above instructions. If you’re on AMD, add the following line to your Xorg configuration:

Option "TearFree" "true"

XFCE

XFCE is notorious for screen tearing. It’s always been a problem, and it can seriously get in the way. However, there’s a fairly simple solution. All you need to do is rip out XFCE’s compositor and replace it with a different one, in this case Compton.

XFCE Disable Compositing

Open the XFCE settings, then locate the window manager settings. Click on the “Compositor” tab, and uncheck the box to “Enable display compositing.” Apply the settings.

Next, install Compton. It’s an independent compositor that works very well with lightweight desktops. The command here is for Debian-based distributions, but Compton is available on just about every popular distro.

sudo apt install compton

XFCE Run Compton At Start

Return to the XFCE settings. This time, click on “Session and Startup.” Add a new application to run at startup. In case you haven’t guessed, that application is Compton. Paste the following in as your command. It contains several key options to run Compton optimally.

/usr/bin/compton --backend glx --paint-on-overlay --vsync opengl-swc

Save and exit. You can either log out and log back in or run the command to start Compton.

These methods are all excellent ways to try and solve your screen tearing problems under Linux. They might not work for everyone, but with any luck, they’ll work for you. Hopefully, as more progress is made in Linux graphics drivers, desktop environments, and Wayland, the screen tearing problem will finally be resolved permanently.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Nick Congleton

Nick is a freelance tech. journalist, Linux enthusiast, and a long time PC gamer.