diff --git a/src/picture.c b/src/picture.c index a0c82a2..bab34f3 100644 --- a/src/picture.c +++ b/src/picture.c @@ -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);