From 68dbbdd4b7601fb00ce6df767f9fff5fcd8ba8fa Mon Sep 17 00:00:00 2001 From: claude-noether Date: Thu, 14 May 2026 15:16:40 +0000 Subject: [PATCH] iter30 DIAG: LIBVA_TS_SCALE env-gated timestamp multiplier Default behavior unchanged: counter*1000ns same as before. With LIBVA_TS_SCALE=N, multiplies the ns timestamp by N. Lets us sweep timestamp magnitude to test whether small-ts collides with stale CAPTURE entries in vb2_find_buffer for HEVC frame 2+ bug. Also keeps iter29 slice-tail probe from previous commit. --- src/picture.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/picture.c b/src/picture.c index 9739f6f..29d9d4e 100644 --- a/src/picture.c +++ b/src/picture.c @@ -468,12 +468,23 @@ VAStatus RequestEndPicture(VADriverContextP context, VAContextID context_id) * 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. + * + * iter30 DIAG: LIBVA_TS_SCALE env-gated multiplier so we can sweep + * timestamp magnitude to test whether small-ts collides with stale + * CAPTURE entries in vb2_find_buffer for HEVC frame 2+ divergence. */ 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); + { + uint64_t ns = (uint64_t)context_object->timestamp_counter * 1000; + const char *scale = getenv("LIBVA_TS_SCALE"); + if (scale && scale[0] != '\0') { + uint64_t mul = (uint64_t)strtoull(scale, NULL, 0); + if (mul > 0) + ns *= mul; + } + surface_object->timestamp.tv_sec = (time_t)(ns / 1000000000ULL); + surface_object->timestamp.tv_usec = (suseconds_t)((ns / 1000ULL) % 1000000ULL); + } /* * iter6: request_fd was bound to the surface in BeginPicture from