Re: [PATCH 3/5] media: mediatek: vcodec: Fix h264 set lat buffer error

From: Yunfei Dong (董云飞)
Date: Thu Nov 17 2022 - 04:30:02 EST


Hi AngeloGioacchino,

Thanks for your detail comments.

Change the driver according to your suggestion in v2.

Best Regards,
Yunfei Dong

On Mon, 2022-11-14 at 12:26 +0100, AngeloGioacchino Del Regno wrote:
> Il 12/11/22 10:41, Yunfei Dong ha scritto:
> > Will set lat buffer to lat_list two times when lat decode timeout
> > for
> > inner racing mode.
> >
> > If core thread can't get frame buffer, need to return error value.
> >
> > Fixes: 59fba9eed5a7 ("media: mediatek: vcodec: support stateless
> > H.264 decoding for mt8192")
> > Signed-off-by: Yunfei Dong <yunfei.dong@xxxxxxxxxxxx>
> > ---
> > .../vcodec/vdec/vdec_h264_req_multi_if.c | 23 ++++++++++++
> > -------
> > 1 file changed, 15 insertions(+), 8 deletions(-)
> >
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_i
> > f.c
> > b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_i
> > f.c
> > index 4cc92700692b..2b7576265f48 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_i
> > f.c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_i
> > f.c
> > @@ -471,6 +471,12 @@ static int vdec_h264_slice_core_decode(struct
> > vdec_lat_buf *lat_buf)
> > sizeof(share_info->h264_slice_params));
> >
> > fb = ctx->dev->vdec_pdata->get_cap_buffer(ctx);
> > + if (!fb) {
> > + err = -EBUSY;
> > + mtk_vcodec_err(inst, "fb buffer is NULL");
> > + goto vdec_dec_end;
> > + }
> > +
> > y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
>
> If you're jumping to vdec_dec_end, this check becomes pointless as
> y_fb_dma
> will never be set to 0, so you can remove the conditional on
> assigning
> the dma address to `y_fb_dma`.
>
> Same comment a few lines later for `c_fb_dma`.
>
> Regards,
> Angelo
>
>