Why use compton with XFCE?

Hi,

out of curiosity I tried the compton compositor with XFCE. I do not see any visual difference compared to the out-of-the-box compositor of XFCE.

And with regard to performance I see that CPU usage with compton goes up to 35 % if I constantly move a mpv window while playing a video. While the CPU usage is less than 15 % if I use the XFCE compositor.

So what is the reason why people use compton with XFCE?

Screen tearing with nVidia, but it seems not everyone is affected.
Did you tweak your compton settings?

I was using the settings I found in the wiki:
https://wiki.manjaro.org/index.php?title=Using_Compton_for_a_tear-free_experience_in_Xfce

I have an nvidia gtx 1050 ti and I do not see tearing in any case. But I do have CompositePipeline enabled in xorg.conf. May be that makes compton obsolete?

1 Like

Yes, that might very well be the reason.
FFCP costs performance and can induce input lag, that's why I don't use that setting.

I had enabled FFCP to get smother output in steam. Will compton help with that as well? If so, I will give it another try without FFCP.

i use compton with some heavy settings like window transition stepping so windows fade in and out smoothly, transparency on unfocused windows, vsync and it sits under %2 . i would have to check about when watching a video.

also, if you have xrender set as the backend it will use a lot more cpu whereas opengl backend uses the gpu for compositing

2 Likes

I usually disable the compositor when playing games (Mod+T in i3).

I can post my nvidia compton config later if you want. It's not perfect but eliminates tearing almost completely.
You can already try with vsync=opengl-swc (EDIT: I think it's the same as =true).
Also try starting compton with --experimental-backends switch.

I gave it a try without ForceCompositionPipeline and the differences between compositors is even more dramatic.

First of all I can confirm tearing in XFCE if no compositor is active. This does not surprise me.

I use a mpv window with a 720p video stream to test the tearing. I move this window around in circles.

Both compositors, XFCE out-of-the-box and compton, successfully eliminate tearing. That is true for the mpv window and in steam (X4 Foundations)

But when I monitor CPU usage while moving the window I see a big difference. With XFCE out-of-the-box the CPU usage for the xorg process is 6-12 %. For the compton compositor the CPU usage is 80+ %.

My conclusion: I am happy with the XFCE out-of-the-box compositor and I do not need ForceCompositionPipeline. This setting was a left over from some time ago when I used cinnamon and I felt the need to activate it for steam.

1 Like

did you test compton not using xrender?

compton --backend glx --vsync

Yes, I am using the config from the wiki article I mentioned earlier:

4# cat compton.conf
backend = "glx";
glx-no-stencil = true;
vsync = true;
unredir-if-possible = true;

# Shadow
shadow = true; # Enabled client-side shadows on windows.
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'",
 "class_g ?= 'Notify-osd'",
 "_GTK_FRAME_EXTENTS@:c"
];

# Opacity
detect-client-opacity = true;

# Window type settings
wintypes:
{
 dock = { shadow = false; };
 dnd = { shadow = false; };
 tooltip = { shadow = false; };
};

i wonder why it's causing cpu usage when most of the load should be done on the gpu. :man_shrugging:

i cant even get compton to go past 8% with video playing and using xrender or glx backend.

i double checked with your commandline and the result is the same: 80+ % CPU load for the xorg process

please check the xorg process when you move a video window

Besides screen tearing compton offers more configuration options (e.g. exclude certain applications from compositing effects) and especially the fork https://github.com/tryone144/compton with kawase-blur has more blur options.

I also didn't experience any high cou-loads with compton :man_shrugging:

1 Like

I don't use Compton for two reasons:

Primarely: I have no need for it; I have had no noticeable screen tearing in Xfce on Nvidia during the 1.5 years I have been using Linux

Secondarely: It does NOT play well with menus and popups. Menus in Firefox, for example, get a thick border around them and the shadow is off by several millimeters, as does popups for say notifications. Especially notable if using blur effects.

I don't think there is a clear answer. But in my experience, compton is better at more graphics intensive work (4K 60fps videos, interlaced videos, gaming). xfwm4 is better for basic desktop work and 30fps videos.

I go through periods where I use xfwm4 (maybe for desktop zoom feature or when 4.14 came out), but then I switch back to my compton setup because I see micro stutter while doing something and find it is smoother with compton.

But compton is a headache also. There are so many options to play with that it's like a puzzle. You change one setting and try to do something like watch a video while moving another window over that video smoothly and think everything is good. But then you realize later in some random game there is very bad stutter now. So I end up constantly messing with different options in compton depending on what I am doing. Sometimes I change it so many times I think I am going crazy.

Settings that affect performance the most are (I guess there really is not that many):

backend = "glx";
unredir-if-possible = true;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
xrender-sync-fence = true;

Setting to avoid is use-damage = true . This makes desktop widgets start flashing randomly on my card.

And then you can also complicate it more playing with nvidia xorg options like triplebuffer and ffcp. Maybe a 1050ti is different, but I have to use ffcp on my GTX 780. No matter what vsync I use (xfwm or compton), there is always a line about 2/3 high on the screen if a video is playing in mpv (and I also test with mpv options opengl-waitvsync and opengl-swapinterval as well).

And if you are getting 80% cpu with compton, that is some config issue (or there are multiple compositors running, or a panel theme issue). Try with no config at all, then start adding things one by one. But you should not be using the vsync option in compton. Even the dev says not to use it in the compton optimization guide. You might as well just use xfwm4 if you are going to use compton's vsync. I don't know why it is enabled in the template and so many example configs.

All the vsync options were deprecated except for on and off in version 6.0.

You can fix Firefox with this option. And the shadow exclude options from mbod's post above for the notifications.

wintypes:
{
  utility = { shadow = false; }; 
};
3 Likes

That's a question of settings. No issues here on i3. Might look different on Xfce though.

shadow-radius = 3;
shadow-offset-x = 2;
shadow-offset-y = 2;
shadow-opacity = .4;
shadow-ignore-shaped = false;
shadow-exclude = [
        "name = 'Dmenu'", 
        "name = 'Rofi'",
        "class_g ?= 'Rofi'",
        "name = 'Notification'",

Try playing with shadow-exclude.

I cannot comment on Xfce, but here on i3, I have a maximum of 11% of CPU usage when moving an mpv window with a video playing.
I think it's once again a configuration setting.
EDIT: it's a bit smoother on KDE though.

2 Likes

In the past xfwm's compositor was notorious for tearing and performance issues.
Not to mention that compton was more easily configurable - choose backend, remove shadows, etc.
But recently the xfce compositor was largely rewritten and improved, so the comparison may not hold up anymore.
You may want to make sure you are using the good bits (especially on amdgpu) by switching vblank mode to new 'xpresent'

Either through dconf command:

xfconf-query -c xfwm4 -p /general/vblank_mode -t string -s "xpresent" --create

Or from the file?
~/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml

    <property name="vblank_mode" type="string" value="xpresent"/>
1 Like

Never managed to make it look good. Admittedly i basically only used it to emulate plasma blur in my terminal

The compton CPU usage is really giving me a headache. I tried almost all config variances. I tried every setting or commandline paramater mentioned in this thread. I turned off all config files etc. The affect is the same: CPU USage while moving awindow goes above 80 %. And it doesnt matter which window it is. I can be a regular terminal window.

Interesting is the behaviour if I move a glxgears window. With XFCE out-of-the-box I can move it smoothly. It is repainted while being moved and everything looks normal. With compton the window is not repainted while being moved. If I stop the movement the window appeas where the mouse pointer is, but while the mouse is moving the window stays on the spot. Very weird.

Forum kindly sponsored by Bytemark