Commit Graph
16 Commits
Author SHA1 Message Date
Pierre Rouanet ae8130666d preinstall installs the GStreamer stack, which was always the plan
`setup-gstreamer.sh` has said so since it was written — "the download happens during provisioning
and, later, from the updater's preinstall hook, which runs with a cleared environment and no token",
which is why the plugins repository is public. The hook half was never written, so a board
provisioned before that script existed needed a command somebody remembered, and a board whose
plugins predate the version this release was built against failed with a missing element in a log.

The hook runs the release's own copy of the script rather than a second implementation of it. That
script owns the pinned plugins version, the Debian package list, the Rockchip MPP and RGA debs, the
udev rule for `/dev/mpp_service` and the encoder report — six things that would otherwise exist twice
and drift, which is the class of bug this repo keeps writing down. It is idempotent by design, so a
provisioned board pays a stamp comparison and two `dpkg -s` calls.

**Never fatal**, and that is the difference from the ONNX Runtime step above it. A release that
cannot load a policy is a robot that cannot stand, so that one aborts the update with the old release
still live. A board with no camera stack loses `mediad` and still walks, pairs and updates — refusing
the update over it would mean a board that cannot be fixed by the mechanism that fixes boards.

**The pre-install hook gets ten minutes instead of two.** It is the hook that installs what the
release needs and the board may not have, and on a board that has never had the media stack that is
around 100 MB of apt over whatever wifi the robot is on. It can afford the minutes precisely because
nothing has been swapped yet: the old release is still live and serving, so a long pre-install is a
slow update rather than a robot in an unclear state. The post-install hook keeps its two minutes,
where the same wait would sit between the swap and the restart.

Packaged at all three sites, with an xtask tripwire — `every_script_the_hooks_run_is_packaged` — for
the failure this would otherwise have: a script referenced and not packaged makes the step a no-op
that says so in a log nobody reads, on exactly the boards it exists for.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-25 17:22:40 +02:00
Pierre Rouanet f3e7876aac setup-gstreamer: pin v3, which can actually offer H.264
v1 predates both plugin patches. The second one matters more than it looks: mpph264enc's src pad
template omitted `constrained-baseline` from its profile list, which is the only profile
webrtcsink's codec discovery will accept, so H.264 was silently dropped from every offer and VP8
negotiated in its place.

The bring-up doc asked someone to read the SPS constraint flags off a real capture rather than
assume them. Done — h264parse reports `constrained-baseline`, so the stream was always right and
only the template denied it. Both closing paragraphs are replaced: the other one described
pre-encoding, which is no longer the shape, and said the encoder never reaches negotiation, which
is exactly the assumption that broke.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-25 11:30:49 +02:00
Pierre Rouanet 5022cdc986 setup-gstreamer: /dev/rga needs the group too
Same fault as the VPU node, one device over, and found the same way: a non-root
encoder that finds its element, starts, and then fails inside RGA —

  Try to use uninit rgaCtx=(nil)
  ... rga call blit fail

RkRgaInit cannot open /dev/rga, so mppenc has no 2D accelerator for format and
stride conversion. Only mpp_service was ever given a group, so this was waiting
for the first non-root pipeline.

One rule now covers both nodes, and the trigger and direct-apply fallback loop
over whichever exist — a kernel without one of them is not an error here.
Exercised against fixtures both ways: both nodes present, and rga absent.

That is twice now that the same class of bug has cost a round: a Rockchip
device node arriving root-only, with a failure that names something else
entirely. Anything mediad touches under /dev on this SoC is worth checking for
it up front rather than discovering it from a log.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 18:04:46 +02:00
Pierre Rouanet 84b412ef7f setup-gstreamer: install the plugins' own libraries, which it never did
A clean board found this and the development board could not have: the script
installed the plugins and not the libraries they link against.
libgstrockchipmpp.so needs librockchip_mpp.so.1 and librga.so.2, neither of
which is in Debian in any suite. Missing, the plugin fails to dlopen, GStreamer
skips it without a word, and mpph264enc simply does not exist.

