The purpose of this gist is to document my experiences with screen tearing in Linux.
- Archlinux
- i5-4460 (4) @ 3.4GHz
- GeForce GTX 750 Ti
There's two ways to fix tearing for me in this situation. One is to use compton composite manager (glx backend, opengl-swc vsync), the other one to use nvidia's composition pipeline. Both of them have their disadvantages.
Using the glx
backend for compton should fix tearing by itself, but it might be necessary to enable vsync as well. This seems to fix tearing everywhere, but makes the desktop much less responsive and laggy/stuttery/choppy when moving windows and playing animations. Especially noticable when playing videos or games in the background, and moving windows around.
Make sure you disable nvidia's Sync to Vblank in nvidia-settings
if you have vsync enabled in compton.
When recording fullscreen gameplay with OBS Studio, and using the Window Capture (Xcomposite) source, it introduces tearing again. This can be avoided by using compton, with glx backend, and setting unredir-if-possible
to false
. When this option is on, that means compton doesn't "render" on fullscreen games, to avoid performance loss. To avoid tearing in this case when using OBS, you need to disable that. I've only experienced this beeing an issue in Minecraft.
Fixes tearing everywhere (use xrender
backend if you want to use compton) at the cost of game performance and GPU load and memory.
Either you choose to get a unresponsive desktop, with laggy animations, or bad performance in some, if not most, games. Before I used compton to fix tearing, I used nvidia's composition pipeline, which I disabled when I was playing games. Fullscreen games with vsync often do not have tearing even if the desktop has, most likely because of the Sync to Vblank option in nvidia-setting
being enabled.