Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: aiyengar1990@gmail.com,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Hans Verkuil <hverkuil@kernel.org>
Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org
Subject: Re: [PATCH 2/2] media: verisilicon: av1: Read the segmentation map at the reference's offset
Date: Tue, 17 Nov 2026 16:50:24 +0100	[thread overview]
Message-ID: <93161ff8-dd0d-4253-aa80-174a33de30dc@collabora.com> (raw)
In-Reply-To: <20261115-b4-vpu981-av1-refs-v1-2-c65769715db9@gmail.com>


Le 15/11/2026 à 09:59, Arun Iyengar via B4 Relay a écrit :
> From: Arun Iyengar <aiyengar1990@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@vger.kernel.org
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>

Reviewed-by: Benjamin Gaignard <benjamin.gaignard@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);
>


      reply	other threads:[~2026-11-17 15:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15  8:59 [PATCH 0/2] media: verisilicon: av1: Fix two reference reads Arun Iyengar via B4 Relay
2026-11-15  8:59 ` [PATCH 1/2] media: verisilicon: av1: Find the reference buffers by timestamp Arun Iyengar via B4 Relay
2026-11-17 15:49   ` Benjamin Gaignard
2026-11-15  8:59 ` [PATCH 2/2] media: verisilicon: av1: Read the segmentation map at the reference's offset Arun Iyengar via B4 Relay
2026-11-17 15:50   ` Benjamin Gaignard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93161ff8-dd0d-4253-aa80-174a33de30dc@collabora.com \
    --to=benjamin.gaignard@collabora.com \
    --cc=aiyengar1990@gmail.com \
    --cc=heiko@sntech.de \
    --cc=hverkuil@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox