[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241116031724.15694-5-yunfei.dong@mediatek.com>
Date: Sat, 16 Nov 2024 11:17:18 +0800
From: Yunfei Dong <yunfei.dong@...iatek.com>
To: NĂcolas F . R . A . Prado
<nfraprado@...labora.com>, Sebastian Fricke <sebastian.fricke@...labora.com>,
Nicolas Dufresne <nicolas.dufresne@...labora.com>, Hans Verkuil
<hverkuil-cisco@...all.nl>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, Benjamin Gaignard
<benjamin.gaignard@...labora.com>, Nathan Hebert <nhebert@...omium.org>,
Daniel Almeida <daniel.almeida@...labora.com>
CC: Hsin-Yi Wang <hsinyi@...omium.org>, Fritz Koenig <frkoenig@...omium.org>,
Daniel Vetter <daniel@...ll.ch>, Steve Cho <stevecho@...omium.org>, Yunfei
Dong <yunfei.dong@...iatek.com>, <linux-media@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-mediatek@...ts.infradead.org>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: [PATCH v7 4/5] media: mediatek: vcodec: Get SRC buffer from bitstream instead of M2M
Getting the SRC buffer from M2M will pick a different than the one
used for current decode operation when the SRC buffer is removed
from ready list.
Signed-off-by: Yunfei Dong <yunfei.dong@...iatek.com>
Reviewed-by: Chen-Yu Tsai <wenst@...omium.org>
---
.../vcodec/decoder/vdec/vdec_av1_req_lat_if.c | 14 ++++++++------
.../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 15 +++++++--------
2 files changed, 15 insertions(+), 14 deletions(-)
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
index bf21f2467a0f..68e02c18a0af 100644
--- 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
@@ -1062,18 +1062,20 @@ static inline void vdec_av1_slice_vsi_to_remote(struct vdec_av1_slice_vsi *vsi,
static int vdec_av1_slice_setup_lat_from_src_buf(struct vdec_av1_slice_instance *instance,
struct vdec_av1_slice_vsi *vsi,
+ struct mtk_vcodec_mem *bs,
struct vdec_lat_buf *lat_buf)
{
- struct vb2_v4l2_buffer *src;
+ struct mtk_video_dec_buf *src_buf_info;
struct vb2_v4l2_buffer *dst;
- src = v4l2_m2m_next_src_buf(instance->ctx->m2m_ctx);
- if (!src)
+ src_buf_info = container_of(bs, struct mtk_video_dec_buf, bs_buffer);
+ if (!src_buf_info)
return -EINVAL;
- lat_buf->src_buf_req = src->vb2_buf.req_obj.req;
+ lat_buf->src_buf_req = src_buf_info->m2m_buf.vb.vb2_buf.req_obj.req;
+
dst = &lat_buf->ts_info;
- v4l2_m2m_buf_copy_metadata(src, dst, true);
+ v4l2_m2m_buf_copy_metadata(&src_buf_info->m2m_buf.vb, dst, true);
vsi->frame.cur_ts = dst->vb2_buf.timestamp;
return 0;
@@ -1723,7 +1725,7 @@ static int vdec_av1_slice_setup_lat(struct vdec_av1_slice_instance *instance,
struct vdec_av1_slice_vsi *vsi = &pfc->vsi;
int ret;
- ret = vdec_av1_slice_setup_lat_from_src_buf(instance, vsi, lat_buf);
+ ret = vdec_av1_slice_setup_lat_from_src_buf(instance, vsi, bs, lat_buf);
if (ret)
return ret;
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
index eea709d93820..54a9c1d2695f 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
@@ -712,19 +712,18 @@ int vdec_vp9_slice_setup_single_from_src_to_dst(struct vdec_vp9_slice_instance *
}
static int vdec_vp9_slice_setup_lat_from_src_buf(struct vdec_vp9_slice_instance *instance,
+ struct mtk_vcodec_mem *bs,
struct vdec_lat_buf *lat_buf)
{
- struct vb2_v4l2_buffer *src;
- struct vb2_v4l2_buffer *dst;
+ struct mtk_video_dec_buf *src_buf_info;
- src = v4l2_m2m_next_src_buf(instance->ctx->m2m_ctx);
- if (!src)
+ src_buf_info = container_of(bs, struct mtk_video_dec_buf, bs_buffer);
+ if (!src_buf_info)
return -EINVAL;
- lat_buf->src_buf_req = src->vb2_buf.req_obj.req;
+ lat_buf->src_buf_req = src_buf_info->m2m_buf.vb.vb2_buf.req_obj.req;
+ v4l2_m2m_buf_copy_metadata(&src_buf_info->m2m_buf.vb, &lat_buf->ts_info, true);
- dst = &lat_buf->ts_info;
- v4l2_m2m_buf_copy_metadata(src, dst, true);
return 0;
}
@@ -1154,7 +1153,7 @@ static int vdec_vp9_slice_setup_lat(struct vdec_vp9_slice_instance *instance,
struct vdec_vp9_slice_vsi *vsi = &pfc->vsi;
int ret;
- ret = vdec_vp9_slice_setup_lat_from_src_buf(instance, lat_buf);
+ ret = vdec_vp9_slice_setup_lat_from_src_buf(instance, bs, lat_buf);
if (ret)
goto err;
--
2.46.0
Powered by blists - more mailing lists