Skip to content

ALI-2358 prototype: a jailed GPU helper that hands frames over as dmabufs - #2

Merged
michaelaguiar merged 26 commits into
mainfrom
ali-2358-gpu-helper
Dec 2, 2026
Merged

michaelaguiar merged 26 commits into
mainfrom
ali-2358-gpu-helper

Conversation

@michaelaguiar

@michaelaguiar michaelaguiar commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Linear: ALI-2358. Based on main (#1 is merged).

This is a prototype, not for merging as it is. It tests the render path Mike chose on 2026-12-02: a jailed helper draws on the GPU and passes dmabufs to the app over linux-dmabuf.

What it does

  • gpu: EGL on GBM, with no window, on the compositor's render node. It allocates XRGB8888 buffers in layouts OpenGL can draw into (from eglQueryDmaBufModifiersEXT, intersected with the compositor's list when one is given). It imports them as EGL images with framebuffers on them, and can read a dmabuf back for checks.
  • gpu_helper: the player, which uses libmpv's OpenGL renderer.
    • It draws each frame into one of 3 buffers, finishes it, and sends the buffer's number over a SOCK_SEQPACKET socket.
    • A buffer's dmabuf travels once, with its buffer message. The app gives buffers back with release.
    • Hardware decoding gets the render node (VA-API, through MPV_RENDER_PARAM_DRM_DISPLAY_V2) or CUDA (NVDEC).
  • jail::gpu_arguments: the usual jail plus /dev/dri, NVIDIA's device files, and /sys. On NVIDIA it also adds /proc, because CUDA won't start without it.
  • No user namespaces inside the jail: the helper's seccomp filter refuses clone with any CLONE_NEW* flag, gives ENOSYS for clone3 (libc then uses clone, as under Flatpak), and refuses unshare, setns, mount, umount2, pivot_root and x32 calls. bubblewrap's --disable-userns isn't used: it writes /proc/sys, which is read-only in an LXC container, so the jail wouldn't start in one. A test runs the test program inside the jail and checks that unshare --user, clone(CLONE_NEWUSER) and clone3 are refused.
  • VA-API gets its own descriptor: the helper opens the card's node again for libmpv's VA-API, so Mesa and iHD don't share one GEM handle table. Sharing one broke Intel decoding (see below).
  • Software fallback: if hardware decoding ends a file more than a second short of its length, the helper sets hwdec=no and plays on from where the picture stopped.
  • Warm start (prototype): gpu_helper::start_warm starts the helper before a file is chosen, and gpu_helper::load gives it the file later.
  • jail::forbid_writes_outside: Landlock rules so the helper can open files for writing only under /dev. That keeps /proc/self/mem closed for writing, which is the reason the jail normally leaves /proc out. A test checks it.
  • examples/gpu-play: plays through the helper with no compositor.
  • examples/gpu-show: shows the frames in a real Wayland window.

First measurements (desktop, RTX 4090, private headless weston 15 with GL, single runs)

Each run is a 5-second 30 fps clip. CPU and peak RSS cover the helper and the app together for ours, and the whole of mpv for mpv (--vo=gpu-next, the same weston). The weston process isn't counted for either.

Clip Decoding CPU, Alias View helper CPU, mpv Peak RSS, ours Peak RSS, mpv First frame, ours / mpv Dropped, ours / mpv
1080p H.264 NVDEC 0.56 s 1.03 s 431 MB 607 MB 699 / 658 ms 1 / 0
4K HEVC NVDEC 0.60 s 1.08 s 572 MB 742 MB 730 / 677 ms 1 / 0
1080p H.264 software 1.03 s 1.44 s 517 MB 679 MB 683 / 633 ms 1 / 0
4K HEVC software 2.76 s 3.00 s 872 MB 1,339 MB 796 / 638 ms 1 / 0

Not yet as good as mpv:

  • First frame: ours is 40 to 160 ms slower. The two numbers also aren't measured the same way: ours runs to the first commit, mpv's to its playback-restart.
  • Dropped frames: ours drops one frame in the decoder at the start of every run, and mpv drops none.

Not yet measured: GPU use, the compositor's own cost, the M1, M1 battery, longer clips, real refresh, direct scanout and HDR (those are for the live acceptance runs).

Intel UHD 770 (VA-API, Proxmox LXC, Debian 13), 2026-12-02

The 1080p VA-API stop, the slow start and the high CPU on Intel had one cause. The helper gave the same render node descriptor to OpenGL (Mesa, through GBM) and to libmpv's VA-API (iHD, through vaGetDisplayDRM). GEM handles belong to the open file, so the two drivers shared one handle table and closed each other's buffers. iHD then failed with "Failed to end picture decode issue: 23". Plain mpv opens the node itself through vaGetDisplayWl, so it never hit this. The helper now opens the node again for VA-API (cead247).

Jailed, gpu-play --hwdec, 2 runs each:

Clip Shared descriptor (de0ac55) Own descriptor (cead247) Plain mpv
1080p H.264 4 decode errors, fell back to software; first frame 1.77 s; helper CPU 2.80 s 151/151 frames with VA-API; first frame 361–387 ms; helper CPU 0.23–0.27 s first frame 90 ms; CPU 0.27 s
4K HEVC 84 decode errors, 113/150 frames; first frame 1.83 s; helper CPU 1.70 s 150/150 frames; first frame 402–416 ms; helper CPU 0.32–0.33 s not run
  • libmpv's renderer started in 70–82 ms with its own descriptor, against 1.49 s shared. The slow start wasn't uncached shaders.
  • 9e283a3's jail couldn't start in the container at all: --disable-userns writes /proc/sys. From da3be7f on, it starts.
  • glFinish on Intel is now 5.23 ms a frame at 1080p and 12.69 ms at 4K. That's time spent waiting, not CPU.

Warm start (desktop, RTX 4090, jailed NVDEC, 5 runs each, at 2e9495d)

First frame, timed from when the file is given for a warm start, and from the start for a cold one:

Clip Cold, median (range) Warm, median (range)
1080p H.264 662 ms (654–687) 273 ms (272–275)
4K HEVC 699 ms (669–754) 290 ms (284–292)

The warm-up takes about 400 ms. CPU and memory are the same either way.