The board this was developed against had both installed by hand during bring-up
hours earlier, so the gap was invisible there. Someone provisioning a fresh
board hit `no element "mpph264enc"` immediately.

Fetched from Radxa's pool at the versions the released plugins were built
against, before install_plugins rather than after — a plugin whose libraries are
absent is a plugin that silently does not register. A failed fetch warns rather
than dies, like the plugin download it sits beside.

The report also gains the check, because this presents *identically* to the
permission trap and the advice there would have misdirected: ldd the plugin and
grep "not found" first, and only then suspect the node.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 18:02:33 +02:00
Pierre Rouanet 0cd77c6531 setup-gstreamer: lead the verdict with what is true, not what is interesting
On a board where everything works, the report printed the entire
install-MPP-and-prove-the-VPU essay — because the verdict branched on
`/dev/mpp_service` existing rather than on `mpph264enc` being registered. A
report that hands setup instructions to a board that has already done the setup
is worse than one that says nothing: it reads as "something here is still
wrong".

So the branches are ordered by what is true. `mpph264enc` present is the first
one and it stays short: hardware encode is available, here is the one command
that proves it encodes rather than merely registers, and here are the four
properties that are decisions — profile, header-mode, rotation, bps — with the
two that need none, no B-frame knob and NV12 on the sink pad.

It also prints **which file** is answering. The distro package and this
script's plugin directory can both provide `rockchipmpp`, and which copy the
registry keeps is undefined, so a board that has both was reporting a result
nobody could attribute. Now it names the path and says how to remove the
duplicate.

The install-MPP advice moves to the branch where it is actually the answer —
node present, encoder absent — and leads with the thing that has now caused
four separate misleading results: suspect the node before the plugin, including
the `usermod -aG video` half that a udev rule alone does not cover.

The stale "the profile is not settled" note goes: it is settled, because the
element exposes it as an enum.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 17:12:58 +02:00
Pierre Rouanet 311147649e docs: Radxa's plugin is not decode-only — the permission was the whole story
Correcting a claim this page made and I repeated: `strings` on
gstreamer1.0-rockchip1_1.14-4's .so lists mpph264enc, mpph265enc, mppjpegenc
and mppvp8enc. Every encoder is in there. "1.14.4 predates the encoders" was
simply wrong.

The green CI build of our own plugin is what exposed it — it lists only
mppjpegdec and mppvideodec too, in a container that has no /dev/mpp_service.
Same output, same cause, and ours definitely contains the encoders because we
watched them compile.

So it is one cause behind four symptoms, and the page now says so as a table
rather than leaving each to be rediscovered: an MPP plugin registers its
decoders unconditionally and *probes MPP* before registering its encoders, so
at 0600 root:root they are silently omitted. mpi_enc_test writing nothing and
exiting 0, Radxa's deb looking decode-only, a third-party deb showing no
mpph264enc after a clean install, and our CI build listing two elements are all
the same fact. A plugin that lists only decoders is evidence about the device
node, not about the plugin.

This weakens the case for building our own, and the page should say what
survives rather than keep a reason that turned out to be false: no libx11-6,
since rkximage and kmssrc are disabled; a pin we control, recorded per release;
and a repository that has to exist for gst-plugins-rs anyway — which no archive
packages at all — so the MPP plugin riding along costs almost nothing.

The report in setup-gstreamer.sh loses its on-board build recipe, which now
lives in the other repository, and gains the one thing worth saying at that
point: if mpph264enc is missing, suspect the node before the plugin.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 16:52:29 +02:00
Pierre Rouanet d5f2314a8e scripts: fetch the plugins from a pinned public release, not a build
The board is the wrong place to compile: an RK3566 takes far too long on the
Rust half. So the build moved to a repository of its own,
pollen-robotics/microduck-gst-plugins, and this side just fetches it.

Not cross-compiled either, which is worth stating because it looks like the
obvious alternative. `ci-cross-deps.sh` says its one C dependency "is the cost
of that one exception, and it is worth reading before adding another" —
GStreamer would be a much larger second one, and x86 multiarch and a
sysroot-plus-meson-cross-file both link against an approximation of the target.
The new repo builds natively on an arm64 runner in a debian:trixie container,
which is the robot's own userland, and arm64 runners are free on public repos.

Public matters for a second reason: this download happens during provisioning
and, later, from the updater's preinstall hook — which runs with a cleared
environment and no token. Exactly the arrangement ONNX Runtime already relies
on.

Pinned, never "latest". Two provisioning runs a day apart producing different
plugins with nothing recording which is an unreproducible media bug waiting to
happen. The pin lives in [workspace.metadata.gst-plugins]; the script carries
the literal because it is fetched standalone with curl; and an xtask test
asserts they agree — the same arrangement and the same reason as ONNX_VERSION,
which exists because two copies of that version drifted and left a board with a
runtime its `ort` panics on.

Verifies the sha256 before unpacking, keeps the release's MANIFEST beside the
plugins so a board records which upstream commits it is running, and stamps the
installed version so a re-run costs nothing — this script is also what you run
to re-check the report after a kernel change. A failed download warns rather
than dies: the packages and the udev rule are already done and still valuable,
and the report will show the elements missing.

Deletes scripts/build-gst-rockchip.sh. One page owns a mechanism, and that
mechanism now lives in the other repository.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 16:05:46 +02:00
Pierre Rouanet ffc90af28f docs: the media bring-up findings, and give the VPU node a group
Everything the board said over the last few sessions, in
`docs/project/media-bringup.md` — a dated record next to `slice-2-bringup.md`
and `update-over-ble.md`, which is where "what the hardware actually did"
lives. Indexed in docs/README.md.

It separates measured from assumed, because most of what looked true here at
the start was not. The VPU encodes 720p H.264 and the bitstream decodes clean
as High/4.0; the encoder is reached through /dev/mpp_service and not V4L2, and
on a BSP kernel that is the expected shape rather than a fault; a plugin built
against GStreamer 1.14 registers fine in 1.26.2, so plugin ABI is not the risk
it was assumed to be. What has not been measured is stated as such: neither
plugin has been built, no camera is attached, and no pipeline exists.

It also answers a question the conversation kept blurring — there are **two**
plugins to build, for unrelated reasons. `gstreamer-rockchip` (meson, C) for
`mpph264enc`, because Debian ships no Rockchip encoder and Radxa's build
predates the encoders. `gst-plugin-webrtc` (cargo-c, Rust) for `webrtcsink`,
because gst-plugins-rs is packaged in no Debian suite. `webrtcbin` is already
installed and needs neither.

And the udev rule the permission finding calls for: `/dev/mpp_service` to group
`video` at 0660, so a non-root `mediad` can open the VPU at all. `video` rather
than `robot` because `robot` gates the sockets we define and a kernel device
node is not ours to redefine. In `setup-gstreamer.sh` rather than
`setup-board.sh` because this script already probes and reports that node, and
a board that skips GStreamer has no use for the rule. It verifies rather than
assumes — `udevadm --name-match` is not in every udev, so a node still
root-only afterwards gets the mode set directly. All three paths, plus a
missing rules directory, exercised against fixtures.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 15:38:21 +02:00
Pierre Rouanet 2ae261d18a scripts: the VPU's H.264 is sound — measured, not searched
The caution added one commit ago came from upstream reports rather than this
board, and this board contradicts it. What mpi_enc_test produced decodes clean
through avdec_h264: High profile, level 4, 4:2:0 8-bit, 1280x720 at 30 fps, no
errors, 60 frames in 0.29 s. So the "poor or invalid bitstreams on 6.1 kernels,
prefer mpph265enc" advice does not apply here, and H.264 stays — which is the
outcome to want, since H.265 has the worse browser reach for WebRTC.

Replaced with the thing that genuinely is unsettled and was hiding behind it:
the VPU emits **High** profile, while WebRTC's interoperable floor is
Constrained Baseline (profile-level-id 42e01f). Current browsers negotiate
High and older peers do not, so `mediad` has to set the profile deliberately
rather than inherit the encoder default. That is a pipeline decision, and
better recorded now than discovered against a peer that will not connect.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 15:33:11 +02:00
Pierre Rouanet 8f598e28dd scripts: Radxa's rockchip plugin is decode-only — say so, and name the build
Measured on a Zero 3W, and it is the opposite of the risk I expected.

gstreamer1.0-rockchip1_1.14-4 — with librga2, its other undeclared-here
dependency — installs and registers cleanly in GStreamer 1.26.2 and provides
exactly two elements: `mppvideodec` and `mppjpegdec`. No encoders. 1.14.4
simply predates them. So the report's "try the pool's plugin, it may load and
save you a build" was half right in the least useful way: it loads, and it
does not encode.

What it does prove is worth keeping: a plugin built against GStreamer 1.14
registers without complaint in 1.26.2, so plugin ABI is *not* the risk in a
source build. That was the stated reason to fear building this thing, and it
is now answered.

The encoders are in the live tree — gstmpph264enc.c, gstmpph265enc.c,
gstmppjpegenc.c, gstmppvp8enc.c under gst/rockchipmpp, meson-built, last
touched 2026-05-21. `rockchip-linux/gstreamer-rockchip` is gone (404);
JeffyCN/mirrors branch `gstreamer-rockchip` is the live mirror, so that is
what the report names, with the two -dev debs the build needs.

Two cautions recorded next to it: /dev/mpp_service needs a udev rule before a
non-root `mediad` can use any of this, and mpph264enc on 6.1 kernels has
upstream reports of poor or invalid bitstreams with mpph265enc suggested
instead — which is the worse codec for browser reach, so the bitstream wants
looking at before a pipeline is built on it.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 15:29:39 +02:00
Pierre Rouanet a82cfe8e55 scripts: the plugin step needs librga2, and say why dpkg -i resolves nothing
Third dependency chased one at a time: gstreamer1.0-rockchip1 depends on
librga2, Rockchip's 2D accelerator. Both deb sets in the report now name
their full closure, and say why they have to — these are direct .deb
downloads, not a configured apt source, so dpkg -i resolves nothing and a
missing dependency leaves an unconfigured package rather than an install
that repairs itself.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 15:24:52 +02:00
Pierre Rouanet 2168f7a745 scripts: report whether mediad can actually open the VPU, not just that it exists
Hardware H.264 is confirmed on a Radxa Zero 3W — `mpi_enc_test` wrote 428 KB
for 60 frames of 720p through Rockchip MPP, with librockchip-mpp1 /
librockchip-vpu0 / rockchip-mpp-demos 1.5.0-1 taken as plain debs from
Radxa's bullseye pool and configuring cleanly against glibc 2.41 on trixie.

The first attempt appeared to fail and did not: /dev/mpp_service arrives at
0600 root:root, and a non-root `mpi_enc_test` against it writes an empty file
and **exits 0**. No error, no log line — so a zero exit status is evidence of
nothing. That is the gap this commit closes: "present" and "usable by a
daemon" are different claims, and the report was only making the first.

It now prints the node's mode and owner, and says plainly when the group bit
leaves it root-only. That is the state that matters, because `mediad` will run
as its own user like every other daemon here — tofd rides in on `i2c`, padd on
`input`, btd on `bluetooth` — so the VPU needs the same treatment: a udev rule
giving the node a group, and `SupplementaryGroups=` on the unit. Both
permission states were exercised against fixtures.

