From 44f997ff543dda1e11665c3b276f52696c313e78 Mon Sep 17 00:00:00 2001 From: chenzhen Date: Wed, 21 Oct 2015 08:59:41 +0800 Subject: [PATCH] rk312x, mali_400: make it more 'difficult' to disable one core in low load. Change-Id: I8f9aaa5d442a1d0f7a7685ba1885ad39b89ee097 Signed-off-by: chenzhen --- .../mali/platform/rk30/arm_core_scaling.c | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) mode change 100755 => 100644 drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.c diff --git a/drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.c b/drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.c old mode 100755 new mode 100644 index 8cb95dcaaf7d..e95d60df0fec --- a/drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.c +++ b/drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.c @@ -13,6 +13,9 @@ * Example core scaling policy. */ +/* #define ENABLE_DEBUG_LOG */ +#include "custom_log.h" + #include "arm_core_scaling.h" #include @@ -23,6 +26,16 @@ static int num_cores_total; static int num_cores_enabled; +/** + * 对连续的 request_to_disable_on_core 的计数. + */ +static int count_of_requests_to_disable_one_core; +/** + * 在 count_of_requests_to_disable_one_core 等于本 value 的时候, + * 将执行确实的 disable_one_core 操作. + */ +#define NUM_OF_REQUESTS_TO_REALLY_DISABLE_ONE_CORE (10) + static struct work_struct wq_work; static void set_num_cores(struct work_struct *work) @@ -114,17 +127,30 @@ void mali_core_scaling_update(struct mali_gpu_utilization_data *data) num_cores_total)); /* NOTE: - * this function is normally called directly - * from the utilization callback which is in timer context. */ + * this function + * is normally called directly + * from the utilization callback + * which is in timer context. */ - if (PERCENT_OF(90, 256) < data->utilization_pp) + if (PERCENT_OF(90, 256) < data->utilization_pp) { + V("to enable max num of pp_cores."); enable_max_num_cores(); - else if (PERCENT_OF(50, 256) < data->utilization_pp) + count_of_requests_to_disable_one_core = 0; + } else if (PERCENT_OF(50, 256) < data->utilization_pp) { + V("to enable more one pp_core."); enable_one_core(); - else if (PERCENT_OF(40, 256) < data->utilization_pp) - MALI_DEBUG_PRINT(6, ("do nothing")); - else if (PERCENT_OF(0, 256) < data->utilization_pp) - disable_one_core(); - else - MALI_DEBUG_PRINT(6, ("do nothing")); + count_of_requests_to_disable_one_core = 0; + } else if (PERCENT_OF(40, 256) < data->utilization_pp) { + count_of_requests_to_disable_one_core = 0; + } else if (PERCENT_OF(0, 256) < data->utilization_pp) { + count_of_requests_to_disable_one_core++; + if (count_of_requests_to_disable_one_core + >= NUM_OF_REQUESTS_TO_REALLY_DISABLE_ONE_CORE) { + V("to disable a pp_core."); + disable_one_core(); + count_of_requests_to_disable_one_core = 0; + } + } else { + count_of_requests_to_disable_one_core = 0; + } } -- 2.34.1