Galaxy Shell / docs
Docs / Interface e recursos

wgpu renderer probe (phase 0)

experiments/wgpu-renderer-probe/README.md · Editar no GitHub ↗

Esta página ainda não tem tradução em português. O conteúdo abaixo está em inglês.

Nesta página

wgpu renderer probe (phase 0)

History (2026-11-10). This probe builds only up to commit d785cce8. Step 2 of openspec/changes/archive/2026-11-10-gles-removal-plan/design.md removed the effects bridge native/wgpu-bridge (galaxy-wgpu-bridge), which Cargo.toml and Cargo.lock here still name by path; the path no longer exists and no stub replaces it. The renderer it probed is native/wgpu-renderer now. Check out d785cce8 to build or run it. Nothing below was rewritten.

A throwaway experiment, not product code. It answers one question for this machine: can a WgpuRenderer that implements Smithay's renderer traits get scanout-capable render targets and sample client dma-bufs, and through which wgpu backend (Vulkan, GL or a mix)? It is the phase 0 of the plan in openspec/changes/wgpu-renderer-plan/design.md.

Pinned: wgpu and wgpu-hal 30.0.1 (Vulkan and GL), ash 0.38.0, Smithay 0.7.0 (GBM, EGL, GLES), gbm 0.18.0 through Smithay, Rust 1.93. It reuses native/wgpu-bridge (galaxy-wgpu-bridge) for the Vulkan device on the EGL render node and for the exported linear buffer. The lockfile was derived from experiments/portability-probe/Cargo.lock and is committed-style.

Safety

  • Headless only: the EGL device platform (surfaceless) and GBM on the render node (/dev/dri/renderD*). It refuses any other node. Each child records the /dev/dri fds it holds (dri_fds).
  • No DRM master, no modeset, no drmModeAddFB2, no scanout. SCANOUT is only a GBM usage flag here, so scanout itself stays untested.
  • No compositor, no core, no host and no pixels of the live session. The only pixels are a synthetic pattern.
  • The binary refuses to start when DISPLAY, WAYLAND_DISPLAY, AGENT_NATIVE_* or ANOS_* is set. Run it with a clean environment.
  • Reports and logs stay local, outside Git, for example under ~/.codex/artifacts/qa/galaxy-shell/YYYY-MM-DD-wgpu-renderer-probe/.

Run

From the checkout, with a clean environment:

env -i HOME="$HOME" PATH="$PATH" \
  cargo run --release --locked --manifest-path experiments/wgpu-renderer-probe/Cargo.toml -- \
  --output "$HOME/.codex/artifacts/qa/galaxy-shell/2026-11-09-wgpu-renderer-probe/report.json" \
  2> "$HOME/.codex/artifacts/qa/galaxy-shell/2026-11-09-wgpu-renderer-probe/probe.log"
python3 experiments/wgpu-renderer-probe/summarize.py <report.json>

The output must be a new file. --only v1a,g runs a subset. Each test group runs in its own child process (180 s timeout), so a driver crash fails only that group and shows up in child_exit.

What it does

The pattern is rgba(x & 255, y & 255, ((7x) ^ (3y)) & 255, 255) in ARGB8888 (Vulkan B8G8R8A8_UNORM, wgpu Bgra8Unorm). It changes on every pixel, so a wrong tiling, stride, channel order or row order gives mismatched pixels. Each check reports exact, the mismatch count, whether a vertical flip would match, and the first mismatch. Sizes are 256x256 and 301x203 (an odd width, so pitch padding matters).

Group Test
v1a GBM bo SCANOUT|RENDERING (implicit modifier) imported into Vulkan as VkImage (OPTIMAL and LINEAR, dedicated allocation, VkImportMemoryFdInfoKHR); wgpu renders the pattern through create_texture_from_hal; release to QUEUE_FAMILY_FOREIGN with an exported SYNC_FD; EGL server wait, then GL readback and gbm_bo_map. A raw byte view (VkBuffer import) tells whether the bo memory is linear.
v1b Same with SCANOUT|RENDERING|LINEAR.
v1c Vulkan-allocated exportable storage: the bridge's linear VkBuffer, and exportable LINEAR and OPTIMAL VkImage; exported as dma-buf, imported with gbm_bo_import(FD, SCANOUT|RENDERING) (falls back to RENDERING to separate the cause), read back through GL and the GBM import.
v2 Client-like bos (RENDERING, RENDERING|LINEAR) written by GL through EGLImage + FBO; Vulkan imports them as OPTIMAL and LINEAR images (and as a VkBuffer), acquires from FOREIGN after waiting the EGL native fence, and samples them with a WGSL textureLoad pass and a wgpu copy. NV12 only records whether GBM can allocate it.
g G1 wgpu_hal::gles::Adapter::new_external on Smithay's EGL context and a WGSL pass; G2 client bo through Smithay import_dmabuf wrapped with texture_from_raw and sampled in WGSL; G3 scanout bo as a render target through glEGLImageTargetRenderbufferStorageOES + texture_from_raw_renderbuffer, and through an EGLImage texture; G4 interleaving with Smithay on one context plus a GL state audit.

V3 (SYNC_FD) is covered inside v1 and v2: vk_sync_fd_pending_at_export and gl_fence_pending_at_export say whether the fence was still unsignaled when it was handed over (so the consumer had to wait), and the readback after the wait is the content check. Passing checks are evidence on this driver, not proof of correct synchronization in general.

summarize.py prints a compact view of a report.