From: Markus Fritsche Date: 2026-05-01 Subject: [PATCH] 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 --- --- a/src/picture.c 2026-05-01 21:50:11.123117853 +0000 +++ b/src/picture.c 2026-05-01 22:20:20.589037667 +0000 @@ -349,6 +349,24 @@ 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);