GRI-174: Phase 0 renderer spike - image, video and web page in one GTK window #2
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!2
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-174-renderer-spike"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GRI-174: Phase 0 renderer spike — image, video and web page in one GTK window
Validates
plan/decisions/0007-gtk-gstreamer-and-wry-for-the-renderer.mdbefore Phase 1 is built on top of it. The roadmap puts this first because a red
spike would change Phase 1.
This pull request was first opened on GitHub as #2, where no CI run ever
started. It is re-opened here because the forge is now the only system of
record (GRI-365).
What is in it
An
ItemRenderertrait incrates/client/src/renderer.rs(widget()/show()/hide()), with one backend per item kind behind it, asplan/client/renderer.mddescribes:renderer/image.rsGtkImage, loaded throughGdkPixbuf, so a bad file is a reportedRenderErrorand not a blank widgetrenderer/video.rsGStreamerplaybinintogtksink, which returns a plainGtkWidgetrenderer/web.rswry(WebKitGTKon Linux) built into aGtkBoxwithWebViewBuilderExtUnix::build_gtkcrates/client/src/bin/renderer_spike.rsis the demonstration: one GTK windowwith a
GtkStack, swapping between all three on a timer. It generates its ownthrowaway image, video and HTML assets, so no binary fixtures are committed,
and prints a timing and
VmRSScheckpoint at each step.No
unsafe. ADR 0007 expected the renderer would need it for the Clibraries.
gtksinkhands back aGtkWidgetdirectly, so no raw window handlecrosses the GStreamer/GTK boundary and none was needed yet.
Also anchors
bin/to/bin/in.gitignore. It came unanchored from aleftover C#/.NET template section and was silently swallowing
crates/client/src/bin/, which is Cargo's own convention for extra binaries.Why the renderer is behind a Cargo feature
The whole stack sits behind a
gtk-rendererfeature, withrequired-featureson the spike binary. No CI runner has the GTK3, GStreamer or WebKitGTK
-devpackages, and nothing else in the codebase needs them yet, so
cargo build/clippy/test --workspace— what CI and the default gate run do —never reaches any of this.
To build and run it:
with
libgtk-3-dev,libgstreamer1.0-devplus-plugins-{base,good},libwebkit2gtk-4.1-devandgstreamer1.0-gtk3. If Phase 1 needs the stack atbuild time in general, that is a CI-configuration change and a separate issue.
What was observed
Run under Xvfb with no GPU or DRI access, so WebKit and any GL path fell back
to software rendering. Screenshots confirmed real pixels rather than only
"reached PLAYING":
GdkPixbuf::from_filepath.
videotestsrcthroughplaybinintogtksink, SMPTE colourbars visibly on screen.
<script>confirmed executing, then
https://example.com, including Arabicright-to-left, CJK and Cyrillic text rendering correctly.
What was measured
On an x86_64 developer machine, software rendering, no GPU. One full cycle:
~2.31 s user plus 0.48 s system CPU, peak RSS ~431 MB, steady state ~290 MB.
Per-step
VmRSSon a warm run:gtksink)WebKitGTKcontext)Widget construction is cheap once the libraries are warm, tens of milliseconds
each. The cost is WebKitGTK's one-time context and first navigation, and it is
memory rather than CPU.
This is not a Pi number. ~290 MB steady state with a ~430 MB transient peak
is a figure to carry into the Pi issue's budget, not a pass or a fail on its
own. The test board has 905 MiB of RAM.
The recommendation — ADR 0007's decision rule
Keep
WebKitGTKbehind theItemRenderertrait. It rendered a realexternal site correctly, including multi-language text, with no
unsafeand noexternal browser process, which is what the ADR expected of it. Nothing here
argues for moving URL items to CEF.
Provisional on one point: only one real external site was tried. A JS-heavy or
WebGL-heavy site that the target users actually need is worth a second check
before Phase 1 locks the choice in.
What this does not answer
that its firmware has H.265, VP8, VP9, MPEG-2 and VC-1 decode disabled, so
video must be H.264 or the measurement is a software-decode measurement.
plan/client/renderer.mdrequires X11,Wayland and
cageon real hardware. This spike covers X11 under Xvfb only.design, not only the renderer.
Gates
./scripts/local-gates.shpassed with exit 0 and no skips on this tree: githooks,
cargo fmt,cargo clippy --workspace --all-targets --locked -D warnings,cargo test(37 passed),cargo test --doc,cargo deny check bans licenses sources, and the front-end check and build.cargo deny advisoriesis CI's own job and does not block a merge, by ADR 0008.The gates do not compile the renderer itself, because it is behind the
gtk-rendererfeature. What they prove is that the branch breaks nothing CIbuilds today. What proves the renderer works is the Xvfb run above.