Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance decrease from arch 2.0 -> 3.0 packages in vbox #41

Closed
jrudess opened this issue Nov 6, 2018 · 27 comments
Closed

Performance decrease from arch 2.0 -> 3.0 packages in vbox #41

jrudess opened this issue Nov 6, 2018 · 27 comments
Labels
info requested The developers have requested additional information from the reporter performance Issue related to performance

Comments

@jrudess
Copy link

jrudess commented Nov 6, 2018

I use arch in a virtualbox VM on my work laptop. With the chjj official repo, I can not get 3D acceleration working, and leave compton disabled at any resolution past 1920x1200 due to very low performance. But starting with compton-2.0-1-x86_64.pkg.tar.xz acceleration started working, and my CPU usage dropped way down to 8% at 2560x1600 and no visual keyboard lag.

But with compton 3.0-1-x86_64.pkg.tar.xz and newer, the CPU usage increased and there is noticeable keyboard lag when typing (and ~16-25% CPU usage reported by top, so a bit more than double),.

I can reproduce this also with head of your branch, but I have not yet started git-bisecting this to try and narrow it down, but will as time allows.

Platform

Arch Linux as a Virtual Box guest

GPU, drivers, and screen setup

Virtualbox running at 250x1600, mesa 18.2.4, and glxinfo -B:

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: VMware, Inc. (0xffffffff)
    Device: llvmpipe (LLVM 7.0, 256 bits) (0xffffffff)
    Version: 18.2.4
    Accelerated: no
    Video memory: 16039MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 3.3
    Max compat profile version: 3.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 7.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.2.4
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.1 Mesa 18.2.4
OpenGL shading language version string: 1.40
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.2.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

Environment

Plasma + i3-gaps

Compton configuration:

backend = "glx";
vsync = "none";
glx-copy-from-front = false;
glx-swap-method = "1";
glx-no-stencil = true;
glx-no-rebind-pixmap = false;
dbe = false;
detect-transient = true;
detect-client-leader = true;
invert-color-include = [ ];

mark-wmwin-focused = true;
mark-ovredir-focused = true;
focus-exclude = [ "class_g = 'Cairo-clock'" ];
detect-rounded-corners = false;
detect-client-opacity = true;
refresh-rate = 0;

wintypes :
{
  dock :
  {
    opacity = 1.0;
    shadlow = false;
  };
  tooltip :
  {
    fade = true;
    shadow = false;
    opacity = 0.95;
    focus = true;
  };
  menu :
  {
    fade = true;
    shadow = false;
  };
  dropdown_menu :
  {
    shadow = false;
  };
  popup_menu :
  {
    shadow = false;
  };
  utility :
  {
    shadow = false;
  };
};

opacity-rule = [
    "95:class_g = 'yakuake'",
    "95:class_g = 'konsole'",
    "95:class_g = 'Terminator'",
    "95:class_g = 'dolphin'",
];
menu-opacity = 0.95;
inactive-opacity = 1.0;
active-opacity = 1.0;
frame-opacity = 1.0;
inactive-opacity-override = false;

shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
shadow-radius = 16;
shadow-offset-x = -24;
shadow-offset-y = -22;
shadow-opacity = 1;
shadow-red = 0.0;
shadow-green = 0.0;
shadow-blue = 0.0;
shadow-exclude = "!I3_FLOATING_WINDOW@:c";
alpha-step = 0.06;
inactive-dim = 0.0;

blur-kern = "3x3box";
blur-background = true;
blur-background-frame = true;
blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ];

fading = false;
fade-in-step = 0.05;
fade-out-step = 0.05;
fade-exclude = [ ];
no-fading-openclose = false;
@yshui
Copy link
Owner

yshui commented Nov 6, 2018

With the chjj official repo, I can not get 3D acceleration working, and leave compton disabled at any resolution past 1920x1200 due to very low performance. But starting with compton-2.0-1-x86_64.pkg.tar.xz acceleration started working.

