From 0a8cbbcb0c502bf6a9dfb96ccd0e055b8893960c Mon Sep 17 00:00:00 2001 From: Quallenauge Date: Mon, 18 Jan 2021 22:11:48 +0100 Subject: [PATCH] power: Avoid reaching req limit of qti perf service. Without cleaning up the power hint handle, vendor.qti.hardware.perf@2.0-service is insulted after a while. ANDR-PERF-MPCTL: Active req limit reached, No optimizations performed When cleaning up the power hint handle we are able to boost, as much as we want to do. Change-Id: I39a69d6b053949578f976fb7ae12f4a9960c50a2 --- power-660.c | 8 +++++++- power-845.c | 8 +++++++- power-8937.c | 8 +++++++- power-8953.c | 8 +++++++- power-8996.c | 8 +++++++- power-8998.c | 8 +++++++- 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/power-660.c b/power-660.c index 2f2e8b3..4bbf37d 100644 --- a/power-660.c +++ b/power-660.c @@ -148,6 +148,7 @@ static int process_video_encode_hint(void* metadata) { static void process_interaction_hint(void* data) { static struct timespec s_previous_boost_timespec; static int s_previous_duration = 0; + static int interaction_handle = -1; struct timespec cur_boost_timespec; long long elapsed_time; @@ -173,7 +174,12 @@ static void process_interaction_hint(void* data) { s_previous_boost_timespec = cur_boost_timespec; s_previous_duration = duration; - perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); + if (CHECK_HANDLE(interaction_handle)) { + release_request(interaction_handle); + } + + interaction_handle = + perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); } static int process_activity_launch_hint(void* data) { diff --git a/power-845.c b/power-845.c index 3a95c79..1ce4ddd 100644 --- a/power-845.c +++ b/power-845.c @@ -187,6 +187,7 @@ static int process_video_encode_hint(void* metadata) { static void process_interaction_hint(void* data) { static struct timespec s_previous_boost_timespec; static int s_previous_duration = 0; + static int interaction_handle = -1; struct timespec cur_boost_timespec; long long elapsed_time; @@ -217,7 +218,12 @@ static void process_interaction_hint(void* data) { s_previous_boost_timespec = cur_boost_timespec; s_previous_duration = duration; - perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); + if (CHECK_HANDLE(interaction_handle)) { + release_request(interaction_handle); + } + + interaction_handle = + perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); } static int process_activity_launch_hint(void* data) { diff --git a/power-8937.c b/power-8937.c index e3e2de9..1a5674f 100644 --- a/power-8937.c +++ b/power-8937.c @@ -164,6 +164,7 @@ static int process_video_encode_hint(void* metadata) { static void process_interaction_hint(void* data) { static struct timespec s_previous_boost_timespec; static int s_previous_duration = 0; + static int interaction_handle = -1; struct timespec cur_boost_timespec; long long elapsed_time; @@ -189,7 +190,12 @@ static void process_interaction_hint(void* data) { s_previous_boost_timespec = cur_boost_timespec; s_previous_duration = duration; - perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); + if (CHECK_HANDLE(interaction_handle)) { + release_request(interaction_handle); + } + + interaction_handle = + perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); } static int process_activity_launch_hint(void* data) { diff --git a/power-8953.c b/power-8953.c index 6823d3c..e325adc 100644 --- a/power-8953.c +++ b/power-8953.c @@ -161,6 +161,7 @@ static int process_video_encode_hint(void* metadata) { static void process_interaction_hint(void* data) { static struct timespec s_previous_boost_timespec; static int s_previous_duration = 0; + static int interaction_handle = -1; struct timespec cur_boost_timespec; long long elapsed_time; @@ -186,7 +187,12 @@ static void process_interaction_hint(void* data) { s_previous_boost_timespec = cur_boost_timespec; s_previous_duration = duration; - perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); + if (CHECK_HANDLE(interaction_handle)) { + release_request(interaction_handle); + } + + interaction_handle = + perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); } static int process_activity_launch_hint(void* data) { diff --git a/power-8996.c b/power-8996.c index 9cc33b6..8c23cc1 100644 --- a/power-8996.c +++ b/power-8996.c @@ -212,6 +212,7 @@ static int process_video_encode_hint(void* metadata) { static void process_interaction_hint(void* data) { static struct timespec s_previous_boost_timespec; static int s_previous_duration = 0; + static int interaction_handle = -1; struct timespec cur_boost_timespec; long long elapsed_time; @@ -242,7 +243,12 @@ static void process_interaction_hint(void* data) { s_previous_boost_timespec = cur_boost_timespec; s_previous_duration = duration; - perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); + if (CHECK_HANDLE(interaction_handle)) { + release_request(interaction_handle); + } + + interaction_handle = + perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); } static int process_activity_launch_hint(void* data) { diff --git a/power-8998.c b/power-8998.c index 4f59b4c..b929336 100644 --- a/power-8998.c +++ b/power-8998.c @@ -183,6 +183,7 @@ static int process_video_encode_hint(void* metadata) { static void process_interaction_hint(void* data) { static struct timespec s_previous_boost_timespec; static int s_previous_duration = 0; + static int interaction_handle = -1; struct timespec cur_boost_timespec; long long elapsed_time; @@ -213,7 +214,12 @@ static void process_interaction_hint(void* data) { s_previous_boost_timespec = cur_boost_timespec; s_previous_duration = duration; - perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); + if (CHECK_HANDLE(interaction_handle)) { + release_request(interaction_handle); + } + + interaction_handle = + perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL); } static int process_activity_launch_hint(void* data) {