DEBUG: sentinel-pattern test for CAPTURE buffer write

Diagnostic-only. Writes 0xab×32 into the CAPTURE buffer's first 32
bytes immediately before VIDIOC_QBUF. The 0010 hex-dump after
DQBUF reveals which case we're in:

  - All 0xab → kernel never wrote to this buffer (wrong buffer
    chosen, alias, or no decode actually happened despite
    bytesused=3655712 reported).
  - All zeros → kernel did write 0x00s (overwriting our
    sentinel), and the apparent "no picture" output is the
    kernel-side decode actually producing zeros (e.g. parser
    rejected the bitstream).
  - Mix of zeros and real luma values → kernel wrote real
    decoded pixels; CPU read sees stale-cached zeros somewhere
    OR the sentinel area was a header that decoder zeroed but
    rest is real. Need to check more bytes.
  - All 0xab still → kernel never touched this region but other
    parts of buffer may be filled (incomplete decode).

Removed once Step 1 decode is verified.

Signed-off-by: Markus Fritsche <fritsche.markus@gmail.com>
This commit is contained in:
2026-05-01 12:00:00 +00:00
parent 3609fbb425
commit 1690dfaa79
+18
View File
@@ -349,6 +349,24 @@ VAStatus RequestEndPicture(VADriverContextP context, VAContextID context_id)
if (rc != VA_STATUS_SUCCESS)
return rc;
/*
* DEBUG INSTRUMENTATION (0011): write a sentinel pattern into
* the CAPTURE buffer's first 32 bytes BEFORE QBUF. If after
* DQBUF the sentinel survives (per surface.c hex dump), the
* kernel never wrote to this buffer. If the sentinel is gone
* (replaced by zeros), the kernel did write but our CPU read
* sees stale-cached data — cache-coherency issue.
*/
{
unsigned char *p = (unsigned char *)
surface_object->destination_map[0];
if (p != NULL) {
unsigned int i;
for (i = 0; i < 32; i++)
p[i] = 0xab;
}
}
rc = v4l2_queue_buffer(driver_data->video_fd, -1, capture_type, NULL,
surface_object->destination_index, 0,
surface_object->destination_buffers_count);