perf(shell): prefer GPU rendering and throttle allocator trimming

This commit is contained in:
Samuel Onoja committed 2026-10-24 22:03:23 +01:00
1 parent e9f36efdb6
commit 910f7cc188
6 files changed
+80 -29

No files matched your search

Generated
+18 -18
View File
@@ -703,7 +703,7 @@ dependencies = [
[[package]]
name = "build_helpers"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"cfg_aliases",
]
@@ -1108,7 +1108,7 @@ dependencies = [
[[package]]
name = "cosmic-config"
version = "1.0.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"atomicwrites",
"cosmic-config-derive",
@@ -1129,7 +1129,7 @@ dependencies = [
[[package]]
name = "cosmic-config-derive"
version = "1.0.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"quote",
"syn 2.0.119",
@@ -1198,7 +1198,7 @@ dependencies = [
[[package]]
name = "cosmic-theme"
version = "1.0.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"almost",
"configparser",
@@ -2945,7 +2945,7 @@ dependencies = [
[[package]]
name = "iced"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"build_helpers",
"dnd",
@@ -2967,7 +2967,7 @@ dependencies = [
[[package]]
name = "iced_accessibility"
version = "0.1.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"accesskit",
"accesskit_winit",
@@ -2976,7 +2976,7 @@ dependencies = [
[[package]]
name = "iced_core"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"bitflags 2.13.2",
"build_helpers",
@@ -3004,7 +3004,7 @@ dependencies = [
[[package]]
name = "iced_debug"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"iced_core",
"iced_futures",
@@ -3014,7 +3014,7 @@ dependencies = [
[[package]]
name = "iced_futures"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"futures",
"iced_core",
@@ -3028,7 +3028,7 @@ dependencies = [
[[package]]
name = "iced_graphics"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"bitflags 2.13.2",
"bytemuck",
@@ -3049,7 +3049,7 @@ dependencies = [
[[package]]
name = "iced_program"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"iced_graphics",
"iced_runtime",
@@ -3058,7 +3058,7 @@ dependencies = [
[[package]]
name = "iced_renderer"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"iced_graphics",
"iced_tiny_skia",
@@ -3070,7 +3070,7 @@ dependencies = [
[[package]]
name = "iced_runtime"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"build_helpers",
"bytes",
@@ -3087,7 +3087,7 @@ dependencies = [
[[package]]
name = "iced_tiny_skia"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"bytemuck",
"cosmic-text",
@@ -3104,7 +3104,7 @@ dependencies = [
[[package]]
name = "iced_wgpu"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"as-raw-xcb-connection",
"bitflags 2.13.2",
@@ -3136,7 +3136,7 @@ dependencies = [
[[package]]
name = "iced_widget"
version = "0.14.2"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"build_helpers",
"cosmic-client-toolkit",
@@ -3156,7 +3156,7 @@ dependencies = [
[[package]]
name = "iced_winit"
version = "0.14.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"build_helpers",
"cosmic-client-toolkit",
@@ -3709,7 +3709,7 @@ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
[[package]]
name = "libcosmic"
version = "1.0.0"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.2#50ff247f14653b3d3a01affef3853a1ef5d8b349"
source = "git+https://github.com/ferese-wm/libcosmic?tag=ferese-v0.1.3-rc.3#51647bdb9ec2a59ef4e4bbb695488c1f119bb250"
dependencies = [
"apply",
"ashpd 0.12.3",
+2 -2
View File
@@ -46,8 +46,8 @@ bitflags = "2.9.4"
calloop = { version = "0.14.5", features = ["signals"] }
jiff = "0.2.37"
libc = "0.2.176"
iced_accessibility = { git = "https://github.com/ferese-wm/libcosmic", tag = "ferese-v0.1.3-rc.2" }
libcosmic = { git = "https://github.com/ferese-wm/libcosmic", tag = "ferese-v0.1.3-rc.2", default-features = false, features = ["multi-window", "tokio", "wayland"] }
iced_accessibility = { git = "https://github.com/ferese-wm/libcosmic", tag = "ferese-v0.1.3-rc.3" }
libcosmic = { git = "https://github.com/ferese-wm/libcosmic", tag = "ferese-v0.1.3-rc.3", default-features = false, features = ["multi-window", "tokio", "wayland"] }
smithay = { git = "https://github.com/Smithay/smithay", rev = "8a270232f1bfc416c781273c98a3f52a812a0bba", default-features = false, features = [
"backend_drm",
"backend_gbm",
+3 -1
View File
@@ -2,6 +2,7 @@
FERESE_TEST_SHELL_MOTION=1 python3 scripts/tests/test_shell_motion_isolated.py
Set FERESE_TEST_BAR_LAYOUT=floating to also test island masks and live switching.
Set FERESE_TEST_SHELL_BACKEND=wgpu to exercise GPU rendering.
Uses release binaries by default. Requires a Wayland host, dbus-daemon and gdbus.
Protocol traces contain only this test's shell traffic, never the host desktop.
"""
@@ -44,6 +45,7 @@ class ShellMotionTest(unittest.TestCase):
config = root / "config/ferese"
config.mkdir(parents=True)
bar_layout = os.environ.get("FERESE_TEST_BAR_LAYOUT", "flat")
shell_backend = os.environ.get("FERESE_TEST_SHELL_BACKEND", "tiny-skia")
self.assertIn(bar_layout, ("flat", "floating"))
config_file = config / "config.kdl"
config_file.write_text(
@@ -185,7 +187,7 @@ class ShellMotionTest(unittest.TestCase):
stdout=subprocess.PIPE, stderr=log, text=True)
env["DBUS_SESSION_BUS_ADDRESS"] = bus.stdout.readline().strip()
compositor = launch([str(binary), "--backend", "nested", "--grant-effects", "--grant-shell-control",
"--", "env", "WAYLAND_DEBUG=client", "ICED_BACKEND=tiny-skia", str(shell)],
"--", "env", "WAYLAND_DEBUG=client", f"ICED_BACKEND={shell_backend}", str(shell)],
stdout=log, stderr=log)
wait_for(lambda: (ipc_socket(runtime)).is_socket())
wait_for(lambda: dbus("GetServerInformation", check=False).returncode == 0)
+1 -2
View File
@@ -22,8 +22,7 @@ ferese-config = { path = "../../crates/ferese-config" }
ferese-protocols = { path = "../../crates/ferese-protocols", default-features = false, features = ["client"] }
jiff.workspace = true
libc.workspace = true
# Keep GPU rendering available as a fallback/override. The shell defaults to
# tiny-skia to avoid a second GPU initialization during desktop startup.
# Prefer GPU rendering, retaining software rendering as a fallback/override.
libcosmic = { workspace = true, features = ["wgpu", "a11y"] }
freedesktop-desktop-entry = { version = "0.8.3", default-features = false }
iced_accessibility.workspace = true
+1 -2
View File
@@ -101,6 +101,7 @@ impl From<panel::PanelGeometry> for BarMetrics {
}
fn main() -> cosmic::iced::Result {
renderer::configure_shell();
let theme_snapshot = ferese_theme_client::service::current();
let (mut config, startup_error) = match config::load(&theme_snapshot) {
Ok(config) => (config, None),
@@ -112,8 +113,6 @@ fn main() -> cosmic::iced::Result {
(ShellConfig::default(), Some(notice))
}
};
renderer::configure_shell();
let compositor_wallpaper = std::env::var_os("FERESE_COMPOSITOR_WALLPAPER").is_some();
if compositor_wallpaper {
// The compositor owns one GPU image, shared across output renderers;
+55 -4
View File
@@ -12,9 +12,9 @@ pub(crate) fn configure_shell() {
APP_BACKEND.set(backend).expect("renderer configured once");
if use_shell_default {
// Small shell surfaces do not need a second GPU device and shader setup.
// Prefer GPU rendering; retain software rendering for unsupported devices.
// SAFETY: main calls this before starting any threads.
unsafe { std::env::set_var("ICED_BACKEND", "tiny-skia,wgpu") };
unsafe { std::env::set_var("ICED_BACKEND", "wgpu,tiny-skia") };
}
}
@@ -40,9 +40,60 @@ mod tests {
use super::*;
#[test]
fn settings_does_not_inherit_the_shells_automatic_software_renderer() {
fn shell_prefers_wgpu_and_preserves_explicit_renderer_choices() {
const CHILD: &str = "FERESE_TEST_RENDERER_CHILD";
if std::env::var_os(CHILD).is_some() {
let original = std::env::var_os("ICED_BACKEND");
configure_shell();
assert_eq!(
std::env::var_os("ICED_BACKEND"),
Some(original.clone().unwrap_or_else(|| "wgpu,tiny-skia".into()))
);
let mut app = Command::new("ferese-settings");
configure_app(&mut app);
assert_eq!(
app.get_envs()
.find(|(key, _)| *key == "ICED_BACKEND")
.unwrap()
.1,
original.as_deref()
);
return;
}
// Each child configures its environment before the toolkit starts.
for backend in [
None,
Some("tiny-skia"),
Some("wgpu"),
Some("tiny-skia,wgpu"),
] {
let mut child = Command::new(std::env::current_exe().unwrap());
child
.args([
"--exact",
"renderer::tests::shell_prefers_wgpu_and_preserves_explicit_renderer_choices",
"--test-threads=1",
])
.env(CHILD, "1");
if let Some(backend) = backend {
child.env("ICED_BACKEND", backend);
} else {
child.env_remove("ICED_BACKEND");
}
let output = child.output().unwrap();
assert!(
output.status.success(),
"backend {backend:?}:\n{}\n{}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
}
}
#[test]
fn settings_does_not_inherit_the_shells_automatic_renderer_preference() {
let mut command = Command::new("ferese-settings");
command.env("ICED_BACKEND", "tiny-skia,wgpu");
command.env("ICED_BACKEND", "wgpu,tiny-skia");
apply_app_backend(&mut command, None);
assert_eq!(
command