From d85072a3ac8f6671353c3447965d4aa5a2dccf39 Mon Sep 17 00:00:00 2001 From: Jeonghee Kim Date: Tue, 19 Jun 2018 21:00:46 +0900 Subject: [PATCH] [COMMON] media: mfc: fix the QoS calculation If too many instances are open, 'total_fps * sw_time' can exceed 1 second and total_mb value can be zero. When the total_mb is zero, we can't request a high QoS level in qos_on function and QoS remove will be called unconditionally in qos_off function. In order to defend this problem, It has been modified to use max_mb value if SW time exceeds 1 second. Change-Id: I833bc27b5c547c8d92c5eddc9f685d26677b179f Signed-off-by: Jeonghee Kim --- drivers/media/platform/exynos/mfc/s5p_mfc_qos.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c index 5b0cfcf45221..8655a4b17423 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c @@ -518,7 +518,10 @@ void s5p_mfc_qos_on(struct s5p_mfc_ctx *ctx) fw_time = qos_table[i].time_fw; sw_time = (MFC_DRV_TIME + fw_time); - total_mb = ((1000000 * hw_mb) / (1000000 - (total_fps * sw_time))); + if ((total_fps * sw_time) >= 1000000) + total_mb = pdata->max_mb; + else + total_mb = ((1000000 * hw_mb) / (1000000 - (total_fps * sw_time))); mfc_debug(4, "[QoS] table[%d] fw_time: %dus, hw_mb: %ld, " "sw_time: %d, total_fps: %ld, total_mb: %ld\n", @@ -598,7 +601,11 @@ void s5p_mfc_qos_off(struct s5p_mfc_ctx *ctx) fw_time = qos_table[i].time_fw; sw_time = (MFC_DRV_TIME + fw_time); - total_mb = ((1000000 * hw_mb) / (1000000 - (total_fps * sw_time))); + if ((total_fps * sw_time) >= 1000000) + total_mb = pdata->max_mb; + else + total_mb = ((1000000 * hw_mb) / (1000000 - (total_fps * sw_time))); + mfc_debug(4, "[QoS] table[%d] fw_time: %dus, hw_mb: %ld, " "sw_time: %d, total_fps: %ld, total_mb: %ld\n", i, fw_time, hw_mb, sw_time, total_fps, total_mb); -- 2.20.1