From ccc268d1b85638ec75bb1991f2f3fbdcbbf75267 Mon Sep 17 00:00:00 2001 From: ming_qian Date: Thu, 7 Nov 2019 13:45:41 +0800 Subject: [PATCH] MLK-22920 vpu: windsor encoder: change the writeable flag synchronously If the writeable flag is not change synchronously, the flag may not changed correct, it'll case the encode stream hang. It's likely to happen when small resolution stream do suspend. Signed-off-by: ming_qian Signed-off-by: Shijie Qin --- drivers/mxc/vpu_windsor/vpu_encoder_b0.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mxc/vpu_windsor/vpu_encoder_b0.c b/drivers/mxc/vpu_windsor/vpu_encoder_b0.c index b61d384972e2..8d7181c45818 100644 --- a/drivers/mxc/vpu_windsor/vpu_encoder_b0.c +++ b/drivers/mxc/vpu_windsor/vpu_encoder_b0.c @@ -2646,8 +2646,10 @@ static int handle_event_start_done(struct vpu_ctx *ctx) if (!ctx) return -EINVAL; + down(&ctx->q_data[V4L2_SRC].drv_q_lock); set_bit(VPU_ENC_STATUS_START_DONE, &ctx->status); set_queue_rw_flag(&ctx->q_data[V4L2_SRC], VPU_ENC_FLAG_WRITEABLE); + up(&ctx->q_data[V4L2_SRC].drv_q_lock); submit_input_and_encode(ctx); enable_fps_sts(get_vpu_ctx_attr(ctx)); @@ -2841,8 +2843,10 @@ static void vpu_enc_event_handler(struct vpu_ctx *ctx, handle_event_stop_done(ctx); break; case VID_API_ENC_EVENT_FRAME_INPUT_DONE: + down(&ctx->q_data[V4L2_SRC].drv_q_lock); set_queue_rw_flag(&ctx->q_data[V4L2_SRC], VPU_ENC_FLAG_WRITEABLE); + up(&ctx->q_data[V4L2_SRC].drv_q_lock); response_stop_stream(ctx); submit_input_and_encode(ctx); break;