Ever tried to watch an HD movie under Linux on a high-resolution TV via HDMI and had screen tearing? Compton may fix your problem!

I run Ubuntu with awesome as my window manager (i.e. without all the Compiz magic) on a Dell Laptop that has the Intel HD 4400 graphics chip. When I connect my computer up to a Full HD TV via HDMI and try to view a high-res movie with mplayer, There is a lot of screen tearing, even in slower panning scenes. This is very disruptive for the viewing experince and basically ruins every movie.

After some googling, I came up with the problem: By default, there's no vertical synchronization with the TV screen because the Intel chipset lacks some instructions normal graphics chips have to achieve that easily (at least that's my understanding of the ramblings in one of the related forums). Thus, the chip sends a new image, even if the TV is currently in the middle of redrawing the last one, leading to tearing.

To fix this, one needs to use another feature of the graphics chip called pageflipping. No idea what that actually does, but it solves the problem and seems to be the only way to get proper vertical synchronization. Responsible for doing this is the composition manager that helps the X server render all visible windows into one final image to display. Unfortunately, the standard composition managers around don't do this, e.g. xcompmgr.

compton to the rescue! It is a fork of xcompmgr with additional features and an OpenGL rendering backend that supports pageflipping. On Ubuntu you can sudo apt-get install compton to get it and start it with compton -b. This will, however, not yet give you the desired features. For this, create a config file under ~/.config/compton.conf with the following contents:

backend = "glx";
vsync = "opengl-swc";

No start compton with compton --config ~/.config/compton.conf -b. This will switch you to the OpenGL backend and enable vertical synchronization. For me this already did the trick. If you're still struggling, check out compton's FAQ on vsync!

Make sure you put compton in the appropriate place in your autostart and disable any other composition manager.