Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Howto: Using Compton for tear-free compositing on XFCE or LXDE

  1. #1
    Join Date
    May 2007
    Location
    Vermont
    Beans
    869
    Distro
    Ubuntu

    Howto: Using Compton for tear-free compositing on XFCE or LXDE

    I've always grappled with one major issues when using lightweight DE's like XFCE or LXDE: Video tearing. For me there is nothing more annoying then seeing tearing when watching video in my local video player or in flash player, and seeing ugly tearing when scrolling in firefox. XFCE's built-in xrender based compositor does nothing but exacerbate the issue, and the intel driver's "TearFree" option performs rather poorly.

    The obvious solution to this is using an opengl compositor. In the past I had been using compiz in XFCE, which worked but left a lot to be desired when it came to integrating with XFCE and general bugginess; and the last straw is that in 13.04 it seems rather unusable when used outside of unity (severe bugs such as unclickable window decorations), so I searched for another solution. I then found compton: https://github.com/chjj/compton. Compton is a very lightweight compositor that is based on xcompmgr (its a fork of xcompmgr-dana). Compton features a stable opengl backend and working vsync (It also has an xrender backend, but for the purpose of getting tear-free output the opengl backend is recommended). Compton is an excellent fit for XFCE or LXDE because it is very lightweight and it does not need to replace your window manager like compiz does, it purely provides compositing.

    The first thing you will want to do is install compton. The compton maintainer has a ppa for compton here: https://launchpad.net/~richardgv/+archive/compton. To add the ppa to your system and install compton, open the terminal and enter the following commands: sudo apt-add-repository ppa:richardgv/compton and sudo apt-get update && sudo apt-get install compton

    Next you will want to create your compton config file. Save the file as "~/.compton.conf". Here is the config file I use, I've added a few detailed comments explaining the most important things:

    Code:
    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; };
    };
    Now you are ready to set compton to start automatically upon login.

    For XFCE/xubuntu:

    Open the XFCE settings manager: settings manager > session and startup > application autostart > add and add compton -b. Now compton will start automatically when you login.

    For LXDE/lubuntu:

    edit this file: ~/.config/lxsession/Lubuntu/autostart. You can just create the file if it does not exist:
    Code:
    mkdir -p ~/.config/lxsession/Lubuntu/
    touch ~/.config/lxsession/Lubuntu/autostart
    If you want to enable compton globally (for every user on the system), you can edit: /etc/xdg/lxsession/Lubuntu/autostart. Once the file is open in your text editor just add your startup command to it with an @ symbol in front of it, for example: @compton -b &

    (I don't use lubuntu/lxde so I haven't tested this myself, I've put this together from these sources: http://lubuntublog.blogspot.com/p/compton.html, https://help.ubuntu.com/community/Lu...g_into_Desktop)

    EDIT: Based on feedback I have moved all switches into the config file and simplified the guide.
    Last edited by screaminj3sus; August 14th, 2013 at 12:30 AM.
    Desktop: Windows 8 x64 | Intel Core i5-2500 | 16 GB DDR3 1333 | ATI 6950 2gb | 64gb Vertex 2/320gb/750gb/1tb hdd
    Laptop: System76 Lemur Ultra | Xubuntu 13.04 x64 | 2.5Ghz Intel Core i5-3210m | 8GB DDR31600 | Intel HD4000 | 500GB 7200rpm hybrid hdd

  2. #2
    Join Date
    Jan 2008
    Beans
    29

    Re: Howto: Using Compton for tear-free compositing on XFCE or LXDE

    works great on Ubuntu 12.04 with Lubuntu-Desktop installed!

    even makes the scrolling in firefox a little faster.
    Last edited by vociferous666; May 16th, 2013 at 05:12 AM.

  3. #3
    Join Date
    Oct 2011
    Beans
    103

    Re: Howto: Using Compton for tear-free compositing on XFCE or LXDE

    Works perfectly with amd radeon 6870 running xubuntu 13.04

    Thank you so much i really didn't wanted to use compiz to address the tearing issue, this is so much better.

  4. #4
    Join Date
    Oct 2007
    Location
    England
    Beans
    178
    Distro
    Xubuntu 12.04 Precise Pangolin

    Cool Re: Howto: Using Compton for tear-free compositing on XFCE or LXDE

    Worked perfectly on Xubuntu 13.04. with Nvidia 310 drivers. I used your Intel command and it seems to be just fine.

    Many thanks! The tearing was slowly driving me mad
    CPU: Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz
    RAM: CORSAIR XMS3 DHX 4GB ( 2 X 2GB )1333MHz DDR3
    GPU: NVIDIA GeForce GTX 280
    Mobo: XFX nForce 790i Ultra 3-Way SLI

  5. #5
    Join Date
    Mar 2010
    Beans
    25

    Re: Howto: Using Compton for tear-free compositing on XFCE or LXDE

    Worked for me on Ubuntu 12.04 too, thanks a lot!

  6. #6
    Join Date
    Mar 2007
    Beans
    105

    Re: Howto: Using Compton for tear-free compositing on XFCE or LXDE

    If you're using DockbarX, including the DockbarX plugin for Xfce, then you might also want to add this to "shadow-exclude" in your config:

    Code:
    "n:w:*dockbarx*"
    Also, you really don't need all those arguments in the compton command line, you can include all them in your config except for "-b". You don't even need to specify the config file location, because it's already in the default location. In summary, you just need this command line to start Compton:

    Code:
    compton -b
    And this config (saved as "~/.compton.conf"):

    Code:
    backend = "glx";
    paint-on-overlay = true;
    glx-no-stencil = true;
    vsync = "opengl-swc";
    
    # 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 = [
      "n:e:Notification",
      "n:e:Docky",
      "g:e:Synapse",
      "g:e:Conky",
      "n:w:*Firefox*",
      "n:w:*Chromium*",
      "n:w:*dockbarx*",
      "class_g ?= 'Cairo-dock'",
      "class_g ?= 'Xfce4-notifyd'",
      "class_g ?= 'Xfce4-power-manager'"
    ];
    
    # Opacity
    detect-client-opacity = true;
    
    # 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
    
    # Window type settings
    wintypes:
    {
      tooltip = { fade = true; shadow = false; };
    };
    Last edited by Emblem Parade; April 4th, 2014 at 04:54 AM.

  7. #7
    Join Date
    Apr 2011
    Beans
    4

    Unhappy Re: Howto: Using Compton for tear-free compositing on XFCE or LXDE

    Compton is of course is better than compiz.

    But with
    Code:
    backend = "glx";
    I have pretty bad performance on my Nvidia Geforce GT 630. So I use
    Code:
    backend = "xrender";
    Unfortunately I cant fix tearing in video with xrender backend. Do you know how to fix that?

    Thanks a lot.

  8. #8
    Join Date
    Jun 2012
    Beans
    2

    Re: Howto: Using Compton for tear-free compositing on XFCE or LXDE

    Quote Originally Posted by jigsaw! View Post
    Compton is of course is better than compiz.

    But with
    Code:
    backend = "glx";
    I have pretty bad performance on my Nvidia Geforce GT 630. So I use
    Code:
    backend = "xrender";
    Unfortunately I cant fix tearing in video with xrender backend. Do you know how to fix that?

    Thanks a lot.
    You shouldn't have a problem with performance with that card unless you are using the nouveau drivers rather than the Nvidia ones. Are you using the Nvidia supplied proprietary drivers? There are several glx / opengl related options in compton that could make a difference, especially if you are using nouveau drivers.

  9. #9
    Join Date
    Dec 2013
    Beans
    1

    Re: Howto: Using Compton for tear-free compositing on XFCE or LXDE

    This might no longer be an issue but I found that compton worked great to fix video tearning when I was running Netflix in XBMC. Here's what I did:

    Install netflix-desktop
    Code:
    sudo apt-add-repository ppa:ehoover/compholio
    sudo apt-get update && sudo apt-get install netflix-desktop
    Install compton
    Code:
    sudo apt-add-repository ppa:richardgv/compton
    sudo apt-get update && sudo apt-get install compton
    Download the addon here.

    From XBMC, choose install addon from zip file and open the netflix addon downloaded in the previous step.

    Change the scripts to be executable. (May no longer be necessary.)
    Code:
    chmod +x ~/.xbmc/addons/script.netflix_install/run*.sh
    Change run.sh to use compton instead.
    Code:
    gedit ~/.xbmc/addons/script.netflix_install/run.sh
    Change the contents from:
    Code:
    #!/bin/bash
    openbox & netflix-desktop "$1"
    kill %1
    To:
    Code:
    #!/bin/bash
    openbox &
    compton -b 
    netflix-desktop "$1"
    kill %1
    Note: you can also change run2.sh to use compton.

  10. #10
    Join Date
    Oct 2010
    Location
    Belo Horizonte, Brazil
    Beans
    72
    Distro
    Kubuntu 13.10 Saucy Salamander

    Re: Howto: Using Compton for tear-free compositing on XFCE or LXDE

    How much heavy lxde turns after installing Compton?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •