media: rkvdec: vdpu383: Fix off-by-one in DPB POC setup
Subsystems (3)
PATCH 1/1 media: rkvdec: vdpu383: Fix off-by-one in DPB POC setup
The REF_PIC_POC() and REF_IS_VALID() bitwriter fields only describe 15 entries (i: 0-14), with RESERVED3/RESERVED4 occupying the position a 16th entry would take. The reference address loop in the same function already uses ARRAY_SIZE(dpb) - 1 for exactly this reason.
Commit 4ae45bf4663e ("media: rkvdec: vdpu383: Drop bitfields for the bitwriter") replaced the hand-written 15 assignments with a loop over the full 16-element dpb array. With 16 active DPB entries, the extra iteration writes the 16th POC and valid flag into the reserved fields, which the old code left zeroed.
Limit the loop to 15 entries to match the field definitions and the hardware's reference address programming.
--- drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c +1 -1
@@ -313,7 +313,7 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx,// Setup POC information rkvdec_set_bw_field (hw_ps->info,CURRENT_POC , dec_params->pic_order_cnt_val); -for (i =0 ; i <ARRAY_SIZE (dec_params->dpb); i++) { +for (i =0 ; i <ARRAY_SIZE (dec_params->dpb) -1 ; i++) {rkvdec_set_bw_field (hw_ps->info,REF_IS_VALID (i), !!(dec_params->num_active_dpb_entries > i)); rkvdec_set_bw_field(hw_ps->info, REF_PIC_POC(i),
Signature · 1 line
2.56.1