Not done here

  • Explicit sync: an EGL native fence passed to the compositor through wp_linux_drm_syncobj_v1, in place of glFinish. Weston 15 doesn't offer that protocol, and Hyprland won't run nested inside it, so it can only be tested on a live Hyprland session.
  • pull_request CI runs: ALI-2358 prototype: a jailed GPU helper that hands frames over as dmabufs #2 hasn't had any since its base moved to main. A run started with workflow_dispatch on 2e9495d passed.

One crate for Alias View, Gannet and Nitrate to play through libmpv:

- Player: libmpv opened at run time, the shared options, commands, and
  events for position, duration, pause, volume, mute, end and failure.
- SwRender and GlRender: libmpv's CPU and OpenGL render APIs.
- options::colour: the colour settings for each render path in one
  place. The CPU path keeps Gannet's BT.1886 relabel (ALI-2418).
- helper and jail: Gannet's jailed CPU player, with frames in shared
  memory, moved here so any app can use it.

Every app stops on a video's last frame instead of closing. Hardware
decoding tries NVDEC, VA-API and V4L2 by name. VDPAU is left out because
it stalls on H.264 4:4:4 on NVIDIA.

The colour tests play 51 clips of solid patches, made from Y'CbCr worked
out from source RGB and encoded losslessly. The clips cover range,
matrix, transfer tag, bit depth, chroma and codec. CI runs them on the CPU
renderer, and examples/colour-gpu.rs runs them on a graphics card.
- jail::own_exe no longer falls back to /proc/self/exe. bubblewrap resolves
  that path in its own process and binds itself, so a video opened after the
  app's file was removed ran bwrap as the helper and failed as a jail error.
  It now fails plainly instead.
- ordered-chapters and access-references are off. A Matroska file could
  otherwise make an unjailed player read other files for its chapters, and
  a playlist could name anything.
- When a file closes, the position and duration go back to 0 rather than
  keeping the last file's values (new helper test, which fails without
  this change).
- GlRender can't move between threads. Dropping it frees libmpv's GL state,
  which needs its context current.
- watch stops the player when try_wait fails, as its documentation says.
- start's documentation says the player dies with the thread that started it.
- The GPU bench skips a case only when the machine's encoder can't make it.
  A missing FFmpeg or a clip that fails its check is now a failure.
- The CPU colour setting's comment covers full-range video with no
  transfer tag too.
- The unused rustix process feature is removed.
- When a file closes, the end also goes back to not reached (Ended(false)),
  as the position and duration already do. Before, an app that had shown
  "ended" kept showing it with nothing loaded. The helper test now checks it,
  and fails without this.
- Player::load always passes a path libmpv reads as a file: a relative one
  gets "./" in front. A relative path shaped like "http://host/x" or
  "edl://..." would otherwise be fetched or built by libmpv.
A jailed helper draws with libmpv's OpenGL renderer into GBM buffers on the
compositor's card and passes their dmabufs to the app over a SOCK_SEQPACKET
socket. The buffers use layouts OpenGL can draw into, which EGL reports.
Hardware decoding gets the render node (VA-API) or CUDA (NVDEC).

The GPU jail adds the card's device files and /sys. On NVIDIA it also adds
/proc, which CUDA needs. Landlock then refuses opening anything outside /dev
for writing, so /proc/self/mem can't change code.

examples/gpu-play plays a file through the helper and prints frames, first
frame, dropped frames, CPU and memory. Prototype for ALI-2358; not for
merging as it is.
examples/gpu-show opens a window and attaches each frame's dmabuf with
linux-dmabuf. When the compositor releases a buffer, it goes back to the
helper. It measures what gpu-play does, end to end, for comparison with
mpv's own window in the same private headless weston.
The card's maker is read from /sys for the compositor's render node:
- NVIDIA decodes with NVDEC and gets its device files and /proc;
- AMD and Intel decode with VA-API on the render node;
- Apple and others try V4L2;
- every maker falls back to the CPU.
No maker gets another's devices.

On NVIDIA, /proc is a fresh one for the jail's own PID namespace.
lock_down_gpu_helper adds two locks on top: Landlock (writes only under /dev)
and a seccomp filter that refuses ptrace, process_vm_readv/writev,
pidfd_getfd and kcmp with EPERM. Tests show /proc/self/mem, ptrace and
process_vm_writev are refused, and that only NVIDIA gets /proc.

The GPU colour bench decodes the same way, for the card it runs on.
…y early

- lock_down now runs before the helper has any other thread. Landlock
  applies only to the thread that turns it on and the ones it starts
  later, and libmpv and the drivers start threads of their own.
- The seccomp filter is synced to every thread (TSYNC), like Gannet's.
- libmpv starts on its own thread while OpenGL starts on the card.
- The buffers are made when the video's size is known, before its first
  frame, so making them doesn't delay that frame.
- The player stays paused until the first frame is drawn, then plays.
- Each frame sent counts as presented (report_swap), for libmpv's timing.
Each clip also goes through the jailed GPU helper, with and without the
card's hardware decoding. Its first frame is read back from the dmabuf on
this side, as Alias View will show it. The bench checks it against the
source colours like every other path.
…lost

The end of a video was reported before that loop drew its last frame. The
measuring apps stop at the end, so they missed the final frame (149 of 150
at 4K). The frame now goes first.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Desktop measurements, 2026-12-02, at 708d7dd. Private headless weston with NVDEC, 3 runs each, against mpv --vo=gpu-next. Ours runs inside the full jail (NVIDIA grants, Landlock, seccomp).

Clip CPU, ours CPU, mpv Peak RSS, ours Peak RSS, mpv First frame, ours First frame, mpv Frames shown
1080p H.264 0.51–0.56 s 1.01–1.09 s 433–435 MB 608–609 MB 653–689 ms 657–717 ms all 150
4K HEVC 0.59–0.60 s 1.09–1.12 s 572–576 MB 741–744 MB 683–691 ms 693–709 ms all 150
  • GPU: the whole card's load was 3–6% for both, and the decoder 3–5% for both. That's within the noise of the live desktop.
  • Colour bench: all 51 clips pass in all 5 paths, including the jailed helper's dmabufs with and without NVDEC.
  • Not yet covered:
    • VA-API (a Proxmox run, waiting for a quiet slot);
    • the live acceptance runs (real refresh, direct scanout, HDR, M1 battery).

- The jail points /lib64 at /usr/lib64 where a system has it (Debian, Fedora),
  not only at /usr/lib (Arch).
- The jail includes /etc/alternatives, which Debian's libraries link through
  (libmpv needs libblas there).
