Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: rkvdec: vdpu383: Fix off-by-one in DPB POC setup
@ 2026-11-30  8:28 Lin Huiyi
  0 siblings, 0 replies; only message in thread
From: Lin Huiyi @ 2026-11-30  8:28 UTC (permalink / raw)
  To: detlev.casanova, ezequiel
  Cc: mchehab, heiko, linux-media, linux-rockchip, linux-arm-kernel,
	Lin Huiyi

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.

Fixes: 4ae45bf4663e ("media: rkvdec: vdpu383: Drop bitfields for the bitwriter")
Signed-off-by: Lin Huiyi <xinghui79@qq.com>
---
 drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c
index 3462d995d4..6a8ea5b193 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c
@@ -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),
-- 
2.56.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-30  8:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30  8:28 [PATCH] media: rkvdec: vdpu383: Fix off-by-one in DPB POC setup Lin Huiyi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox