b47938e0bc
build and publish packages / distcc-avahi-aarch64 (push) Successful in 1m3s
build and publish packages / lmcp-any (push) Successful in 9s
build and publish packages / lmcp-debian (push) Successful in 4s
build and publish packages / claude-his-any (push) Failing after 4s
build and publish packages / ffmpeg-v4l2-request-aarch64 (push) Has been skipped
build and publish packages / claude-his-debian (push) Has been skipped
Mirrors phase6/step1/ from the ohm_gl_fix campaign. Contract-correct
hantro multi-planar / chromium-149-era stateless H.264 port of
bootlin's libva-v4l2-request, patches 0001..0018 + fourier-local.
Honest characterisation in README:
- Builds cleanly on chromium-builder LXC (boltzmann)
- vainfo enumerates H.264 profiles cleanly with LIBVA_DRIVER_NAME=v4l2_request
- NOT on Brave's decode path on ohm_gl_fix stack — Brave uses
Chromium's own V4L2VideoDecoder in media/gpu/v4l2/.
- Most likely useful for a future Firefox-via-libavcodec-vaapi
campaign, modulo a separate Mesa-panfrost WSI pitch issue.
- DEBUG patches (0010, 0011, 0014) intentionally kept in series
for development; remove for cleaner production runs.
Audit trail in the source repo at ohm_gl_fix:
phase6/step1/audit_0008_decode_params_2026-05-01.md
phase6/step1/api_contract_findings_2026-05-01.md
phase3_remeasure_2026-05-02/B3_decoder_discovery.md (why this
isn't on Brave's path)
59 lines
2.6 KiB
Diff
59 lines
2.6 KiB
Diff
From: Markus Fritsche <fritsche.markus@gmail.com>
|
|
Date: 2026-05-01
|
|
Subject: [PATCH] surface: don't VIDIOC_S_FMT the CAPTURE queue
|
|
|
|
The hantro stateless decoder derives the CAPTURE format from the
|
|
SPS attached to the per-request OUTPUT controls. Calling
|
|
VIDIOC_S_FMT on the CAPTURE queue at vaCreateSurfaces2 time can
|
|
leave the driver's vb2 state in an inconsistent configuration
|
|
where the queue accepts buffers and DQBUF returns successfully but
|
|
the kernel never actually writes decoded pixels into them.
|
|
|
|
Cross-reference: GStreamer's gst-plugins-bad/sys/v4l2codecs/
|
|
gstv4l2decoder.c only calls VIDIOC_G_FMT on the CAPTURE side
|
|
(via gst_v4l2_decoder_negotiate_src_format and friends). The
|
|
same code path produces correctly-decoded NV12 frames on the
|
|
same RK3568 hantro-vpu where libva-v4l2-request-with-S_FMT
|
|
emits flat-green zeroed CAPTURE buffers.
|
|
|
|
The v4l2_get_format() call immediately after this block already
|
|
gives us the bytesperline / sizes the driver chose; nothing else
|
|
in this file consumed the explicit S_FMT side-effects.
|
|
|
|
Empirical hypothesis test for the lingering "kernel decodes
|
|
without errors but emits zeroed CAPTURE" bug. If post-patch
|
|
output shows actual picture content, this confirms the
|
|
diagnosis: explicit CAPTURE format mutation breaks hantro's
|
|
internal state. If output remains flat-green, the bug is
|
|
elsewhere and we resume hex-dump-grade instrumentation.
|
|
|
|
Signed-off-by: Markus Fritsche <fritsche.markus@gmail.com>
|
|
---
|
|
--- a/src/surface.c 2026-05-01 21:16:19.588759711 +0000
|
|
+++ b/src/surface.c 2026-05-01 21:41:12.095146549 +0000
|
|
@@ -118,10 +118,20 @@
|
|
|
|
capture_type = v4l2_type_video_capture(video_format->v4l2_mplane);
|
|
|
|
- rc = v4l2_set_format(driver_data->video_fd, capture_type,
|
|
- video_format->v4l2_format, width, height);
|
|
- if (rc < 0)
|
|
- return VA_STATUS_ERROR_OPERATION_FAILED;
|
|
+ /*
|
|
+ * Do not VIDIOC_S_FMT on the CAPTURE queue. The hantro
|
|
+ * stateless decoder derives the CAPTURE format from the
|
|
+ * SPS attached to the OUTPUT request; explicitly setting
|
|
+ * it here can put the driver into an inconsistent state.
|
|
+ * GStreamer's v4l2slh264dec only G_FMTs CAPTURE (see
|
|
+ * gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c::
|
|
+ * gst_v4l2_decoder_negotiate_src_format), and that
|
|
+ * variant produces correct decoded NV12 on the same
|
|
+ * hardware where this driver currently emits zeros.
|
|
+ *
|
|
+ * v4l2_get_format() below queries the driver's current
|
|
+ * state and gives us the bytesperline/sizes we need.
|
|
+ */
|
|
} else {
|
|
video_format = driver_data->video_format;
|
|
capture_type = v4l2_type_video_capture(video_format->v4l2_mplane);
|