sway
sway copied to clipboard
Background (color or image) noticeably affects performance on slower GPU's
-
Sway Version:
- sway version 1.8-dev-30d27b59 (Feb 5 2022, branch 'master')
-
Debug Log:
-
Configuration File:
- default configuration
-
Description:
It's probably clearly reproducible only on low-end GPU's and high resolution screens. I noticed this issue when scrolling in Firefox was not smooth on some pages, when it should (and it is w/o background color or wallpaper). Not reproducible in full-screen.
Step to reproduce:
- set fixed, lowest GPU clocks, if possible
- comment out
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill - run sway
- run
glmark2-wayland -b build --run-forever --size 1800x1800for example. (Link to glmark2) - after few loops run
swaybg -o "*" -c '#000000' -m solid_color
Reproducible results on my system:
W/o any background:
[build] <default>: FPS: 2959 FrameTime: 0.338 ms
[build] <default>: FPS: 2954 FrameTime: 0.339 ms
[build] <default>: FPS: 2950 FrameTime: 0.339 ms
[build] <default>: FPS: 2965 FrameTime: 0.337 ms
After swaybg -o "*" -c '#000000' -m solid_color
[build] <default>: FPS: 2672 FrameTime: 0.374 ms
[build] <default>: FPS: 2659 FrameTime: 0.376 ms
[build] <default>: FPS: 2665 FrameTime: 0.375 ms
[build] <default>: FPS: 2661 FrameTime: 0.376 ms
[build] <default>: FPS: 2664 FrameTime: 0.375 ms
[build] <default>: FPS: 2668 FrameTime: 0.375 ms
I've been scratching my head as to why my mouse movement has felt somewhat sluggish over the past weeks, as if I'd suddenly ran into some performance issue which would've resulted in poor fps.. Thank you for opening this issue; I commented out output * bg #313443 solid_color in my config, and the issue is gone!
I'm running sway on an old(ish) thinkpad t450s (Intel(R) Core(TM) i5-5200U CPU, 12 GB ram) with a GeForce 940M dGPU which is switched off with bbswitch.
sway version 1.8-dev-f707f583 (Feb 10 2022, branch 'master')
Is this a regression? Was it working better with a previous version of Sway/wlroots?
Is this a regression?
If it is, it's not a recent regression. It's reproducible in sway 1.6 and wlroots 0.13
FYI: If it's not a regression, this may be because sway renders each layer for every frame (so it'd normally paint grey, background, window), and not rendering the background will be slightly faster. This is required if surfaces use transparency, and currently the only time it's skipped is for opaque overlays (like lockscreen) or fullscreen.
@danieldg Thank you for the explanation. This is most likely it. So it's probably related to https://github.com/swaywm/sway/issues/5723
As a side note, it is worth mentioning that even in full screen, wlroots/sway is not on pair with other wayland compositors. It this a known issue?
glmark2-wayland -b build --run-forever --size 2000x2000 (floating)
| sway-git/wlroots-git | mutter 41.4 standalone | weston 10 | |
|---|---|---|---|
| default (radial gradient on mutter, wallpaper on weston) | - | ~2740 fps | ~2743 fps |
| grey | ~2495 fps | - | - |
| + background | ~2200 fps | - | - |
| + background + terminal window behind | ~1899 fps | - | - |
glmark2-wayland -b build --run-forever --fullscreen (4K)
| sway-git/wlroots-git | mutter 41.4 standalone | weston 10 | |
|---|---|---|---|
| default (radial gradient on mutter, wallpaper on weston) | - | ~2098 fps | ~2100 fps |
| grey | ~1690 fps | - | - |
| + background | ~1690 fps | - | - |
| + background + terminal window behind | ~1690 fps | - | - |
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3488 should help when combined with https://github.com/swaywm/sway/pull/6844
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3488 should help when combined with #6844
Just tested it. Noticed some visual glitches, but it works. Thanks!
If you noticed visual glitches with #6844, please report them in that PR.
With scene optimizations merged with upstream wlroots, it would be nice to know if they improve this. With #6844 I have frame time consistency improvements with my laptop, it would be nice to have independent validation.
Absolutely. https://github.com/swaywm/sway/pull/6844 also fixes the other performance issue I mentioned above. Amazing work, @Nefsen402. Thank you!
| sway-git/wlroots-git | w/#6844 | |
|---|---|---|
| grey/black | ~2495 fps | ~2750 fps |
| + background | ~2200 fps | ~2750 fps |
Closed by https://github.com/swaywm/sway/pull/6844.