- Landlock is required only when the jail has /proc (NVIDIA). Proxmox's kernel
  has no Landlock. The seccomp filter is still required.
- GBM buffers with a second plane (Intel's compressed CCS layouts) are skipped,
  and GBM is asked again.
- gpu-play says how the helper ended when it ends before the clip does.
@michaelaguiar
michaelaguiar changed the base branch from ali-2420-playback-crate to main December 2, 2026 17:39
# Conflicts:
#	.github/workflows/ci.yml
#	Cargo.lock
#	Cargo.toml
#	examples/colour-gpu.rs
#	src/ffi.rs
#	src/helper.rs
#	src/jail.rs
#	src/lib.rs
#	src/options.rs
#	src/render.rs
A helper that has been taken over could make a user namespace inside the
jail, get privileges back there, and mount a procfs of its own to reach
/proc/self/mem, even with no /proc granted. The GPU jail now runs with
bubblewrap's --unshare-user --disable-userns. The helper's seccomp filter
also refuses mount, umount2, unshare, setns and pivot_root, as Gannet's
player filter does.

New tests show both refusals, and each fails without its change:
- unshare --user fails inside the jail but works outside it;
- unshare and mount return EPERM under the filter.
NVDEC still plays inside the jail.
A jailed helper can't write a log file anywhere. With debug (gpu_helper::
start's new flag, GPU_PLAY_DEBUG=1 in gpu-play), it sends libmpv's log lines
as log messages. It also reports how long OpenGL, libmpv and libmpv's
renderer took to start, and the average time to finish a frame. Player gains
on_log for the log lines.
bubblewrap's --disable-userns writes /proc/sys/user/max_user_namespaces,
which is read-only in an LXC container, so the GPU jail wouldn't start in
one. The jail keeps --unshare-user and drops --disable-userns. The helper's
seccomp filter now does that job:
- clone with any CLONE_NEW* flag gets EPERM;
- clone3 gets ENOSYS, as under Flatpak, so libc falls back to clone;
- on x86-64, x32 system calls get EPERM, as they'd get past the numbers;
- mount, umount2, unshare, setns and pivot_root stay refused.

A new test runs the test program inside the GPU jail. There, before the
filter, unshare --user works; after it, unshare --user, clone with
CLONE_NEWUSER and clone3 are refused, and processes and threads still
start. The test fails with the clone rules removed, and with the filter
removed. NVDEC still plays inside the jail.
…ftware

libmpv falls back to the CPU only when the hardware decoder reports an
error. On the Proxmox box's Intel UHD 770, iHD stopped giving 1080p frames
after 5 to 8 without one, and libmpv reported the end of the file.

When a file ends more than a second short of its known length while
hardware decoding is in use, the helper now sets hwdec to no. libmpv then
starts the decoder again in software where the picture stopped, and the
video plays on. This happens once per file, and the helper says "decoder
software" again. A file that really is shorter than its stated length
costs one start in software before it ends there too.

A unit test covers when it falls back. The fallback itself was checked
on the desktop by forcing it at the real end of the 1080p clip with a
seek back to 1 s: NVDEC played to the end, then software played on from
1 s to the end (272 frames), with no end reported in between.
The helper passed one render node descriptor to both GBM/EGL and libmpv,
whose VA-API interop calls vaGetDisplayDRM on it. GEM buffer handles
belong to the open file, so Mesa and iHD shared one handle table: a handle
one closes is gone for the other. That fits the Intel UHD 770 run, where
1080p H.264 stopped after a few frames with iHD's "Failed to end picture
decode issue: 23" (VA_STATUS_ERROR_DECODING_ERROR) inside the helper only.
Plain mpv in the same container uses vaGetDisplayWl, which opens the node
itself, so its decoder has a file of its own.

The helper now opens the node again by name, under /dev/dri, before it
locks down, and gives that to libmpv; OpenGL keeps the app's descriptor.
If that open fails, the shared one is used as before.

Not yet confirmed on Intel: that needs another Proxmox run. NVDEC and
software playback are unchanged on the desktop. A new test checks the
reopened node is the same card with a file description of its own.
- A new size draws the frame again while paused or stopped, as the CPU
  helper does. Checked on the desktop: paused, then sent a new size, and
  a 960x540 buffer and frame followed.
- A frame that comes while the app holds every buffer is drawn once one is
  given back, instead of being lost.
- nouveau is no longer taken for NVIDIA: only NVIDIA's own driver gets
  NVDEC and the jail's /proc. A card with NVIDIA's PCI number on another
  driver decodes in software.
- The app's `buffer` check takes only XRGB8888, and a row at most 64 KiB
  longer than its pixels.
- Volume from the app is kept within 0 to 100.
- A debug log line is cut to the packet size in bytes, not characters, so
  a long line with non-ASCII text isn't dropped.
- The GPU jail test skips where there's no /dev/dri, which the jail binds.
- gpu-show stops when the helper goes without a word. Killing the helper's
  bubblewrap mid-clip now ends gpu-show at once; before, it waited until
  it was killed.
`gpu_helper::start_warm` starts a player with no file: OpenGL, libmpv and
its renderer start at once, and it says `hello` when they're ready.
`gpu_helper::load` then gives it the file, as a descriptor on a `load`
message. `start` is unchanged. A player started warm keeps the file
loaded last, and the one before, open while libmpv may read them.

gpu-play's `--warm` times the first frame from when the file is given.
No shader cache is added to the jail.
CI's clippy (Rust 1.100) refuses the indexed loop over the slots as
needless_range_loop. The loop now walks the held flags with enumerate.
- A second file loaded into a warm helper starts afresh. Its decoder is
  announced again, and its size and frames don't carry over from the last
  file; these reset when libmpv says the file is loaded, as the last
  file's frame can still be drawn until then. Hardware decoding comes
  back if the last file fell back to software. Checked by loading the
  clip twice into one warm helper: both said "decoder nvdec" and played
  every frame.
- A `load` while another waits replaces it, so the newest file chosen
  plays. Before, it was dropped with no answer.
- The seccomp filter also refuses the newer mount API (fsopen, fsconfig,
  fsmount, fspick, move_mount, open_tree, mount_setattr, open_tree_attr),
  which can make a procfs without `mount`.
- An NVIDIA card whose driver can't be read is taken to run NVIDIA's own
  again; only nouveau decodes in software without the NVIDIA grants.
About half of songs with cover art never started: no frame was drawn, so
the helper never unpaused. A cover is one frame, queued as soon as the
video is set up. The helper's `VideoChanged` handling asks libmpv for
the size, which waits on libmpv's core, while the core waits for this
thread to draw the frame. libmpv gives up after 200 ms, keeps the frame
on screen, and stops flagging it as new, so the draw was skipped and
nothing woke the loop again.

When playback starts or restarts, the helper now draws the current frame
whatever the flag says. With cover art on (in a local test build of
gpu-play, jailed, on NVIDIA), a FLAC with a 600x600 PNG cover showed its
frame in 2 of 10 runs before and 12 of 12 after. 1080p video plays as
before.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 1 (fresh reviewer, code-review at high, on da3be7f..2e9495d)

What the reviewer confirmed holds:

  • The seccomp BPF jump offsets, the CLONE_NEW* mask (CLONE_NEWTIME is left out because it overlaps clone's exit signal), clone3 getting ENOSYS, and the x32 check.
  • The software fallback trigger.
  • gpu::reopen: it runs before the lockdown and checks rdev.
  • The fixes from ALI-2358: GPU helper plays sound and says the file's tags #3's review.

Findings:

  1. P2, fixed in 237de75. A second load into a warm helper didn't re-announce the decoder or reset the fallback, size and frames.
    • These now reset when libmpv reports the file loaded, not at load, since the previous file's frame can still be drawn until then.
    • Hardware decoding comes back if the previous file fell back.
    • Checked by loading the clip twice: both loads said nvdec and played every frame.
  2. P2, fixed in 237de75. A load that arrived while another was still pending was dropped without a reply. It now replaces the pending one, so the newest file chosen plays.
  3. P3, fixed in 237de75. The seccomp filter now also refuses the newer mount API: fsopen, fsconfig, fsmount, fspick, move_mount, open_tree, mount_setattr and open_tree_attr. Without CAP_SYS_ADMIN they fail anyway, so no test can tell the filter's refusal from the kernel's.
  4. P3, fixed in 237de75. A card with NVIDIA's PCI vendor ID whose driver can't be read is treated as NVIDIA again. Only nouveau is mapped to software.

Also fixed, found by #3's UI agent:

  • 7f6a58d: songs with cover art sometimes never showed their cover and stayed paused.
    • Cause: the VideoChanged handler's blocking property read waited on libmpv's core while the core waited for the helper to draw. libmpv timed out and cleared the new-frame flag.
    • Fix: the current frame is now drawn when playback starts or restarts.
    • Before the fix, 2 of 10 runs showed the cover; after it, 12 of 12 did.

Unchanged from earlier: no fallback for gbm_bo_create_with_modifiers2, the plane offset isn't pinned, explicit sync is parked, and the optional Landlock stays as it is.

The helpers read the picture's size, and the GPU helper its decoder and
dropped-frame counts, with blocking gets on their render thread. A get
waits on libmpv's core, and the core can be waiting in the video output
for that same thread to draw. libmpv gives up after 200 ms and drops the
frame's "new" flag. A song's cover lost its only frame that way, and the
same could happen to a video that changes size mid-stream.

The player now watches dwidth, dheight, hwdec-current, frame-drop-count
and vo-delayed-frame-count, as new events: Width, Height, Decoder,
DecoderDrops and LateFrames. The CPU and GPU helpers use them and no
longer ask for them. The GPU helper settles the size once per batch of
events, as width and height arrive separately, so no buffers are made for
a half-changed size. It names the decoder once a frame is drawn and
libmpv has said which decoder it is. The draw on every playback start
(7f6a58d) stays as a second guard.

Checked on the desktop (NVIDIA, jailed):
- A FLAC with a cover (cover art on, in a local test build of gpu-play)
  showed its frame in 12 of 12 runs. The stall before its first frame went
  from about 400 ms to about 200 ms.
- A clip that changes from 640x360 to 1280x720 mid-stream played all 120
  frames. It makes no buffers at an in-between size.
- The 1080p clip's first frame is unchanged (652 to 681 ms).
A thread that draws for libmpv can't wait on libmpv's core: the core may
be waiting in the video output for that thread to draw. libmpv then gives
up after 200 ms and drops the frame's "new" flag. Every start had that
stall, and a cover could lose its only frame to it.

- Requests are now async. command, load, load_fd, set_paused, play,
  the seeks, set_volume and set_muted return once libmpv has the request,
  through mpv_command_async. A request libmpv turns down comes back as
  Event::Refused(Request), where Request is Command, Load, Pause, Seek,
  Volume or Mute. The helpers say `cantplay` for a refused load.
- play() reads the end from the last watched eof-reached, not with a get.
- Player::ask(name, id) reads a property as text without waiting.
  Event::Answered(id) says the answer is ready, and Player::answer(id)
  takes it as an Option<String>. Event stays Copy.
- Loaded { video } keeps its shape. It now comes when libmpv answers an
  async read of `vid`, a moment after the file is loaded, so it can arrive
  after the first Width and Height.
- The GPU helper resets each file's decoder, frames and fallback when it
  asks libmpv to load the file, no longer on Loaded.
- libmpv reports the picture's size only once its core is free, and the
  core waits for the first frame to be drawn. So while the size isn't
  known yet, the GPU helper draws a new frame at the window's size (libmpv
  keeps the picture's shape, with borders), then again at the picture's
  own size once that arrives.
- Fixes from review round 2:
  - A restart owes a draw once the size is settled in the same batch,
    not before it.
  - The CPU helper settles the size once per batch too.

Measured on the desktop (NVIDIA, jailed). The "render() not being called
or stuck" stall is gone from every run, and no first frame is dropped.
- First frame, cold: 1080p H.264 472-530 ms (was 652-714), 4K HEVC
  493-537 ms (was 669-754).
- First frame, warm: 72 ms at 1080p.
- A FLAC with a cover: shown in 12 of 12 runs, first frame 446-509 ms
  (was 651-787).
- Pause and seek during playback are as before: pause 0-67 ms, seek
  63-100 ms to the reported state.
- A clip that changes size mid-stream plays every frame.
Answers to `ask` waited in a map until taken, with nothing to stop the
map growing, or to stop a late answer about the last file being taken
for the next one under a reused id.

Each load now starts a new generation and drops untaken answers. An
answer carries the generation it was asked in, and one from an earlier
generation is turned away with no Answered event. At most 64 answers
wait untaken; beyond that, answer() gives None. Reply ids now keep their
kind in the top 4 bits, then the generation, then the caller's id.

A new test asks for a property, loads another file before reading the
answer, and checks that the late answer is turned away and an untaken one
is dropped on load. It fails without the generation and the clearing.
michaelaguiar added a commit that referenced this pull request Dec 2, 2026
The three tag reads were blocking gets on the drawing thread, which stalled a song's cover
art once #2's own reads stopped waiting (a8024d8). They're now asked with Player::ask on
Loaded, and each is said as meta when Event::Answered brings it; one that's missing or
empty says nothing. Loaded may now come after the first frame; the novideo start still
only begins playback when there's no picture.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 2 (fresh reviewer, code-review at high, on 237de75..a8024d8)

The reviewer confirmed:

  • FORMAT_STRING reply data handling;
  • WATCHED indexes against the translate arms;
  • the fallback and second-load logic;
  • the seccomp mount-API list;
  • Vendor::from_sys;
  • the tests aren't affected by the new events.

Findings:

  1. P2, fixed in 8937853. Restarted owed a draw only if natural was already set, but the size is now settled after the event batch. A restart arriving in the same batch as the first Width/Height could still lose a cover's frame. Fix: Restarted sets a flag, which is ORed into owed after the size is settled.
  2. P3, fixed in 8937853. The CPU helper set its size on each of Width and Height separately. It now settles the size once per batch, as the GPU helper does.
  3. P3, fixed in 8937853. The cached decoder wasn't cleared per file. It's now reset when the helper loads a file.

Also in 8937853, at the coordinator's request:

  • The render threads never make a blocking libmpv call.
  • Requests go through mpv_command_async; refusals come back as Event::Refused(Request).
  • New async reads: Player::ask / Event::Answered / Player::answer.
  • Loaded now comes from an async read of vid.
  • A new frame that arrives before the size is known is drawn at the window's size, then redrawn at its own size.

Measured on the desktop, NVIDIA, jailed:

  • The 200 ms "render() not being called or stuck" stall is gone, and so is the decoder drop at start.
  • First frame: 1080p 472–530 ms (was 652–714), 4K 493–537 ms (was 669–754).
  • Warm start: 72 ms.
  • Covers: 12 of 12 shown, 446–509 ms.

df646d2 ties each ask answer to the file it was asked about: a per-load generation, answers cleared on load, at most 64 untaken. Its test fails without the fix.

- The internal `vid` read behind Loaded now carries the load generation
  too. Its answer is turned away if another load was asked for since, so a
  late "no picture" about the last file isn't reported for the new one.
- A load request bumps the generation and clears the answers under the
  answers lock, and an answer is checked and stored under it. An `ask` on
  another thread can't land between the two.
- `ask`'s documentation now says what the generation covers. An answer
  asked for before a later load request is turned away. One asked for
  after the request but before libmpv opens the file can still be about
  the last file, so ask once Loaded has come.
- A restart that comes while the picture's size is still unknown is kept
  until the size is known, so its draw isn't lost across batches.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review rounds 3 and 4 (fresh reviewers, code-review at high and then medium. Round 3 covered 8937853 and df646d2; round 4 covered 15e5e9e only.)

What the reviewers confirmed:

  • The async ffi signatures and the reply event ids match client.h.
  • Reply data is read safely: the layout, error check, nulls and copy are all right.
  • No render thread makes a blocking libmpv call any more.
  • The set pause, set volume and set mute commands match the old property sets.
  • The tag and generation decoding is correct, and no lock-ordering deadlock is possible.
  • pending_restart behaves correctly.

Round 3 findings:

  1. P2, fixed in 15e5e9e. The internal vid read behind Loaded had no generation, so a late answer about the previous file could produce Loaded for the new one. It now carries the generation, and stale answers are dropped.
  2. P3, fixed in 15e5e9e (docs). An ask sent after a load request, but before libmpv opens the file, can still be about the previous file. The docs now say this and say to ask once Loaded has come.
  3. P3, fixed in 15e5e9e. The generation bump and the answer store could interleave. Both now happen under the answers lock.
  4. P3, declined. play() reads a cached end-of-file flag, which can be one event-loop turn out of date. If play lands in the same wake as the end-of-file event, it unpauses without seeking back, and a second press works. Fixing that means reordering the helper loop, which isn't worth it for a one-turn window.
  5. P3, fixed in 15e5e9e. A restart that arrived while the size was still unknown was lost at the end of the batch. It's now kept until the size is known.

Round 4 found nothing new at P1 or P2. Its P3 is the edge noted as a follow-up: libmpv's FILE_LOADED doesn't say which file it belongs to. If the previous file's FILE_LOADED is translated after a new load request, its vid read carries the new generation and can give one stray Loaded. Fixing that needs the playlist entry id from loadfile's reply.

Other follow-ups:

  • Explicit sync. It needs a live Hyprland run.
  • pull_request CI doesn't trigger on this PR. A manual run passed. Closing and reopening the PR is Mike's call.

…reading a dmabuf

Gpu::new now holds the GBM device, EGL display and context in a guard that frees them if a later step or lookup fails. read_dmabuf checks glCheckFramebufferStatus and returns an error instead of a zeroed buffer.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Two notes from an automated review, checked against the code:

  1. Gpu::new leaks on error paths: fixed in 6c0187c. Real: after gbm_create_device, the extension check, the config choice, the context creation and the later GL symbol lookups all returned without freeing the device, display or context. They now sit in a Setup guard whose Drop makes nothing current, destroys the context, terminates the display and destroys the device. new disarms it only at the end. No test: it needs a GPU.
  2. read_dmabuf skips the framebuffer completeness check: fixed in 6c0187c. Real: on an incomplete framebuffer glReadPixels errors and the zeroed buffer would pass as black. It now checks glCheckFramebufferStatus, frees the image, texture and framebuffer, and returns Err. No test: it needs a GPU. It has no caller on this branch yet.

@michaelaguiar michaelaguiar reopened this Dec 2, 2026
@michaelaguiar
michaelaguiar marked this pull request as ready for review December 2, 2026 22:37
@michaelaguiar
michaelaguiar added this pull request to stack #4 December 2, 2026 22:37
@michaelaguiar
michaelaguiar merged commit a250832 into main Dec 2, 2026
3 checks passed
michaelaguiar added a commit that referenced this pull request Dec 2, 2026
* ALI-2420: The shared libmpv playback crate, with colour tests

One crate for Alias View, Gannet and Nitrate to play through libmpv:

- Player: libmpv opened at run time, the shared options, commands, and
  events for position, duration, pause, volume, mute, end and failure.
- SwRender and GlRender: libmpv's CPU and OpenGL render APIs.
- options::colour: the colour settings for each render path in one
  place. The CPU path keeps Gannet's BT.1886 relabel (ALI-2418).
- helper and jail: Gannet's jailed CPU player, with frames in shared
  memory, moved here so any app can use it.

Every app stops on a video's last frame instead of closing. Hardware
decoding tries NVDEC, VA-API and V4L2 by name. VDPAU is left out because
it stalls on H.264 4:4:4 on NVIDIA.

The colour tests play 51 clips of solid patches, made from Y'CbCr worked
out from source RGB and encoded losslessly. The clips cover range,
matrix, transfer tag, bit depth, chroma and codec. CI runs them on the CPU
renderer, and examples/colour-gpu.rs runs them on a graphics card.

* Review fixes: jailed exe, hidden file reads, stale duration, GL thread

- jail::own_exe no longer falls back to /proc/self/exe. bubblewrap resolves
  that path in its own process and binds itself, so a video opened after the
  app's file was removed ran bwrap as the helper and failed as a jail error.
  It now fails plainly instead.
- ordered-chapters and access-references are off. A Matroska file could
  otherwise make an unjailed player read other files for its chapters, and
  a playlist could name anything.
- When a file closes, the position and duration go back to 0 rather than
  keeping the last file's values (new helper test, which fails without
  this change).
- GlRender can't move between threads. Dropping it frees libmpv's GL state,
  which needs its context current.
- watch stops the player when try_wait fails, as its documentation says.
- start's documentation says the player dies with the thread that started it.
- The GPU bench skips a case only when the machine's encoder can't make it.
  A missing FFmpeg or a clip that fails its check is now a failure.
- The CPU colour setting's comment covers full-range video with no
  transfer tag too.
- The unused rustix process feature is removed.

* Review fixes: clear the end with the file, and always load a file

- When a file closes, the end also goes back to not reached (Ended(false)),
  as the position and duration already do. Before, an app that had shown
  "ended" kept showing it with nothing loaded. The helper test now checks it,
  and fails without this.
- Player::load always passes a path libmpv reads as a file: a relative one
  gets "./" in front. A relative path shaped like "http://host/x" or
  "edl://..." would otherwise be fetched or built by libmpv.

* GPU helper prototype: libmpv on the card, frames handed over as dmabufs

A jailed helper draws with libmpv's OpenGL renderer into GBM buffers on the
compositor's card and passes their dmabufs to the app over a SOCK_SEQPACKET
socket. The buffers use layouts OpenGL can draw into, which EGL reports.
Hardware decoding gets the render node (VA-API) or CUDA (NVDEC).

The GPU jail adds the card's device files and /sys. On NVIDIA it also adds
/proc, which CUDA needs. Landlock then refuses opening anything outside /dev
for writing, so /proc/self/mem can't change code.

examples/gpu-play plays a file through the helper and prints frames, first
frame, dropped frames, CPU and memory. Prototype for ALI-2358; not for
merging as it is.

* GPU helper prototype: show its dmabufs on a compositor

examples/gpu-show opens a window and attaches each frame's dmabuf with
linux-dmabuf. When the compositor releases a buffer, it goes back to the
helper. It measures what gpu-play does, end to end, for comparison with
mpv's own window in the same private headless weston.

* GPU helper: hardware decoding and jail grants chosen per card maker

The card's maker is read from /sys for the compositor's render node:
- NVIDIA decodes with NVDEC and gets its device files and /proc;
- AMD and Intel decode with VA-API on the render node;
- Apple and others try V4L2;
- every maker falls back to the CPU.
No maker gets another's devices.

On NVIDIA, /proc is a fresh one for the jail's own PID namespace.
lock_down_gpu_helper adds two locks on top: Landlock (writes only under /dev)
and a seccomp filter that refuses ptrace, process_vm_readv/writev,
pidfd_getfd and kcmp with EPERM. Tests show /proc/self/mem, ptrace and
process_vm_writev are refused, and that only NVIDIA gets /proc.

The GPU colour bench decodes the same way, for the card it runs on.

* GPU helper: lock down first, start libmpv beside OpenGL, buffers ready early

- lock_down now runs before the helper has any other thread. Landlock
  applies only to the thread that turns it on and the ones it starts
  later, and libmpv and the drivers start threads of their own.
- The seccomp filter is synced to every thread (TSYNC), like Gannet's.
- libmpv starts on its own thread while OpenGL starts on the card.
- The buffers are made when the video's size is known, before its first
  frame, so making them doesn't delay that frame.
- The player stays paused until the first frame is drawn, then plays.
- Each frame sent counts as presented (report_swap), for libmpv's timing.

* GPU colour bench: Alias View's own path, the jailed helper's dmabufs

Each clip also goes through the jailed GPU helper, with and without the
card's hardware decoding. Its first frame is read back from the dmabuf on
this side, as Alias View will show it. The bench checks it against the
source colours like every other path.

* GPU helper: draw before reporting the state, so the last frame isn't lost

The end of a video was reported before that loop drew its last frame. The
measuring apps stop at the end, so they missed the final frame (149 of 150
at 4K). The frame now goes first.

* GPU helper: run on Debian and on Intel (found on the Proxmox UHD 770)

- The jail points /lib64 at /usr/lib64 where a system has it (Debian, Fedora),
  not only at /usr/lib (Arch).
- The jail includes /etc/alternatives, which Debian's libraries link through
  (libmpv needs libblas there).
- Landlock is required only when the jail has /proc (NVIDIA). Proxmox's kernel
  has no Landlock. The seccomp filter is still required.
- GBM buffers with a second plane (Intel's compressed CCS layouts) are skipped,
  and GBM is asked again.
- gpu-play says how the helper ended when it ends before the clip does.

* GPU jail: no new user namespaces, no mounts

A helper that has been taken over could make a user namespace inside the
jail, get privileges back there, and mount a procfs of its own to reach
/proc/self/mem, even with no /proc granted. The GPU jail now runs with
bubblewrap's --unshare-user --disable-userns. The helper's seccomp filter
also refuses mount, umount2, unshare, setns and pivot_root, as Gannet's
player filter does.

New tests show both refusals, and each fails without its change:
- unshare --user fails inside the jail but works outside it;
- unshare and mount return EPERM under the filter.
NVDEC still plays inside the jail.

* GPU helper: sound through the PulseAudio socket, and the file's tags

- jail::gpu_arguments takes the sound socket, bound read-only as for the CPU helper. Use
  it with Audio::Pulse. PipeWire's own socket is never bound.
- The player says the file's title, artist and album once it has loaded, as meta messages.
  gpu_helper::clean_meta takes out control characters and bidirectional overrides, isolates
  and marks, and cuts each tag to 160 bytes. parse_said cleans them again on the app's side.

* GPU helper: a debug mode that sends libmpv's log and start-up timings

A jailed helper can't write a log file anywhere. With debug (gpu_helper::
start's new flag, GPU_PLAY_DEBUG=1 in gpu-play), it sends libmpv's log lines
as log messages. It also reports how long OpenGL, libmpv and libmpv's
renderer took to start, and the average time to finish a frame. Player gains
on_log for the log lines.

* GPU jail: seccomp instead of --disable-userns, so it starts in LXC

bubblewrap's --disable-userns writes /proc/sys/user/max_user_namespaces,
which is read-only in an LXC container, so the GPU jail wouldn't start in
one. The jail keeps --unshare-user and drops --disable-userns. The helper's
seccomp filter now does that job:
- clone with any CLONE_NEW* flag gets EPERM;
- clone3 gets ENOSYS, as under Flatpak, so libc falls back to clone;
- on x86-64, x32 system calls get EPERM, as they'd get past the numbers;
- mount, umount2, unshare, setns and pivot_root stay refused.

A new test runs the test program inside the GPU jail. There, before the
filter, unshare --user works; after it, unshare --user, clone with
CLONE_NEWUSER and clone3 are refused, and processes and threads still
start. The test fails with the clone rules removed, and with the filter
removed. NVDEC still plays inside the jail.

* GPU helper: sound with no picture starts playing

A song with no cover art has no first frame, and the helper waited for one before
unpausing, so it never played. With no video, it now starts as soon as it's loaded.

* GPU helper: hardware decoding that ends a file early falls back to software

libmpv falls back to the CPU only when the hardware decoder reports an
error. On the Proxmox box's Intel UHD 770, iHD stopped giving 1080p frames
after 5 to 8 without one, and libmpv reported the end of the file.

When a file ends more than a second short of its known length while
hardware decoding is in use, the helper now sets hwdec to no. libmpv then
starts the decoder again in software where the picture stopped, and the
video plays on. This happens once per file, and the helper says "decoder
software" again. A file that really is shorter than its stated length
costs one start in software before it ends there too.

A unit test covers when it falls back. The fallback itself was checked
on the desktop by forcing it at the real end of the 1080p clip with a
seek back to 1 s: NVDEC played to the end, then software played on from
1 s to the end (272 frames), with no end reported in between.

* GPU helper: VA-API gets the card opened again, not OpenGL's descriptor

The helper passed one render node descriptor to both GBM/EGL and libmpv,
whose VA-API interop calls vaGetDisplayDRM on it. GEM buffer handles
belong to the open file, so Mesa and iHD shared one handle table: a handle
one closes is gone for the other. That fits the Intel UHD 770 run, where
1080p H.264 stopped after a few frames with iHD's "Failed to end picture
decode issue: 23" (VA_STATUS_ERROR_DECODING_ERROR) inside the helper only.
Plain mpv in the same container uses vaGetDisplayWl, which opens the node
itself, so its decoder has a file of its own.

The helper now opens the node again by name, under /dev/dri, before it
locks down, and gives that to libmpv; OpenGL keeps the app's descriptor.
If that open fails, the shared one is used as before.

Not yet confirmed on Intel: that needs another Proxmox run. NVDEC and
software playback are unchanged on the desktop. A new test checks the
reopened node is the same card with a file description of its own.

* GPU helper: fixes from #3's review

- A new size draws the frame again while paused or stopped, as the CPU
  helper does. Checked on the desktop: paused, then sent a new size, and
  a 960x540 buffer and frame followed.
- A frame that comes while the app holds every buffer is drawn once one is
  given back, instead of being lost.
- nouveau is no longer taken for NVIDIA: only NVIDIA's own driver gets
  NVDEC and the jail's /proc. A card with NVIDIA's PCI number on another
  driver decodes in software.
- The app's `buffer` check takes only XRGB8888, and a row at most 64 KiB
  longer than its pixels.
- Volume from the app is kept within 0 to 100.
- A debug log line is cut to the packet size in bytes, not characters, so
  a long line with non-ASCII text isn't dropped.
- The GPU jail test skips where there's no /dev/dri, which the jail binds.
- gpu-show stops when the helper goes without a word. Killing the helper's
  bubblewrap mid-clip now ends gpu-show at once; before, it waited until
  it was killed.

* GPU helper prototype: start warm, before a file is chosen

`gpu_helper::start_warm` starts a player with no file: OpenGL, libmpv and
its renderer start at once, and it says `hello` when they're ready.
`gpu_helper::load` then gives it the file, as a descriptor on a `load`
message. `start` is unchanged. A player started warm keeps the file
loaded last, and the one before, open while libmpv may read them.

gpu-play's `--warm` times the first frame from when the file is given.
No shader cache is added to the jail.

* GPU helper: make buffers with an iterator, for Rust 1.100's clippy

CI's clippy (Rust 1.100) refuses the indexed loop over the slots as
needless_range_loop. The loop now walks the held flags with enumerate.

* GPU helper: fixes from the first review round of #2

- A second file loaded into a warm helper starts afresh. Its decoder is
  announced again, and its size and frames don't carry over from the last
  file; these reset when libmpv says the file is loaded, as the last
  file's frame can still be drawn until then. Hardware decoding comes
  back if the last file fell back to software. Checked by loading the
  clip twice into one warm helper: both said "decoder nvdec" and played
  every frame.
- A `load` while another waits replaces it, so the newest file chosen
  plays. Before, it was dropped with no answer.
- The seccomp filter also refuses the newer mount API (fsopen, fsconfig,
  fsmount, fspick, move_mount, open_tree, mount_setattr, open_tree_attr),
  which can make a procfs without `mount`.
- An NVIDIA card whose driver can't be read is taken to run NVIDIA's own
  again; only nouveau decodes in software without the NVIDIA grants.

* GPU helper: draw the current frame when playback starts, so covers show

About half of songs with cover art never started: no frame was drawn, so
the helper never unpaused. A cover is one frame, queued as soon as the
video is set up. The helper's `VideoChanged` handling asks libmpv for
the size, which waits on libmpv's core, while the core waits for this
thread to draw the frame. libmpv gives up after 200 ms, keeps the frame
on screen, and stops flagging it as new, so the draw was skipped and
nothing woke the loop again.

When playback starts or restarts, the helper now draws the current frame
whatever the flag says. With cover art on (in a local test build of
gpu-play, jailed, on NVIDIA), a FLAC with a 600x600 PNG cover showed its
frame in 2 of 10 runs before and 12 of 12 after. 1080p video plays as
before.

* Player: watch the picture's size, decoder and dropped frames

The helpers read the picture's size, and the GPU helper its decoder and
dropped-frame counts, with blocking gets on their render thread. A get
waits on libmpv's core, and the core can be waiting in the video output
for that same thread to draw. libmpv gives up after 200 ms and drops the
frame's "new" flag. A song's cover lost its only frame that way, and the
same could happen to a video that changes size mid-stream.

The player now watches dwidth, dheight, hwdec-current, frame-drop-count
and vo-delayed-frame-count, as new events: Width, Height, Decoder,
DecoderDrops and LateFrames. The CPU and GPU helpers use them and no
longer ask for them. The GPU helper settles the size once per batch of
events, as width and height arrive separately, so no buffers are made for
a half-changed size. It names the decoder once a frame is drawn and
libmpv has said which decoder it is. The draw on every playback start
(7f6a58d) stays as a second guard.

Checked on the desktop (NVIDIA, jailed):
- A FLAC with a cover (cover art on, in a local test build of gpu-play)
  showed its frame in 12 of 12 runs. The stall before its first frame went
  from about 400 ms to about 200 ms.
- A clip that changes from 640x360 to 1280x720 mid-stream played all 120
  frames. It makes no buffers at an in-between size.
- The 1080p clip's first frame is unchanged (652 to 681 ms).

* Player: requests and reads that never wait on libmpv's core

A thread that draws for libmpv can't wait on libmpv's core: the core may
be waiting in the video output for that thread to draw. libmpv then gives
up after 200 ms and drops the frame's "new" flag. Every start had that
stall, and a cover could lose its only frame to it.

- Requests are now async. command, load, load_fd, set_paused, play,
  the seeks, set_volume and set_muted return once libmpv has the request,
  through mpv_command_async. A request libmpv turns down comes back as
  Event::Refused(Request), where Request is Command, Load, Pause, Seek,
  Volume or Mute. The helpers say `cantplay` for a refused load.
- play() reads the end from the last watched eof-reached, not with a get.
- Player::ask(name, id) reads a property as text without waiting.
  Event::Answered(id) says the answer is ready, and Player::answer(id)
  takes it as an Option<String>. Event stays Copy.
- Loaded { video } keeps its shape. It now comes when libmpv answers an
  async read of `vid`, a moment after the file is loaded, so it can arrive
  after the first Width and Height.
- The GPU helper resets each file's decoder, frames and fallback when it
  asks libmpv to load the file, no longer on Loaded.
- libmpv reports the picture's size only once its core is free, and the
  core waits for the first frame to be drawn. So while the size isn't
  known yet, the GPU helper draws a new frame at the window's size (libmpv
  keeps the picture's shape, with borders), then again at the picture's
  own size once that arrives.
- Fixes from review round 2:
  - A restart owes a draw once the size is settled in the same batch,
    not before it.
  - The CPU helper settles the size once per batch too.

Measured on the desktop (NVIDIA, jailed). The "render() not being called
or stuck" stall is gone from every run, and no first frame is dropped.
- First frame, cold: 1080p H.264 472-530 ms (was 652-714), 4K HEVC
  493-537 ms (was 669-754).
- First frame, warm: 72 ms at 1080p.
- A FLAC with a cover: shown in 12 of 12 runs, first frame 446-509 ms
  (was 651-787).
- Pause and seek during playback are as before: pause 0-67 ms, seek
  63-100 ms to the reported state.
- A clip that changes size mid-stream plays every frame.

* Player: answers belong to the file they were asked about

Answers to `ask` waited in a map until taken, with nothing to stop the
map growing, or to stop a late answer about the last file being taken
for the next one under a reused id.

Each load now starts a new generation and drops untaken answers. An
answer carries the generation it was asked in, and one from an earlier
generation is turned away with no Answered event. At most 64 answers
wait untaken; beyond that, answer() gives None. Reply ids now keep their
kind in the top 4 bits, then the generation, then the caller's id.

A new test asks for a property, loads another file before reading the
answer, and checks that the late answer is turned away and an untaken one
is dropped on load. It fails without the generation and the clearing.

* Player and GPU helper: fixes from review round 3

- The internal `vid` read behind Loaded now carries the load generation
  too. Its answer is turned away if another load was asked for since, so a
  late "no picture" about the last file isn't reported for the new one.
- A load request bumps the generation and clears the answers under the
  answers lock, and an answer is checked and stored under it. An `ask` on
  another thread can't land between the two.
- `ask`'s documentation now says what the generation covers. An answer
  asked for before a later load request is turned away. One asked for
  after the request but before libmpv opens the file can still be about
  the last file, so ask once Loaded has come.
- A restart that comes while the picture's size is still unknown is kept
  until the size is known, so its draw isn't lost across batches.

* Merge ali-2358-gpu-helper (15e5e9e); no picture confirmed by the file loading

A late Loaded about the previous file can still come after a new load. A Loaded without
video now asks the video track (vid) without waiting, and only an answer of no, which
belongs to the file now loading (df646d2), says novideo and starts sound alone. A file
that has already drawn a frame never does.

* Release GPU setup on every error path and check the framebuffer when reading a dmabuf

Gpu::new now holds the GBM device, EGL display and context in a guard that frees them if a later step or lookup fails. read_dmabuf checks glCheckFramebufferStatus and returns an error instead of a zeroed buffer.
@michaelaguiar
michaelaguiar deleted the ali-2358-gpu-helper branch December 3, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant