picom icon indicating copy to clipboard operation
picom copied to clipboard

High CPU usage if vsync is disabled

Open XoDefender opened this issue 10 months ago • 5 comments

Noticed it started happening after frame pacing and vblank additions

GPU, drivers, and screen setup

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) Graphics (ADL GT2) (0x4626)
    Version: 22.3.6
    Accelerated: yes
    Video memory: 15697MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) Graphics (ADL GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 22.3.6
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.6 (Compatibility Profile) Mesa 22.3.6
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 22.3.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

picom version

v11.2

Configuration:

Configuration file
shadow = true;
shadow-radius = 30;
shadow-opacity = 1;
shadow-offset-x = -10;
shadow-offset-y = -7;
shadow-exclude = [ "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", "name = 'Notification'", "class_g = 'Conky'", "class_g ?= 'Notify-osd'", "class_g = 'Cairo-clock'", "class_g = 'fly-notify-osd-service'", "class_g = 'firefox' && (window_type = 'popup_menu' || window_type = 'utility')", "_GTK_FRAME_EXTENTS@:c" ];
fading = false;
fade-in-step = 0.03;
fade-out-step = 0.03;
enable-transparency = false;
inactive-opacity = 1.0;
inactive-opacity-override = false;
focus-exclude = [ "class_g = 'Cairo-clock'" ];
opacity-rule = [ "0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'", "0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'", "0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'", "0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'", "0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'" ];
corner-radius = 10;
rounded-corners-exclude = [ "window_type = 'dock'", "window_type = 'desktop'", "class_g ?= 'Firefox'" ];
blur-kern = "3x3box";
blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'", "class_g = 'firefox' && (window_type = 'popup_menu' || window_type = 'utility')", "_GTK_FRAME_EXTENTS@:c" ];
backend = "glx";
vsync = false;
dbus = false;
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
use-ewmh-active-win = true;
unredir-if-possible = true;
detect-transient = true;
detect-client-leader = true;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
use-damage = true;
xrender-sync-fence = false;
no-ewmh-fullscreen = false;
log-level = "warn";
frame-opacity = 1.0;

Steps of reproduction

  1. Disable vsync through the config
  2. Launch picom

Expected behavior

Picom takes not so much of CPU

Current Behavior

(292 root children) Picom takes up to 80% of CPU - vsync disabled Picom takes 30% of CPU - vsync enabled

XoDefender avatar Apr 23 '24 09:04 XoDefender

image can confirm https://github.com/killertofus/awesome/blob/main/config/picom.conf

killertofus avatar Jun 14 '24 17:06 killertofus

This is expected: disabling vsync makes picom render new frames as fast as possible, which means a really high fps, which means high CPU usage.

maybe I ask why you chose to disable vsync? If there's a compelling use case, we can consider adding a frame rate limiter.

yshui avatar Jun 17 '24 07:06 yshui

Sorry for the late reply: for me disabling vsync makes the compositor more responsive and smooth (especially for FTlabs animations). Probably it is not noticeable with cutting age hardware, but for i5 igpu it is the case.

XoDefender avatar Jul 18 '24 07:07 XoDefender

@yushui multi-monitor mixed refresh-rate setups on X11 get force Vsynced to the lowest display's output. The only way to get around this is to disable compositor Vsync.

Shringe avatar Aug 23 '24 23:08 Shringe

Also, GLX animations are very stuttery for me without Vsync on Nvidia. I assume this is due to suboptimal resource usage.

Shringe avatar Aug 24 '24 01:08 Shringe