Smoother animations without a GPU: faster rasteriser, frame pacing, software/hardware mode
CI / test (push) Failing after 3m2s
CI / test (push) Failing after 3m2s
Measured headless at 1920x1080 with CHANDRA_FRAME_TRACE (new: one log line per drawn frame): - Overview open: 46 -> 62 fps, worst frame gap 69 -> 36 ms, raster 14 -> 5 ms a frame. - Live Starfield: 19 -> 30 fps (its target), raster 49 -> 13 ms, CPU 97% -> 46%. Rasteriser (MoonBit host; circles and previews also in the Rust host): - Blending works on two channels at a time in 16-bit lanes with an exact /255: same pixels, about 3x quicker on big translucent fills (the overview's dim, the starfield's nebulae). - Filled circles are drawn as row spans, rings skip their empty middle (a sqrt per pixel of the bounding box before). Same pixels; a Rust test checks it against the old loop. - Window previews gliding in the overview are sampled straight from the preview at each frame's size instead of filtered and cached at a size used once; the MoonBit host also gets the one-large-size cache and 4096 px draw limit the Rust host had (it kept every size and didn't draw previews past 1024 px). - Image scaling sums each output row's columns once, with 32-bit sums and division. Frame pacing: frames are drawn only when the output can take them (no page flip in flight on KMS; the previous frame shown nested and on X11), with a frame every 250 ms for an output that never gets ready. The KMS loop runs at 125 Hz, so animations used to rasterise frames that were never shown. Software or hardware mode (compositor/shell/render_mode.mbt, docs/rendering.md): detected from the DRM render nodes' drivers (and NVIDIA's proprietary driver, LIBGL_ALWAYS_SOFTWARE), overridden by CHANDRA_RENDER=software|hardware or Settings > Session "Lighter animations" (state.edn :render, saved only when it differs from what was detected). Software mode remakes changing previews every 200 ms instead of 100 ms and caps desktop modules at ~30 fps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hkTQp5uN5FtwpzrXUA
This commit is contained in:
16 files changed
+719
-97
No files matched your search
@@ -51,6 +51,8 @@ pub(all) struct SavedState {
|
||||
terminal : String?
|
||||
/// From `:auth-agent`: true for :chandra, false for :system.
|
||||
native_auth_agent : Bool?
|
||||
/// From `:render`: :software or :hardware chosen in Settings (absent: as detected).
|
||||
render : RenderMode?
|
||||
}
|
||||
|
||||
///|
|
||||
@@ -64,7 +66,7 @@ let layout_names : Array[String] = ["tiling", "monocle", "floating"]
|
||||
///| The keys this build owns; everything else in the file is kept as it is.
|
||||
let owned_keys : Array[String] = [
|
||||
"layout", "recent", "desktop-card", "windows", "wallpaper", "restore-session", "remember-windows",
|
||||
"theme", "power", "shortcuts", "terminal", "auth-agent",
|
||||
"theme", "power", "shortcuts", "terminal", "auth-agent", "render",
|
||||
]
|
||||
|
||||
///| How state.edn names each wallpaper, in `@libshell.wallpaper_names` order.
|
||||
@@ -113,6 +115,7 @@ pub fn DesktopShell::load_state(self : DesktopShell) -> SavedState {
|
||||
shortcuts: [],
|
||||
terminal: None,
|
||||
native_auth_agent: None,
|
||||
render: None,
|
||||
}
|
||||
}
|
||||
let entries = read_state_file()
|
||||
@@ -228,6 +231,10 @@ pub fn DesktopShell::load_state(self : DesktopShell) -> SavedState {
|
||||
Some(Text(t)) if t.length() > 0 => Some(t)
|
||||
_ => None
|
||||
},
|
||||
render: match lookup_key(entries, "render") {
|
||||
Some(Keyword(k)) | Some(Text(k)) => RenderMode::parse(k)
|
||||
_ => None
|
||||
},
|
||||
native_auth_agent: match lookup_key(entries, "auth-agent") {
|
||||
Some(Keyword("system")) => Some(false)
|
||||
Some(Keyword("chandra")) => Some(true)
|
||||
@@ -288,6 +295,10 @@ pub fn DesktopShell::apply_state(self : DesktopShell, st : SavedState) -> Unit {
|
||||
Some(b) => self.native_auth_agent = b
|
||||
None => ()
|
||||
}
|
||||
self.render_choice = match st.render {
|
||||
Some(m) if m != self.render_detected => Some(m)
|
||||
_ => None
|
||||
}
|
||||
match st.terminal {
|
||||
Some(t) => {
|
||||
self.terminal = t
|
||||
@@ -388,6 +399,10 @@ pub fn DesktopShell::save_state(self : DesktopShell) -> Unit {
|
||||
if !self.native_auth_agent {
|
||||
entries.insert(2, (@edn.Value::Keyword("auth-agent"), @edn.Value::Keyword("system")))
|
||||
}
|
||||
match self.render_choice {
|
||||
Some(m) => entries.insert(2, (@edn.Value::Keyword("render"), @edn.Value::Keyword(m.name())))
|
||||
None => ()
|
||||
}
|
||||
if !self.dark_mode {
|
||||
entries.insert(2, (@edn.Value::Keyword("theme"), @edn.Value::Keyword("light")))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user