Skip to content

Commit 037a9c5

Browse files
minaripenguinvbajs
authored andcommitted
adreno_tz: Adjust GPU target frequency calculation
* based from [1], here we finetune the logic by adding a min_busy condition so that we will only upscale when FLOOR is exceeded (for power consumption). * ratio: by increasing initial load + the quotient of the 120(max refresh)/60 ratio, so that this will definitely act as boost (which is needed for HFR/heavy load situations). * 90hz ratio is used for conditions below FLOOR value [1]: KasaOS/KASA_Surya@24c1487 Change-Id: I98be2f909b63e5fb3426a74ddb5f0412ecbc5a00 Signed-off-by: dlwlrma123 <alexfinhart@gmail.com> Signed-off-by: Richard Raya <rdxzv.dev@gmail.com> Signed-off-by: Yahya Wessam <yahyawessam2002@gmail.com>
1 parent 0a5db2c commit 037a9c5

File tree

1 file changed

+13
-28
lines changed

1 file changed

+13
-28
lines changed

drivers/devfreq/governor_msm_adreno_tz.c

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/mm.h>
2222
#include <linux/msm_adreno_devfreq.h>
2323
#include <asm/cacheflush.h>
24-
#include <drm/drm_refresh_rate.h>
2524
#include <soc/qcom/scm.h>
2625
#include "governor.h"
2726

@@ -32,18 +31,13 @@ static DEFINE_SPINLOCK(suspend_lock);
3231
* FLOOR is 5msec to capture up to 3 re-draws
3332
* per frame for 60fps content.
3433
*/
35-
#define FLOOR 5000
34+
#define FLOOR 3350
3635
/*
3736
* MIN_BUSY is 1 msec for the sample to be sent
3837
*/
3938
#define MIN_BUSY 1000
4039
#define MAX_TZ_VERSION 0
4140

42-
/*
43-
* CEILING is 50msec, larger than any standard
44-
* frame length, but less than the idle timer.
45-
*/
46-
#define CEILING 50000
4741
#define TZ_RESET_ID 0x3
4842
#define TZ_UPDATE_ID 0x4
4943
#define TZ_INIT_ID 0x6
@@ -372,7 +366,12 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq)
372366
#endif
373367

374368
priv->bin.total_time += stats.total_time;
375-
priv->bin.busy_time += stats.busy_time;
369+
370+
if ((unsigned int)(priv->bin.busy_time + stats.busy_time) >= FLOOR) {
371+
priv->bin.busy_time += stats.busy_time * 4;
372+
} else {
373+
priv->bin.busy_time += stats.busy_time * 4 / 2;
374+
}
376375

377376
if (stats.private_data)
378377
context_count = *((int *)stats.private_data);
@@ -397,26 +396,12 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq)
397396
return level;
398397
}
399398

400-
/*
401-
* If there is an extended block of busy processing,
402-
* increase frequency. Otherwise run the normal algorithm.
403-
*/
404-
if (!priv->disable_busy_time_burst &&
405-
priv->bin.busy_time > CEILING) {
406-
val = -1 * level;
407-
} else {
408-
unsigned int refresh_rate = dsi_panel_get_refresh_rate();
409-
410-
scm_data[0] = level;
411-
scm_data[1] = priv->bin.total_time;
412-
if (refresh_rate > 60)
413-
scm_data[2] = priv->bin.busy_time * refresh_rate / 60;
414-
else
415-
scm_data[2] = priv->bin.busy_time;
416-
scm_data[3] = context_count;
417-
__secure_tz_update_entry3(scm_data, sizeof(scm_data),
418-
&val, sizeof(val), priv);
419-
}
399+
scm_data[0] = level;
400+
scm_data[1] = priv->bin.total_time;
401+
scm_data[2] = priv->bin.busy_time;
402+
scm_data[3] = context_count;
403+
__secure_tz_update_entry3(scm_data, sizeof(scm_data),
404+
&val, sizeof(val), priv);
420405
priv->bin.total_time = 0;
421406
priv->bin.busy_time = 0;
422407

0 commit comments

Comments
 (0)