Kyle Lin | 79b32cb | 2020-06-02 18:51:20 +0800 | [diff] [blame] | 1 | #!/system/bin/sh |
| 2 | # |
| 3 | # Copyright (C) 2020 The Android Open Source Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # performance test setup for 2020 devices |
| 18 | function disable_thermal() |
| 19 | { |
| 20 | thermal_path='/sys/devices/virtual/thermal/' |
| 21 | |
| 22 | nz=$(ls -al $thermal_path | grep thermal_zone | wc -l) |
| 23 | i=0 |
| 24 | while [ $i -lt $nz ]; do |
| 25 | tz_path=$thermal_path'thermal_zone'$i'/' |
| 26 | mode_path=$tz_path'mode' |
| 27 | |
| 28 | if [ -f $mode_path ]; then |
| 29 | echo disabled > $tz_path'mode' |
| 30 | fi |
| 31 | i=$(($i + 1)); |
| 32 | done |
| 33 | } |
| 34 | |
| 35 | disable_thermal |
| 36 | setprop vendor.powerhal.init 0 |
| 37 | setprop ctl.restart vendor.power-hal-aidl |
| 38 | |
| 39 | cpubase=/sys/devices/system/cpu |
| 40 | gov=cpufreq/scaling_governor |
| 41 | |
| 42 | cpu=6 |
| 43 | top=8 |
| 44 | #Big Core 652800 940800 1152000 1478400 1728000 1900800 2092800 2208000 |
| 45 | #Big Plus 806400 1094400 1401600 1766400 1996800 2188800 2304000 2400000 |
| 46 | cpufreq=2092800 |
| 47 | # Set the bigcores around 2G |
| 48 | while [ $((cpu < $top)) -eq 1 ]; do |
| 49 | echo 1 > $cpubase/cpu${cpu}/online |
| 50 | echo userspace > $cpubase/cpu${cpu}/$gov |
| 51 | echo $cpufreq > /sys/devices/system/cpu/cpu$cpu/cpufreq/scaling_max_freq |
| 52 | echo $cpufreq > /sys/devices/system/cpu/cpu$cpu/cpufreq/scaling_setspeed |
| 53 | S=`cat $cpubase/cpu${cpu}/cpufreq/scaling_cur_freq` |
| 54 | echo "set cpu $cpu to $S kHz" |
| 55 | cpu=$(($cpu + 1)) |
| 56 | done |
| 57 | |
| 58 | cpu=0 |
| 59 | top=6 |
| 60 | # Disable the silver cores. |
| 61 | while [ $((cpu < $top)) -eq 1 ]; do |
| 62 | echo "disable cpu $cpu" |
| 63 | echo 0 > $cpubase/cpu${cpu}/online |
| 64 | cpu=$(($cpu + 1)) |
| 65 | done |
| 66 | |
| 67 | echo "disable GPU bus split" |
| 68 | echo 0 > /sys/class/kgsl/kgsl-3d0/bus_split |
| 69 | echo "enable GPU force clock on" |
| 70 | echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_on |
| 71 | echo "set GPU idle timer to 10000" |
| 72 | echo 10000 > /sys/class/kgsl/kgsl-3d0/idle_timer |
| 73 | |
| 74 | # 0 381 572 762 1144 1571 2086 2597 2929 3879 4943 5931 6881 |
| 75 | echo performance > /sys/class/devfreq/soc:qcom,gpubw/governor |
| 76 | echo -n "set GPU bus frequency to max at " |
| 77 | cat /sys/class/devfreq/soc:qcom,gpubw/cur_freq |
| 78 | |
| 79 | #625 500 400 275 mhz |
| 80 | echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor |
| 81 | echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel |
| 82 | echo 0 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel |
| 83 | echo -n "set GPU frequency to max at " |
| 84 | cat /sys/class/kgsl/kgsl-3d0/devfreq/cur_freq |