Linux Intel HD screen tearing fix

Not long ago I had to get a new computer, and it has an Intel integrated card in it. I experienced some screen tearing, and I use compton, but I quickly found some solution.

We need to create the following file:

/etc/X11/xorg.conf.d/20-intel.conf

And put the following lines in it:

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

Then restart the computer, or just log out and log in.

One of the best way to test it, if you just simple scrolling down in your browser, very slowly, and you will see if there are lines across the screen.