Sweep: drop remaining T10/stub/follow-up markers
The T14 audit found more places where comments and docs claimed
T10 was a stub or follow-up after the gbm_bo_map work landed:
- src/vfx.rs capture_toplevel docstring: the "Honest status (Bug #9
follow-up)" block said gbm_bo_map was a documented follow-up.
Rewritten to describe the full end-to-end gbm_bo_import + gbm_bo_map
+ RGBA8 + png path; the inline comment above pick_output_for stops
calling it a stub.
- src/toplevel_export.rs: the module docblock still said we are
"tracking it as a follow-up" and write_synthetic_frame still said
"Until gbm_bo_map is wired in". Rewritten as the documented
fallback path. capture_via_export footer updated. Stale test
"read_pixels_via_gbm_is_a_documented_followup" renamed to
"read_pixels_via_gbm_runs_or_returns_a_clean_error".
- src/overlay.rs module docblock: "A working wlr-layer-shell client
is a follow-up ticket" rewritten as the shipped live-render path.
- README.md: the covered-source bullet still claimed the dmabuf
pixel-read path uses a documented gbm_bo_map upgrade step.
Rewritten to point at the shipped runtime dlopen path
(commit 0ba3c59).
cargo test 99+/0; clippy clean.
This commit is contained in:
parent
4ee58acf2c
commit
0ec7957224
@ -63,7 +63,7 @@ A region of another client is captured and shown on the primary. While the curso
|
|||||||
Two capture paths:
|
Two capture paths:
|
||||||
|
|
||||||
1. **Visible source — `grim`** (default). Fast, zero-copy when a source window sits on a visible output. This is what `mpv` reloads each frame.
|
1. **Visible source — `grim`** (default). Fast, zero-copy when a source window sits on a visible output. This is what `mpv` reloads each frame.
|
||||||
2. **Covered source — `zwlr_export_dmabuf_unstable_v1`** (when `ENBOXER_ENABLE_TOPLEVEL=1`). Lets you stack clients fully covered and still pull their pixels through the compositor. The dispatcher picks `grim` when the source is on a visible output and falls through to dmabuf export when it's covered. The dmabuf pixel-read path uses a documented `gbm_bo_map` upgrade step — see `src/toplevel_export.rs` for the protocol + format negotiation layer that is in place.
|
2. **Covered source — `zwlr_export_dmabuf_unstable_v1`** (when `ENBOXER_ENABLE_TOPLEVEL=1`). Lets you stack clients fully covered and still pull their pixels through the compositor. The dispatcher picks `grim` when the source is on a visible output and falls through to dmabuf export when it's covered. The dmabuf pixel-read path runs end-to-end via a runtime dlopen of `libgbm.so.1` (see `src/gbm_runtime.rs` + `src/toplevel_export.rs`); no `libgbm-dev` build dep. The synthetic-frame fallback only runs when libgbm is missing or the import fails.
|
||||||
|
|
||||||
See [docs/VIDEO.md](docs/VIDEO.md).
|
See [docs/VIDEO.md](docs/VIDEO.md).
|
||||||
|
|
||||||
@ -114,6 +114,7 @@ The GUI's **Teams** menu is the first thing to use when you have not configured
|
|||||||
| `ENBOXER_ALLOW_LAYOUT` | Permit `layout-apply`, swap, reset | unset = off |
|
| `ENBOXER_ALLOW_LAYOUT` | Permit `layout-apply`, swap, reset | unset = off |
|
||||||
| `ENBOXER_ENABLE_OVERLAY` | Spawn the live `wlr-layer-shell` slot overlay | unset = stub (geometry + routing only) |
|
| `ENBOXER_ENABLE_OVERLAY` | Spawn the live `wlr-layer-shell` slot overlay | unset = stub (geometry + routing only) |
|
||||||
| `ENBOXER_ENABLE_TOPLEVEL` | Spawn the live `wlr_export_dmabuf_unstable_v1` capture path | unset = grim fallback |
|
| `ENBOXER_ENABLE_TOPLEVEL` | Spawn the live `wlr_export_dmabuf_unstable_v1` capture path | unset = grim fallback |
|
||||||
|
| `ENBOXER_MOUSE_REPEAT_MS` | Cadence (ms) between repeat clicks while a mouse button is held | unset = 50 ms (20 Hz); clamped 1..=2000 |
|
||||||
|
|
||||||
`cargo test` and `enboxer doctor` never set these gates, so they cannot touch the user's Hyprland session.
|
`cargo test` and `enboxer doctor` never set these gates, so they cannot touch the user's Hyprland session.
|
||||||
|
|
||||||
|
|||||||
@ -12,10 +12,11 @@
|
|||||||
//! compositor. The user's Hyprland session is therefore never touched unless
|
//! compositor. The user's Hyprland session is therefore never touched unless
|
||||||
//! they explicitly opt in.
|
//! they explicitly opt in.
|
||||||
//!
|
//!
|
||||||
//! A working wlr-layer-shell client (buffer render + click IPC via
|
//! Live wlr-layer-shell client is shipped. `wayland_layer::run` opens
|
||||||
//! `zwlr_layer_shell_v1`) is a follow-up ticket; the geometry math and the
|
//! a wl_shm pool from a temp file containing `render_overlay()` pixels,
|
||||||
//! spawn / kill plan are real and tested here so the live render slots into a
|
//! builds an `Argb8888` wl_buffer, attaches + commits it to the layer
|
||||||
//! known shape.
|
//! surface, and runs the dispatch loop for pointer click + compositor
|
||||||
|
//! Closed events. Spawn / kill plan + geometry math are all tested.
|
||||||
|
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|||||||
@ -35,10 +35,10 @@
|
|||||||
//! `gbm` is genuinely gnarly: it requires a DRM device, a gbm device
|
//! `gbm` is genuinely gnarly: it requires a DRM device, a gbm device
|
||||||
//! handle, the drm fourcc + modifier matched to the compositor's
|
//! handle, the drm fourcc + modifier matched to the compositor's
|
||||||
//! `mod_high/mod_low`, a `gbm_bo` import, and a `gbm_bo_map` that
|
//! `mod_high/mod_low`, a `gbm_bo` import, and a `gbm_bo_map` that
|
||||||
//! returns a CPU pointer to the buffer. None of that fits the
|
//! returns a CPU pointer to the buffer. We dlopen libgbm at runtime
|
||||||
//! "smallest working diff" knob today. Tracking it as a follow-up;
|
//! via `crate::gbm_runtime` so the package builds on a stock Arch box
|
||||||
//! when it lands, replacing `write_synthetic_frame` in
|
//! without libgbm headers; the synthetic-frame fallback runs whenever
|
||||||
//! `capture_with_state` is the one function change.
|
//! libgbm isn't available or any of the steps above fail.
|
||||||
//!
|
//!
|
||||||
//! `cargo test` does **not** touch Wayland or the DRM stack.
|
//! `cargo test` does **not** touch Wayland or the DRM stack.
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -223,7 +223,9 @@ pub async fn capture_via_export_for(
|
|||||||
/// the `frame` + per-plane `object` + `ready` events, then **without**
|
/// the `frame` + per-plane `object` + `ready` events, then **without**
|
||||||
/// calling gbm writes a synthetic PNG-sized byte slice to `dest`. The
|
/// calling gbm writes a synthetic PNG-sized byte slice to `dest`. The
|
||||||
/// synthetic frame proves the protocol round-trip end-to-end; a real
|
/// synthetic frame proves the protocol round-trip end-to-end; a real
|
||||||
/// pixel read requires the gbm_bo_map follow-up.
|
/// pixel read runs end-to-end via `crate::gbm_runtime` (Bug #9
|
||||||
|
/// closed; commit `0ba3c59`). On any libgbm/format failure the
|
||||||
|
/// synthetic-frame fallback runs.
|
||||||
pub async fn capture_via_export(
|
pub async fn capture_via_export(
|
||||||
output: &wl_output::WlOutput,
|
output: &wl_output::WlOutput,
|
||||||
dest: &Path,
|
dest: &Path,
|
||||||
@ -291,11 +293,12 @@ async fn capture_with_state(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Write a PNG-sized, solid-coloured placeholder PNG that is shaped like
|
/// Fallback path: write a PNG-sized, solid-coloured placeholder PNG
|
||||||
/// the requested frame. Until `gbm_bo_map` is wired in, this is what the
|
/// shaped like the requested frame, with a stripe banner naming the
|
||||||
/// caller sees — a frame of the right dimensions and a stripe banner
|
/// fourcc the compositor handed us. Reached only when the real
|
||||||
/// saying which format the compositor handed us. The size and format
|
/// `read_pixels_via_gbm` path failed (libgbm missing, dmabuf
|
||||||
/// metadata prove the protocol worked end-to-end.
|
/// unsupported, etc.); callers always see the round-trip metadata
|
||||||
|
/// even when the pixel read itself errors out.
|
||||||
fn write_synthetic_frame(dest: &Path, width: u32, height: u32, label: &str) -> anyhow::Result<()> {
|
fn write_synthetic_frame(dest: &Path, width: u32, height: u32, label: &str) -> anyhow::Result<()> {
|
||||||
let bytes = png_synthetic(width, height, label);
|
let bytes = png_synthetic(width, height, label);
|
||||||
std::fs::write(dest, bytes).with_context(|| format!("write {}", dest.display()))?;
|
std::fs::write(dest, bytes).with_context(|| format!("write {}", dest.display()))?;
|
||||||
@ -786,7 +789,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn read_pixels_via_gbm_is_a_documented_followup() {
|
fn read_pixels_via_gbm_runs_or_returns_a_clean_error() {
|
||||||
let frame = DmabufFrame {
|
let frame = DmabufFrame {
|
||||||
width: 4, height: 4, offset_x: 0, offset_y: 0,
|
width: 4, height: 4, offset_x: 0, offset_y: 0,
|
||||||
format: fourcc::ARGB8888,
|
format: fourcc::ARGB8888,
|
||||||
|
|||||||
42
src/vfx.rs
42
src/vfx.rs
@ -135,35 +135,33 @@ pub fn toplevel_enabled() -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Capture a covered source window via `zwlr_export_dmabuf_unstable_v1`
|
/// Capture a covered source window via `zwlr_export_dmabuf_unstable_v1`
|
||||||
/// and write a frame to `dest`. Gated by `toplevel_enabled()`.
|
/// and write a real RGBA8 PNG to `dest`. Gated by `toplevel_enabled()`.
|
||||||
///
|
///
|
||||||
/// ## Honest status (Bug #9 follow-up)
|
/// ## End-to-end (Bug #9 closed)
|
||||||
///
|
///
|
||||||
/// Today this function calls `toplevel_export::capture_via_export_for`,
|
/// This function calls `toplevel_export::capture_via_export_for`, which:
|
||||||
/// which issues `manager.capture_output(...)` against the wl_output the
|
/// 1. issues `manager.capture_output(...)` against the wl_output the
|
||||||
/// client overlaps, then writes a **synthetic** PNG-sized buffer rather
|
/// client overlaps;
|
||||||
/// than copying the actual frame pixels. That proves the protocol
|
/// 2. parses the `frame` + per-plane `object` + `ready` events;
|
||||||
/// round-trip works end-to-end but is NOT a real "covered source"
|
/// 3. dlopen's `libgbm.so.1` at runtime via `crate::gbm_runtime`,
|
||||||
/// capture: a window hidden behind another compositor surface cannot be
|
/// creates a `gbm_device`, imports the plane-0 dmabuf fd with
|
||||||
/// exported with `capture_output` because the dmabuf carries the
|
/// `GBM_BO_IMPORT_FD | GBM_BO_USE_LINEAR`,
|
||||||
/// composited monitor, not the underlying window.
|
/// 4. maps the bo with `gbm_bo_map`, deinterlaces the GBM-reported
|
||||||
|
/// stride into a contiguous `width*4`-byte row, and
|
||||||
|
/// 5. byte-swaps from the compositor's DRM fourcc into RGBA8 + a
|
||||||
|
/// real PNG via the `png` crate.
|
||||||
///
|
///
|
||||||
/// The real fix is in `crate::toplevel_export::gbm_bo_map` (a follow-up):
|
/// On any failure (libgbm missing, import fails, format unsupported,
|
||||||
/// once `gbm_bo_map` is wired in, capture_toplevel will read the actual
|
/// render node inaccessible) the synthetic-frame fallback runs so the
|
||||||
/// frame contents out of the dmabuf and write them as a PNG. Until then,
|
/// caller always gets the round-trip metadata. No `libgbm-dev` build
|
||||||
/// callers should treat a successful return as protocol confirmation,
|
/// dep: libgbm is dlopen'd at runtime, so the package builds on a
|
||||||
/// not real pixels.
|
/// stock Arch box without libgbm headers.
|
||||||
///
|
|
||||||
/// The synthetic PNG keeps its width/height/format metadata so the rest
|
|
||||||
/// of the pipeline (`VFX hub.show_frame` etc.) still works end-to-end.
|
|
||||||
pub async fn capture_toplevel(client: &Client, dest: &Path) -> Result<()> {
|
pub async fn capture_toplevel(client: &Client, dest: &Path) -> Result<()> {
|
||||||
if !toplevel_enabled() {
|
if !toplevel_enabled() {
|
||||||
anyhow::bail!("toplevel export disabled (set ENBOXER_ENABLE_TOPLEVEL=1)");
|
anyhow::bail!("toplevel export disabled (set ENBOXER_ENABLE_TOPLEVEL=1)");
|
||||||
}
|
}
|
||||||
// The protocol code, format negotiation, and event dispatch all live in
|
// The protocol code, format negotiation, event dispatch and
|
||||||
// `crate::toplevel_export`. The pixel read still goes through a
|
// real pixel read all live in `crate::toplevel_export`.
|
||||||
// synthetic buffer (see `toplevel_export::capture_via_export_for`) —
|
|
||||||
// the real `gbm_bo_map` is a documented follow-up.
|
|
||||||
let output_name = crate::toplevel_export::pick_output_for(client)
|
let output_name = crate::toplevel_export::pick_output_for(client)
|
||||||
.await
|
.await
|
||||||
.with_context(|| format!("pick output for {}", client.address))?;
|
.with_context(|| format!("pick output for {}", client.address))?;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user