redox-wayland-compositor/README.md

122 lines
5.1 KiB
Markdown
Raw Normal View History

Initial commit: phases 1-3 du portage Wayland Rust pour Redox OS Plan directeur 14 phases / 5 ans (REDOX_COSMIC_XWAYLAND_RS_PLAN.md). Phase 1 — Audit Redox (docs/existing-redox-gui.md, 486 lignes) : - Orbital, graphics-ipc (API DRM compatible Linux subset KMS), inputd, vesad - relibc support : AF_UNIX, SCM_RIGHTS, shm_open, mmap, poll - 3 manques identifiés : memfd_create, keymap XKB, AT-SPI Phase 2 — Validation primitives sur Redox via redoxer (5 tests + 1 POC) : - test-unix-socket : SOCK_STREAM Wayland-shaped roundtrip - test-fd-passing : SCM_RIGHTS mono-process (artefact kernel) - test-fd-passing-fork : SCM_RIGHTS multi-process (validation Wayland critique) - test-shm-open : shm_open + mmap + persistance + unlink - test-poll-multifd : poll() multiplexing + POLLHUP - poc-pixels : datapath shm + SCM_RIGHTS bout en bout (10000 pixels ARGB) Phase 3 — wayland-rs sur Redox (compile + runtime) : - wayland-{scanner,backend,server,client} compilent pour x86_64-unknown-redox sans patch upstream (rustix supporte Redox via libc backend) - test-handshake : server/client wl_registry handshake roundtrip - test-shm-pipeline : pipeline complet (ListeningSocket Unix réel + fd passing via wl_shm.create_pool + wl_shm_pool + wl_buffer + wl_surface + commit + serveur lit pixels via fd reçu, validation pixel-perfect) Verdict phase 3 : wayland-rs upstream est viable sur Redox out-of-the-box, le port "Wayland sur Redox" est désormais un problème de compositor à écrire, pas de stack à porter. Prérequis build : redoxer (pas cargo direct, car CMSG_NXTHDR/CMSG_DATA ne sont pas linkés autrement vers librelibc.a). Leyoda 2026 – GPLv3
2026-05-08 17:41:55 +02:00
# redox-wayland-compositor
Portage de Wayland sur Redox OS, en Rust pur, visant à terme à remplacer
Orbital comme serveur graphique de base.
**État** : phases 1+2+3 du plan directeur complétées le 2026-05-08.
Le pipeline shm Wayland complet est validé end-to-end sur Redox via redoxer
(crate `redox-wl-test-shm-pipeline`) : socket Unix réel, `wl_compositor` +
`wl_shm` globals, fd passing via SCM_RIGHTS, `wl_shm_pool` + `wl_buffer`,
`wl_surface.attach`/`damage`/`commit`, lecture pixels côté serveur via le
fd reçu — pixel-perfect.
## Structure
```
.
├── REDOX_COSMIC_XWAYLAND_RS_PLAN.md # plan directeur 14 phases / 5 ans
├── docs/
│ ├── existing-redox-gui.md # phase 1 : audit Orbital + graphics-ipc + inputd + relibc
│ └── redox-wayland-primitives.md # phase 2 : 5 primitives + POC pixels validés sur Redox
├── crates/
│ ├── redox-wl-test-unix-socket/ # primitive 1 : SOCK_STREAM Wayland-shaped
│ ├── redox-wl-test-fd-passing/ # primitive 2 : SCM_RIGHTS mono-process (artefact)
│ ├── redox-wl-test-fd-passing-fork/ # primitive 2b : SCM_RIGHTS via fork (vrai cas Wayland)
│ ├── redox-wl-test-shm-open/ # primitive 3 : shm_open + mmap MAP_SHARED
│ ├── redox-wl-test-poll-multifd/ # primitive 4 : poll() multiplexing + POLLHUP
│ ├── redox-wl-poc-pixels/ # POC : datapath shm + SCM_RIGHTS bout en bout
│ ├── redox-wl-test-handshake/ # phase 3 : wayland-rs server/client registry
│ ├── redox-wl-test-shm-pipeline/ # phase 3 : pipeline shm complet validé
│ └── redox-wl-test-display-backend/ # phase 4.1 : ouvre display Redox via inputd + V2GraphicsHandle
Initial commit: phases 1-3 du portage Wayland Rust pour Redox OS Plan directeur 14 phases / 5 ans (REDOX_COSMIC_XWAYLAND_RS_PLAN.md). Phase 1 — Audit Redox (docs/existing-redox-gui.md, 486 lignes) : - Orbital, graphics-ipc (API DRM compatible Linux subset KMS), inputd, vesad - relibc support : AF_UNIX, SCM_RIGHTS, shm_open, mmap, poll - 3 manques identifiés : memfd_create, keymap XKB, AT-SPI Phase 2 — Validation primitives sur Redox via redoxer (5 tests + 1 POC) : - test-unix-socket : SOCK_STREAM Wayland-shaped roundtrip - test-fd-passing : SCM_RIGHTS mono-process (artefact kernel) - test-fd-passing-fork : SCM_RIGHTS multi-process (validation Wayland critique) - test-shm-open : shm_open + mmap + persistance + unlink - test-poll-multifd : poll() multiplexing + POLLHUP - poc-pixels : datapath shm + SCM_RIGHTS bout en bout (10000 pixels ARGB) Phase 3 — wayland-rs sur Redox (compile + runtime) : - wayland-{scanner,backend,server,client} compilent pour x86_64-unknown-redox sans patch upstream (rustix supporte Redox via libc backend) - test-handshake : server/client wl_registry handshake roundtrip - test-shm-pipeline : pipeline complet (ListeningSocket Unix réel + fd passing via wl_shm.create_pool + wl_shm_pool + wl_buffer + wl_surface + commit + serveur lit pixels via fd reçu, validation pixel-perfect) Verdict phase 3 : wayland-rs upstream est viable sur Redox out-of-the-box, le port "Wayland sur Redox" est désormais un problème de compositor à écrire, pas de stack à porter. Prérequis build : redoxer (pas cargo direct, car CMSG_NXTHDR/CMSG_DATA ne sont pas linkés autrement vers librelibc.a). Leyoda 2026 – GPLv3
2026-05-08 17:41:55 +02:00
└── (pas de Cargo.toml racine : chaque crate est standalone — voir note ci-dessous)
```
> **Note structure** : pas de workspace Cargo racine. Chaque crate dans `crates/`
> est autonome avec son propre `Cargo.toml` et son propre `target/` lors de la build.
> Raison : `redoxer build`/`redoxer run` cherche le binaire dans `<crate>/target/...`
> et n'arrive pas à le retrouver si le `target/` est centralisé au niveau workspace.
> Ce sera repensé quand on aura un compositor unique vs plusieurs binaires de tests.
## Prérequis
- Rust nightly (récent — testé 2026-05-07)
- Target installé : `rustup target add x86_64-unknown-redox --toolchain nightly`
- `cargo install redoxer` puis `redoxer install` (sysroot Redox ~456 Mo)
- Repo upstream `Smithay/wayland-rs` cloné en `../wayland-rs/` (paths relatifs depuis `crates/*/Cargo.toml`)
## Reproduire les tests
Chaque crate s'exécute via redoxer (mini-VM Redox sous QEMU) :
```bash
cd crates/redox-wl-test-shm-pipeline
redoxer run --release
```
Pattern attendu en fin d'exécution : `[test-XX] PASS: ...`.
> **Important** : utiliser `redoxer build` ou `redoxer run`, **pas** `cargo build --target=x86_64-unknown-redox` direct
> qui fait un fail au link (`undefined reference CMSG_NXTHDR/CMSG_DATA`) parce que le linker host
> ne sait pas chaîner librelibc.a du sysroot Redox. `redoxer` configure le linker correctement.
## Tests qui exigent un vrai framebuffer
Les binaires qui touchent au display (à partir de `redox-wl-test-display-backend`)
ne tourneront pas sous `redoxer run` standard car celui-ci est headless.
Deux voies pour les exécuter :
### Voie A — `redoxer exec --gui` (mini-VM interactive)
```bash
cd crates/redox-wl-test-display-backend
redoxer build --release
redoxer exec --gui target/x86_64-unknown-redox/release/redox-wl-test-display-backend
```
Ouvre une fenêtre QEMU, boote une mini-VM Redox avec framebuffer, lance le binaire.
À fermer manuellement quand le test est fini.
### Voie B — Image complète + `make qemu`
Pousser le binaire dans une image Redox bootable via redoxfs-fuse, puis booter
en mode interactif. Étapes :
```bash
# 1. Monter l'image (redoxfs reste en foreground tant que monté)
mkdir -p /tmp/redox-mnt
~/Projets/Redox/redox-src/build/fstools/bin/redoxfs \
~/Projets/Redox/redox-src/build/x86_64/desktop/harddrive.img \
/tmp/redox-mnt &
sleep 2
# 2. Copier le binaire dans /usr/bin de l'image
cp ~/Projets/Redox/redox-wayland-compositor/crates/redox-wl-test-display-backend/target/x86_64-unknown-redox/release/redox-wl-test-display-backend \
/tmp/redox-mnt/usr/bin/
# 3. Démonter
fusermount -u /tmp/redox-mnt
rmdir /tmp/redox-mnt
# 4. Booter (avec clavier FR si besoin, voir hook QEMU_USER_FLAGS dans mk/qemu.mk)
cd ~/Projets/Redox/redox-src
make qemu audio=no QEMU_USER_FLAGS="-k fr"
```
Une fois Redox bootée :
- **Ctrl+Alt+F2** pour basculer sur le **VT 2 (console texte)**, sans Orbital
- Login : `root` / mot de passe `password`
- Lancer : `redox-wl-test-display-backend`
> Le binaire écrit aussi sur `/scheme/debug` (serial), donc même si tu lances
> depuis Orbital (VT 3) la sortie sera visible côté host dans le terminal qui
> a lancé `make qemu`.
Initial commit: phases 1-3 du portage Wayland Rust pour Redox OS Plan directeur 14 phases / 5 ans (REDOX_COSMIC_XWAYLAND_RS_PLAN.md). Phase 1 — Audit Redox (docs/existing-redox-gui.md, 486 lignes) : - Orbital, graphics-ipc (API DRM compatible Linux subset KMS), inputd, vesad - relibc support : AF_UNIX, SCM_RIGHTS, shm_open, mmap, poll - 3 manques identifiés : memfd_create, keymap XKB, AT-SPI Phase 2 — Validation primitives sur Redox via redoxer (5 tests + 1 POC) : - test-unix-socket : SOCK_STREAM Wayland-shaped roundtrip - test-fd-passing : SCM_RIGHTS mono-process (artefact kernel) - test-fd-passing-fork : SCM_RIGHTS multi-process (validation Wayland critique) - test-shm-open : shm_open + mmap + persistance + unlink - test-poll-multifd : poll() multiplexing + POLLHUP - poc-pixels : datapath shm + SCM_RIGHTS bout en bout (10000 pixels ARGB) Phase 3 — wayland-rs sur Redox (compile + runtime) : - wayland-{scanner,backend,server,client} compilent pour x86_64-unknown-redox sans patch upstream (rustix supporte Redox via libc backend) - test-handshake : server/client wl_registry handshake roundtrip - test-shm-pipeline : pipeline complet (ListeningSocket Unix réel + fd passing via wl_shm.create_pool + wl_shm_pool + wl_buffer + wl_surface + commit + serveur lit pixels via fd reçu, validation pixel-perfect) Verdict phase 3 : wayland-rs upstream est viable sur Redox out-of-the-box, le port "Wayland sur Redox" est désormais un problème de compositor à écrire, pas de stack à porter. Prérequis build : redoxer (pas cargo direct, car CMSG_NXTHDR/CMSG_DATA ne sont pas linkés autrement vers librelibc.a). Leyoda 2026 – GPLv3
2026-05-08 17:41:55 +02:00
## Roadmap
Voir `REDOX_COSMIC_XWAYLAND_RS_PLAN.md` pour le plan complet 14 phases / 5 ans.
Prochaine étape : **phase 4 — display backend Redox via `graphics-ipc::V2GraphicsHandle`**.
## Licence
Leyoda 2026 — GPLv3+