Fix Video Tearing in Xubuntu with Compton

I love the simplicity of XFCE, but it uses a notoriously garbage window compositor. The thing hasn’t worked correctly on most system configurations for years, and seems abandoned in terms of receiving a proper fix. In my experience, even using cutting-edge XFCE developer PPAs doesn’t do much to address the issue. The problem manifests as horizontal lines (hard cuts) and artifacts that appear particularly during window scrolling, video playback, and while moving windows.

Fear not! Smooth web surfing and video are possible with some minor Linux wizardry. Compton is a lightweight compositor, consistent with XFCE’s function-over-form mentality. No over the top effects or settings like Compiz – just nicely configurable window transparency and shadowing with clean transitions.

These instructions have been tested with Xubuntu 15.04 Vivid Vervet, but will work for the most part on any distribution that has a compton package in repositories, with minor differences in syntax.

Before we begin, my first recommendation is to make sure to use a proprietary graphics driver. For example, drop Nouveau for the latest tested version of the official nvidia package. Other manufacturers have similar alternatives available. I stand by the open source community 100%, however I will not compromise peak performance in a production environment.

The easiest way to enable proprietary drivers in Xubuntu is located under Settings > Software and Updates > Additional Drivers. Select “Use NVIDIA binary driver [version numbering] (proprietary, tested)”, apply the changes, wait for it to finish. It will prompt a system restart to complete the switch.

Now that a solid foundation is in place, let’s move on to actually fixing things.

1) Start by disabling XFCE’s built-in display compositing by removing the check mark next to the first option located under Settings > Window Manager Tweaks > Compositor.

2) Next, create a configuration file for Compton to use. Run the following command in a terminal, or open a favorite text editor:

nano ~/.compton.conf

The full range of Compton’s available settings are outlined at the project documentation page. Copy and paste the following block for a decent starting point, replacing things like Firefox and Thunderbird with your preferred browser, email client and so on:

# BEGIN COPY BLOCK

 

backend = "glx";
paint-on-overlay = true;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
vsync = "none";
shadow = true;
no-dock-shadow = true;
no-dnd-shadow = true;
clear-shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
shadow-exclude = [
"! name~=''",
"name = 'Notification'",
"name = 'Docky'",
"name = 'Plank'",
"name = 'xfce4-notifyd'",
"name *= 'SMPlayer'",
"name *= 'compton'",
"name *= 'Firefox'",
"name *= 'Chrome'",
"name *= 'Thunderbird'",
"name *= 'Deluge'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g ?= 'Xfce4-notifyd'",
"class_g ?= 'Xfce4-power-manager'"
];
fading = true;
fade-delta = 4;
fade-in-step = 0.03;
fade-out-step = 0.03;

detect-client-opacity = true;

wintypes:
{
tooltip = { fade = true; shadow = false; };
};

 

# END COPY BLOCK

 

Save that (Ctrl-O if you decided to use nano) and exit (Ctrl-X).

3) Now make Compton automatically start at login. Do this by navigating to Settings > Session and Startup > Application Autostart and add a new item with the Command: compton -b

Feel free to use anything for Name and Description. Be sure there is check mark next to it under the Application Autostart list (signifying it’s enabled).

4) Log out and log back in for tear-free display compositing!

For the best HD video playback, I recommend using SMPlayer with vdpau video output enabled. This will leverage power of the graphics card to render frames, as opposed to the less-efficient processor.

Good luck!

Feel free to buy me a coconut water (donate) if you like my work. It would be greatly appreciated!

4 comments

      1. The –backend glx lags me out. I’m on nvidiaGTX970, so this really shouldn’t be happening.

        The wiki page tells me to install nvidia-libgl, which is already installed.

        pkgfile nvidia-libgl returns
        extra/nvidia-340xx-libgl
        extra/nvidia-libgl

        What exactly is the deal? I really don’t want to force full composition pipeline.

        Thanks

        1. That’s a tough one. Newer nvidia chipsets have been experiencing hiccups with Linux from everything I’ve read lately.

          What version of Xubuntu are you running? I’d definitely recommend trying 15.10. If it doesn’t work out of the box, check out an updated kernel and make sure to use the latest nvidia drivers from xorg-edgers

Leave a Reply to hahahaha Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.