FORUMS

Analysis & Opinion

Top Forum Discussions

Adreno idler, an idling algorithm for devfreq-based Adreno devices

2,031 posts
Thanks Meter: 13,673
 
Post Reply Subscribe to Thread Email Thread
I'm here to introduce 'Adreno idler' to the world, and for kernel developers out there, how to apply and test.

So what is Adreno idler?
Quote:

It is an idling algorithm,
an efficient workaround for msm-adreno-tz's overheads.

Main goal is to lower the power consumptions while maintaining high-performance.

Since msm-adreno-tz tends to *not* use the lowest frequency even on idle,
Adreno idler replaces msm-adreno-tz's algorithm when it comes to
calculating idle frequency(mostly by ondemand's method).

The higher frequencies are not touched with this algorithm, so high-demanding
games will (most likely) not suffer from worsened performance.

Why have I made it?
Because I don't like every, single, GPU governors out there for our Snapdragon devices.

Let me break it down for you.
msm-adreno-tz: default GPU governor for Snapdragon devices. It's interval/polling mechanism is very efficient, reducing the number of unnecessary frequency switches and maintains high performance. But, even on idle, it *tends* to not use the lowest frequency, resulting in higher power consumption and more battery drains on simple tasks such as watching video/YouTube or browsing the web.
Simple: a GPU governor made by faux123. I was using this on my older, non-devfreq-based devices but faux123's version of devfreq-based Simple GPU governor, it introduced a lot of weird switches and latencies resulting in a lot of lagginess and heat.
simple_ondemand: a devfreq governor made by Samsung, forked from ondemand cpufreq governor. It can be used as a GPU governor if your Snapdragon device uses devfreq governor for GPU frequency scaling. At idle, it goes all the way down to the lowest frequency, which is promising, but if it's under load, it continuously goes up and down, resulting in a similar behavior compared to Simple. Unnecessary number of switches, resulting in lagginess and heat.

So what's the answer?
None! Maybe the ideal solution is to modify msm-adreno-tz's algorithm to utilize the lowest frequency, but because msm-adreno-tz's algorithm is hidden under ARM's TrustZone technology, we can't tweak it much.
Hence, here comes Adreno idler.

Main goal is to lower the power consumptions while maintaining high-performance.

Adreno idler replaces msm-adreno-tz's algorithm when it comes to
calculating idle frequency(mostly by ondemand's method).
The higher frequencies are not touched with this algorithm, so high-demanding
games will (most likely) not suffer from worsened performance.


There are 3 main tunables for Adreno idler.
idleworkload for determining if the given workload is idle,
idlewait for preventing micro-lags,
and downdifferential for final calculation for determining if the GPU can go idle.

Logics are explained very well on the source-code. Go check if you're interested.

How to test and apply
Please go through the testing process.
If your device's stock msm-adreno-tz can go idle very well(it can differ from device to device since it's closed source), Adreno idler is not needed.
So far, it's working as advertised on Galaxy S4 LTE-A and Galaxy Note 3.

Use adb shell and type the following.
Code:
cd /sys/devices/*kgsl*/devfreq/*/
while true; do cat trans_stat; busybox sleep 0.1; done
If you can notice the msm-adreno-tz not using the lowest frequency even on idle, it's time to go try Adreno idler.
Your device MUST use devfreq msm-adreno-tz before applying Adreno idler.
AFAIK, Nexus 5 doesn't use devfreq, but more recent devices will use devfreq.
Go check if drivers/devfreq/governor_msm-adreno-tz.c exists.

I highly recommend to cherry-pick every devfreq/msm-adreno-tz changes on my Git repository to avoid inconsistencies which I did not intend.
Part of Adreno idler uses powersuspend by faux123.
Go apply it first before applying Adreno idler.

https://bitbucket.org/arter97/androi...bab2aeeba223b4
(powersuspend dependency. Just make sure to apply include/linux/powersuspend.h and kernel/power/powersuspend.c changes.)

https://bitbucket.org/arter97/androi...50aa8de45cb217
https://bitbucket.org/arter97/androi...e7fd35b1b268ad
https://bitbucket.org/arter97/androi...e217346b1aa346
https://bitbucket.org/arter97/androi...5274db21a7fd51
https://bitbucket.org/arter97/androi...50a25638955b45
https://bitbucket.org/arter97/androi...71bc1161efacbd
https://bitbucket.org/arter97/androi...9ded312c4ebe1c
https://bitbucket.org/arter97/androi...8224a012e43138
https://bitbucket.org/arter97/androi...15d0b82ec666e5
<-- The main party starts here !-->
https://bitbucket.org/arter97/androi...e9d680e3aaf60a
https://bitbucket.org/arter97/androi...b1ad684399290f
<-- More updates !-->
https://bitbucket.org/arter97/androi...623e07d78e1a8b
https://bitbucket.org/arter97/androi...2d58d4cb7991a6
https://bitbucket.org/arter97/androi...038b1fdaf6a941
https://bitbucket.org/arter97/androi...1463d94b612de3 (This is a must-have commit)
https://bitbucket.org/arter97/androi...c8a6164e3956c2
https://bitbucket.org/arter97/androi...1409e82bc0ba0d

That's it for Adreno idler 1.1.
I'll continuously update in the future.
Make sure to follow my Git and apply changes made to devfreq/msm-adreno-tz/adreno-idler.

After you've applied Adreno idler, turn it on from the defconfig and go through the testing process to check if the Adreno idler is working correctly.
It should ramp down the frequency to the lowest after about 200~500ms when system hits idle.

And you can turn Adreno idler on/off and fine-tune from /sys/module/adreno_idler/parameters.

Benchmark
Ahhhhhhh.. this will be interesting. And it is.

I've tested my ks01lte with watching a movie and playing a game.

1. 15 GB 1080p 2.5 hrs movie w/ HW decoder - Airplane mode ON/Brightness 25%
2. Casual game, leave it for 30 minutes on the same screen - Airplane mode ON/Brightness 100%

1.1. Adreno idler off - 46.3% battery drain, can expect approx. 6hrs 5mins of video playback on 100% battery charge.
1.2. Adreno idler on - 25.5% battery drain, can expect approx. 11hrs 2mins of video playback on 100% battery charge.
2.1. Adreno idler off - 13.4% battery drain, can expect approx, 3hrs 43mins of gameplay on 100% battery charge.
2.2. Adreno idler on - 11.7% battery drain, can expect approx, 4hrs 16mins of gameplay on 100% battery charge.

You decide if Adreno idler is awesome or not.
Enjoy

Huge thanks to hsk from Matcl for debugging, analyzing, and suggesting more efficient code.
This would be a piece of crap if it's not for hsk
Last edited by arter97; 14th June 2015 at 12:22 PM.
The Following 82 Users Say Thank You to arter97 For This Useful Post: [ View ]
 
 
14th June 2015, 03:34 PM |#2  
JMS74's Avatar
Senior Member
Thanks Meter: 12
 
More
Great. Those benchmark are from what phone?
14th June 2015, 03:43 PM |#3  
Senior Member
Thanks Meter: 351
 
More
@arter97 this advantage is only in gaming or heavy videos or also has effect in light usage?

Sent from my A0001
14th June 2015, 03:48 PM |#4  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 13,673
 
Donate to Me
More
Quote:
Originally Posted by JMS74

Great. Those benchmark are from what phone?

ks01lte = Galaxy S4 LTE-A(Snapdragon 800)
The Following 3 Users Say Thank You to arter97 For This Useful Post: [ View ]
14th June 2015, 03:48 PM |#5  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 13,673
 
Donate to Me
More
Quote:
Originally Posted by JMS74

Great. Those benchmark are from what phone?

Quote:
Originally Posted by CounterC

@arter97 this advantage is only in gaming or heavy videos or also has effect in light usage?

Sent from my A0001

More likely in light usage.
I'd suggest you to read the OP again.
The Following 7 Users Say Thank You to arter97 For This Useful Post: [ View ]
14th June 2015, 04:44 PM |#6  
Member
Thanks Meter: 21
 
Donate to Me
More
@arter97
How much is your web browsing time approximately?

Sent from my GT-I9506 using XDA Free mobile app
Last edited by Kiryo24; 14th June 2015 at 04:47 PM.
14th June 2015, 06:37 PM |#7  
DespairFactor's Avatar
Recognized Developer / Recognized Contributor
Flag Toronto
Thanks Meter: 5,702
 
Donate to Me
More
Thanks @arter97 added to my shamu source to test.
15th June 2015, 09:31 AM |#8  
freakingprime's Avatar
Senior Member
Thanks Meter: 35
 
More
If I don't use "Force 2D GPU Rendering", is this idler still effective? I almost do light usage: facebook, web browsing, no games.
15th June 2015, 10:05 AM |#9  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 13,673
 
Donate to Me
More
Quote:
Originally Posted by Kiryo24

@arter97
How much is your web browsing time approximately?

Sent from my GT-I9506 using XDA Free mobile app

No idea. I haven't tested it scientifically.
The Following User Says Thank You to arter97 For This Useful Post: [ View ]
15th June 2015, 10:06 AM |#10  
arter97's Avatar
OP Recognized Developer
Flag Seoul
Thanks Meter: 13,673
 
Donate to Me
More
Quote:
Originally Posted by freakingprime

If I don't use "Force 2D GPU Rendering", is this idler still effective? I almost do light usage: facebook, web browsing, no games.

Yes.
The Following User Says Thank You to arter97 For This Useful Post: [ View ]
15th June 2015, 10:30 AM |#11  
Senior Member
Thanks Meter: 243
 
More
Arter just want to tel you that this is a big thing, am already testing and i think that iam seeing a difference in browsing battery life, anyway too early to tell...

We are so lucky to have a freaking genius developer for our note 3..

Read More
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes