Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 157ede95 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "devfreq: Weight stall cycles more for GPU bus DCVS"

parents 862c3b40 981f5c62
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -24,6 +24,7 @@
#define HIST                    5
#define HIST                    5
#define TARGET                  80
#define TARGET                  80
#define CAP                     75
#define CAP                     75
#define WAIT_THRESHOLD          10
/* AB vote is in multiple of BW_STEP Mega bytes */
/* AB vote is in multiple of BW_STEP Mega bytes */
#define BW_STEP                 160
#define BW_STEP                 160


@@ -65,7 +66,9 @@ static int devfreq_gpubw_get_target(struct devfreq *df,
	int result;
	int result;
	int level = 0;
	int level = 0;
	int act_level;
	int act_level;
	int norm_max_cycles;
	int norm_cycles;
	int norm_cycles;
	int wait_active_percent;
	int gpu_percent;
	int gpu_percent;
	/*
	/*
	 * Normalized AB should at max usage be the gpu_bimc frequency in MHz.
	 * Normalized AB should at max usage be the gpu_bimc frequency in MHz.
@@ -94,8 +97,12 @@ static int devfreq_gpubw_get_target(struct devfreq *df,
	if (priv->bus.total_time < LONG_FLOOR)
	if (priv->bus.total_time < LONG_FLOOR)
		return result;
		return result;


	norm_max_cycles = (unsigned int)(priv->bus.ram_time) /
			(unsigned int) priv->bus.total_time;
	norm_cycles = (unsigned int)(priv->bus.ram_time + priv->bus.ram_wait) /
	norm_cycles = (unsigned int)(priv->bus.ram_time + priv->bus.ram_wait) /
			(unsigned int) priv->bus.total_time;
			(unsigned int) priv->bus.total_time;
	wait_active_percent = (100 * (unsigned int)priv->bus.ram_wait) /
			(unsigned int) priv->bus.ram_time;
	gpu_percent = (100 * (unsigned int)priv->bus.gpu_time) /
	gpu_percent = (100 * (unsigned int)priv->bus.gpu_time) /
			(unsigned int) priv->bus.total_time;
			(unsigned int) priv->bus.total_time;


@@ -104,8 +111,8 @@ static int devfreq_gpubw_get_target(struct devfreq *df,
	 * FAST hint.  Otherwise check the current value against the current
	 * FAST hint.  Otherwise check the current value against the current
	 * cutoffs.
	 * cutoffs.
	 */
	 */
	if (norm_cycles > priv->bus.max) {
	if (norm_max_cycles > priv->bus.max) {
		_update_cutoff(priv, norm_cycles);
		_update_cutoff(priv, norm_max_cycles);
		bus_profile->flag = DEVFREQ_FLAG_FAST_HINT;
		bus_profile->flag = DEVFREQ_FLAG_FAST_HINT;
	} else {
	} else {
		/* GPU votes for IB not AB so don't under vote the system */
		/* GPU votes for IB not AB so don't under vote the system */
@@ -114,7 +121,8 @@ static int devfreq_gpubw_get_target(struct devfreq *df,
		act_level = (act_level < 0) ? 0 : act_level;
		act_level = (act_level < 0) ? 0 : act_level;
		act_level = (act_level >= priv->bus.num) ?
		act_level = (act_level >= priv->bus.num) ?
		(priv->bus.num - 1) : act_level;
		(priv->bus.num - 1) : act_level;
		if (norm_cycles > priv->bus.up[act_level] &&
		if ((norm_cycles > priv->bus.up[act_level] ||
				wait_active_percent > WAIT_THRESHOLD) &&
				gpu_percent > CAP)
				gpu_percent > CAP)
			bus_profile->flag = DEVFREQ_FLAG_FAST_HINT;
			bus_profile->flag = DEVFREQ_FLAG_FAST_HINT;
		else if (norm_cycles < priv->bus.down[act_level] && level)
		else if (norm_cycles < priv->bus.down[act_level] && level)