From 843febc174afd3871ea2387953b6a3ee228b755f Mon Sep 17 00:00:00 2001 From: Markus Fritsche Date: Tue, 5 May 2026 14:51:10 +0000 Subject: [PATCH] iter5 sweep: remove iter1 slice_header parse + VAPicture dump + Sync RETURN trace h264.c: - Remove the slice_header parse success log (the parse data is now forwarded into decode_params directly without per-frame echo). Keep the FAILED-rc log since it indicates a real decode-blocking error. - Remove the iter1 patch-0014 VAPictureH264 byte-dump + field-read log block. The TopFieldOrderCnt=65536 anomaly it diagnosed was resolved by the POC sentinel strip (h264_strip_ffmpeg_poc_sentinel) that stays in the codebase. surface.c: - Remove the per-call "RequestSyncSurface RETURN status=" trace. - Remove the per-call "RequestSyncSurface early-exit" trace. v4l2.c: - Suppress the per-frame "Unable to get control(s): Permission denied" log when errno == EACCES (the expected case on this hantro rig per iter1 patch-0014's findings). The one-time announcement in h264.c stays. Real EACCES-on-non-request-fd or other errno values still log normally. Per-frame v4l2-request log noise drops from ~30+ lines/frame to init-time + once-per-resolution-change. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/h264.c | 44 -------------------------------------------- src/surface.c | 4 ---- src/v4l2.c | 11 ++++++++++- 3 files changed, 10 insertions(+), 49 deletions(-) diff --git a/src/h264.c b/src/h264.c index 4f30c2b..113aecf 100644 --- a/src/h264.c +++ b/src/h264.c @@ -430,14 +430,6 @@ static void h264_va_picture_to_v4l2(struct request_data *driver_data, decode->delta_pic_order_cnt1 = sh.delta_pic_order_cnt1; decode->pic_order_cnt_bit_size = sh.pic_order_cnt_bit_size; decode->dec_ref_pic_marking_bit_size = sh.dec_ref_pic_marking_bit_size; - request_log("slice_header parse: idr_pic_id=%u " - "poc_lsb=%u poc_bits=%u refmark_bits=%u " - "frame_num=%u slice_type=%u pps_id=%u\n", - sh.idr_pic_id, sh.pic_order_cnt_lsb, - sh.pic_order_cnt_bit_size, - sh.dec_ref_pic_marking_bit_size, - sh.frame_num, sh.slice_type, - sh.pic_parameter_set_id); } else { request_log("slice_header parse FAILED rc=%d " "(payload_len=%zu) — DECODE_PARAMS bit_size " @@ -464,42 +456,6 @@ static void h264_va_picture_to_v4l2(struct request_data *driver_data, * the OUTPUT bitstream — a hypothesis verified empirically by * running this patch and inspecting the CAPTURE buffer. */ - /* - * DEBUG INSTRUMENTATION (0014): dump the raw bytes of - * VAPicture->CurrPic plus sizeof(VAPictureH264) so we can - * tell whether the observed TopFieldOrderCnt=65536 anomaly is - * (a) at the documented byte-offset 12 (ffmpeg-side bug or - * intentional non-spec encoding) or - * (b) at a different offset (libva ABI / VA_PADDING_LOW - * mismatch between ffmpeg's writer and our reader). - * - * Documented VAPictureH264 layout (libva-2.x): - * offset 0: VASurfaceID picture_id (uint32) - * offset 4: uint32 frame_idx - * offset 8: uint32 flags - * offset 12: int32 TopFieldOrderCnt - * offset 16: int32 BottomFieldOrderCnt - * offset 20+: uint32 va_reserved[VA_PADDING_LOW] - */ - { - const unsigned char *cp = (const unsigned char *)&VAPicture->CurrPic; - char hex[32 * 3 + 1] = { 0 }; - unsigned int i; - for (i = 0; i < 32; i++) - snprintf(hex + i * 3, 4, " %02x", cp[i]); - request_log("VAPictureH264 sizeof=%zu CurrPic[0..31]:%s\n", - sizeof(VAPictureH264), hex); - request_log("VAPictureH264 CurrPic field reads: " - "picture_id=0x%08x frame_idx=%u flags=0x%x " - "TopFOC=%d BottomFOC=%d frame_num=%u\n", - (unsigned)VAPicture->CurrPic.picture_id, - (unsigned)VAPicture->CurrPic.frame_idx, - (unsigned)VAPicture->CurrPic.flags, - (int)VAPicture->CurrPic.TopFieldOrderCnt, - (int)VAPicture->CurrPic.BottomFieldOrderCnt, - (unsigned)VAPicture->frame_num); - } - decode->nal_ref_idc = nal_ref_idc; decode->frame_num = VAPicture->frame_num; decode->top_field_order_cnt = diff --git a/src/surface.c b/src/surface.c index 348d493..549b595 100644 --- a/src/surface.c +++ b/src/surface.c @@ -437,8 +437,6 @@ VAStatus RequestSyncSurface(VADriverContextP context, VASurfaceID surface_id) if (surface_object->status != VASurfaceRendering) { status = VA_STATUS_SUCCESS; - request_log(" RequestSyncSurface(surf=%u) early-exit, status=%d\n", - surface_id, surface_object->status); goto complete; } @@ -522,8 +520,6 @@ error: } complete: - request_log(" RequestSyncSurface(surf=%u) RETURN status=%d\n", - surface_id, status); return status; } diff --git a/src/v4l2.c b/src/v4l2.c index abc7b66..1063c5d 100644 --- a/src/v4l2.c +++ b/src/v4l2.c @@ -457,7 +457,16 @@ int v4l2_get_controls(int video_fd, int request_fd, rc = v4l2_ioctl_controls(video_fd, request_fd, VIDIOC_G_EXT_CTRLS, control_array, num_controls); if (rc < 0) { - request_log("Unable to get control(s): %s\n", strerror(errno)); + /* + * EACCES on G_EXT_CTRLS for request fds is the normal case on + * this hantro rig — the kernel doesn't allow readback through + * the request_fd. Caller (h264.c) tracks this with a one-time + * "V4L2 readback unavailable" announcement. Suppress per-call + * noise to keep the log signal-to-noise high. + */ + if (errno != EACCES) + request_log("Unable to get control(s): %s\n", + strerror(errno)); return -1; }