Not sure what you mean by "get 3D acceleration working"? I don't think I did anything in compton-2 to fix non-working 3D acceleration. Maybe it is because of some other software update?

But with compton 3.0-1-x86_64.pkg.tar.xz and newer, the CPU usage increased.

Are you sure it is compton 3.0-1, not 3.0-2? If it is the case, I can rule out one of the possibilities, which is good.

To rule out another possibility, can you try compton 2.0 and 3.0 with the xrender backend, and see if there is difference in CPU usage and lag?

@jrudess
Copy link
Author

jrudess commented Nov 6, 2018

Not sure what you mean by "get 3D acceleration working"? I don't think I did anything in compton-2 to fix non-working 3D acceleration. Maybe it is because of some other software update?

Sorry, poor wording on my part. Using backend=glx was not functioning properly in vbox for me until 2.0, so I was using xrender. But starting with 2.0 I was able to switch to backend=glx and there was a huge performance gain.

Are you sure it is compton 3.0-1, not 3.0-2? If it is the case, I can rule out one of the possibilities, which is good.

Yes, I can reproduce the lag with both 3.0-1 and 3.0-2

To rule out another possibility, can you try compton 2.0 and 3.0 with the xrender backend, and see if there is difference in CPU usage and lag?

Unfortunately, underneath virtualbox, xrender with the posted-config is having massive performance issues in both 2.0 and 3.0. From key-press to character viewable on the screen is 2-5s and I'm getting bizarre replicating keystrokes while trying to type (likely due to heavy cpu usage).

@yshui
Copy link
Owner

yshui commented Nov 6, 2018

Hmm, there is one (semi-unrelated) thing I want verify with this opportunity. Can you run compton 2 with your posted config, but with xrender instead, and --xrender-sync-fence on the command line? That might solve your xrender lag.

@jrudess
Copy link
Author

jrudess commented Nov 6, 2018

I don't see a performance difference when enabling --xrender-sync-fence. The xrender slowdown was one of the reasons I had tried switching back to glx and found it to work now.

There were known GL/mesa issues for arch in vbox on the arch bug tracker at one point (older sighting from 2016 I think). Will find it again to see if there was any status change that might identify other changes.

@yshui
Copy link
Owner

yshui commented Nov 6, 2018

Thanks for confirming! I'm always worried about whether removing xrender-sync is a good idea..

@jrudess
Copy link
Author

jrudess commented Nov 6, 2018

The vbox/GL issue I was remembering is here: https://bugs.archlinux.org/task/49752

@yshui
Copy link
Owner

yshui commented Nov 6, 2018

Thanks. I will wait for your bisect results.

@jrudess
Copy link
Author

jrudess commented Nov 6, 2018

If I understand the arch bug correctly, I'm not actually running with hardware acceleration in vbox, and
the LLVM gallium mentioned is a software render pipe for glx. The decrease in performance from 2.0->3.0 is not massive, just perceivable, and I bet that I would not be able to see if it I was using true hardware acceleration.

When using the LD_PRELOAD hack mentioned in the arch-bug, compton 2 and 3 give the following errors and windows do not draw.

glx_bind_pixmap(32): Couldn't find FBConfig with requested depth.
win_paint_win(0x00e000f6): Failed to bind texture. Expect troubles.
win_paint_win(0x00e000f6): Missing painting data. This is a bad sign.

Will post bisect results later this evening, after work.

@yshui
Copy link
Owner

yshui commented Nov 7, 2018

Do you think your issue is somehow related to #40 ?

@jrudess
Copy link
Author

jrudess commented Nov 7, 2018

My bisect results point to 28a2cc6 being the culprit. I did not see a v2 tag in the repo, so I started with the v1 tag.

@BurhanDanger
Copy link

Did you try omor1's patch from https://bugs.archlinux.org/task/49752 ?

@jrudess
Copy link
Author

jrudess commented Nov 7, 2018

I tried omor1's patch around a year ago but did not have too much success with compton. I believe where I ended up was that after rebuiling vboxservice, compton gave the same errors I was getting with just the LD_PRELOAD hack (pasted in #41 (comment) )

@yshui
Copy link
Owner

yshui commented Nov 7, 2018

@jrudess It is entirely possible 28a2cc6 can affect opengl performance. Maybe it is not as visible when you have proper hardware acceleration. I will investigate.

BTW, did buffer-age swap method help? I remember you said it made the performance worse?

@jrudess
Copy link
Author

jrudess commented Nov 7, 2018

I'm seeing something suspicious now related to my glx-swap-method setting that makes me suspect I have a minor syntax problem in my .conf

If I use quotes, performance with v2 is good: glx-swap-method= "1";
If I get rid of the quotes glx-swap-method = 1; then performance reduces to the same speed I'm seeing with v3.

What's the correct syntax to get 'copy'? Should it be the literal string?

@yshui
Copy link
Owner

yshui commented Nov 7, 2018

@jrudess glx-swap-methods should be a string.

@jrudess
Copy link
Author

jrudess commented Nov 7, 2018

With v2 performance decreases when switching from copy to buffer-age to about the same performance I see with v3.

With v3, I don't observe any performance difference between copy or buffer-age.

@yshui
Copy link
Owner

yshui commented Nov 7, 2018

@jrudess The behavior of glx-swap-methods="1" did change from v2 to v3, so that might be why.

@yshui
Copy link
Owner

yshui commented Nov 7, 2018

@jrudess In my test, the opengl calls compton v2 and v3 made with glx-swap-methods="1" are essentially the same...

@jrudess
Copy link
Author

jrudess commented Nov 8, 2018

I'll do some more rigorous testing. I possibly changed more than one variable between cases as I was running through them while slightly distracted in a work meeting. And I'd like to pair down my giant conf file to something more default as well to make sure one of the other switches isn't influencing the results.

But based on the commit where I see a small performance drop, I don't know that there's anything more to pursue for this issue, and it probably more makes more sense for me to go focus on getting hardware-acceleration in arch/vbox actually working.

@yshui
Copy link
Owner

yshui commented Nov 10, 2018

@jrudess #40 is fixed in next. I don't know if this issue is related or not, but can you give next a test and see if that helps?

@yshui yshui added the performance Issue related to performance label Nov 10, 2018
@jrudess
Copy link
Author

jrudess commented Nov 12, 2018

Looks like #40 is not related to my issue. Tested with and without the xrender-sync/fence options but didn't observe any change in performance.

@yshui
Copy link
Owner

yshui commented Nov 12, 2018

@jrudess When you say "CPU usage", do you mean the cpu usage of compton, or X?

@jrudess
Copy link
Author

jrudess commented Nov 12, 2018

CPU usage of compton, and also a slight lag on text appearing when typing in terminals.

@yshui
Copy link
Owner

yshui commented Nov 13, 2018

I wonder if doing some profiling will help... Are you familiar with perf?

@jrudess
Copy link
Author

jrudess commented Nov 22, 2018

I'm not familiar with perf, but I will read up on it and see if there is anything I can discover and let you know.

@yshui yshui added the info requested The developers have requested additional information from the reporter label Dec 19, 2018
@jrudess
Copy link
Author

jrudess commented Dec 21, 2018

@yshui my apologies for the long delay. I've begun looking into this now that the holiday work-rush is ramping down

@jrudess
Copy link
Author

jrudess commented Nov 9, 2020

This is no longer an issue using Virtualbox 6.1 with graphics set to VMSVGA and hardware acceleration enabled and the latest releases of picom.

@jrudess jrudess closed this as completed Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info requested The developers have requested additional information from the reporter performance Issue related to performance
Projects
None yet
Development

No branches or pull requests

3 participants