summaryrefslogtreecommitdiff
authorSong Zhao <song.zhao@amlogic.com>2020-08-12 06:22:29 (GMT)
committer Hui Zhang <hui.zhang@amlogic.com>2020-08-14 07:26:55 (GMT)
commit8c84a9c10e55f8b6d52c125de9266573d253859c (patch)
treea16e5c996142cab1c40c4134a6b0117512941357
parent86b532bfdba90f7145a13b9d02efcc2648b19b9f (diff)
downloadmedia_modules-8c84a9c10e55f8b6d52c125de9266573d253859c.zip
media_modules-8c84a9c10e55f8b6d52c125de9266573d253859c.tar.gz
media_modules-8c84a9c10e55f8b6d52c125de9266573d253859c.tar.bz2
v4l2: do not reset pool fields on streamoff output port [1/1]
PD#SWPL-30433 Problem: a) Streamoff output port will reset cap_pool.in, it will cause decoding error like "v4l_get_free_buf_idx fail" b) Sometimes application will not call dqueue of capture buffer to trigger aml_recycle_dma_buffers(). Solution: ONLY reset cap_pool filed on streamoff capture port. Recycle DMA secure buffer after receiving vframe from VFM. Verify: U212 + RDK + DSTV seek Change-Id: Ic9e72591398c5c68cbad970282f4530a4a91c22f Signed-off-by: Song Zhao <song.zhao@amlogic.com>
Diffstat
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/amvdec_ports/aml_vcodec_dec.c b/drivers/amvdec_ports/aml_vcodec_dec.c
index 99406bc..eecd4f3 100644
--- a/drivers/amvdec_ports/aml_vcodec_dec.c
+++ b/drivers/amvdec_ports/aml_vcodec_dec.c
@@ -194,6 +194,7 @@ extern bool dump_capture_frame;
extern int dmabuf_fd_install_data(int fd, void* data, u32 size);
extern bool is_v4l2_buf_file(struct file *file);
+static void aml_recycle_dma_buffers(struct aml_vcodec_ctx *ctx);
static ulong aml_vcodec_ctx_lock(struct aml_vcodec_ctx *ctx)
{
@@ -518,6 +519,7 @@ EXPORT_SYMBOL(put_fb_to_queue);
void trans_vframe_to_user(struct aml_vcodec_ctx *ctx, struct vdec_v4l2_buffer *fb)
{
struct aml_video_dec_buf *dstbuf = NULL;
+ struct vb2_buffer *vb2_buf = NULL;
struct vframe_s *vf = (struct vframe_s *)fb->vf_handle;
v4l_dbg(ctx, V4L_DEBUG_CODEC_OUTPUT,
@@ -531,6 +533,11 @@ void trans_vframe_to_user(struct aml_vcodec_ctx *ctx, struct vdec_v4l2_buffer *f
fb->m.mem[2].addr, fb->m.mem[2].size);
dstbuf = container_of(fb, struct aml_video_dec_buf, frame_buffer);
+ vb2_buf = &dstbuf->vb.vb2_buf;
+
+ if (ctx->is_drm_mode && vb2_buf->memory == VB2_MEMORY_DMABUF)
+ aml_recycle_dma_buffers(ctx);
+
if (dstbuf->frame_buffer.num_planes == 1) {
vb2_set_plane_payload(&dstbuf->vb.vb2_buf, 0, fb->m.mem[0].bytes_used);
} else if (dstbuf->frame_buffer.num_planes == 2) {
@@ -1406,9 +1413,6 @@ static int vidioc_vdec_dqbuf(struct file *file, void *priv,
struct aml_video_dec_buf *aml_buf = NULL;
struct file *file = NULL;
- if (ctx->is_drm_mode && ctx->output_dma_mode)
- aml_recycle_dma_buffers(ctx);
-
vq = v4l2_m2m_get_vq(ctx->m2m_ctx, buf->type);
vb2_v4l2 = to_vb2_v4l2_buffer(vq->bufs[buf->index]);
aml_buf = container_of(vb2_v4l2, struct aml_video_dec_buf, vb);
@@ -2374,13 +2378,13 @@ static void vb2ops_vdec_stop_streaming(struct vb2_queue *q)
/*v4l_dbg(ctx, V4L_DEBUG_CODEC_EXINFO, "idx: %d, state: %d\n",
q->bufs[i]->index, q->bufs[i]->state);*/
}
- }
- ctx->buf_used_count = 0;
- ctx->cap_pool.in = 0;
- ctx->cap_pool.out = 0;
- ctx->cap_pool.dec = 0;
- ctx->cap_pool.vpp = 0;
+ ctx->buf_used_count = 0;
+ ctx->cap_pool.in = 0;
+ ctx->cap_pool.out = 0;
+ ctx->cap_pool.dec = 0;
+ ctx->cap_pool.vpp = 0;
+ }
}
static void m2mops_vdec_device_run(void *priv)