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

High CPU usage when screen is off #1288

Open
desbma opened this issue Jul 4, 2024 · 8 comments
Open

High CPU usage when screen is off #1288

desbma opened this issue Jul 4, 2024 · 8 comments

Comments

@desbma
Copy link

desbma commented Jul 4, 2024

Platform

Arch Linux x86-64, up to date.

GPU, drivers, and screen setup

NVidia GTX 980, with nvidia-dkms 555.58.02-1

$ glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 4096 MB
    Total available memory: 4096 MB
    Currently available dedicated video memory: 3158 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 980/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 555.58.02
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 555.58.02
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 555.58.02
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

Environment

Xmonad

picom version

$ picom --version
vgit-89c2c
$ picom --diagnostics
**Version:** vgit-89c2c

### Extensions:

* Shape: Yes
* RandR: Yes
* Present: Present

### Misc:

* Use Overlay: No
  (Another compositor is already running)
* Config file used: /home/maxime/.config/picom/picom.conf

### Drivers (inaccurate):

NVIDIA

### Backend: glx

* Driver vendors:
 * GLX: NVIDIA Corporation
 * GL: NVIDIA Corporation
* GL renderer: NVIDIA GeForce GTX 980/PCIe/SSE2

### Backend: egl

* Driver vendors:
 * EGL: NVIDIA
 * GL: NVIDIA Corporation
* GL renderer: NVIDIA GeForce GTX 980/PCIe/SSE2

~/.config/picom/picom.conf:

#
# Backend
#
backend = "glx";
xrender-sync-fence = true;
vsync = true;


#
# Shadows
#

shadow = true;
shadow-radius = 12;
shadow-offset-x = -12;
shadow-offset-y = -12;
shadow-opacity = 0.75;
# Solarized base02 #073642
shadow-red = 0.02734375;
shadow-green = 0.2109375;
shadow-blue = 0.2578125;
shadow-exclude = [
    "! name~=''",
    "name = 'Notification'",
    "class_g = 'Polybar'",
    "class_g = 'Firefox' && argb",
    "class_g = 'Dunst'",
    "class_g = 'albert'",
    "class_g = 'mpv'",
    "class_g ?= 'Notify-osd'",
    "_GTK_FRAME_EXTENTS@:c",
    "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'",
    # https://github.com/chjj/compton/issues/167#issuecomment-31932159
    "(_NET_WM_STATE@[0]:a = '_NET_WM_STATE@_MAXIMIZED_VERT' || _NET_WM_STATE@[1]:a = '_NET_WM_STATE@_MAXIMIZED_VERT' || _NET_WM_STATE@[2]:a = '_NET_WM_STATE@_MAXIMIZED_VERT' || _NET_WM_STATE@[3]:a = '_NET_WM_STATE@_MAXIMIZED_VERT' || _NET_WM_STATE@[4]:a = '_NET_WM_STATE@_MAXIMIZED_VERT') && (_NET_WM_STATE@[0]:a = '_NET_WM_STATE@_MAXIMIZED_HORZ' || _NET_WM_STATE@[1]:a = '_NET_WM_STATE@_MAXIMIZED_HORZ' || _NET_WM_STATE@[2]:a = '_NET_WM_STATE@_MAXIMIZED_HORZ' || _NET_WM_STATE@[3]:a = '_NET_WM_STATE@_MAXIMIZED_HORZ' || _NET_WM_STATE@[4]:a = '_NET_WM_STATE@_MAXIMIZED_HORZ')",
    "y = 26 && y2 = 1200",
    "y = 26 && y2 = 1080"
];


#
# Opacity
#

inactive-opacity-override = false;
opacity-rule = [
    "94:class_g = 'Alacritty' && focused",
    "90:class_g = 'Alacritty' && ! focused",
    "60:class_g = 'KeePassXC' && ! focused"
]


#
# Blur
#

blur-background = true;
blur: {
    method = "gaussian";
    size = 4;
    deviation = 5.0;
};
blur-background-exclude = [
    "window_type = 'dock'",
    "window_type = 'desktop'",
    "class_g = 'Alacritty' && ! focused",
    "! class_g = 'Alacritty'"
];


#
# Fading
#

fading = true;
fade-delta = 6;
fade-in-step = 0.03;
fade-out-step = 0.03;
fade-exclude = [
    "class_g = 'Alacritty'",
    "class_g = 'Rofi'"
];


#
# Corners
#

corner-radius = 6
rounded-corners-exclude = [
  "window_type != 'dialog'"
];


#
# Other
#

mark-wmwin-focused = true;
mark-ovredir-focused = true;
use-ewmh-active-win = true;
detect-rounded-corners = true;
detect-client-opacity = true;
detect-client-leader = true;


#
# Window type settings
#

wintypes:
{
    dropdown_menu = { shadow = false; };
    popup_menu    = { shadow = false; };
    utility       = { shadow = false; };

    tooltip =
    {
        # fade: Fade the particular type of windows.
        fade = true;
        # shadow: Give those windows shadow
        shadow = false;
        # opacity: Default opacity for the type of windows.
        opacity = 0.85;
        # focus: Whether to always consider windows of this type focused.
        focus = true;
    };
};

Steps of reproduction

  1. Turn screens off with xset dpms force off (my lock screen does this)
  2. Listen to the CPU fans speeding up, or monitor CPU usage of picom process to see it goes out of control

Expected behavior

CPU usage should remain low, or lower than when screens are active.

Current Behavior

CPU usage is high when screens are off, and goes back to normal when screens are active.

Stack trace

N/A

OpenGL trace

N/A

Other details

N/A

@yshui
Copy link
Owner

yshui commented Jul 4, 2024

is this new? did this happen with older nvidia drivers?

@desbma
Copy link
Author

desbma commented Jul 5, 2024

It seems recent, but I'm not exactly sure when it first occurred, a few weeks ago, a few months at most I'd say.

@yshui
Copy link
Owner

yshui commented Jul 6, 2024

@absolutelynothelix has a nvidia GPU and is able to reproduce this.

nvidia's glXWaitVideoSyncSGI has awful behavior when screen is off, and has caused us many headaches. maybe we should let them know.

@Jacajack
Copy link

I have an Nvidia GPU and can reproduce this too. Is there any known workaround for this except temporarily disabling picom when screens go to sleep?

My system info
$ glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 8192 MB
    Total available memory: 8192 MB
    Currently available dedicated video memory: 6997 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 560.35.03
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 560.35.03
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 560.35.03
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

$ picom --diagnostics
**Version:** vgit-89c2c

### Extensions:

* Shape: Yes
* RandR: Yes
* Present: Present

### Misc:

* Use Overlay: No
  (Another compositor is already running)
* Config file used: /home/j/.config/picom/picom.conf

### Drivers (inaccurate):

NVIDIA, modesetting

### Backend: glx

* Driver vendors:
 * GLX: NVIDIA Corporation
 * GL: NVIDIA Corporation
* GL renderer: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2

### Backend: egl

* Driver vendors:
 * EGL: NVIDIA
 * GL: NVIDIA Corporation
* GL renderer: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2
$ cat ~/.config/picom/picom.conf
backend = "glx"
detect-rounded-corners = true;
vsync = true;

fading = false
fade-delta = 2
# fade-in-step = 0.18
# fade-out-step = 0.18

inactive-opacity = 1;
active-opacity = 1;

rounded-corners = true
corner-radius = 10
window-shader-fg-rule = "rounded-borders.glsl:(window_type='normal' || window_type='notification') && !(class_g = 'Rofi' || class_g = 'dmenu')"
rounded-corners-exclude = [
	"window_type!='normal' && window_type!='notification'",
	"class_g = 'Rofi'",
	"class_g = 'dmenu'",
]

blur: {
  method = "gaussian";
  size = 5;
  deviation = 5.0;
};

blur-background-exclude = [
	"window_type = 'popup_menu'",
	"window_type = 'dropdown_menu'",
	"class_g = 'scrot'",
	"class_g = 'slop'", # this is for maim
	"window_type = 'utility'",
	"window_type = 'tooltip'",
	"window_type = 'menu'"
];

shadow = true;
shadow-exclude = [
	"class_g = 'scrot'",
	"class_g = 'slop'", # this is for maim
];

wintypes:
{
	#dock = {shadow = false; full-shadow = false;};
	#normal = {full-shadow = false;};
	#menu        = { shadow = false; };
	dropdown_menu = { shadow = false; };
	popup_menu    = { shadow = false; };
	utility       = { shadow = false; };
	tooltip       = { shadow = false; };
	menu          = { shadow = false; };
};

@absolutelynothelix
Copy link
Collaborator

@Jacajack, from best to worst:

  1. buy an amd or intel gpu instead the nvidia one
  2. PICOM_DEBUG=force_vblank_sched=present if it works fine for you
  3. --no-frame-pacing or no-frame-pacing = true;
  4. --no-vsync or vsync = false;

@Jacajack
Copy link

Thanks! I guess the main reason why I can't do (1) is Stockholm syndrome, but (2) seems to be working fine for me.

@tomswartz07
Copy link

1. buy an amd or intel gpu instead the nvidia one

That's ragebait.

You're also forgetting option 5: Install a different compositor that'll at least attempt to address the bug :)

@absolutelynothelix
Copy link
Collaborator

absolutelynothelix commented Sep 18, 2024

That's ragebait.

no, that's not a bait of any form. nvidia's linux driver sucks: it has plenty of bugs, lacks plenty of features and behaves weirdly. there's already a ton of workarounds for all of this in picom and in other compositors (including kde's kwin and gnome's mutter) and another ton has to be done. nvidia is not a wise choice for desktop linux installations.

You're also forgetting option 5: Install a different compositor that'll at least attempt to address the bug :)

i'm afraid that picom is probably the only standalone x compositor maintained to this day. however, you are free to use whatever you like and whatever suits you the most.

btw, i have an nvidia gpu myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants