Steam for Linux

Steam for Linux

Not enough ratings
Fix Screen Tearing / Non-Functional Vsync in Linux Games v1.2
By Corvias
This guide will show you how to configure your Linux Mint, or other ubuntu-based linux install to have a special session just for running games through steam which will force even the most stubborn linux games to use vsync to prevent screen tearing-- Even games without a vsync option and games created with the Unity3d game engine, such as Shadowrun Returns. This is really more of a workaround, rather than a fix, but it works CONSISTENTLY once you get it set up. You should also see a boost in performance as well!
   
Award
Favorite
Favorited
Unfavorite
Introduction
Some games just will not use Vsync to prevent screen tearing. Either some don't have a vsync option, while othershave a Vsync option that doesn't seem to work. There's numerous reason why vsync behavior can be inconsistent across games run throuygh steam on linux. Sometimes it's just an incompatibility btween the desktop environments compositor, or a bug in the drivers. Games built with Unity3d, for example, Detect when there is a compositing window manager running and force vsync off.

This guide will show you how to configure your Linux Mint, or other ubuntu-based linux install to have a special session just for running games through steam. I am assuming you are using an Nvidia GPU and Nvidia's Binary drivers. Though, hypothetically this guide should work for AMD/ATI users as well. Not sure if they have the same vsync woes.

Anyway, you'll need sudo access on the machine you are doing this, because you'll have to install some packages. I claim no resposibility if you screw up your install though, so proceed at your own peril. Games that I've tested and "fixed" vsync/screen tearing with using this method include: Shadowrun Returns, XCOM: Enemy Unknows/Within, Civ 5, and a few others. Basically, if you hate playing without Vsync, and you have a game that:

  • Has no Vsync option and seems impervious to Sync to Vblank being enforced by the Nvidia driver
  • Has a Vsync option that does not work
  • Was built with Unity3d, and thus refuses to use vsync if you have a compositor running, and will likely tear even if you don't.

Then this guide is for you!

Really, this method is more of a workaround than a fix. But it WORKS CONSISTENTLY. If you do work on the same machine you game, then it might be worth it productivity-wise to just "sandbox" all your game stuff into a separate user profile with Openbox set as its default session. You could even set it up with limited permissions on your system and use fast user switching into it. (I may try that, actually and update this guide) Just something to think about.
The Procedure
First we need to install some packages with apt-get. We'll be installing:

  • OpenBox, a lightweight, very minimalistic desktop environment.
  • Compton, a slick, fast and simple compositing engine that will enforce vsync on everything we run

Let's get started:

1. Open up your favorite teminal program.
2. Type or copypasta the following command and press Enter:

sudo apt-get install openbox obconf obmenu compton

3. Enter your user account password, and apt-get will download openbox and compton.
4. When apt is done installing, we then have to create an autostart file so openbox runs compton and Steam for us as soon as we log in.
5. In the terminal window, type gedit ~/.config/openbox/autostart (no sudo!)
6. A text editor should appear. Paste the following into it.

# Start up Compton for compositing compton -b --backend xrender --vsync opengl # Start Steam steam

IMPORTANT: If the compton parameters above give you mixed results, try the following alternate line to invoke compton instead:
compton -b --backend glx --vsync opengl-swc
This is actually the original set of options I used, which work okay. Just make sure you uncheck "Sync to VBlank" and "Allow Flipping" in nvidia-settings. Otherwise you'll get artificial jittering. For me, I've found the xrender backend method gives more consistent, superior results. Experiment. YMMV.

7. Save the file and close the text editor.
8. Restart (you could probably just log off).
9. When you get to the login screen, look for a button or link with the word "Session." Click it.
10. A list of desktop environments to choose from should appear. Select "Openbox."
11. Steam should pop up automatically.
12. That's it. Play a game that you typically get a lot of screen tearing. There shouldn't be any.
Conclusion
If all went well, you should not see any more screen tearing in your games, and because openbox and compton are so lightweight, you should get better performance in your games as well.

Finally, I think the reason this works with Unity3d engine looks to see if there is a compositor running, it doesn't recognize Compton and is tricked into allowing vsync. Performance seems fine to me despite claims on onther Unity3d game forums that vsync under linux for Unity engine games is really slow.

Finally, if you use Mint Cinnamon edition, you can't just do "compton --replace" or anythiing to avoid having to create a seperate session. I could be wrong, but I'm pretty sure this is because cinnamon was designed to use compositing from the ground up, so it's compositor (muffin, I think) is baked in. Now, MATE on the other hand, should work in place of openbox, you'd just have to configure it to start up compton with the options I used in this guide.

I truly hope this helps you. I spent a weekend obsessively trying to find a solution to screen tearing/vsync ignoring games instead of actually playing them.
< >
13 Comments
Fragorides->HuevoZen Nov 29, 2016 @ 10:40pm 
Muy útil tu post. Me sirvió muchísimo
RetroPacman Jun 19, 2016 @ 7:29pm 
How do I fix vsync if I have poured pudding all over my naked body and computer?
Ewerton Del Toro Jun 15, 2016 @ 11:28am 
Awesome! :steamhappy:
Kenu Nov 25, 2015 @ 12:51pm 
Hi, thanks for making this guide! What does "Sync to VBlank" and "Allow Flipping" do exactly? I'm trying to figure out if tweaking these settings will also improve performance or reduce stuttering.
EnderDom Sep 27, 2015 @ 4:04am 
In case its of use to anyone else. As a Kde user with a nvidia binary drivers (GTX 980), I removed most of my screen tearing issues by going into System Settings -> Desktop Effects -> Advanced (tab)

Compositing Type: OpenGL 3.1
Qt graphics: Native

Scale Method: Accurate
✓ Suspend desktop Effects for Fullscreen Window

Tearing Prevention (Vsync): Re-use Screen Content


gionn Aug 14, 2015 @ 12:58am 
Too much work, I've fixed with this [wiki.archlinux.org].
rustynail May 10, 2015 @ 11:53pm 
If you are using unity or any other system with compiz try disabling "Composite -> Unredirect Fullscreen Windows" in CCSM, works for me.
Mz May 7, 2015 @ 6:37pm 
Thanks a lot ! I was starting to despair when I saw this guide. The alternate line worked for me, with XCOM and Civ5.
Aaron May 6, 2015 @ 9:52am 
One option that might help without having to run compton is to start the X server with backing store disabled. A bug in libSDL 1.2 sets backing store to "Always", which the X server interprets as forcing the window to be automatically redirected. You can disable that behavior by passing the "-bs" option to the X server at startup. E.g. on modern Linux systems, edit the /usr/bin/Xorg wrapper script and add -bs, or edit the configuration for your display manager to add it (sadly not possible with gdm, as far as I can tell).

https://devtalk.nvidia.com/default/topic/679688
[ars]ewichern Apr 6, 2015 @ 1:42pm 
Thanks for the tip - though I needed some additional instructions that I dug up here: http://ubuntuforums.org/showthread.php?t=2144468