FORUMS

HTC’s New Ad Campaign And What It Really Means

HTC has just released three new blind test adverts comparing app loading … more

XDA Picks: Best Apps of the Week (June 27 – July 4)

Apps are at the front and center of any smartphone experience, and with over a … more

HTC One M9 Developer Edition Android 5.1 OTA

The Developer Edition of the HTC One M9 is receiving an over-the-air update to Android 5.1. … more

Index Project For XDA Device Subforums

Another ambitious project from the collaborative efforts of Recognized Contributors and Forum … more

[HACK] Overclocking and tuning Adreno200 GPU & misc qsd8k development

1,821 posts
Thanks Meter: 13,540
 
By FeraVolt, Senior Member on 21st September 2014, 05:08 PM
Post Reply Subscribe to Thread Email Thread


"Hey Dev! Make those Snapdragons fly!"


A little into:
Hello wonderful and amazing people! I'm Fera, ROM/Kernel developer from SonyXperia X10 forum. I'm 20 years old hungry student and I'd like to share a bit of my experience with you guys. Open Source rules! Hacks listed here have to work despite kernel versions. I made this hacks specificly for qsd8k board, but you may try your luck on newer chipsets if you get the logic. Things are pretty similar on Snapdragon chipsets. I spent a lot of hard time figuring things out so if you like this stuff, hit 'Thanks' button, rate this thread, share it to let other people know, and feed me.
Now..enough for drama, have good music, tighten your belts, sit back and relax - we're going to fly at the speed of light..



GPU and CPU overclocking:
I will show an example by overclocking my Sony Ericsson Xperia X10 retired phone with QSD8x50 Snapdragon S1 board with Adreno200 rev1 GPU onboard. You may look at more complex details list of Adreno GPU HERE.
Let's start now. This hack requiers to recompile kernel for your device. It's quite simple actually. To keep things more clear, let's note what we have:
Code:
grp_clock = Graphics clock //128000000 by default for adreno200 rev1
ebi1_clock = External Bus Interface 1 clock //256000000 by default for qsd8k
imem_clock = Internal Graphics Memory clock //256000000 by default for qsd8k
We're going to deal with grp_clock of Adreno bus clock and CPU clock itself.
In kernel sources under arch/arm/mach-msm we have acpuclock-8x50.c file. This file (or any equivalent to your board) contains actual CPU freq. table and misc hw stuff related to clocks.
Default freq. table for qsd8k is:
PHP Code:
019200ACPU_PLL_TCXO000014000001000},
0128000ACPU_PLL_1150014000201000},
1245760ACPU_PLL_0400029000001000},
1384000ACPU_PLL_300005800010xA1000},
0422400ACPU_PLL_3000011700010xB1000},
0460800ACPU_PLL_3000011700010xC1000},
0499200ACPU_PLL_3000011700010xD1025},
0537600ACPU_PLL_3000011700010xE1050},
1576000ACPU_PLL_3000011700010xF1050},
0614400ACPU_PLL_3000011700010x101075},
0652800ACPU_PLL_3000011700010x111100},
0691200ACPU_PLL_3000011700010x121125},
0729600ACPU_PLL_3000011700010x131150},
1768000ACPU_PLL_3000012800010x141150},
0806400ACPU_PLL_3000012800010x151175},
0844800ACPU_PLL_3000012800010x161200},
0883200ACPU_PLL_3000012800010x171225},
0921600ACPU_PLL_3000012800010x181275},
0960000ACPU_PLL_3000012800010x191275},
1998400ACPU_PLL_3000012800010x1A1300}, 
Little theory lesson:
Let's take last line and digest it..
  • 1/0 - means that this clk ladder is enabled/disabled
  • 998400 - Actual ladder freq. in Khz
  • ACPU_PLL_3, 0, 0, 0, 0 - AXI/PLL macros, adresses
  • 128000 - AXI bus freq. in Khz
  • 0/1/2 - Init adresses
  • 0x1A - Step raw code for CPU
  • 1300 - Voltage gained to corresponding freq. step in mV

We can see that we have 128000 freq. on top of the table set as 0 (disabled) for global access and reserved for PLL_1 which is adressed to 2. After hardcore testings I found out that this adresses to GPU AXI bus clock used by Adreno200. We simply change it to 192000Khz. Overclocking to higher values made my device very unstable, so don't bump high too much.
The ready line will be look as:
PHP Code:
0192000ACPU_PLL_1150014000201000 }, 
But it's not all. Note that this may vary in your .c file so turn on your brain and search for axi defines. In my case it was in same .c file in this function :
Code:
unsigned long clk_get_max_axi_khz(void)
{
	return 128000;
}
EXPORT_SYMBOL(clk_get_max_axi_khz);
Find something similar to this (if it realy exists) and set value to 192000.

