Skip to content

Instantly share code, notes, and snippets.

@mkrupczak3
Forked from Brottweiler/screen-tearing.md
Created October 3, 2020 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkrupczak3/7f4cf57b8787255036d94f89c7fdd739 to your computer and use it in GitHub Desktop.
Save mkrupczak3/7f4cf57b8787255036d94f89c7fdd739 to your computer and use it in GitHub Desktop.
Screen tearing in Linux

Screen Tearing in Linux

The purpose of this gist is to document my experiences with screen tearing in Linux.

Information

  • 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 Compton

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.

OBS Studio

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.

Nvidia Composition Pipeline

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment