From e0be4e69924d650997d9a36e4d36dabd2405ae0a Mon Sep 17 00:00:00 2001 From: claude-noether Date: Wed, 13 May 2026 13:55:33 +0000 Subject: [PATCH] =?UTF-8?q?iter9=20Phase=206=20=CE=B1-7:=20monotonic=20per?= =?UTF-8?q?-context=20timestamp=20counter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace gettimeofday in RequestEndPicture with object_context-scoped counter producing small us values (1, 2, 3, ...) so OUTPUT QBUF timestamp and DPB.reference_ts match ffmpeg-v4l2request's pattern. Phase 5 IMP-1: counter scoped to object_context (not driver_data) to avoid multi-context collisions. Empirical confirmation only — reviewer's CRIT-1 predicts this is inert (VP9/MPEG-2 use same path and PASS). If α-7 produces the same broken hash, the libva wire-byte search space is exhausted and iter10 must pivot to slice-data inspection or kernel investigation. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/context.c | 1 + src/context.h | 9 +++++++++ src/picture.c | 14 +++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/context.c b/src/context.c index 09706eb..a46317f 100644 --- a/src/context.c +++ b/src/context.c @@ -254,6 +254,7 @@ VAStatus RequestCreateContext(VADriverContextP context, VAConfigID config_id, goto error; } memset(&context_object->dpb, 0, sizeof(context_object->dpb)); + context_object->timestamp_counter = 0; /* iter9 α-7 */ /* * Initialize the OUTPUT (bitstream-input) buffer pool. Sized by diff --git a/src/context.h b/src/context.h index 50d93d5..66cb08d 100644 --- a/src/context.h +++ b/src/context.h @@ -55,6 +55,15 @@ struct object_context { struct h264_dpb dpb; bool h264_start_code; + /* + * iter9 α-7: monotonic per-context timestamp counter (us). Replaces + * gettimeofday in EndPicture so DPB.reference_ts / OUTPUT QBUF ts + * are small values matching ffmpeg-v4l2request's pattern. Placed + * here (object_context) not driver_data per Phase 5 IMP-1 to avoid + * cross-context collisions. + */ + uint64_t timestamp_counter; + /* fresnel-fourier iter4: VP9 loop-filter delta state, persisted across * frames per kernel UAPI :2578 ("If this syntax * element is not present in the bitstream, users should pass its last diff --git a/src/picture.c b/src/picture.c index edb43d8..f72828b 100644 --- a/src/picture.c +++ b/src/picture.c @@ -461,7 +461,19 @@ VAStatus RequestEndPicture(VADriverContextP context, VAContextID context_id) if (surface_object == NULL) return VA_STATUS_ERROR_INVALID_SURFACE; - gettimeofday(&surface_object->timestamp, NULL); + /* + * iter9 α-7: monotonic per-context counter instead of gettimeofday, + * so DPB.reference_ts / OUTPUT QBUF ts stay small (matches + * ffmpeg-v4l2request's pattern). gettimeofday's giant ns may or may + * not be load-bearing for rkvdec's reference resolution — Phase 5 + * reviewer flagged this as low-probability (VP9/MPEG-2 use the same + * pattern and PASS), but this is the only remaining wire-byte diff. + */ + context_object->timestamp_counter++; + surface_object->timestamp.tv_sec = + (time_t)(context_object->timestamp_counter / 1000000); + surface_object->timestamp.tv_usec = + (suseconds_t)(context_object->timestamp_counter % 1000000); /* * iter6: request_fd was bound to the surface in BeginPicture from