Files
marfrit-packages/arch/libva-v4l2-request-ohm-gl-fix/0010-DEBUG-hex-dump-output-capture.patch
T
test0r 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
Add libva-v4l2-request-ohm-gl-fix package
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)
2026-05-02 15:17:10 +00:00

102 lines
3.3 KiB
Diff

From: Markus Fritsche <fritsche.markus@gmail.com>
Date: 2026-05-01
Subject: [PATCH] DEBUG: hex-dump OUTPUT and CAPTURE buffer contents per frame
Diagnostic-only patch (NOT for upstream). Hex-dumps:
- First 32 bytes of OUTPUT buffer at QBUF time in
picture.c::RequestEndPicture (i.e. what we feed the kernel)
- First 32 bytes of CAPTURE Y-plane after DQBUF in
surface.c::RequestSyncSurface (i.e. what kernel returned)
Lets us see whether:
- OUTPUT bitstream begins with valid ANNEX_B start code + NAL
header byte (e.g. `00 00 01 65` for IDR slice)
- CAPTURE Y-plane after decode contains varied luma data
(working) vs. all-zeros / repeating pattern (kernel didn't
write anything).
Removed once Step 1 decode is verified working. Output goes via
existing request_log() to stderr.
Signed-off-by: Markus Fritsche <fritsche.markus@gmail.com>
---
--- a/src/picture.c 2026-05-01 21:41:00.114969150 +0000
+++ b/src/picture.c 2026-05-01 21:50:11.123117853 +0000
@@ -36,6 +36,7 @@
#include "mpeg2.h"
#include <assert.h>
+#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -354,6 +355,27 @@
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
+ /*
+ * DEBUG INSTRUMENTATION (0010): hex-dump first 32 bytes of the
+ * OUTPUT buffer at the moment we hand it to the kernel. Helps
+ * pin down whether our bitstream prepend logic is correct.
+ * For a valid ANNEX_B IDR slice the dump should start
+ * 00 00 01 65 ... (00 00 01 = start code; 0x65 = nal_ref_idc=3,
+ * nal_unit_type=5 = IDR slice). Removed once Step 1 decode is
+ * verified working.
+ */
+ {
+ const unsigned char *p = surface_object->source_data;
+ char hex[32 * 3 + 1] = { 0 };
+ unsigned int i, n = surface_object->slices_size < 32 ?
+ surface_object->slices_size : 32;
+ for (i = 0; i < n; i++)
+ snprintf(hex + i * 3, 4, " %02x", p[i]);
+ request_log("OUTPUT[idx=%u, len=%u]:%s\n",
+ surface_object->source_index,
+ surface_object->slices_size, hex);
+ }
+
rc = v4l2_queue_buffer(driver_data->video_fd, request_fd, output_type,
&surface_object->timestamp,
surface_object->source_index,
--- a/src/surface.c 2026-05-01 21:41:12.095146549 +0000
+++ b/src/surface.c 2026-05-01 21:50:15.895188360 +0000
@@ -29,6 +29,7 @@
#include <assert.h>
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -364,6 +365,30 @@
goto error;
}
+ /*
+ * DEBUG INSTRUMENTATION (0010): hex-dump first 32 bytes of the
+ * decoded CAPTURE Y-plane after DQBUF. If the kernel actually
+ * decoded the frame, these should reflect a real Y-luma pattern
+ * (varied bytes). All-zero or all-identical means no decode
+ * landed pixels in the buffer. Removed once Step 1 is verified.
+ */
+ {
+ const unsigned char *p =
+ (unsigned char *)surface_object->destination_map[0];
+ char hex[32 * 3 + 1] = { 0 };
+ unsigned int i;
+ if (p == NULL) {
+ request_log("CAPTURE[idx=%u, plane0]: (NULL)\n",
+ surface_object->destination_index);
+ } else {
+ for (i = 0; i < 32; i++)
+ snprintf(hex + i * 3, 4, " %02x", p[i]);
+ request_log("CAPTURE[idx=%u, plane0]:%s\n",
+ surface_object->destination_index,
+ hex);
+ }
+ }
+
surface_object->status = VASurfaceDisplaying;
status = VA_STATUS_SUCCESS;