Now we have to update all CPU freq table with overclocked axi bus values which could be stable.. At this point I spent monthes of testing and finally came up to stable things. I will just paste here my table which also includes CPU overclock and undervolt:
PHP Code:
    019200ACPU_PLL_TCXO000014000001000 },
    { 
0192000ACPU_PLL_1150014000201000 },
    { 
1245760ACPU_PLL_0400029000001025 },
    { 
1384000ACPU_PLL_300005800010xA1025 },
    { 
0422400ACPU_PLL_3000011700010xB1025 },
    { 
1460800ACPU_PLL_3000011700010xC1025 },
    { 
0499200ACPU_PLL_3000011700010xD1025 },
    { 
0537600ACPU_PLL_3000011700010xE1025 },
    { 
1576000ACPU_PLL_3000011700010xF1025 },
    { 
0614400ACPU_PLL_3000011700010x101050 },
    { 
0652800ACPU_PLL_3000011700010x111075 },
    { 
0691200ACPU_PLL_3000011700010x121100 },
    { 
0729600ACPU_PLL_3000012800010x131125 },
    { 
1768000ACPU_PLL_3000012800010x141125 },
    { 
0806400ACPU_PLL_3000012800010x151150 },
    { 
0844800ACPU_PLL_3000012800010x161200 },
    { 
0883200ACPU_PLL_3000016000010x171225 },
    { 
0921600ACPU_PLL_3000016000010x181250 },
    { 
0960000ACPU_PLL_3000016000010x191275 },
    { 
1998400ACPU_PLL_3000019200010x1A1300 },
    { 
11036800ACPU_PLL_3000019200010x1B1325 },
    { 
11075200ACPU_PLL_3000019200010x1C1325 },
    { 
11113600ACPU_PLL_3000019200010x1D1325 },
    { 
11152000ACPU_PLL_3000019200010x1E1350 },
    { 
11190400ACPU_PLL_3000019200010x1F1350 },
    { 
11228800ACPU_PLL_3000019200010x201375 },
    { 
11267200ACPU_PLL_3000019200010x211425 },
    { 
11305600ACPU_PLL_3000019200010x221425 },
    { 
00000000000}, 
This is how my table looks after GPU/CPU overclock/undervolt and hard testings. I find theese values solid stable and best at performance, exept last freq ladder. 1.3Ghz overclock is a bit overdose for my device (since it is max available freq. ladder for my cpu) but I save it in case there is a phone of mine with balls of steel (not all CPU chips are same and not all can handle overclocking). As you may notice, overclocked axi frequency is enabled on higher CPU clock steps. This means that axi overclock will be enabled when CPU runs on 1113Mhz and higher, so to enable all this things you have to use overclocked CPU table.
Since we overclocked our CPU we need to modify our .c file with all theese tables furter (acpuclock-8x50.c in my case) to match new changes. Search for:
Code:
case 0x00:
		max_acpu_khz = 998400;
and set it to 1305600 (maximum available CPU freq.)
Then searching for this:
Code:
static struct cpufreq_frequency_table freq_table[20];
and changing the value in the ind to 28 since we have now 28 CPU freq. steps in total. That's all for CPU overclock. Continuing boosting our Adreno..

Open your board-****.c file.
If you use old KGSL drivers (Android 2.3 and older), search for struct kgsl_platform_data kgsl_pdata function. In function structure you will see this:
Code:
.high_axi_3d = 128000,
.max_grp3d_freq = 0,
.min_grp3d_freq = 0,
Set high_axi_3d value to 192000.
Set max_grp3d_freq value to 256*1000*1000.
Set min_grp3d_freq value to 192*1000*1000.

