Commit 12ac20d6 authored by Yunfei Dong's avatar Yunfei Dong Committed by Mauro Carvalho Chehab

media: mediatek: vcodec: Setting lat buf to lat_list when lat decode error

Need to set lat buf to lat_list when lat decode error, or lat buffer will
be lost.

Fixes: 5d418351 ("media: mediatek: vcodec: support stateless VP9 decoding")
Signed-off-by: default avatarYunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 23d677bd
...@@ -2073,21 +2073,23 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, ...@@ -2073,21 +2073,23 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
return -EBUSY; return -EBUSY;
} }
pfc = (struct vdec_vp9_slice_pfc *)lat_buf->private_data; pfc = (struct vdec_vp9_slice_pfc *)lat_buf->private_data;
if (!pfc) if (!pfc) {
return -EINVAL; ret = -EINVAL;
goto err_free_fb_out;
}
vsi = &pfc->vsi; vsi = &pfc->vsi;
ret = vdec_vp9_slice_setup_lat(instance, bs, lat_buf, pfc); ret = vdec_vp9_slice_setup_lat(instance, bs, lat_buf, pfc);
if (ret) { if (ret) {
mtk_vcodec_err(instance, "Failed to setup VP9 lat ret %d\n", ret); mtk_vcodec_err(instance, "Failed to setup VP9 lat ret %d\n", ret);
return ret; goto err_free_fb_out;
} }
vdec_vp9_slice_vsi_to_remote(vsi, instance->vsi); vdec_vp9_slice_vsi_to_remote(vsi, instance->vsi);
ret = vpu_dec_start(&instance->vpu, NULL, 0); ret = vpu_dec_start(&instance->vpu, NULL, 0);
if (ret) { if (ret) {
mtk_vcodec_err(instance, "Failed to dec VP9 ret %d\n", ret); mtk_vcodec_err(instance, "Failed to dec VP9 ret %d\n", ret);
return ret; goto err_free_fb_out;
} }
if (instance->irq) { if (instance->irq) {
...@@ -2107,7 +2109,7 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, ...@@ -2107,7 +2109,7 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
/* LAT trans full, no more UBE or decode timeout */ /* LAT trans full, no more UBE or decode timeout */
if (ret) { if (ret) {
mtk_vcodec_err(instance, "VP9 decode error: %d\n", ret); mtk_vcodec_err(instance, "VP9 decode error: %d\n", ret);
return ret; goto err_free_fb_out;
} }
mtk_vcodec_debug(instance, "lat dma addr: 0x%lx 0x%lx\n", mtk_vcodec_debug(instance, "lat dma addr: 0x%lx 0x%lx\n",
...@@ -2120,6 +2122,9 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, ...@@ -2120,6 +2122,9 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
vdec_msg_queue_qbuf(&ctx->dev->msg_queue_core_ctx, lat_buf); vdec_msg_queue_qbuf(&ctx->dev->msg_queue_core_ctx, lat_buf);
return 0; return 0;
err_free_fb_out:
vdec_msg_queue_qbuf(&ctx->msg_queue.lat_ctx, lat_buf);
return ret;
} }
static int vdec_vp9_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs, static int vdec_vp9_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment