Fix for Screen Tearing on Linux

User avatar
dez
L.F.A. TEAM
Posts: 410
Joined: Thu Jun 02, 2005 11:16 pm
Contact:

Fix for Screen Tearing on Linux

Postby dez » Wed May 20, 2015 7:30 pm

This is a workaround found by Tux:
in the xorg.conf file you have to add the line
{ ForceFullCompositionPipeline = On } in the metamodes.

Then reboot, that will fix tearing overall other then unity 3d games
which I found ton of fourms saying the same thing "Unity 3D will disable vsync if Compiz/Composite is detected" So a work around is go into compiz settings and turn off composite plugin. No more tearing :)
now because composite plugin is off I am not sure if the command in xorg.conf needs {ForceFullCompositionPipeline = On }.
Have not tested it. Hope this helps others that might come asking about this tearing issue

Tux
New face
Posts: 8
Joined: Fri Dec 19, 2014 7:31 pm
Location: Canada
Contact:

Re: Fix for Screen Tearing on Linux

Postby Tux » Sun May 24, 2015 6:45 pm

****UPDATE JUNE 03 / 2017 OFFICIAL FIX****

Finally Nvidia has made an official fix for screen tearing. Load up Nvidia-Settings. Click on X Server Display Configuration. On the right menu at the bottom click Advanced then click check the box for Force Full Composition Pipeline. Click apply then click Save to X Configuration File

This should work on any Linux distro. Note: You need the most updated Nvidia driver to have this option.

If all else fails try my workarounds below
--------------------------------------------------------------------------------------------------------------------------------------------------
I have been fighting this issue for years using all different workarounds & found a few things that can fix this issue with nvidia proprietary drivers

Note: If your using Ubuntu 16.04 then you must use Fix 1 or Fix 2. Other others using under 16.04 use Fix 3. For other distros I am not sure.


**UPDATE** I have noticed for Fix 1 & 2 that when the screen saver comes on then it un-applies the ForceFullCompositionPipeline which returns the screen tearing. I have not found a workaround other then disabling the screensaver or just build the script in Fix 2 and just run it after you wake the computer up from the screen saver.

Until Ubuntu & other distro's gets rid of X11 which is outdated & replaces it with Wayland tearing will always be an issue.

------------------------------------------------------------------------------------------------------------------------------------

Fix 1

Adding ForceFullCompositionPipeline to the xorg.conf file. Instead of typing it all out here is an awesome page that explains how to do it.
http://www.thelinuxrain.com/articles/got-tearing-with-proprietary-nvidia-try-this

------------------------------------------------------------------------------------------------------------------------------------

Fix 2

If you build this script and set it execute & auto run at start up (Optional) it will maintain the screen from tearing but I have noticed it has stopped working after a bit & the script needs to be started again.

You need to edit this script for your monitor / monitors resolutions & positions. If you open the terminal & type xrandr it will give the info you need.

If you just copy & past & not edit the script for your monitors your going to run into issues.

Once you got your script setup I suggest trying running it before you set auto start. The screen / screens will flash that's it. Try it out & see if screen tearing is gone & go from there.

This script is for 2 monitors

Code: Select all

#!/bin/bash
nvidia-settings --assign CurrentMetaMode="DVI-D-0:1920x1080_60 +0+0 { ForceFullCompositionPipeline = On }, DVI-I-0:1680x1050_60 +1920+0 { ForceFullCompositionPipeline = On }"


Save script as a sh file

This script is for 1 monitor

Code: Select all

#!/bin/bash
nvidia-settings --assign CurrentMetaMode="DVI-D-0:1920x1080_60 +0+0 { ForceFullCompositionPipeline = On }"


Save script as a sh file
------------------------------------------------------------------------------------------------------------------------------------

Fix 3 (Ubuntu Versions Under 16.04

This guide is for Debain Systems, (Ubuntu, Linux Mint, etc). All desktops environments should work with Compton but don't quote me on it.

1. Got into Compiz Settings, & turn off the Composite plugin. This will disable all desktop effects. If you can remove Compiz its even better.

2. Add ppa ppa:kelleyk/compton (new ppa 11/14/2015) (sudo add-apt-repository ppa:kelleyk/compton)

3. Update Repo's (sudo apt-get update)

4. Install Compton (sudo apt-get install compton)

5. Create a file called .compton.conf in your home dir. Then write your own conf file. Instructions & options can be found here https://github.com/chjj/compton/wiki/perf-guide & https://github.com/chjj/compton/wiki/vsync-guide or goto Step 6

6. Optional: Here is a config setup I use that works awesome that I found online. Copy and paste code below into the new config file & save as .compton.conf like in step 6.

Code: Select all

backend = "glx";
paint-on-overlay = true;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
vsync = "opengl-swc";

# These are important. The first one enables the opengl backend. The last one is the vsync method. Depending on the driver you might need to use a different method.
# The other options are smaller performance tweaks that work well in most cases.
# You can find the rest of the options here: https://github.com/chjj/compton/wiki/perf-guide, and here: https://github.com/chjj/compton/wiki/vsync-guide


# Shadow
shadow = true;         # Enabled client-side shadows on windows.
no-dock-shadow = true;      # Avoid drawing shadows on dock/panel windows.
no-dnd-shadow = true;      # Don't draw shadows on DND windows.
clear-shadow = true;      # Zero the part of the shadow's mask behind the window (experimental).
shadow-radius = 7;      # The blur radius for shadows. (default 12)
shadow-offset-x = -7;      # The left offset for shadows. (default -15)
shadow-offset-y = -7;      # The top offset for shadows. (default -15)
shadow-exclude = [
 "! name~=''",
 "n:e:Notification",
 "n:e:Plank",
 "n:e:Docky",
 "g:e:Synapse",
 "g:e:Kupfer",
 "g:e:Conky",
 "n:w:*Firefox*",
 "n:w:*Chrome*",
 "n:w:*Chromium*",
 "class_g ?= 'Notify-osd'",
 "class_g ?= 'Cairo-dock'",
 "class_g ?= 'Xfce4-notifyd'",
 "class_g ?= 'Xfce4-power-manager'"
];

# The shadow exclude options are helpful if you have shadows enabled. Due to the way compton draws its shadows, certain applications will have visual glitches
# (most applications are fine, only apps that do weird things with xshapes or argb are affected).
# This list includes all the affected apps I found in my testing. The "! name~=''" part excludes shadows on any "Unknown" windows, this prevents a visual glitch with the XFWM alt tab switcher.

# Fading
fading = true; # Fade windows during opacity changes.
fade-delta = 4; # The time between steps in a fade in milliseconds. (default 10).
fade-in-step = 0.03; # Opacity change between steps while fading in. (default 0.028).
fade-out-step = 0.03; # Opacity change between steps while fading out. (default 0.03).
#no-fading-openclose = true; # Fade windows in/out when opening/closing

detect-client-opacity = true; # This prevents opacity being ignored for some apps. For example without this enabled my xfce4-notifyd is 100% opacity no matter what.

# Window type settings
wintypes:
{
  tooltip = { fade = true; shadow = false; };
};


7. Make compton to start automatically by running Start Up Applications & add a new entry using this command

Code: Select all

compton -b


Please Note: For LXDE/lubuntu
More info can be found here http://lubuntublog.blogspot.ca/p/compton.html
or here https://help.ubuntu.com/community/Lubuntu/Boot_Install_Login#How_I_can_autostart_a_program_when_logging_into_Desktop

8. That is it, Restart and everything should load as normal, tear free in & out of games. You will notice some desktop effects will be back.


Return to “bug reports”

Who is online

Users browsing this forum: No registered users and 1 guest

cron