From 9739b6286167ad97a20c3428dfa4559fe61d2896 Mon Sep 17 00:00:00 2001 From: Jeonghee Kim Date: Tue, 9 Jan 2018 15:19:35 +0900 Subject: [PATCH] media: mfc: NAL-Q: change work_bits handling. Change-Id: I230fde8ab018e3968ef5f8e5e693cff129bb41ba Signed-off-by: Jeonghee Kim --- .../platform/exynos/mfc/s5p_mfc_hwlock.c | 39 +++++++------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c b/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c index b31c2966cc77..83e5138bb2fd 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_hwlock.c @@ -669,24 +669,17 @@ static int mfc_nal_q_just_run(struct s5p_mfc_ctx *ctx, int need_cache_flush) mfc_info_ctx("NAL Q: start NAL QUEUE\n"); s5p_mfc_nal_q_start(dev, nal_q_handle); - if (s5p_mfc_nal_q_enqueue_in_buf(dev, ctx, nal_q_handle->nal_q_in_handle)) { + if (s5p_mfc_nal_q_enqueue_in_buf(dev, ctx, nal_q_handle->nal_q_in_handle)) mfc_debug(2, "NAL Q: Failed to enqueue input data\n"); - if (ctx->clear_work_bit) { - s5p_mfc_clear_bit(ctx->num, &dev->work_bits); - ctx->clear_work_bit = 0; - } - s5p_mfc_release_hwlock_ctx(ctx); - ret = 0; - break; - } - if (!nal_q_handle->nal_q_exception) - s5p_mfc_clear_bit(ctx->num, &dev->work_bits); + s5p_mfc_clear_bit(ctx->num, &dev->work_bits); + if ((s5p_mfc_ctx_ready(ctx) && !ctx->clear_work_bit) || + nal_q_handle->nal_q_exception) + s5p_mfc_set_bit(ctx->num, &dev->work_bits); + ctx->clear_work_bit = 0; s5p_mfc_release_hwlock_ctx(ctx); - if (s5p_mfc_ctx_ready(ctx)) - s5p_mfc_set_bit(ctx->num, &dev->work_bits); if (s5p_mfc_is_work_to_do(dev)) queue_work(dev->butler_wq, &dev->butler_work); @@ -711,24 +704,18 @@ static int mfc_nal_q_just_run(struct s5p_mfc_ctx *ctx, int need_cache_flush) break; } else { /* NAL QUEUE */ - if (s5p_mfc_nal_q_enqueue_in_buf(dev, ctx, nal_q_handle->nal_q_in_handle)) { + if (s5p_mfc_nal_q_enqueue_in_buf(dev, ctx, nal_q_handle->nal_q_in_handle)) mfc_debug(2, "NAL Q: Failed to enqueue input data\n"); - if (ctx->clear_work_bit) { - s5p_mfc_clear_bit(ctx->num, &dev->work_bits); - ctx->clear_work_bit = 0; - } - s5p_mfc_release_hwlock_ctx(ctx); - ret = 0; - break; - } - if (!nal_q_handle->nal_q_exception) - s5p_mfc_clear_bit(ctx->num, &dev->work_bits); + s5p_mfc_clear_bit(ctx->num, &dev->work_bits); + + if ((s5p_mfc_ctx_ready(ctx) && !ctx->clear_work_bit) || + nal_q_handle->nal_q_exception) + s5p_mfc_set_bit(ctx->num, &dev->work_bits); + ctx->clear_work_bit = 0; s5p_mfc_release_hwlock_ctx(ctx); - if (s5p_mfc_ctx_ready(ctx)) - s5p_mfc_set_bit(ctx->num, &dev->work_bits); if (s5p_mfc_is_work_to_do(dev)) queue_work(dev->butler_wq, &dev->butler_work); ret = 0; -- 2.20.1