From efbd295cce5bffdd2a071e5da4ec390924c26cba Mon Sep 17 00:00:00 2001 From: vasilito Date: Sat, 20 Jun 2026 14:24:24 +0300 Subject: [PATCH] =?UTF-8?q?docs:=20redbear-power=20v1.2=20=E2=80=94=20conf?= =?UTF-8?q?ig=20file,=20AMD=20CCD,=20tabs,=20D-Bus=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updates the v1.1 §24 deferred items to "implemented in v1.2". CONSOLE-TO-KDE-DESKTOP-PLAN.md: - New §3.3.2 v1.2 section after v1.1, documenting: - Config file (TOML): /etc/redbear-power.toml + ~/.config/redbear-power.toml - AMD Zen CCD topology via leaf 0x8000001E (NC field) and 0x80000026 (Zen 4+) - Multi-view tab system (Per-CPU / System / Info) with Tabs widget - D-Bus methods: cycle/set_governor, toggle_throttle, force_*, set_pstate - Mouse sub-panel navigation (left/right/middle click conventions) - v1.2 source state: 2758 LoC across 11 modules; 3.2 MB stripped binary redbear-power-improvement-plan.md: - New §25 "Status Update — v1.2 Deferred Items Implemented" - Removes the v1.1 §24 "Remaining work" list (all items now implemented) - Documents implementation order and final module structure ISO rebuild status: still blocked by pre-existing upstream nix-0.30.1 vs Redox relibc SaFlags incompatibility in uutils. --- local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md | 59 ++++++++++++++- local/docs/redbear-power-improvement-plan.md | 77 +++++++++++++++++++- 2 files changed, 131 insertions(+), 5 deletions(-) diff --git a/local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md b/local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md index f6456e6415..6b09e38ae6 100644 --- a/local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md +++ b/local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md @@ -806,7 +806,64 @@ and will be packaged into the next successful ISO build. │▶ ·0 ? n/a n/a ? ? - 0% │ │ ·1 ? n/a n/a ? ? - 0% │ ... -``` + +#### v1.2 Config File, AMD CCD, Tab System, D-Bus Methods (2026-06-20) + +Implements the v1.1 §24 deferred items: config file, AMD Zen CCD +topology, multi-view tabs, D-Bus methods, mouse sub-panel navigation. + +| Item | Status | +|------|--------| +| Config file (TOML at `/etc` + `~/.config`) | ✅ | +| AMD Zen CCD topology (leaf 0x8000001E, Zen 4+ 0x80000026) | ✅ | +| Multi-view tab system (Per-CPU / System / Info) | ✅ | +| D-Bus methods (cycle/set_governor, toggle_throttle, force_*, set_pstate) | ✅ | +| Mouse sub-panel navigation | ✅ | + +**Config file (TOML)**: new `config.rs` module loaded from +`/etc/redbear-power.toml` and `~/.config/redbear-power.toml` (with +`--config ` override). Sections: `display`, `theme`, +`keybindings`, `benchmark`. Search order is system file first, then +user file. `display.refresh_ms` overrides the default refresh interval. +`benchmark.default_duration_s` sets the benchmark duration. Full +schema is documented in `--help`. + +**AMD Zen CCD topology**: `cpuid.rs` now reads CPUID leaf 0x8000001E +`NC` field (cores per CCX) and Zen 4+ leaf 0x80000026 (CCD count + +cores per CCD). Linux host with 24 AMD cores now shows +`CCD0..CCD5` grouping instead of all-Unknown. + +**Multi-view tab system**: `TabId` enum with `PerCpu`, `System`, +`Info` variants. Hotkeys `1`/`2`/`3` jump directly; `T` cycles. +The `Tabs` widget renders the tab bar. System tab shows aggregate +CPU stats (avg freq, max temp, total pkg power, aggregate flags, +benchmark status). Info tab shows detailed CPU identification +(family/model/stepping hex, full feature flag list, per-level cache +hierarchy with KB+way+line size). + +**D-Bus methods**: Added `CycleGovernor`, `SetGovernor(name)`, +`ToggleThrottle`, `ForceMinPstate`, `ForceMaxPstate`, `SetPstate(target)` +methods to `org.redbear.Power`. New `PowerCommand` enum + command +channel back to main thread for MSR-bound actions. New `App` methods +`set_governor(Governor)` and `set_selected_pstate(i32)` enable D-Bus +clients to set governor/P-state directly. + +**Mouse sub-panel navigation**: refined hit-test so left-click on +header/controls cycles governor, right-click toggles throttle, +middle-click on table expands P-state. Header now has two distinct +actions (governor + throttle) reachable via different mouse buttons. + +**v1.2 source state**: 2758 LoC across **11 modules** (was 2376/10 in +v1.1). New module: `config.rs` (224 lines). New dependencies: +`toml = "0.8"`, `dirs = "5"`, `serde = { version = "1", features = ["derive"] }`. + +Cross-compiled binary: 3.2 MB stripped Redox ELF +(SHA256 `58b7812a5f673e227753c01e93a05678bd9e8f28101d8a447d70d4943170c40a`). + +ISO rebuild status: still blocked by pre-existing upstream +nix-0.30.1 vs Redox relibc SaFlags incompatibility in uutils. +v1.2 binary IS staged and will be packaged into the next successful +ISO build once that issue is resolved (separate scope). ### 3.4 D-Bus diff --git a/local/docs/redbear-power-improvement-plan.md b/local/docs/redbear-power-improvement-plan.md index ec4837abb8..451a974c18 100644 --- a/local/docs/redbear-power-improvement-plan.md +++ b/local/docs/redbear-power-improvement-plan.md @@ -1270,10 +1270,79 @@ phases (A → D, including previously-deferred items) have been implemented**. ### Remaining work (post-v1.1) - **Fix uutils/nix-0.30.1 incompatibility** so the redbear-mini ISO rebuild can complete (separate issue). -- **AMD Zen CCD topology** via leaf `0x80000026` — currently AMD reports `Unknown` core type (work deferred; Zen 4+ only). -- **D-Bus methods** beyond properties (e.g. `cycle_governor()` method invocation) — currently the TUI receives the keystroke; D-Bus clients read state but cannot mutate. -- **Config file** (TOML at `/etc/redbear-power.toml` + `~/.config/redbear-power.toml`) — still deferred. -- **Mouse-driven header/controls sub-panel navigation** — currently left-click on header toggles throttle, on controls cycles governor (single-action per panel). + +## 25. Status Update — v1.2 Deferred Items Implemented (2026-06-20) + +Per the user's "go on" directive, **all §24 deferred items have now been +implemented in v1.2**. + +| Item | Status | +|------|--------| +| AMD Zen CCD topology (Zen 1/2/3 via 0x8000001E, Zen 4+ via 0x80000026) | ✅ | +| Config file (TOML at /etc + ~/.config) | ✅ | +| Multi-view tab system (Per-CPU / System / Info) | ✅ | +| D-Bus methods (cycle_governor, set_governor, toggle_throttle, force_*, set_pstate) | ✅ | +| Mouse sub-panel navigation | ✅ | + +### Implementation order (2026-06-20 afternoon) + +1. **Config file** (`config.rs`, 224 lines, TOML via `toml = "0.8"` + `dirs = "5"`) + - Sections: `display` (refresh_ms, show_*_panel, spark_width, dbus_name), `theme` (mode, focused_border, dim_border), `keybindings` (quit, cycle_governor, etc.), `benchmark` (default_duration_s, auto_stop_temp_c) + - Search order: `/etc/redbear-power.toml` → `~/.config/redbear-power.toml` → defaults + - `--config ` override flag + - HELP_TEXT documents full schema + +2. **AMD Zen CCD topology** (`cpuid.rs`, +30 lines) + - Parse leaf 0x8000001E EBX bits 15:8 = `NC` (cores per CCX) + - Parse leaf 0x80000026 if available (Zen 4+: CCD count + cores per CCD) + - Group threads by `cpu_id / NC` for display + - Linux host with 24 AMD cores now shows `CCD0..CCD5` rows + +3. **Multi-view tab system** (`render.rs` + `app.rs`) + - `TabId` enum: PerCpu / System / Info + - `Tabs` widget for tab bar (Per-CPU | System | Info) + - Hotkeys: `1`/`2`/`3` jump, `T` cycles + - System tab: aggregate stats (avg freq, max temp, total pkg power, aggregate flags, bench status) + - Info tab: family/model/stepping hex, full feature flag list, per-level cache hierarchy + +4. **D-Bus methods** (`dbus.rs`, +115 lines; `app.rs`, +70 lines) + - New `PowerCommand` enum: CycleGovernor, SetGovernor(name), ToggleThrottle, ForceMinPstate, ForceMaxPstate, SetPstate(target) + - Bidirectional channel: main thread holds `cmd_rx`, worker holds `cmd_tx` + - New `App::set_governor(Governor)` and `App::set_selected_pstate(i32)` methods + - `--dbus` now enables both property reads AND method invocations + +5. **Mouse sub-panel navigation** (`main.rs`) + - Left-click: cycle governor (header + controls) + - Right-click: toggle throttle (header); expand P-state (table) + - Middle-click: toggle throttle (controls); expand P-state (table) + +### v1.2 final state + +- **Source**: 2758 LoC across **11 modules** (was 2376/10 in v1.1, +382 LoC) +- **Cross-compile**: 3.2 MB stripped Redox ELF binary (was 2.8 MB in v1.1) +- **SHA256**: `58b7812a5f673e227753c01e93a05678bd9e8f28101d8a447d70d4943170c40a` +- **Build**: `cook redbear-power - successful` + +### Final module structure + +``` +local/recipes/system/redbear-power/source/src/ +├── main.rs (~440 lines) — event loop, key + mouse dispatch, tab routing +├── app.rs (~492 lines) — App, CpuRow, TabId, PackageThermal, HybridInfo +├── render.rs (~600 lines) — header, tab bar, per-cpu/system/info panels, controls +├── acpi.rs (166) — CPU enumeration, ACPI _PSS, CPUID fallback +├── cpuid.rs (~380) — CPUID leaf decoding including Zen CCD topology +├── bench.rs (123) — prime-sieve stress benchmark +├── dbus.rs (~310) — D-Bus export (properties + methods) via zbus 5 +├── msr.rs (127) — MSR constants + PackageThermal decoder +├── cpufreq.rs (50) — governor hint read/write +├── theme.rs (72) — central color palette (const Style) +└── config.rs (224) — TOML config file loader (NEW) +``` + +ISO rebuild status: still blocked by pre-existing upstream nix-0.30.1 vs +Redox relibc incompatibility in uutils. v1.2 binary is staged and will +be packaged into the next successful ISO build once that issue is resolved. ---