Screen tearing in Linux could be a major issue with non-compositing window managers.
Even many compositing window manager could show tearing while dragging windows.
Seems like lots of technical jargon, so to simplify the matter let's discus about basics.
ContentsShow / Hide
What is a compositing window manager?
Basically stacking window managers like kWin, Mutter, XFWM, Compiz with the capability of-screen buffering. They've functionalities like window shadow, 3D animation, transparent windows, anti-aliasing, blur background and many more.
They're much more visually appealing than simple window managers, read more here.
What is Screen tearing?
You may often notice that a part of the video/graphics/window is torn apart from the main section. It's is glitch related with video or graphics rendering, when the input video is not in sync with the refresh rate of the display. That's called Screen tearing and on LCD displays, horizontal screen tearing is much prominent.
Screen tearing happens mostly when you're playing a video and dragging/moving or maximizing/minimizing a window.
Fix Linux screen tearing
It's rather easy if you're using KWin or Mutter as window manager, there's always an option to enable vsync.
If you're using KDE or minimal KWin, use the instruction below.
- Open up the System Settings application.
- Go to the Display and Monitor option under the Hardware section.
- Then on the Tearing prevention option, set it to Full screen repaints. img
XFWM also has an option to enable vsync to prevent tearing, that never works !
You can also use a compositing manager like compton or xcompmgr with Openbox or XFWM window manager. But there's another little tweak to prevent linux screen tearing efficiently on Intel graphics.
First create a new X11 configuration directory,
mkdir -p /etc/X11/xorg.conf.d/, if already not exists.
Create a configuration file
20-intel.conf there with your favorite text editor as root.
sudo nano /etc/X11/xorg.conf.d/20-intel.conf
Put the configuration below there, and save the file, and exit the test editor.
Section "Device" Identifier "Intel Graphics" Driver "intel" Option "TearFree" "true" EndSection
Finally restart your X11 session by logging out and logging in again, or simply reboot the PC.
However you may need to add other few extra option like
Option "AccelMethod" "uxa" or
Option "TripleBuffer" "true" in the 20-intel.conf file.
Checked with 2nd generation Intel HD3000 graphics and 5 generation HD5500 graphics, both worked without those options.
Conclusion and thoughts
So, that's all about fixing screen tearing in linux with Intel graphics, hope it helped you.
Enabling vsync decreases the graphics benchmark performance, so next I'll experiment with the TripleBuffer and completely disable vsync and compare the difference.
If you've any question or suggestion, just leave a comment. Also don't forget to share if you've found this tutorial worthy to share.