[PATCH 2/2] media: verisilicon: av1: Read the segmentation map at the reference's offset
Benjamin Gaignard
benjamin.gaignard at collabora.com
Tue Nov 17 07:50:24 PST 2026
Le 15/11/2026 à 09:59, Arun Iyengar via B4 Relay a écrit :
> From: Arun Iyengar <aiyengar1990 at gmail.com>
>
> The segmentation map of the primary reference is read at the motion
> vector offset of the current CAPTURE format. After a switch to a larger
> format, that is past the end of a reference held in a smaller buffer.
>
> Use the reference's own offset, and skip the map of a reference of
> another size (the spec then uses segment 0, load_previous_segment_ids()
> in section 6.8.2).
>
> Fixes: 727a400686a2 ("media: verisilicon: Add Rockchip AV1 decoder")
> Cc: stable at vger.kernel.org
> Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard at collabora.com>
> ---
> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c b/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
> index 59f2adf74850..f23af435f961 100644
> --- a/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
> +++ b/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
> @@ -899,15 +899,17 @@ static void rockchip_vpu981_av1_dec_set_segmentation(struct hantro_ctx *ctx)
> if (!!(seg->flags & V4L2_AV1_SEGMENTATION_FLAG_ENABLED) &&
> frame->primary_ref_frame < V4L2_AV1_REFS_PER_FRAME) {
> int idx = rockchip_vpu981_get_frame_index(ctx, frame->primary_ref_frame);
> + int mi_cols = DIV_ROUND_UP(frame->frame_width_minus_1 + 1, 8);
> + int mi_rows = DIV_ROUND_UP(frame->frame_height_minus_1 + 1, 8);
>
> - if (idx >= 0) {
> + if (idx >= 0 && av1_dec->frame_refs[idx].mi_cols == mi_cols &&
> + av1_dec->frame_refs[idx].mi_rows == mi_rows) {
> dma_addr_t luma_addr, mv_addr = 0;
> struct hantro_decoded_buffer *seg;
> - size_t mv_offset = rockchip_vpu981_av1_dec_chroma_size(ctx);
>
> seg = vb2_to_hantro_decoded_buf(rockchip_vpu981_av1_dec_ref_buf(ctx, idx));
> luma_addr = hantro_get_dec_buf_addr(ctx, &seg->base.vb.vb2_buf);
> - mv_addr = luma_addr + mv_offset;
> + mv_addr = luma_addr + seg->av1.mv_offset;
>
> hantro_write_addr(vpu, AV1_SEGMENTATION, mv_addr);
> hantro_reg_write(vpu, &av1_use_temporal3_mvs, 1);
>
More information about the Linux-rockchip
mailing list