From: Nanxin Qin Date: Thu, 9 Jul 2020 16:39:44 +0000 (+0800) Subject: v4l: fixed the issue of cts. [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9787d42524cfe4bc4e58b7f75acd8bc9c349f3eb;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_media.git v4l: fixed the issue of cts. [1/1] PD#SWPL-28575 Problem: When capture buffer's status isn't stream on, there is no flush video pipeline. The driver will not send EOS to the back end, this will cause jamming. Solution: When the upper layer sends the stop command, flush the video pipeline. Verify: U212 Change-Id: I0ae3f73e536bfcba85f8901c2cb7ce4d46b99e75 Signed-off-by: Nanxin Qin --- diff --git a/drivers/amvdec_ports/aml_vcodec_dec.c b/drivers/amvdec_ports/aml_vcodec_dec.c index c8445d2..1216ada 100644 --- a/drivers/amvdec_ports/aml_vcodec_dec.c +++ b/drivers/amvdec_ports/aml_vcodec_dec.c @@ -1126,15 +1126,12 @@ static int vidioc_decoder_cmd(struct file *file, void *priv, if (ret) return ret; - dst_vq = v4l2_m2m_get_vq(ctx->m2m_ctx, - multiplanar ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : - V4L2_BUF_TYPE_VIDEO_CAPTURE); switch (cmd->cmd) { case V4L2_DEC_CMD_STOP: ATRACE_COUNTER("v4l2_stop", 0); if (ctx->state != AML_STATE_ACTIVE) { if (ctx->state >= AML_STATE_IDLE && - ctx->state <= AML_STATE_PROBE) { + ctx->state < AML_STATE_PROBE) { ctx->state = AML_STATE_ABORT; ATRACE_COUNTER("v4l2_state", ctx->state); aml_vdec_dispatch_event(ctx, V4L2_EVENT_REQUEST_EXIT); @@ -1152,13 +1149,7 @@ static int vidioc_decoder_cmd(struct file *file, void *priv, return 0; } - if (!vb2_is_streaming(dst_vq)) { - v4l_dbg(ctx, V4L_DEBUG_CODEC_ERROR, - "Capture stream is off. No need to flush.\n"); - return 0; - } - - /* flush src */ + /* flush pipeline */ v4l2_m2m_buf_queue(ctx->m2m_ctx, &ctx->empty_flush_buf->vb); v4l2_m2m_try_schedule(ctx->m2m_ctx);//pay attention ctx->receive_cmd_stop = true; @@ -1166,6 +1157,9 @@ static int vidioc_decoder_cmd(struct file *file, void *priv, case V4L2_DEC_CMD_START: v4l_dbg(ctx, V4L_DEBUG_CODEC_EXINFO, "CMD V4L2_DEC_CMD_START\n"); + dst_vq = v4l2_m2m_get_vq(ctx->m2m_ctx, + multiplanar ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : + V4L2_BUF_TYPE_VIDEO_CAPTURE); vb2_clear_last_buffer_dequeued(dst_vq);//pay attention break;