The advice now says sudo, and says to check the file size rather than the exit
code.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 15:22:57 +02:00
Pierre Rouanet e3d3051f2a scripts: the MPP proof needs librockchip-vpu0 too
rockchip-mpp-demos depends on librockchip-vpu0 at exactly 1.5.0-1, so the
two-deb command in the report left it unconfigured and mpi_enc_test
unavailable. It is in the same pool; all three now go in one dpkg call.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 15:17:57 +02:00
Pierre Rouanet 0e569fca26 scripts: GStreamer on by default, and the MPP verdict names the proof
It ran on a Radxa Zero 3W: GStreamer 1.26.2 from plain Debian trixie,
`webrtcbin` registered, kernel `6.1.115-vendor-rk35xx`, no `v4l2h264enc`,
`/dev/mpp_service` present. That was the agreed trigger, so the
provisioning default flips to on, with `--no-gstreamer` /
`DUCK_GSTREAMER=0` as the opt-out. Empty is deliberately not off: empty is
what an unset environment looks like, and the default has to survive that.

The report was diagnostic where it could be actionable. Radxa's pool does
carry MPP — `librockchip-mpp1`, `-dev`, and `rockchip-mpp-demos` at 1.5.0-1
for arm64, plus `gstreamer1.0-rockchip1` — reachable by plain .deb
download, the same route `setup_rkaiq.sh` already uses on this board. So
the MPP branch now names two cheap tests in the right order: `mpi_enc_test`
from the demos package proves the VPU encodes with no GStreamer involved,
and the pool's own plugin is worth a `dpkg -i` before anyone builds one —
GStreamer keeps plugin ABI stable across 1.x, so a bullseye-era build may
load into 1.26 and make the source build unnecessary.

Two report fixes from reading the real output. "V4L2 devices: none" is
also exactly what an unattached camera looks like, so it said nothing about
whether a driver was missing; it now says so. And an absent `v4l2h264enc`
on a BSP kernel is the expected shape rather than a missing package, which
the verdict now states rather than leaving to be inferred.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 15:15:44 +02:00
Pierre Rouanet a7e0ef0eec scripts: record when the GStreamer default flips, and that the list shrinks
Two review decisions, put where the next person to touch this will read
them rather than in a thread.

The flip trigger was wrong: it said "when `mediad` ships", and the agreed
one is earlier — the moment this installs cleanly and reports correctly on
a real board. Waiting for `mediad` would leave every board provisioned in
between needing a bring-up step someone has to remember, which is the
failure the wiring exists to avoid.

The package list is a reasoned guess, not a measurement: it came from the
pipeline in `microduck_runtime/src/camera.rs` plus what `webrtcbin` needs
to negotiate, and there is no `mediad` yet to profile against it. Says so,
and says to re-read it and drop what nothing loads — every entry is disk
on a robot and a security update somebody has to care about.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 15:07:25 +02:00
Pierre Rouanet b44277a5ce scripts: a dedicated GStreamer install, and what the board can encode
`mediad` needs a GStreamer stack this board does not have — nothing is
installed today, and `apt-cache policy` shows the candidate coming from
plain Debian trixie at 1.26.2, so it is an apt install rather than a
source build.

Split from `setup-board.sh` for the reasons `migrate-network.sh` is:
different lifetime — around 100 MB of media stack that a board doing
walking work needs none of — and a different question. Half the value is
the report, which answers something nothing else on the board answers:
whether this kernel exposes hardware H.264, and through which element.
That decides whether `mediad` streams at a usable rate or cooks the CPU
`robotd`'s control loop shares, and it is worth asking repeatably rather
than once, by hand, in a bring-up nobody wrote down.

The probe paths are variables for the reason `CMDLINE` is one in
`setup-board.sh`: the interesting states are a board with no VPU node and
a board on the wrong kernel, which are the states you least want to find
the check wrong in. All three verdict branches were exercised against
fixtures.

Wired through `provision-board.sh --gstreamer` → `DUCK_GSTREAMER=1` →
`provision.sh`, off by default. The default is timing, not taste: until
`mediad` exists nothing uses a byte of it, and the wiring is the part
worth having early. Flip it when `mediad` ships.

Deliberately not installed: libcamera, whose mainline rkisp1 pipeline
handler does not drive the vendor rkisp this board's camera needs, and
`gstreamer1.0-plugins-rs`, which Debian packages in no suite — so
`webrtcsink` is built or shipped in the release payload, and the report
says so with the commands when it is missing.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 14:38:29 +02:00