All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kyrie Wu" <kyrie.wu@mediatek.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
	linux-media@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 13/14] media: mediatek: decoder: fill av1 buffer size with picinfo
Date: Wed, 03 Jun 2026 09:07:29 +0000	[thread overview]
Message-ID: <20260603090730.4036F1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603084045.17488-14-kyrie.wu@mediatek.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The C plane buffer size (`vref->c.size`) is completely missing initialization for reference frames, leaving it as zero in the shared hardware structure.
--

commit a2c9dc4836cf2314c45a5c3f24634d8cb307be25
Author: Yunfei Dong <yunfei.dong@mediatek.com>

media: mediatek: decoder: fill av1 buffer size with picinfo

The buffer size of y and c plane has been calculated in vcp/scp,
and this commit fills each frame buffer size directly using picinfo.

> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c
> --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c
> @@ -1811,18 +1811,19 @@ static int vdec_av1_slice_setup_core_buffer(struct vdec_av1_slice_instance *inst
>  {
>  	struct vb2_buffer *vb;
>  	struct vb2_queue *vq;
> -	int w, h, plane, size;
> +	int plane;
>  	int i;
>  
>  	plane = instance->ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes;
> -	w = vsi->frame.uh.upscaled_width;
> -	h = vsi->frame.uh.frame_height;
> -	size = ALIGN(w, VCODEC_DEC_ALIGNED_64) * ALIGN(h, VCODEC_DEC_ALIGNED_64);
>  
>  	/* frame buffer */
>  	vsi->fb.y.dma_addr = fb->base_y.dma_addr;
> +
> +	vsi->fb.y.size = instance->ctx->picinfo.fb_sz[0];
> +	vsi->fb.c.size = instance->ctx->picinfo.fb_sz[1];
> +
>  	if (plane == 1)
> -		vsi->fb.c.dma_addr = fb->base_y.dma_addr + size;
> +		vsi->fb.c.dma_addr = fb->base_y.dma_addr + vsi->fb.y.size;
>  	else
>  		vsi->fb.c.dma_addr = fb->base_c.dma_addr;

[ ... ]

> @@ -1845,8 +1846,9 @@ static int vdec_av1_slice_setup_core_buffer(struct vdec_av1_slice_instance *inst
>  		}
>  
>  		vref->y.dma_addr = vb2_dma_contig_plane_dma_addr(vb, 0);
> +		vref->y.size = vsi->fb.y.size;
>  		if (plane == 1)
> -			vref->c.dma_addr = vref->y.dma_addr + size;
> +			vref->c.dma_addr = vref->y.dma_addr + vsi->fb.y.size;
>  		else
>  			vref->c.dma_addr = vb2_dma_contig_plane_dma_addr(vb, 1);
>  	}

[Severity: High]
Are we missing an assignment for vref->c.size here?

Earlier in vdec_av1_slice_setup_core_buffer(), vsi->fb.c.size is explicitly
initialized, but here for the reference frames only vref->y.size is assigned.

Because the underlying vsi structure is backed by zero-initialized memory,
the C plane size for all reference frames will be left as zero.

Could this missing initialization cause visual corruption or trigger a
coprocessor fault when the firmware uses these reference buffer sizes for DMA
configuration and bounds checking?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260603084045.17488-1-kyrie.wu@mediatek.com?part=13

  reply	other threads:[~2026-06-03  9:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  8:40 [PATCH v5 00/14] media: mediatek: vcodec: support video decoder in mt8196 Kyrie Wu
2026-06-03  8:40 ` [PATCH v5 01/14] media: mediatek: vcodec: support vcp architecture Kyrie Wu
2026-06-03  8:40 ` [PATCH v5 02/14] media: mediatek: vcodec: add driver to support vcp Kyrie Wu
2026-06-03  8:58   ` sashiko-bot
2026-06-03  8:40 ` [PATCH v5 03/14] media: mediatek: vcodec: add driver to support vcp encoder Kyrie Wu
2026-06-03 11:01   ` sashiko-bot
2026-06-03  8:40 ` [PATCH v5 04/14] media: mediatek: vcodec: get different firmware ipi id Kyrie Wu
2026-06-03  8:40 ` [PATCH v5 05/14] media: mediatek: vcodec: get share memory address Kyrie Wu
2026-06-03  8:59   ` sashiko-bot
2026-06-03  8:40 ` [PATCH v5 06/14] media: mediatek: vcodec: define MT8196 vcodec levels Kyrie Wu
2026-06-03  8:51   ` sashiko-bot
2026-06-03  8:40 ` [PATCH v5 07/14] media: mediatek: vcodec: support 36bit iova address Kyrie Wu
2026-06-03  8:52   ` sashiko-bot
2026-06-03  8:40 ` [PATCH v5 08/14] media: mediatek: vcodec: clean xpc status Kyrie Wu
2026-06-03  8:54   ` sashiko-bot
2026-06-03  8:40 ` [PATCH v5 09/14] media: mediatek: vcodec: add debug information Kyrie Wu
2026-06-03  8:54   ` sashiko-bot
2026-06-03  8:40 ` [PATCH v5 10/14] media: mediatek: vcodec: send share memory address to vcp Kyrie Wu
2026-06-03 11:09   ` sashiko-bot
2026-06-03  8:40 ` [PATCH v5 11/14] dt-bindings: media: mediatek: vcodec: add decoder dt-bindings for mt8196 Kyrie Wu
2026-06-03  9:03   ` sashiko-bot
2026-06-03 16:14   ` Conor Dooley
2026-06-03 16:14     ` Conor Dooley
2026-06-03  8:40 ` [PATCH v5 12/14] media: mediatek: vcodec: add decoder compatible to support mt8196 Kyrie Wu
2026-06-03  8:59   ` sashiko-bot
2026-06-03  8:40 ` [PATCH v5 13/14] media: mediatek: decoder: fill av1 buffer size with picinfo Kyrie Wu
2026-06-03  9:07   ` sashiko-bot [this message]
2026-06-03  8:40 ` [PATCH v5 14/14] media: mediatek: decoder: support av1 extend vsi Kyrie Wu
2026-06-03  9:10   ` sashiko-bot

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=20260603090730.4036F1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kyrie.wu@mediatek.com \
    --cc=linux-media@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.