Commit Graph

2 Commits

Author SHA1 Message Date
marfrit 89a4b81654 iter1 phase 2: hypothesis 3 ruled out by EXPBUF lseek probe
Probe `/tmp/expbuf_probe.c` (snapshot at probes/expbuf_probe.c) opens
/dev/video1, sets OUTPUT format H264_SLICE 1920x1088, REQBUFS 4 capture
buffers, EXPBUF on plane 0 of buffer 0, lseek(fd, 0, SEEK_END).

On ohm (kernel besser-7.0, hantro-vpu / rk3568-vpu-dec):
  CAPTURE: NV12 1920x1088 num_planes=1 sizeimage=3655712
  EXPBUF fd lseek(SEEK_END) = 3657728  (page-rounded from 3655712)

Kernel exports the dma_buf at full sizeimage; offset 2,088,960
(plane 1 base in ffmpeg's drm-frame-descriptor) is well inside.
Hantro is innocent.

Side observation: sizeimage = 3,655,712 > naive NV12's 3,133,440.
The 522,272-byte excess is trailing padding (likely Rockchip
per-frame MV / context metadata) past the UV plane. Y and UV layout
fit cleanly within [0, 3,133,440), exactly where mpv/ffmpeg expect.

Remaining hypothesis space: H1 (panfrost EGL non-zero plane offset),
H2 (KWin wl_dmabuf import), H4 (kwin-fourier residual, low conf).

Next probe queued: H2 source-read of KWin 6.6.4 wl_dmabuf import
path. ~30 min, no hardware needed. If that turns up nothing,
write the EGL importer harness for H1.

Posted to dmabuf-modifier-triage#1 comment 255.
2026-05-08 21:11:09 +00:00
marfrit eddd9ef88f phase2 iter1: source-read overturns earlier mpv-bug conclusion
mpv 0.41.0's drmprime_dmabuf_importer reads correctly. Kwiboo's
ffmpeg V4L2 hwaccel at b57fbbe sets planes[1].object_index=0 for
hantro single-planar NV12 (LINEAR modifier branch, line 157), so
mpv should produce identical fd values for both .add() calls.

Runtime confirms via strace: ffmpeg does one VIDIOC_EXPBUF per
CAPTURE buffer, returning ONE fd. nb_objects=1.

The "different fds per plane" observed in WAYLAND_DEBUG is most
likely libwayland's wl_closure_marshal dup_cloexec'ing the fd at
protocol-marshal time — both .add()s use the same source fd, the
trace shows post-dup values which are consecutive but point at the
same dma_buf.

This means the earlier phase 0 conclusion ("mpv mixes per-plane
fds with single-allocation offset") was wrong. The wl_dmabuf
message is internally consistent. Bug is somewhere else.

New hypothesis space (in phase2_iter1_findings.md):
  - Mali-G52 panfrost EGL_dma_buf_import with non-zero plane offset
  - KWin wl_dmabuf import deduplication bug
  - hantro kernel exports dma_buf with size < full allocation
  - environment-reset incompleteness from earlier kwin-fourier A/B

Recommended next moves: probe fd size on ohm, mpv debug-logging
patch, KWin source-read, update issue #1 with revised analysis.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 20:12:47 +00:00