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>
This commit is contained in:
2026-05-01 12:00:00 +00:00
parent 597e896594
commit 3609fbb425
2 changed files with 47 additions and 0 deletions
+25
View File
@@ -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 @@ VAStatus RequestSyncSurface(VADriverContextP context, VASurfaceID surface_id)
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;