evidence · 6.8 KiB

vglite-wlroots-source-audit.md

Committed at docs/research/vglite-wlroots-source-audit.md. This is what grounds the requirements that cite it.

Open raw source

Opt-in VG-Lite compositor checkpoint

Date: 2026-09-23. This is a source and host contract checkpoint, not physical GPU, cache, scanout, interaction, or performance acceptance. The default shell still selects Pixman. The experiment must remain outside the default image.

Pinned interfaces and ownership

wlroots 0.20.2 defines renderer/texture/pass implementations in include/wlr/render/interface.h and operation fields in include/wlr/render/pass.h. types/scene/wlr_scene.c:1480-1578 supplies non-null regions, opacity/luminance pointers, default premultiplied blending, and default bilinear filtering even for unscaled opaque buffers. Its background at line 2577 excludes visible opaque scene regions. The renderer supports that ordinary full-redraw shape, as demonstrated by the host scene-region test.

The renderer locks only the output buffer passed by wlroots. It obtains dma-buf attributes and a real CPU mapping through that buffer’s API; it never opens DRM, becomes master, allocates a scanout buffer, modesets, or commits. The existing Sway/wlroots DRM backend remains responsible for all those operations. The mapping must match the dma-buf format and stride and remains held until GPU completion or lifetime quarantine. The SDK refuses vg_lite_map with both a NULL memory pointer and zero physical address even for its dma-buf flag.

Recording copies clips, opacity, luminance, and primaries. Each texture operation captures immutable RGBA pixels and a paired Pixman texture, so original textures can be updated/destroyed and caller options released before submit. Texture readback/allocation/region-copy failure fails the whole recorded pass; no prefix is submitted. No GPU command occurs while recording.

Current eligibility

Only WLR_RENDERER=vglite selects the fork. GPU submission additionally requires exactly K230_VGLITE_ALLOW_UNPROVEN_CACHE=1; other strings, including 0, retain full-pass Pixman replay. This flag acknowledges missing physical proof.

GPU failures after commands start fail submit and permanently disable GPU use in that process; they never start Pixman on the partially written target. The next pass uses Pixman. Every allocated GPU source stays alive through finish. If finish fails, target access/lock, GPU mappings and GPU allocations are quarantined for process lifetime: no free, unmap, close, or buffer reuse can race unproven completion. A process-global mutex serializes the vendor context, including multiple renderer instances.

Vendor cache and geometry audit

SDK pin: kendryte/k230_linux_sdk commit 1104236db4d1e47873bd68924f912747b820228c, under buildroot-overlay/package/vg_lite/:

Host proof and remaining gates

Run the behavior test with the pinned source paths:

WLROOTS_SOURCE=/path/to/pinned-wlroots-0.20.2 \
VGLITE_SOURCE=/path/to/pinned-sdk/buildroot-overlay/package/vg_lite \
  tools/test-vglite-renderer.sh
nix build .#shell-compositor-vglite --no-link --print-out-paths

The test compiles the actual renderer and pinned wlroots Pixman pass, uses real Pixman image operations as its reference, and injects an asynchronous mock VG API. It checks every output pixel plus padding, source/option lifetime, complete recording failures, import rejection, source allocation failure before/after GPU commands, command failures, failed finish quarantine, and following-pass Pixman recovery under ASan/UBSan. It does not emulate physical GPU rounding or caches. tools/test-vglite-fallback.py remains only a source wiring check.

Committed host evidence records exact commands, source artifacts, and output package. The OpenSpec tasks for physical RGBA/alpha correctness, cache ownership, live Sway scene use, fallback rates, scanout ownership, interaction and matched performance comparison remain open.