author | Nanxin Qin <nanxin.qin@amlogic.com> | 2020-05-21 03:18:07 (GMT) |
---|---|---|
committer | shuanglong wang <shuanglong.wang@amlogic.com> | 2020-07-22 05:09:47 (GMT) |
commit | f28061a40159ea5cad115336a3c3f3eb99171210 (patch) | |
tree | 240a61229f756420d3b7c189bae3e24b96e76be4 | |
parent | 87e53d07cebb868c4973843d0a374ec94d990e4f (diff) | |
download | media_modules-f28061a40159ea5cad115336a3c3f3eb99171210.zip media_modules-f28061a40159ea5cad115336a3c3f3eb99171210.tar.gz media_modules-f28061a40159ea5cad115336a3c3f3eb99171210.tar.bz2 |
v4l: fixed some issues of the v4l codec. [1/1]
PD#SWPL-26430
Problem:
1. the first picture output 2 times.
2. exception calltrace was found when exit multi-inst playbacks
Solution:
1. the first frame of es must be removed after probe done.
2. clean vb2 buffers status when cmd stream stop.
Verify:
u212
Change-Id: Ic90a5a48e0e2f966e150dc76ba7902a8a9920f3e
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
(cherry picked from commit 6c27635450014c78a9da7fbbabd5b25546122806)
-rw-r--r-- | drivers/amvdec_ports/aml_vcodec_dec.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/amvdec_ports/aml_vcodec_dec.c b/drivers/amvdec_ports/aml_vcodec_dec.c index 2ffab91..c6b2b3c 100644 --- a/drivers/amvdec_ports/aml_vcodec_dec.c +++ b/drivers/amvdec_ports/aml_vcodec_dec.c @@ -2169,6 +2169,10 @@ static void vb2ops_vdec_buf_queue(struct vb2_buffer *vb) if (ctx->is_drm_mode && src_mem.model == VB2_MEMORY_DMABUF) { v4l2_m2m_src_buf_remove(ctx->m2m_ctx); aml_recycle_dma_buffers(ctx); + } else if (ctx->param_sets_from_ucode) { + v4l2_m2m_src_buf_remove(ctx->m2m_ctx); + v4l2_m2m_buf_done(to_vb2_v4l2_buffer(vb), + VB2_BUF_STATE_DONE); } if (vdec_if_get_param(ctx, GET_PARAM_PIC_INFO, &ctx->picinfo)) { @@ -2370,16 +2374,25 @@ static void vb2ops_vdec_stop_streaming(struct vb2_queue *q) codec_mm_bufs_cnt_clean(q); if (V4L2_TYPE_IS_OUTPUT(q->type)) { + if (ctx->is_drm_mode && q->memory == VB2_MEMORY_DMABUF) + aml_recycle_dma_buffers(ctx); + while ((vb2_v4l2 = v4l2_m2m_src_buf_remove(ctx->m2m_ctx))) v4l2_m2m_buf_done(vb2_v4l2, VB2_BUF_STATE_ERROR); - if (ctx->is_drm_mode && q->memory == VB2_MEMORY_DMABUF) - aml_recycle_dma_buffers(ctx); + for (i = 0; i < q->num_buffers; ++i) { + vb2_v4l2 = to_vb2_v4l2_buffer(q->bufs[i]); + if (vb2_v4l2->vb2_buf.state == VB2_BUF_STATE_ACTIVE) + v4l2_m2m_buf_done(vb2_v4l2, VB2_BUF_STATE_ERROR); + } } else { /* clean output cache and decoder status . */ if (ctx->state > AML_STATE_INIT) aml_vdec_reset(ctx); + while ((vb2_v4l2 = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx))) + v4l2_m2m_buf_done(vb2_v4l2, VB2_BUF_STATE_ERROR); + for (i = 0; i < q->num_buffers; ++i) { vb2_v4l2 = to_vb2_v4l2_buffer(q->bufs[i]); buf = container_of(vb2_v4l2, struct aml_video_dec_buf, vb); |