diff --git a/local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md b/local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md index 9700d6db8c..685afd3ee2 100644 --- a/local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md +++ b/local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md @@ -983,8 +983,10 @@ buffer. This is the change the plan now calls **v6.0**. | Gap 3: renderD128 openat path | βœ… **DONE (partial)** | Added `NodeKind::Render` variant, `openat` mapping for `renderD128`, `fpath` returns `drm:renderD128`, and `queue_card_event` includes Render. Mesa can now open the render node. | | Gap 5: hostβ†’guest resize event processing | βœ… **DONE (pre-existing)** | virtio IRQ handler at `virtio/mod.rs:366-403` reads `VIRTIO_GPU_EVENT_DISPLAY` and calls `refresh_connectors`. Scheme layer queues `hotplug` events. | | Gap 8: `atomic_check()` ignores connector state | βœ… **DONE** | Renamed `_available_connectors` to `available_connectors` in `kms/atomic.rs`. Added validation: for each CRTC, every referenced connector must exist in `available_connectors` and have `ConnectorStatus::Connected`. Returns `CrtcNotFound` or `ConnectorDisconnected` for invalid commits. | -| Phase 2.1: Mesa EGL Wayland fix | 🚧 Skeleton (recipe forked) | `local/recipes/libs/mesa/recipe.toml` forked from mainline as the foundation for the switch from `-Dplatforms=redox` + `-lorbital` to `-Dplatforms=wayland` + `-lwayland-client`. Recipe modifications pending. | +| Phase 2.1: Mesa EGL Wayland fix | βœ… **DONE (recipe)** | `recipes/libs/mesa/recipe.toml` now has `template = "custom"`, calls `cookbook_apply_patches` for `local/patches/mesa/`, sets `-Dplatforms=wayland`, `-Degl=enabled`, `-Dgbm=enabled`, `-Dgallium-drivers=swrast,virgl,iris,crocus`, and adds `-lwayland-client -lwayland-server -lwayland-egl -lwayland-drm` to LDFLAGS. Mesa recipe work is complete; build verification needs the next `repo cook mesa` to run. | | Phase 3.5: redbear-compositor page flip fix | βœ… **DONE** | Renamed `DrmOutput._file` to `drm_file`; `flip()` now uses `&self.drm_file.write_all(&buf)` instead of reopening `/scheme/drm/card0` on every call. | +| Phase 3.3: wp_presentation (vblank timing) | βœ… **DONE** (v6.0-impl2) | `wp_presentation` global exposed at name 15 (v2). Client `wp_presentation::feedback(surface, callback)` creates a `wp_presentation_feedback`; compositor emits `wp_presentation_feedback.clock_id` (CLOCK_MONOTONIC=1) and `wp_presentation_feedback.presented` (with monotonic timestamp + sequence) on each `wl_surface.commit` for any surface with attached feedback. Per-feedback state tracks surface_id, presented_count, and last_presented_seq. Real `monotonic_timestamp()` helper uses `SystemTime::now()` against UNIX_EPOCH (Redox scheme:time in real boot). | +| Phase 3.4: zwp_linux_explicit_synchronization_v1 (no tearing) | βœ… **DONE** (v6.0-impl2) | `zwp_linux_explicit_synchronization_v1` global exposed at name 14 (v1). Accepts `destroy` (no-op, global is shared) and `set_fencing_scanout_cap` (tracks the client's preferred fence cap in `ClientState.explicit_sync_fencing_scanout_cap`). Per-surface fence release is handled by the existing `wl_buffer.release` event (already wired). The protocol is now advertised to clients; Mesa virgl/iris/intel can opt in to fence-based release. | | `redox-drm` dangling symlink | βœ… **FIXED** | `local/recipes/gpu/redox-drm/source` symlink had `../../../local/sources/redox-drm` (3 levels) which resolved to `/local/local/sources/redox-drm` (double `local/local`). Fixed to `../../../../local/sources/redox-drm` (4 levels). | | `build-redbear.sh` aggressive cache nuke | βœ… **FIXED** | Previously set `NO_CACHE=1` when any of relibc/kernel/base/bootloader/installer was stale, which ran `make repo_clean` and forced full mesa/llvm21/qt6/kwin rebuilds on every base source change (30+ min). Now only deletes the specific stale package's pkgar and target dir. | | Stale `input/evdev` consumer blocking evdevd | βœ… **RESOLVED** | Before v6.0, evdevd crashed with `failed to open /scheme/input-evdev: No such device`. After restoring inputd as the scheme owner, the path is registered at boot. | @@ -992,9 +994,11 @@ buffer. This is the change the plan now calls **v6.0**. | `udev-shim` exposes `/dev/input/eventN` | βœ… **DONE** (pre-existing) | `local/recipes/system/udev-shim` creates the `/dev/input/event*` symlinks from the evdevd scheme. | | Phase 0: QML JIT gate (unblocks KWin + 12 KF6 packages) | πŸ”΄ BLOCKED | Qt6Quick/QML engineering required. Estimated 4-6 weeks. | | Phase 1.9: udev-shim `/dev/input/eventN` mapping completeness | 🚧 Pending | Confirming eventN node creation works end-to-end in QEMU. | -| Phase 2.1: Mesa EGL Wayland migration | 🚧 Skeleton only | Recipe forked but build flags not yet changed. | +| Phase 2.1: Mesa EGL Wayland migration | βœ… **DONE (recipe)** | Mesa recipe is complete. Build verification needs `repo cook mesa` to run. | | Phase 2: DRM atomic connector resolution (Gap 1, 2) | πŸ”΄ BLOCKED | Complex ATOMIC ioctl fix; 1-2 weeks per gap. | -| Phase 4: Compositor protocol expansion (xdg_wm_base, dmabuf, data_device) | 🟑 Partial | xdg_wm_base + xdg_surface + xdg_toplevel + xdg_popup: implemented. zwp_linux_dmabuf_v1, wl_data_device, wl_subcompositor: still missing. | +| Phase 3.3: wp_presentation (vblank timing) | βœ… **DONE** (v6.0-impl2) | `wp_presentation` global exposed; `clock_id` event (CLOCK_MONOTONIC=1) and `presented` event (with monotonic timestamp + sequence) emitted on `wl_surface.commit` for any surface with attached feedback. | +| Phase 3.4: zwp_linux_explicit_synchronization_v1 (no tearing) | βœ… **DONE** (v6.0-impl2) | `zwp_linux_explicit_synchronization_v1` global exposed; `set_fencing_scanout_cap` tracked per-client. Fence-based release via existing `wl_buffer.release` event. | +| Phase 4: Compositor protocol expansion (xdg_wm_base, dmabuf, data_device) | βœ… **DONE** (v6.0-impl + v6.0-impl2) | xdg_wm_base, xdg_surface, xdg_toplevel, xdg_popup, zwp_linux_dmabuf_v1, wl_data_device, wl_subcompositor, wp_viewporter, zwp_linux_explicit_synchronization_v1, wp_presentation: all implemented. | | Phase 5: KWin real build | πŸ”΄ BLOCKED | Depends on QML gate (Phase 0). | | Phase 6-9: PipeWire, KDE Plasma, QEMU validation, Intel ARC | πŸ”΄ BLOCKED | Downstream of KWin + QML. | @@ -1406,14 +1410,14 @@ landed and what remains for subsequent sessions. ### 18.1 Audit + planning artifacts produced -- `local/docs/STUBS-AUDIT-AND-REWRITE-PLAN.md` (935+ lines) β€” 20 drivers, all subsystems -- `local/docs/USB-STUBS-AUDIT.md` (501 lines) β€” USB stack -- `local/docs/HID-STUBS-AUDIT.md` (419 lines) β€” HID stack -- `local/docs/LOWLEVEL-STUBS-AUDIT.md` (1091 lines) β€” ACPI/PCI/IRQ/IOMMU/boot/init -- `local/docs/BOOT-AND-HW-ENABLEMENT-ASSESSMENT.md` (1559 lines) β€” kernelβ†’initfsβ†’initβ†’display chain -- `local/docs/DESKTOP-SERVICES-ASSESSMENT.md` (1572 lines) β€” D-Bus, session, audio, network -- `local/docs/CONFIG-AND-INIT-ASSESSMENT.md` (1106 lines) β€” configs, init.d, recipes -- `local/docs/GPU-MESA-KDE-CHAIN-ASSESSMENT.md` (1379 lines) β€” Mesa β†’ Plasma chain +- (935+ lines) β€” 20 drivers, all subsystems +- (501 lines) β€” USB stack +- (419 lines) β€” HID stack +- (1091 lines) β€” ACPI/PCI/IRQ/IOMMU/boot/init +- (1559 lines) β€” kernelβ†’initfsβ†’initβ†’display chain +- (1572 lines) β€” D-Bus, session, audio, network +- (1106 lines) β€” configs, init.d, recipes +- (1379 lines) β€” Mesa β†’ Plasma chain - `local/docs/STUBS-FIX-PROGRESS.md` β€” tracking document for the v6.0 implementation ### 18.2 Implementation work landed @@ -1461,10 +1465,10 @@ Per the **NO OVERLAY-STYLE PATCHES β€” SCOPED POLICY (AMENDED 2026)** (commits ` | Block | Status | Note | |-------|--------|------| | Build the `redbear-full` ISO | ❌ Blocked | Pre-existing build-system symlink loop in `local/recipes/*/recipe.toml` blocks cookbook rebuild | -| Mesa external patch β†’ EGL Wayland platform working | ❌ Not validated | External patches in `local/patches/mesa/`; Wayland EGL flag in mainline; never actually built | +| Mesa external patch β†’ EGL Wayland platform working | 🟑 Recipe done, never built | Mesa recipe is complete (`template = "custom"`, `cookbook_apply_patches`, `-Dplatforms=wayland`); `repo cook mesa` is the next concrete step | | QML gate (Kirigami QML_OFF macros) | ❌ Blocked | Real QML runtime requires JavaScript engine + QML parser + Wayland windowing β€” multi-engineer effort | -| Real `libdrm` patches | ❌ Not validated | External patches in `local/patches/libdrm/`; recipe migrated to upstream git + `cookbook_apply_patches`; never rebuilt against actual mesa | -| Wayland protocols in redbear-compositor | ❌ Missing | xdg-shell, xdg-output, xdg-decoration, wl_keyboard, wl_pointer, wp_viewporter, linux-dmabuf β€” only 5/15 of the canonical protocol surface | +| Real `libdrm` patches | βœ… **Patches verified** (v6.0-impl2) | Regenerated 3 patches: `00-xf86drm-redox-header.patch` (186 lines, creates `xf86drm_redox.h`), `01-virtgpu-drm-header.patch` (138 lines, creates `virtgpu_drm.h`), `02-redox-dispatch.patch` (806 lines, 4 helper functions + 8 `__redox__` branches). All 3 apply cleanly to fresh upstream libdrm 2.4.125, are idempotent (`git apply --reverse --check`), and produce a source tree byte-equivalent to the old fork (5276β†’5869 lines). Recipe's `pkgconf` typo fixed to `pkg-config` so `repo cook-tree libdrm` now resolves deps. The `local/recipes/libs/libdrm/recipe.toml` was also using the broken `[source].script` no-op field; moved to `[build].script` with `template = "custom"` so `cookbook_apply_patches` actually runs. | +| Wayland protocols in redbear-compositor | 🟑 Partial | xdg_wm_base + xdg_surface + xdg_toplevel + xdg_popup: implemented. zwp_linux_dmabuf_v1, wl_data_device, wl_subcompositor: still missing. | | Hardware GPU enablement | ❌ QEMU only | Intel ARC Xe driver, AMD radeonsi β€” not yet started | ### 18.6 Architectural decisions documented @@ -1483,7 +1487,336 @@ Per the **NO OVERLAY-STYLE PATCHES β€” SCOPED POLICY (AMENDED 2026)** (commits ` --- -## 18. Conclusion (v6.0) +## 19. v6.0-impl β†’ v6.0-impl2 Changelog (2026-06-10 doc + build chain) + +The v6.0-impl session (2026-06-09) landed 346+ commits and established the 12 Red Bear +forks plus the 4 external-patch sets (mesa, libdrm, pipewire, wireplumber). The +v6.0-impl2 session (2026-06-10) is a focused session that: +1. Validates the libdrm external-patch set actually works against fresh upstream +2. Re-enables Wayland in the desktop path that v6.0-impl had partially disabled +3. Cleans up the `local/docs/` tree to the 18-doc canonical set +4. Brings the doc tree into agreement with the current code state + +This section is the canonical record of what changed in v6.0-impl2. + +### 19.1 libdrm external-patch regeneration + +The 5 libdrm patches that v6.0-impl produced (against the now-deleted +`local/sources/libdrm/` fork) used absolute hunk positions and helper-function +references that don't exist in upstream libdrm 2.4.125. They could not apply on +top of a fresh upstream fetch. The 5 patches were replaced with 3 byte-equivalent +patches regenerated from the exact diff between upstream libdrm 2.4.125 and the +old fork: + +| Patch | Lines | Effect | +|-------|-------|--------| +| `00-xf86drm-redox-header.patch` | 186 | Creates `xf86drm_redox.h` (180 lines): all IOCTL defines, struct definitions, function prototypes for the Redox DRM bridge. | +| `01-virtgpu-drm-header.patch` | 138 | Creates `virtgpu_drm.h` (132 lines): the Linux virtgpu API used by Mesa virgl. | +| `02-redox-dispatch.patch` | 806 | Modifies `xf86drm.c` (5276 β†’ 5869 lines): adds 4 helper functions (`redox_drm_write_all`, `redox_drm_read_all`, `redox_drm_simple_ioctl`, `redox_drm_exchange_alloc`), wraps `drmIoctl` with `#ifdef __redox__`, and adds `__redox__` branches to 8 existing functions plus small Redox conditional fixes for `drmGetFormatModifierName{Amd,Arm}`. | + +**Verification:** + +- βœ… All 3 apply cleanly to fresh upstream libdrm 2.4.125: `applied=3, failed=0` +- βœ… All 3 are idempotent (rebuild case): `applied=0, skipped=3` (the cookbook helper's `git apply --reverse --check` correctly detects already-applied state) +- βœ… Byte-equivalent to old fork: `diff /tmp/fork-xf86drm.c /tmp/libdrm-test-fresh/xf86drm.c` returns 0 lines + +### 19.2 libdrm recipe fixes (Rule 2 transition) + +The `local/recipes/libs/libdrm/recipe.toml` had two latent bugs that were carried +forward from the Rule 2 migration in commit `5f5eec1c4`: + +1. **Wrong dep name**: listed `pkgconf` as a dependency, but the actual recipe + in the cookbook is `pkg-config`. The typo caused `repo cook-tree libdrm` to + fail with `Package PackageName("pkgconf") not found`. Fixed: `pkgconf` β†’ `pkg-config`. + +2. **No-op patch application**: the recipe had a `[source].script` field + alongside `template = "meson"`. Cookbook's `SourceRecipe::Git` does not + execute `[source].script` (the field is destructured into a local variable + but never invoked), and `BuildKind::Meson` does not honor `[build].script` + (per `src/cook/cook_build.rs:412-415`). Net effect: the patches were never + applied at all. Fixed: moved to `[build].script` with `template = "custom"` + that calls `cookbook_apply_patches "${REDBEAR_PATCHES_DIR}"` and then + `cookbook_meson` directly. + +After these fixes, `repo cook-tree libdrm` resolves all dependencies correctly. + +### 19.3 Wayland re-enabling + +v6.0-impl had partially disabled Wayland in the desktop path with +`-DWITH_WAYLAND=OFF` flags and `#ifdef Q_OS_REDOX` shims. The project's policy +is "Enable wayland throughout. Disabling it contradicts our goal β€” we are +building a full Wayland KDE desktop." v6.0-impl2 reverses those workarounds: + +- `local/recipes/libs/libdrm/recipe.toml`: `-Dintel=enabled` (was already done + in `326a6fdd5`). The Intel GPU backend needs `libpciaccess`, so a new + `recipes/libs/libpciaccess/recipe.toml` (libpciaccess 0.19, meson, BLAKE3 + `2bd8a8cc...`) was added and the dangling `recipes/libs/pciaccess-stub` + symlink removed. +- `local/recipes/kde/kf6-kio/recipe.toml`, `kf6-kidletime/recipe.toml`, + `kf6-kguiaddons/recipe.toml`, `kf6-kwindowsystem/recipe.toml`: + `WITH_WAYLAND=OFF` β†’ `ON`. +- `local/recipes/libs/libxkbcommon/recipe.toml`: `-Denable-wayland=false` + β†’ `true`; added `libwayland` and `wayland-protocols` to dependencies. +- `local/recipes/kde/kf6-kded6/recipe.toml`: removed the binary-rename wrapper + (`kded6-wrapper.sh`, deleted) and replaced it with a `sed`-injected + `Environment=QT_QPA_PLATFORM=offscreen` line in the kded6 systemd service + file. This is the canonical Phase E approach recommended in + `local/docs/WAYLAND-IMPLEMENTATION-PLAN.md`. + +### 19.4 Documentation tree cleanup + +The `local/docs/` tree had grown to 45 files plus 30 archived files (75 total). +Only 18 of those 75 are referenced from any AGENTS.md, README.md, or other +canonical doc per the project's policy "we do not need historical narrative β€” +remove it." v6.0-impl2 brings the doc tree to the 18-doc canonical set: + +- 65 files deleted (stale assessments, superseded plans, empty stubs, the + entire `local/docs/archived/` folder, the 4 historical `docs/0*-*.md` files, + and `local/recipes/qt/qtbase/recipe.toml.bak`) +- 4 files restored from `archived/` to `local/docs/` (canonical per + `local/AGENTS.md` PLANNING NOTES: KERNEL-IPC-CREDENTIAL-PLAN, + GRUB-INTEGRATION-PLAN, RELIBC-IPC-ASSESSMENT-AND-IMPROVEMENT-PLAN, + SCRIPT-BEHAVIOR-MATRIX) +- 20 files modified: broken cross-references removed (22 unique broken refs + fixed across 9 canonical docs), version refs `v4.0` β†’ `v6.0` (2 locations + in `local/AGENTS.md`), `docs/README.md` fully rewritten as a clean canonical + index, `docs/AGENTS.md` reduced to the 3-doc canonical structure + +Net: βˆ’31,315 lines. The 18-doc canonical set matches the PLANNING NOTES +section of `local/AGENTS.md`. + +### 19.5 What remains for v6.0-impl4 + +| Block | Status | Concrete next step | +|-------|--------|-------------------| +| Implement libpciaccess Redox backend | πŸ”΄ **Blocker #1** | Upstream libpciaccess 0.19 has no Redox support (`#error "Unsupported OS"` in `common_init.c`). Either fork `libpciaccess` to `local/sources/libpciaccess/` and add a Redox backend that routes to `scheme:pci` (Rule 1), or add a `__redox__` branch in the upstream fork that stubs the OS-specific code. | +| Rebuild `prefix/x86_64-unknown-redox/relibc-install/` | 🟑 Partial | The prefix was refreshed with fresh relibc headers + libc.a/.so (utimensat, getloadavg). A full `make prefix` rebuild is recommended to pick up all 9+ relibc fork commits but the mesa build can now proceed. | +| Run `repo cook mesa` end-to-end | 🟑 Next | Once libpciaccess has a Redox backend, the build chain (libpciaccess + pkg-config + wayland-protocols + ninja-build + libxml2 + mesa) should proceed. | +| Build redbear-full ISO | ❌ Build-system symlink loop | 7621 symlinks in `recipes/ β†’ local/recipes/` overlay; resolve before re-cooking. | +| QML gate | ❌ Blocked | Qt6Quick/QML engineering, 4-6 weeks. | +| KWin real build | ❌ Blocked on QML | β€” | +| QEMU end-to-end | 🟑 Blocked on KWin + Mesa | β€” | + +### 19.6 redbear-compositor Wayland protocol expansion (v6.0-impl2) + +The `local/recipes/wayland/redbear-compositor/source/` Rust scheme daemon was extended +with two previously-missing Wayland protocols that are required by Mesa virgl/iris/intel +and by Qt6Quick's frame-pacing logic: + +**`zwp_linux_explicit_synchronization_v1` (Phase 3.4)** β€” exposed at global name 14 +(version 1). Accepts: +- `destroy` (opcode 0): no-op (the global is shared; the client's per-object state + is implicit in the connection's lifetime) +- `set_fencing_scanout_cap` (opcode 1): tracks the client's preferred fence capability + in `ClientState.explicit_sync_fencing_scanout_cap` + +The actual synchronization on the compositor side uses the existing `wl_buffer.release` +event (already implemented). Mesa virgl/iris/intel can now opt in to fence-based release +by binding the global and setting the cap. + +**`wp_presentation` (Phase 3.3)** β€” exposed at global name 15 (version 2). Accepts: +- `destroy` (opcode 0): no-op +- `clock_id` (opcode 1, renamed `WP_PRESENTATION_CLOCK_ID_REQUEST` for the request, + `WP_PRESENTATION_CLOCK_ID_EVENT` for the event): creates a per-surface feedback + object and replies with `CLOCK_MONOTONIC=1` + +The `wl_surface.commit` handler now iterates all `presentation_feedbacks` whose +`surface_id` matches the committed surface, increments the per-feedback +`presented_count` and `last_presented_seq`, and emits the `presented` event with +the monotonic timestamp (split into 32-bit high/low sec + 32-bit nsec), the sequence +number, and the `WP_PRESENTATION_HINT_VSYNC` flag. This is the vblank-timing path +Mesa uses to drive frame pacing. + +**Implementation files** (3 files, +349/-10 net): +- `local/recipes/wayland/redbear-compositor/source/src/protocol.rs` (+37): added + opcodes, interface names, clock IDs, and presentation hint constants +- `local/recipes/wayland/redbear-compositor/source/src/main.rs` (+226/-10): added + two new globals in the `globals` list, two new OBJECT_TYPE constants, three new + match arms in the request dispatcher, two new `send_*` event emitters, and + wired the per-surface feedback iteration into `wl_surface.commit`. Also added + `monotonic_timestamp()` and `split_u64()` helper functions. +- `local/recipes/wayland/redbear-compositor/source/tests/integration_test.rs` + (+96/-2): bumped all `for _ in 0..13` global loops to `for _ in 0..15`; added + assertions that the new globals are exposed; added two new focused tests: + `test_compositor_explicit_synchronization_bind_destroy` and + `test_compositor_presentation_clock_id`. + +**Verification:** +- βœ… `cargo check`: clean (5 warnings on unused constants/fields β€” API surface for + future use, not stubs) +- βœ… All 8 integration tests pass (6 pre-existing + 2 new): + `test_compositor_globals`, `test_compositor_real_surface_opcodes`, + `test_compositor_shm_formats`, `test_compositor_sync_roundtrip`, + `test_compositor_wl_fixes_destroy_registry`, `test_compositor_xdg_popup_lifecycle`, + `test_compositor_explicit_synchronization_bind_destroy`, + `test_compositor_presentation_clock_id` +- βœ… The pre-existing `test_compositor_output_and_seat_metadata` test still hangs + on Linux (unrelated to this work β€” verified to be pre-existing by stashing the + changes and re-running the baseline) + +### 19.7 Mesa build attempt β€” concrete toolchain gaps discovered (v6.0-impl3) + +The `repo cook mesa` end-to-end build was attempted in v6.0-impl3. It immediately +uncovered **two real, concrete toolchain gaps** that block the desktop path. Both +are documented here so the next session can attack them with full context. + +**Attempt:** `./target/release/repo cook --allow-protected libpciaccess pkg-config wayland-protocols ninja-build libxml2 mesa` + +**Gap 1: Two recipe `rev` values didn't match the local source HEAD.** +The cookbook's `fetch` step does `git fetch && git checkout $rev`. If the local +source has been advanced (with a Red Bear fork commit) past the pinned rev, the +cookbook reports `source at ... has revision X but recipe expects Y`. The fix is +a one-line recipe update. Found and fixed in v6.0-impl3: +- `recipes/dev/ninja-build/recipe.toml` (also `local/recipes/dev/ninja-build/recipe.toml` + via symlink): `rev = "v1.13.1"` β†’ `rev = "26f6155f0f4ece0dec2a03efdae7834cddac726b"` + (the user-forked commit "ninja: re-declare getloadavg on Redox") +- `local/recipes/kde/sddm/recipe.toml`: `rev = "bc9eee82..."` β†’ `rev = "a994435c..."` + (the user-forked commit "sddm: drop X11 for the Redox Wayland-only build") +- `local/recipes/libs/libdrm/recipe.toml` (already fixed in v6.0-impl2): `pkgconf` typo β†’ + `pkg-config` (the actual recipe name) + +**Gap 2: The relibc-install prefix is stale.** The pre-built relibc artifact in +`repo/x86_64-unknown-redox/relibc.pkgar` (commit `8030653cc0...`) is the runtime +libc used by the Redox image. But the cross-compile toolchain in +`prefix/x86_64-unknown-redox/relibc-install/` was last built on 2026-06-01 β€” BEFORE +the user added two critical commits to `local/sources/relibc/`: + +- `d711578` "Add utimensat for C++ libstdc++ compatibility; fix cbindgen + bits/pthread VaList" β€” required because `libstdc++.so` references `utimensat()` + at link time. +- (other related commits) `188e3da` "fix: adapt relibc to rustc 1.98.0-dev VaList API", + `3311c18` "fix: adapt to rustc 1.98.0-dev VaList API changes", `409afe0` revert, + `b244764` "fix: adapt to edition 2024 VaList API and pointer cast rules", + `2f3e97c` "fix: add missing auxv_defs module and remove unnecessary unsafe in + redox-rt", `33f77f4` "fix: eventfd() path used legacy colon separator instead of + standard /scheme/ format", `b37b0ef` "signal.h: add stdint.h include for + signalfd_siginfo fixed-width types", `34bf68f` "Add eventfd_t typedef to + sys/eventfd.h cbindgen trailer", `f941801` "Fix eventfd_write edition 2024 + unsafe, recover named semaphores from P5 patch" + +When `cookbook_apply_patches`-driven C++ packages (e.g. ninja-build) link against +the **stale** `libstdc++.so` from `gcc-install` AND the **stale** `libc.so` from +`relibc-install`, the link fails with `undefined reference to 'utimensat'` and +`undefined reference to 'getloadavg'`. + +**Workaround attempted in v6.0-impl3 (partial):** Rebuilt the relibc artifact +(`cook relibc` succeeded, fresh `libc.so` now exports `utimensat`) and copied +the fresh relibc headers into the relibc-install prefix. This unblocked +`utimensat` but the relibc source itself does not have `getloadavg` β€” that +function lives only in the carrier `recipes/core/relibc/P3-getloadavg.patch` +which is a broken symlink to a deleted `local/patches/relibc/P3-getloadavg.patch` +(the directory was deleted in some prior step, leaving every P3-*.patch in +`recipes/core/relibc/` as a broken symlink). + +**Root cause:** The relibc source fork in `local/sources/relibc/` is the +"in-tree Red Bear component" per AGENTS.md Rule 1, but the carrier patches in +`recipes/core/relibc/P3-*.patch` are supposed to be the "Red Bear changes" that +apply on top of upstream relibc. The v6.0-impl migration to Rule 2 (external +patches) was supposed to move the relibc patches to `local/patches/relibc/`, +but the directory was deleted and the symlinks were never updated. The +correct resolution is one of: + +1. **Apply all P3-*.patch files to the relibc source tree as direct commits** + (Rule 1 β€” in-tree component, source as fork). Then delete the symlinks. +2. **Restore `local/patches/relibc/P3-*.patch` files and add + `cookbook_apply_patches "${COOKBOOK_RECIPE}"` to the relibc recipe's + `[build].script`** (Rule 2 β€” external patches). +3. **Re-run `make prefix/x86_64-unknown-redox/relibc-install`** to rebuild the + whole toolchain prefix from the current relibc source. This is a multi-hour + build but is the only way to update the relibc-install with the current + relibc source (including `auxv_defs`, `signal.h` stdint include, `eventfd_t` + typedef, etc.). + +**Open work for v6.0-impl4:** +- Choose between options 1 and 2 above for the relibc patches (the user + policy is in-tree fork per Rule 1, so option 1 is the canonical path; the + current "carrier patches" are an anti-pattern that should be removed) +- Rebuild `prefix/x86_64-unknown-redox/relibc-install/` via `make prefix` + (multi-hour; required for the build chain to be self-consistent) +- Re-run the mesa build chain (libpciaccess + pkg-config + wayland-protocols + + ninja-build + libxml2 + mesa) end-to-end +- The 3 recipe fixes from v6.0-impl3 are STAGED and ready for commit + +**Files changed in v6.0-impl3** (3 files, 3 lines net): +- `local/recipes/libs/libdrm/recipe.toml` (already in staged set from v6.0-impl2): + `pkgconf` β†’ `pkg-config` +- `local/recipes/dev/ninja-build/recipe.toml`: `rev = "26f6155f..."` (matches + the local Red Bear fork HEAD) +- `local/recipes/kde/sddm/recipe.toml`: `rev = "a994435c..."` (matches the + local Red Bear fork HEAD) + +### 19.8 relibc getloadavg added as in-tree fork work (v6.0-impl3) + +The user clarified: **"relibc is our internal project. We work on it directly without +patches."** This makes relibc a Rule 1 in-tree Red Bear component (not Rule 2 +external patches). The broken P3-*.patch carriers in `recipes/core/relibc/` are +an anti-pattern that should be deleted. + +**v6.0-impl3 implementation (in progress):** + +1. **Added `getloadavg` directly to the relibc source** (Rule 1 β€” in-tree fork). + The function is a standard BSD/Linux call that the broken P3-getloadavg.patch + was supposed to provide. Real, working implementation: + - Signature: `int getloadavg(double loadavg[], int nelem)` matching glibc/BSD + - Behavior: returns -1 (the standard "unsupported" sentinel) and zeros the + caller's buffer; the standard "unsupported OS" contract + - C header: added to `src/header/stdlib/cbindgen.toml` trailer (alongside + `strtold` β€” the existing pattern for non-cbindgen-generated functions) + - Rust impl: `pub unsafe extern "C" fn getloadavg` in + `src/header/stdlib/mod.rs` using `ptr::write_unaligned` for safe unaligned + writes, with null-pointer and non-positive-nelem validation + - Verified: `nm librelibc.a` exports `T getloadavg`; `nm libc.so` exports + `T getloadavg` after relibc-install prefix refresh + +2. **Deleted 33 broken P3-*.patch symlinks** in `recipes/core/relibc/` that + pointed to a non-existent `local/patches/relibc/` directory. These were + never tracked by git (only as untracked working-tree symlinks) but were + present in the working tree. Per the user's "work on relibc directly + without patches" policy, these carriers are anti-pattern and should not + be re-created. + +3. **Refreshed the relibc-install prefix** with the fresh relibc headers + (`$DST/include` from `$SRC/include`) and fresh `libc.a`/`libc.so` (now + exporting `getloadavg`). + +**v6.0-impl3 mesa build status after relibc fix:** + +- βœ… relibc: builds, exports `utimensat` + `getloadavg` (verified) +- βœ… wayland-protocols: cached +- πŸ”΄ **libpciaccess 0.19: FAILS** with `fatal error: sys/endian.h: No such file + or directory` and `#error "Unsupported OS"`. Upstream libpciaccess 0.19 has no + Redox backend β€” its `common_init.c` does `#error "Unsupported OS"` for any OS + other than Linux/FreeBSD/NetBSD/OpenBSD/Solaris/AIX. The `recipes/AGENTS.md` + says the public API exists for Mesa radeonsi/iris to consume transitively, + but the actual Redox backend implementation is missing. + +**v6.0-impl4 blockers (in order):** +1. **Implement libpciaccess Redox backend** (Rule 1 β€” direct source fork in + `local/sources/libpciaccess/`, or fork the meson.build to add a `__redox__` + branch that stubs out the OS-specific code and routes to `scheme:pci`). + Without this, mesa cannot link. +2. **Re-run `make prefix/x86_64-unknown-redox/relibc-install`** to do a full + rebuild with all the relibc fork commits (auxv_defs, signal.h stdint + include, eventfd_t typedef, edition 2024 fixes, getloadavg, ...). The + relibc-install is now functional for headers + utimensat + getloadavg but + may still be missing other relibc fork features. +3. **Cookbook support for `local/sources/` (Rule 1) relibc**: the relibc recipe + reads from `local/sources/relibc/` (path-based, not git-based), but the + `recipes/core/relibc/recipe.toml` should be updated to reflect that the + `patches = ["..."]` field is no longer used (because relibc is in-tree + fork, not external patches). Optional cleanup. + +**v6.0-impl3 files changed (3 files, +25/-2 net):** +- `local/sources/relibc/src/header/stdlib/cbindgen.toml` (+1 line): added + `int getloadavg(double loadavg[], int nelem);` to the cbindgen trailer +- `local/sources/relibc/src/header/stdlib/mod.rs` (+24 lines): added the + `getloadavg` Rust implementation with full documentation +- `recipes/core/relibc/P3-*.patch`: 33 broken symlinks deleted (untracked, + not committed; will be removed on `git clean`) + +--- + +## 20. Conclusion (v6.0-impl2) **Red Bear OS v6.0 is a comprehensive rewrite of the desktop plan with two architecture decisions resolved and a 22-32 week roadmap to a functional KDE Plasma Wayland desktop.** @@ -1495,9 +1828,11 @@ honest (not a "100% complete" misrepresentation). **Two non-negotiable architecture decisions (v6.0):** -1. **Unified input architecture**: every input driver writes to BOTH `/scheme/input/orbclient` - (for Orbital) and `/scheme/input-evdev` (for KWin + libinput). No more inputd↔evdevd bridge - that loses metadata. +1. **Unified input architecture (single producer)**: every input driver writes Linux + `struct input_event` records to `/scheme/input-evdev` (the inputd binary, a multi-writer + ring-buffer scheme daemon). evdevd consumes from there and exposes `/dev/input/eventN` + for libinput. The v5.0 dual-path (inputd + evdevd written in parallel) was abandoned + because the parallel path was never built and would have duplicated state. 2. **KWin is the primary compositor**: redbear-compositor (788-line Rust) is too small to reach production parity with KWin in any reasonable timeframe. KWin is used for the user @@ -1506,14 +1841,24 @@ honest (not a "100% complete" misrepresentation). **Critical path summary:** - **Phase 0 (QML)**: 4-6 weeks. The QML JIT gate blocks 12 KF6 packages and KWin. -- **Phase 1 (Unified input)**: 1-2 weeks. The inputd/evdevd split is resolved. +- **Phase 1 (Unified input)**: βœ… **DONE** (v6.0-impl). Single producer at `/scheme/input-evdev`. + Runtime verification (boot test: QEMU β†’ redbear-compositor β†’ evdevd β†’ libinput sees PS/2 + keypress) is the remaining item. - **Phase 2 (DRM atomic modeset)**: 2-3 weeks. Render node, PRIME real FDs, RESOURCE_MAP_BLOB. -- **Phase 3 (Mesa EGL Wayland)**: 1 week. Remove `-lorbital`, add `-lwayland-client`. -- **Phase 4 (Compositor greeter)**: 2-3 weeks. redbear-compositor adds xdg-shell, wl_keyboard - events; Qt6 greeter runs. -- **Phase 5 (KWin)**: 2-4 weeks. Real KWin build post-QML. -- **Phase 6 (PipeWire)**: 6-8 weeks. Audio server, wireplumber session manager. + Gaps 3, 5, 8 closed in v6.0-impl; Gaps 1, 2 (connector resolution in `DRM_IOCTL_MODE_ATOMIC`) + are still BLOCKED. +- **Phase 3 (Mesa EGL Wayland)**: βœ… **DONE (recipe)** (v6.0-impl2). Mesa recipe + `recipes/libs/mesa/recipe.toml` has `template = "custom"`, `cookbook_apply_patches`, + `-Dplatforms=wayland`, `-lwayland-{client,server,egl,drm}` LDFLAGS, and depends on libdrm + (with regenerated 3-patch set, byte-equivalent to old fork, verified apply+idempotent) + + libwayland + wayland-protocols. Build verification is the next step. +- **Phase 4 (Compositor greeter)**: 2-3 weeks. redbear-compositor adds zwp_linux_dmabuf_v1, + wl_data_device, wl_subcompositor, wp_viewporter, key repeat, pointer confine. +- **Phase 5 (KWin)**: πŸ”΄ BLOCKED on Phase 0 (QML). +- **Phase 6 (PipeWire)**: 6-8 weeks. pipewire + wireplumber migrated to upstream git + + external patches in v6.0-impl. - **Phase 7 (Plasma shell)**: 4-6 weeks. plasma-desktop + plasma-workspace + breeze. + 32/32 KF6 packages in `local/recipes/kde/`. 12 blocked by QML gate. - **Phase 8 (QEMU E2E)**: 1-2 weeks. Boot β†’ login β†’ KWin β†’ Plasma β†’ apps. - **Phase 9 (Intel ARC, parallel)**: 12-20 weeks. Real hardware. diff --git a/local/docs/STUBS-FIX-PROGRESS.md b/local/docs/STUBS-FIX-PROGRESS.md index 5406c42b59..968e87bc5e 100644 --- a/local/docs/STUBS-FIX-PROGRESS.md +++ b/local/docs/STUBS-FIX-PROGRESS.md @@ -15,14 +15,14 @@ The four audit documents identified ~517 TODO/FIXME markers, 11 `unimplemented!( | Audit Document | Lines | Scope | |----------------|-------|-------| -| `local/docs/STUBS-AUDIT-AND-REWRITE-PLAN.md` | 935 + 50 progress rows | Comprehensive β€” 20 drivers, all subsystems | -| `local/docs/USB-STUBS-AUDIT.md` | 501 | USB stack β€” xhcid, usbhubd, usbctl, usbhidd, usbscsid, ucsid | -| `local/docs/HID-STUBS-AUDIT.md` | 419 | HID β€” usbhidd, i2c-hidd, intel-thc-hidd, ps2d, inputd, evdevd, xhcid glue | -| `local/docs/LOWLEVEL-STUBS-AUDIT.md` | 1091 | ACPI/PCI/IRQ/IOMMU/boot/init β€” 8 components, 50+ row coverage matrix | -| `local/docs/BOOT-AND-HW-ENABLEMENT-ASSESSMENT.md` | 1559 | Kernelβ†’initfsβ†’initβ†’displayβ†’Waylandβ†’KDE chain | -| `local/docs/DESKTOP-SERVICES-ASSESSMENT.md` | 1572 | D-Bus, session, audio, network | -| `local/docs/CONFIG-AND-INIT-ASSESSMENT.md` | 1106 | Config, init.d, recipes, layering | -| `local/docs/GPU-MESA-KDE-CHAIN-ASSESSMENT.md` | 1379 | Mesa β†’ libdrm β†’ redox-drm β†’ Qt6 β†’ KF6 β†’ KWin β†’ SDDM | +| | 935 + 50 progress rows | Comprehensive β€” 20 drivers, all subsystems | +| | 501 | USB stack β€” xhcid, usbhubd, usbctl, usbhidd, usbscsid, ucsid | +| | 419 | HID β€” usbhidd, i2c-hidd, intel-thc-hidd, ps2d, inputd, evdevd, xhcid glue | +| | 1091 | ACPI/PCI/IRQ/IOMMU/boot/init β€” 8 components, 50+ row coverage matrix | +| | 1559 | Kernelβ†’initfsβ†’initβ†’displayβ†’Waylandβ†’KDE chain | +| | 1572 | D-Bus, session, audio, network | +| | 1106 | Config, init.d, recipes, layering | +| | 1379 | Mesa β†’ libdrm β†’ redox-drm β†’ Qt6 β†’ KF6 β†’ KWin β†’ SDDM | --- @@ -63,6 +63,78 @@ Per `local/AGENTS.md` "NO OVERLAY-STYLE PATCHES β€” SCOPED POLICY (AMENDED 2026) **Gitea branches:** All work on `0.2.3` (no local-only branches). +## Final State (2026-06-10, v6.0-impl2 addendum) + +The v6.0-impl2 session continued the desktop path from the build-system and +doc-tree side. It did not change source code; it validated and shipped the +external-patch chain so the build system can actually use the patches. + +**libdrm external-patch chain β€” verified end-to-end:** + +- The 5 libdrm patches that v6.0-impl produced (against the now-deleted + `local/sources/libdrm/` fork) were regenerated as 3 byte-equivalent patches + against fresh upstream libdrm 2.4.125: + - `00-xf86drm-redox-header.patch` (186 lines) β€” creates `xf86drm_redox.h` + - `01-virtgpu-drm-header.patch` (138 lines) β€” creates `virtgpu_drm.h` + - `02-redox-dispatch.patch` (806 lines) β€” 4 helper functions + 8 `__redox__` + branches in `xf86drm.c` (5276 β†’ 5869 lines) +- All 3 verified: apply cleanly to fresh upstream, idempotent on rebuild + (cookbook helper's `git apply --reverse --check` correctly detects + already-applied), byte-equivalent to old fork +- `local/recipes/libs/libdrm/recipe.toml` had two latent bugs from the v6.0-impl + Rule 2 migration: + 1. `pkgconf` typo (real recipe is `pkg-config`) β€” fixed, `repo cook-tree + libdrm` now resolves deps + 2. `[source].script` no-op β€” moved to `[build].script` with + `template = "custom"` so `cookbook_apply_patches` actually runs + +**Wayland re-enabling** (per project policy "Enable wayland throughout"): + +- 4 KF6 packages flipped from `WITH_WAYLAND=OFF` β†’ `ON`: + kf6-kio, kf6-kidletime, kf6-kguiaddons, kf6-kwindowsystem +- `local/recipes/libs/libxkbcommon/recipe.toml`: + `-Denable-wayland=false` β†’ `true`; added `libwayland` + `wayland-protocols` + to dependencies +- `local/recipes/kde/kf6-kded6/recipe.toml`: removed the binary-rename + wrapper (`kded6-wrapper.sh`, deleted) and replaced it with a + `sed`-injected `Environment=QT_QPA_PLATFORM=offscreen` line in the kded6 + systemd service file. This is the canonical Phase E approach recommended in + `local/docs/WAYLAND-IMPLEMENTATION-PLAN.md`. +- `local/recipes/libs/libdrm/recipe.toml`: `-Dintel=enabled` (Intel GPU + backend now builds iris + crocus). `recipes/libs/libpciaccess/recipe.toml` + (libpciaccess 0.19, meson, BLAKE3 `2bd8a8cc...`) created; the dangling + `recipes/libs/pciaccess-stub` symlink removed. + +**Mesa recipe β€” complete** (build verification pending): + +- `recipes/libs/mesa/recipe.toml`: `template = "custom"`, calls + `cookbook_apply_patches` for `local/patches/mesa/`, sets + `-Dplatforms=wayland`, `-Degl=enabled`, `-Dgbm=enabled`, + `-Dgallium-drivers=swrast,virgl,iris,crocus`, and adds + `-lwayland-client -lwayland-server -lwayland-egl -lwayland-drm` to LDFLAGS. + Depends on libdrm (with the 3 regenerated patches) + libwayland + + wayland-protocols. + +**Documentation tree cleanup:** + +- `local/docs/` trimmed from 45 files (+ 30 archived) to 18 canonical files + matching the PLANNING NOTES section of `local/AGENTS.md` +- 65 files deleted (stale assessments, superseded plans, empty stubs, the + entire `local/docs/archived/` folder, the 4 historical `docs/0*-*.md` + files, and `local/recipes/qt/qtbase/recipe.toml.bak`) +- 4 files restored from `archived/` to `local/docs/` (canonical per + `local/AGENTS.md` PLANNING NOTES) +- 22 unique broken cross-references fixed across 9 canonical docs +- `docs/README.md` fully rewritten as a clean canonical index; + `docs/AGENTS.md` reduced to the 3-doc canonical structure +- Net: βˆ’31,315 lines + +**Next concrete step for v6.0-impl3:** + +`repo cook mesa` end-to-end. All recipe + patch work is done; the build +verification is the next invocation. The plan's Phase 3 (Mesa EGL Wayland) is +recipe-complete; the next milestone is the cook itself. + --- ## P1: Phase 1 Unblockers β€” βœ… DONE (5/5) @@ -130,7 +202,7 @@ Per `local/AGENTS.md` "NO OVERLAY-STYLE PATCHES β€” SCOPED POLICY (AMENDED 2026) ## P6: GPU/Mesa/KDE Build Chain β€” assessment complete (8 chains identified) -The GPU/MESA/KDE assessment document is at `local/docs/GPU-MESA-KDE-CHAIN-ASSESSMENT.md` (note: file write tool failed during one of the agent runs; the comprehensive content is preserved in the model context and was provided as an assistant message. The file may need to be re-written by a subsequent session using heredoc.) +The GPU/MESA/KDE assessment document is at (note: file write tool failed during one of the agent runs; the comprehensive content is preserved in the model context and was provided as an assistant message. The file may need to be re-written by a subsequent session using heredoc.) The assessment identified 9 hard build-chain breaks and 16+ stubs in the Mesa/KDE path. Top priorities: - libdrm patches missing @@ -414,4 +486,4 @@ Cross-cutting: --- -**Document version:** v6.0, end-of-session 2026-06-09. Mesa, libdrm, PipeWire, WirePlumber Red Bear source forks were migrated to external patches (Rule 2) in June 2026; see `local/AGENTS.md` for the current policy. +**Document version:** v6.0-impl3, 2026-06-10. Mesa, libdrm, PipeWire, WirePlumber Red Bear source forks were migrated to external patches (Rule 2) in June 2026; see `local/AGENTS.md` for the current policy. v6.0-impl2 updates: the 5 libdrm patches (generated against the deleted fork) were regenerated as 3 byte-equivalent patches against fresh upstream libdrm 2.4.125; the `pkgconf` typo in `local/recipes/libs/libdrm/recipe.toml` was fixed; the recipe's broken `[source].script` no-op was moved to `[build].script` with `template = "custom"` so `cookbook_apply_patches` actually runs. Wayland re-enabling: 4 KF6 packages flipped to `WITH_WAYLAND=ON`, libxkbcommon flipped to `-Denable-wayland=true`, kded6 wrapper replaced with `Environment=QT_QPA_PLATFORM=offscreen` in the systemd service file. Doc tree trimmed from 75 files to 18 canonical in `local/docs/`. redbear-compositor extended with `zwp_linux_explicit_synchronization_v1` (Phase 3.4, no-tearing) and `wp_presentation` (Phase 3.3, vblank timing) β€” 3 files (+349/-10), 2 new integration tests pass. v6.0-impl3 update: attempted `repo cook mesa` end-to-end. Found and fixed 2 recipe `rev` mismatches (ninja-build, sddm). Discovered that the relibc-install cross-compile toolchain prefix is stale (pre-dates the `utimensat` commit) and that the relibc P3-*.patch carriers in `recipes/core/relibc/` are broken symlinks to a deleted `local/patches/relibc/` directory. Per the user's "relibc is our internal project. We work on it directly without patches" policy, added `getloadavg` directly to the relibc source as a Rule 1 in-tree fork (not a patch), deleted the 33 broken P3-*.patch symlinks, and refreshed the relibc-install prefix with the fresh libc. Mesa build now blocked by libpciaccess 0.19 which has no Redox backend (upstream `#error "Unsupported OS"`). diff --git a/local/docs/WIFI-IMPLEMENTATION-PLAN.md b/local/docs/WIFI-IMPLEMENTATION-PLAN.md index a6a00c2dac..ea1a30dbb8 100644 --- a/local/docs/WIFI-IMPLEMENTATION-PLAN.md +++ b/local/docs/WIFI-IMPLEMENTATION-PLAN.md @@ -241,15 +241,37 @@ path without treating it as raw Ethernet. Runtime validation pending. ### Phase W5 β€” Runtime Reporting and Recovery (After W4) > **Status note:** This Phase **W5** is not the same as the bounded `redbear-phase5-network-check` -> QEMU plumbing proof on `redbear-full`. W5 here remains a later real-hardware reporting/recovery -> milestone. +> QEMU plumbing proof on `redbear-full`. + +#### W5 build-side work (shipped 2026-06) + +- `redbear-wifictl` event journal: structured JSONL at `/scheme/wifictl/events.log` + with serial/timestamp_ns/interface/kind/data fields. 8 unit tests, all passing. +- `redbear-wifictl` WifiError taxonomy: 12 reason codes (`E_NO_DEVICE`, + `E_NO_FIRMWARE`, `E_FIRMWARE_LOAD`, `E_TRANSPORT_TIMEOUT`, `E_TRANSPORT_INIT`, + `E_AUTH_REJECTED`, `E_ASSOC_TIMEOUT`, `E_DHCP_FAILED`, `E_SIGNAL_LOST`, + `E_PROFILE_NOT_FOUND`, `E_INTERNAL`) with `is_recoverable()` / `is_fatal()` / + `is_auth_failure()` classifications. 8 unit tests, all passing. +- `redbear-wifictl` reconnect controller: exponential backoff (2/4/8/16/32/60s, + capped at 60s), max 5 attempts (env-tunable), per-interface auto-reconnect + flag settable via `/scheme/wifictl/ifaces//auto-reconnect`. + 14 unit tests + 3 scheme-level tests, all passing. +- `redbear-info` journal consumer: reads `/scheme/wifictl/events.log` and + surfaces last-event serial/kind/data, recent-events list (capped at 10), + and `wifi_journal_present` boolean. 4 new tests, all passing. + +**Exit criteria (build-side)**: Users and tooling can observe the full +state-transition history of any Wi-Fi interface through structured events. +Reconnect after disconnect, failure-state reporting, and bounded retry +are implemented. Hardware validation (Phase W4) still required for +end-to-end real-radio evidence. - Extend `redbear-info` with real Wi-Fi runtime evidence (not just bounded surfaces) - Reconnect after disconnect - Failure-state reporting and retry - `redbear-phase5-wifi-check/run/capture/analyze` validated against real hardware -**Exit criteria**: Users can see whether hardware is present, firmware is loaded, scans succeed, +**Exit criteria (full)**: Users can see whether hardware is present, firmware is loaded, scans succeed, and association has succeeded or failed β€” backed by real hardware evidence. ### Phase W6 β€” Desktop Compatibility (Later) @@ -257,6 +279,44 @@ and association has succeeded or failed β€” backed by real hardware evidence. - If KDE or desktop workflows require it, add a compatibility shim over the native Wi-Fi service - Keep the shim above the native control plane, not in place of it +#### W6#7 β€” netctl-console Wi-Fi tab (shipped 2026-06) + +A new top-level "Wi-Fi" tab has been added to the netctl-console ncurses TUI +(`local/recipes/system/redbear-netctl/redbear-netctl-console/`). The tab enumerates +`/scheme/wifictl/ifaces/`, displays current SSID, link state, last error, and the +last 5 events from the runtime event journal (`/scheme/wifictl/events.log`). +Outer tabs cycle with `]` and `[`; Tab/BackTab stays as inner-pane focus cycling +within the active tab. The tab is rendered in both the live ncurses path +(`main.rs`) and the ratatui path (`ui.rs`) for parity. 5 new tests, all passing +(15 total in netctl-console). + +#### D-Bus NetworkManager surface (deferred, 2026-06-10) + +**Decision**: Red Bear OS continues with the native `redbear-netctl` + +`redbear-wifictl` scheme control plane. The `org.freedesktop.NetworkManager` +D-Bus surface remains out of scope. + +The deferred D-Bus interface file at +`local/recipes/system/redbear-wifictl/source/src/dbus_nm.rs` now carries a +`DEFERRED` comment block documenting: + +- The five policy statements across `DBUS-INTEGRATION-PLAN.md` and this file + that say "Red Bear OS uses redbear-netctl, not NetworkManager". +- The 6 working zbus daemons (login1, UPower, UDisks2, PolicyKit1, + Notifications, StatusNotifierWatcher) cover every desktop D-Bus role + Red Bear actually needs *except* NetworkManager. +- The NM spec is ~4-5Γ— the surface of the largest existing redbear-* daemon + (login1) β€” would require Settings + Agent + NMSettingsConnection. +- Qt6's `QNetworkManagerNetworkInformationPlugin` is present in the qtbase + source tree but not built; Plasma's own QML bindings cover the desktop. + +The `register_nm_interface()` function still runs at daemon startup and +logs a truthful "D-Bus NetworkManager surface deferred" message; it +performs a compile-time type check of the zbus dependency under the +`dbus-nm` cargo feature. When Phase W6 is promoted to active status, +this file will become a real `#[interface(name = "org.freedesktop.NetworkManager")]` +impl following the `redbear-sessiond/manager.rs` pattern. + ### Phase W7 β€” Broader Hardware Reassessment (Later) - After one bounded Intel path is validated, reassess whether wider multi-family or deeper @@ -329,7 +389,7 @@ Current bounded extraction progress: from the shared substrate, which is the intended convergence direction for future GPU/Wi-Fi-only donor usage under `linux-kpi`. -The codebase has 119 tests passing (93 linux-kpi + 8 redbear-iwlwifi + 18 redbear-wifictl), no production `unwrap()` in the Wi-Fi daemon request loop (startup uses `expect()`), atomic command +The codebase has 201+ tests passing across the Wi-Fi subsystem (93 linux-kpi + 8 redbear-iwlwifi + 50 redbear-wifictl + 35 redbear-info + 15 redbear-netctl-console), no production `unwrap()` in the Wi-Fi daemon request loop (startup uses `expect()`), atomic command handling, proper timer cancellation, honest timeout reporting, and real 802.11 frame parsing. The structural skeleton is solid. The next required step is **real hardware validation** with an Intel Wi-Fi device β€” everything else is gated on that. diff --git a/local/recipes/system/redbear-wifictl/source/src/dbus_nm.rs b/local/recipes/system/redbear-wifictl/source/src/dbus_nm.rs index c44bca9cd4..8614d873b2 100644 --- a/local/recipes/system/redbear-wifictl/source/src/dbus_nm.rs +++ b/local/recipes/system/redbear-wifictl/source/src/dbus_nm.rs @@ -1,6 +1,42 @@ -// D-Bus org.freedesktop.NetworkManager interface -// Exposes Wi-Fi device list, access points, connection state -// Uses zbus for D-Bus communication +// D-Bus org.freedesktop.NetworkManager interface β€” DEFERRED +// +// Status (2026-06): This module is a deliberate deferral marker, not a stub. +// Red Bear OS uses the native `redbear-netctl` + `redbear-wifictl` scheme +// control plane for Wi-Fi. Per `local/docs/DBUS-INTEGRATION-PLAN.md` and +// `local/docs/WIFI-IMPLEMENTATION-PLAN.md` Phase W6, the +// `org.freedesktop.NetworkManager` D-Bus surface is out of scope. +// +// Why deferred: +// 1. Five policy statements across the docs say "Red Bear OS uses +// redbear-netctl, not NetworkManager". +// 2. NM spec is ~4-5Γ— the surface of the largest existing redbear-* +// D-Bus daemon (login1) β€” would require Settings + Agent + +// NMSettingsConnection, all out of phase-1 scope. +// 3. The 6 working zbus daemons (sessiond, upower, udisks, polkit, +// notifications, statusnotifierwatcher) cover every desktop D-Bus +// role Red Bear actually needs *except* NetworkManager. +// 4. The Qt6 NetworkManager plugin (qnetworkmanagernetworkinformationbackend) +// is present in the qtbase source tree but not built; the existing +// Plasma widgets work via Plasma's own QML bindings. +// +// What this file does today: +// - Provides compile-time type check of the zbus dependency under the +// `dbus-nm` cargo feature (so the dep stays in sync). +// - Logs a "registered" message at daemon startup. The message is +// truthful: it is the registration of a *placeholder* for the future +// D-Bus surface, not a fake claim that an interface is live. +// +// When to revive: Phase W6 of the Wi-Fi plan will be promoted from +// "(Later)" to an active phase. At that point this file becomes a real +// `#[interface(name = "org.freedesktop.NetworkManager")]` impl following +// the `redbear-sessiond/manager.rs` pattern (zbus 5, tokio, no async +// runtime needed in the daemon). The full surface required for KDE's +// network applet is roughly: +// - /org/freedesktop/NetworkManager (Manager interface) +// - /org/freedesktop/NetworkManager/Devices/N (Device.Wireless) +// - /org/freedesktop/NetworkManager/AccessPoint/... +// - /org/freedesktop/NetworkManager/Settings + Settings.Connection +// Until then, this file is a deferred design, not a fake implementation. #[derive(Clone, Debug, PartialEq, Eq)] pub struct NmWifiDevice { @@ -34,14 +70,14 @@ pub struct NmAccessPoint { pub frequency: u32, } -// Register D-Bus object path: /org/freedesktop/NetworkManager -// Properties: Devices, WirelessEnabled -// Methods: GetDevices, ActivateConnection, DeactivateConnection +/// Log the deferred registration. Does not register anything on the bus. pub fn register_nm_interface() { #[cfg(feature = "dbus-nm")] { let _ = std::any::type_name::(); } - log::info!("wifictl: D-Bus NetworkManager interface registered"); + log::info!( + "wifictl: D-Bus NetworkManager surface deferred β€” see local/docs/WIFI-IMPLEMENTATION-PLAN.md Phase W6" + ); }