Skip to content

media: rkvdec: Fix the HEVC reference picture set handling

Daniel Golle linux-arm-kernel linux-media linux-rockchip lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 of 7 patches 2 repliesIn review

6 of 7 patches are in this archive. The cover letter announces 7.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7media: rkvdec: hevc: apply request controls firstdrivers/media/platform/rockchip/rkvdec/rkvdec-hevc-common.c+2 -20 replies
2/7media: rkvdec: vdpu383: complete refused HEVC requestsdrivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c+1 -00 replies
3/7media: rkvdec: hevc: bound the RPS reads by the control sizedrivers/media/platform/rockchip/rkvdec/rkvdec-hevc-common.c drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-hevc.c drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c+10 -102 replies
5/7media: rkvdec: vdpu381: refuse HEVC jobs without RPS setsdrivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-hevc.c+8 -110 replies
6/7media: rkvdec: hevc: cache every short-term RPS setdrivers/media/platform/rockchip/rkvdec/rkvdec-hevc-common.c drivers/media/platform/rockchip/rkvdec/rkvdec-hevc-common.h drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-hevc.c +1 more+18 -70 replies
7/7media: rkvdec: hevc: check the RPS scratch allocationdrivers/media/platform/rockchip/rkvdec/rkvdec-hevc-common.c drivers/media/platform/rockchip/rkvdec/rkvdec-hevc-common.h drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-hevc.c +1 more+33 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/7] media: rkvdec: Fix the HEVC reference picture set handling

This series fixes the code the VDPU381 and VDPU383 back ends of the rkvdec driver share for the HEVC EXT_SPS_ST_RPS and EXT_SPS_LT_RPS controls. The defects were found while bringing up the VDPU346 of the RK3568, which uses the VDPU381 back end, on top of Christian Hewitt's VDPU346 series (last posted as v3:
https://lore.kernel.org/r/[email protected]).

Several are memory-safety fixes for input a userspace V4L2 client can submit to the decoder, and carry Cc: stable like the EXT SPS RPS bounds merged in v7.3 (f0b9d7e5be06, 796b5c6d4f16, 052c5ed5a1d9).

Tested on a NanoPi R5C (RK3568) with Linux 6.18 and the VDPU346 series
backported: GStreamer fluster JCT-VC-HEVC_V1 stays at 140/147, an FFmpeg v4l2request build that sets the RPS controls confirms the reads and the short-term set cache, and the VDPU381 refusal removes a watchdog reset of the RK3568. The same VDPU381 back end was exercised on a Radxa ROCK 5B (RK3588): H.264, HEVC and VP9 decode through rkvdec with no kernel message across the fluster runs (HEVC 146/147), a per-patch A/B sweep and a 30-minute stability run, at the baseline throughput. The VDPU383 back end has no hardware here, the code-only patches have no reproducer, and nothing was tested on an RK3576.

An LLM coding agent did the analysis, and helped with writing the patches. A second instance, given only the code, reviewed the series, and has tested and validated it on real hardware independently.

Daniel Golle (7):
media: rkvdec: hevc: apply request controls first
media: rkvdec: vdpu383: complete refused HEVC requests
media: rkvdec: hevc: bound the RPS reads by the control size
media: rkvdec: hevc: bound predicted short-term RPS sets
media: rkvdec: vdpu381: refuse HEVC jobs without RPS sets
media: rkvdec: hevc: cache every short-term RPS set
media: rkvdec: hevc: check the RPS scratch allocation

 .../rockchip/rkvdec/rkvdec-hevc-common.c      | 52 +++++++++++++------
 .../rockchip/rkvdec/rkvdec-hevc-common.h      | 11 +++-
 .../rockchip/rkvdec/rkvdec-vdpu381-hevc.c     | 24 +++++----
 .../rockchip/rkvdec/rkvdec-vdpu383-hevc.c     | 14 +++--
 4 files changed, 67 insertions(+), 34 deletions(-)

base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb

Signature · 1 line
2.56.0