If you use new KGSL drivers (Android 4.0+) then search for struct kgsl_device_platform_data kgsl_3d0_pdata. You will see something like this:
PHP Code:
    .pwrlevel = {
            {
                .
gpu_freq 0,
                .
bus_freq 128000000,
            }, 
Set gpu_freq value to 256000000.
Set bus_freq value to 192000000.

In the end we have undervolted and overclocked (1.3Ghz) CPU and overclocked GPU of my old phone. Saying again..Overclocking bus higher than 192Khz is realy bad idea for QSD8x50.

When you're done, build your kernel with enabled debugging (CONFIG_DEBUG_KERNEL=y) and then add this script to mount debug sysfs dir. in init.d or anywhere else on auostart:
Code:
#!/system/bin/sh
### FeraLab ###
mount -t debugfs debugfs /sys/kernel/debug
echo 0 > /sys/kernel/debug/msm_fb/0/vsync_enable
This script will also disable VSYNC to boost your 2D FPS. When system runs check out /sys/kernel/debug/clk_rate folder (If you can't see this folder the your init.d support is not working properly..put script somewhere else, in /etc/hw_config.sh for ex.). You will have to see reports:
  • gp_clk - 192000000
  • grp_3d_clk - 256000000
  • imem_clk - 256000000
And for CPU overclocking use any app you like from market. No-frill-CPU is a good one.

Bingo!
Now I can play such games like NFS MW or GTA Vice City on my retired but rocking phone.. (proof video)
If you like this - feed me



Display panel overclocking:
Still not enough? Wow..you're d thirsty one..
Ok.. Let's overclock your LCD bus frequency then..
Install any app on you pc that could recursively search txt from kernel directory (I use double-cmd-gtk on ubuntu) or just search you git repo online. Fins this thing (It may vary on 3.x kernels. This is for 2.6 ones):
Code:
panel_info.clk_rate
This part of code will most probably be under /drivers/video/msm folder or directly in your board-xxx.c file which is just my case.
I have this values by default:
Code:
panel_data->panel_info.clk_rate = 192000000;
panel_data->panel_info.clk_min = 190000000;
panel_data->panel_info.clk_max = 200000000;
Simply change to
Code:
panel_data->panel_info.clk_rate = 235000000;
panel_data->panel_info.clk_min = 192000000;
panel_data->panel_info.clk_max = 256000000;
Done



Updating KGSL drivers in kernel:
At first I though this is realy hard to do but I dealed with this and wanna show you a quick and easy way to do it. It is pretty same for most kernel versions. I will do an example using my 2.6 kernel.

Basicly, just get my sourcecode .zip, extract it somewhere. Go to your kernel's /drivers/gpu/msm (or drivers/char/msm) folder and delete it. Now go to my kernel/drivers/gpu/msm and copy that folder to your kernel. Not finished yet. Replace your file with mine from my kernel/include/linux/msm_kgsl.h. Done. Yeah. Soo simple. This are latest CAF gb_release KGSL drivers which improved my 3D performance around 30%. Don't forget to update ROM libs. (You may take them from my .zip too) Same thing is for newer android versions, but dont copy it from my kernel. My kernel is for GingerBread atm.



Tuning Adreno GPU:
This is more simple than previos guides and is already familiar, but I will stick it here again anyway.
It's about using Adreno config file. This will work only on GingerBread ROMs. To make it working place this part of code in your /system/etc/hw_config.sh:
Code:
if [ ! -h /data/local/tmp/adreno_config.txt ]; then
	chmod 777 /system/etc/adreno_config.txt
    ln -s /system/etc/adreno_config.txt /data/local/tmp/adreno_config.txt
fi
Now edit and put your adreno_config.txt in /system/etc/ and set all permissions for it (chmod 777). Also edit your build.prop, add:
Code:
debug.egl.hw=1
debug.egl.profiler=1
debug.performance.tuning=1
debug.sf.hw=1
This is how originnal version of adreno_config file looks like. It contains various explanations and I will put it here so you could refer to.
Now what parameters are realy cool to tune are:
Code:
forceAutoTextureCompression=1
triJuice=3
Theese configs have to greatly improve your 3D performance in cost of quality, but I think it doesnt matter anymore for old devices.



Juice it:
A simple trick to disable framebuffer swapping and flush all frames without filtering os to edit your build.prop and add/replace theese strings:
Code:
debug.sf.hw=1
debug.egl.hw=1
debug.egl.profiler=1
debug.performance.tuning=1
debug.gr.swapinterval=0
debug.egl.swapinterval=0
This will double your 2D FPS but you will get UI glithces instead. It's not because something've get slow - it's because it've get too fast . If you wish to use this trick for prolonged use, I suggest you do disable all animations in system settings.


Probably you may want have a look at another my thread for optimized apps & games HERE.
I think that's it for now. Have a nice day-time. Peace out!

Last edited by FeraVolt; 14th March 2015 at 04:01 PM.
The Following 108 Users Say Thank You to FeraVolt For This Useful Post: [ View ]
 
 
23rd September 2014, 01:40 PM |#2  
maddoc1007's Avatar
Senior Member
Flag cork
Thanks Meter: 56
 
More
tuning adreno gpu
while i wanted to try this hack however i find it impossible as my phone htc hd2 has not got a hw_config.sh in it searched with es file explorer and root explorer and also in system etc and cant find the file. is there any other way to do this? cant do kernel hack as no nothing about kernels at all phone htc hd2 cm7 gingerbread rom http://forum.xda-developers.com/show....php?t=1867986 it is fast and very stable but would be nice to tweak it a bit. Oh and for juice it in my build prop only have debug.sf.hw=1 not the other debug lines do i just add them to build.prop. thank you
Last edited by maddoc1007; 23rd September 2014 at 01:44 PM.
The Following User Says Thank You to maddoc1007 For This Useful Post: [ View ]
24th September 2014, 08:36 AM |#3  
Well i ain't pro in kernel developing but is it work with adreno 205-8255 chipset-mogami board?
26th September 2014, 01:36 AM |#4  
Junior Member
Irvine
Thanks Meter: 44
 
More
Quote:
Originally Posted by yamin8000

Well i ain't pro in kernel developing but is it work with adreno 205-8255 chipset-mogami board?

Yes, adreno 205 has been overclocked before. See this commit: https://github.com/Evervolv/android_...43b0003bbbfd73
The Following User Says Thank You to npz For This Useful Post: [ View ]
27th September 2014, 10:02 PM |#5  
FeraVolt's Avatar
OP Senior Member
Thanks Meter: 13,540
 
Donate to Me
More
Quote:
Originally Posted by yamin8000

Well i ain't pro in kernel developing but is it work with adreno 205-8255 chipset-mogami board?

Quote:
Originally Posted by npz

Yes, adreno 205 has been overclocked before. See this commit: https://github.com/Evervolv/android_...43b0003bbbfd73

I realy hope that that commit realy does overclock andreno205, because in adreno200, despite of setting various values for same kgsl-3d data function, grp_clk was still reporting same default value.. Thats why i digged deeper to find out how adrenos work.. I dont know how do new chips work but older ones frequencies are fully depended on cpu..
Last edited by FeraVolt; 27th September 2014 at 10:04 PM.
The Following User Says Thank You to FeraVolt For This Useful Post: [ View ]
29th September 2014, 09:06 PM |#6  
Member
Thanks Meter: 13
 
More
antutu benchmark score would be nice to compare the results before & after cpu and gpu OC each :3
30th September 2014, 07:56 AM |#7  
FeraVolt's Avatar
OP Senior Member
Thanks Meter: 13,540
 
Donate to Me
More
Quote:
Originally Posted by Flam

antutu benchmark score would be nice to compare the results before & after cpu and gpu OC each :3

I will say about my kernel..that after all optimizations of my kernel..which are not only overclocking, comparing quadrant 3d scores..60% improvement was observed. Comparing cpu score on antutu.. 80% of improvement was observed. Not many dual core cpus can reach 1400 in antutu cpu.. I get it on my one core. Overall my kernel does roughly double higher score than stock firmware. I will attach screensjots later.
The Following 2 Users Say Thank You to FeraVolt For This Useful Post: [ View ]
14th November 2014, 12:26 PM |#8  
rootdefyxt320's Avatar
Senior Member
Flag Sydney, NSW
Thanks Meter: 391
 
More
@FeraVolt Can you please help me to overclock my GPU on MSM7225A? The kernel source is here: https://github.com/rootdefyxt320/and...orola_tinboost My kernel version is 2.6.38.6

EDIT: Okay, here is my acpuclock-7201.c:

Code:
/* 7x25a pll2 at 1200mhz with GSM capable modem */
static struct clkctl_acpu_speed pll0_960_pll1_245_pll2_1200_pll4_800_25a[] = {
	{ 0, 19200, ACPU_PLL_TCXO, 0, 0, 2400, 3, 0, 30720 },
	{ 0, 61440, ACPU_PLL_1, 1, 3,  7680, 3, 1,  61440 },
	{ 1, 122880, ACPU_PLL_1, 1, 1,  15360, 3, 2,  61440 },
	{ 1, 245760, ACPU_PLL_1, 1, 0, 30720, 3, 3,  61440 },
	{ 0, 300000, ACPU_PLL_2, 2, 3, 37500, 3, 4, 150000 },
	{ 1, 320000, ACPU_PLL_0, 4, 2, 40000, 3, 4, 122880 },
	{ 0, 400000, ACPU_PLL_4, 6, 1, 50000, 3, 4, 122880 },
	{ 1, 480000, ACPU_PLL_0, 4, 1, 60000, 3, 5, 122880 },
	{ 1, 600000, ACPU_PLL_2, 2, 1, 75000, 3, 6, 200000 },
May you please help me to interpret it?
Last edited by rootdefyxt320; 14th November 2014 at 12:40 PM.
27th November 2014, 11:08 AM |#9  
Member
Thanks Meter: 10
 
More
HTC HD2
Would this hack work on an old HTC HD2 , it has Adreno 200 (AMD Z430) with OpenGL ES 2.0 support GPU and a Snapdragon S1 QSD8250 chipset
28th November 2014, 06:36 AM |#10  
FeraVolt's Avatar
OP Senior Member
Thanks Meter: 13,540
 
Donate to Me
More
Quote:
Originally Posted by EvilMegaDroid

Would this hack work on an old HTC HD2 , it has Adreno 200 (AMD Z430) with OpenGL ES 2.0 support GPU and a Snapdragon S1 QSD8250 chipset

Yes

Sent from my X10i using XDA Free mobile app
Post Reply Subscribe to Thread

Tags
200, adreno, feralab, feravolt, overclock
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes