├── .gitignore ├── post-fs-data.sh ├── META-INF └── com │ └── google │ └── android │ ├── updater-script │ └── update-binary ├── system.prop ├── sepolicy.rule ├── .gitattributes ├── script ├── vtools-powercfg.sh ├── pathinfo.sh ├── settings_override.sh ├── powercfg_main.sh ├── powercfg_once.sh ├── libcommon.sh └── libpowercfg.sh ├── module.prop ├── profiles ├── sdm710 │ ├── system │ │ └── vendor │ │ │ └── etc │ │ │ └── perf │ │ │ ├── perfboostsconfig.xml │ │ │ ├── targetconfig.xml │ │ │ ├── perfd_profiles │ │ │ ├── fast │ │ │ │ ├── targetconfig.xml │ │ │ │ └── perfboostsconfig.xml │ │ │ ├── powersave │ │ │ │ ├── targetconfig.xml │ │ │ │ └── perfboostsconfig.xml │ │ │ ├── performance │ │ │ │ ├── targetconfig.xml │ │ │ │ └── perfboostsconfig.xml │ │ │ └── balance │ │ │ │ ├── targetconfig.xml │ │ │ │ └── perfboostsconfig.xml │ │ │ └── targetresourceconfigs.xml │ └── powercfg_modes.sh ├── sdm765 │ ├── system │ │ └── vendor │ │ │ └── etc │ │ │ └── perf │ │ │ ├── perfboostsconfig.xml │ │ │ ├── targetconfig.xml │ │ │ ├── perfd_profiles │ │ │ ├── fast │ │ │ │ └── targetconfig.xml │ │ │ ├── balance │ │ │ │ └── targetconfig.xml │ │ │ ├── powersave │ │ │ │ └── targetconfig.xml │ │ │ └── performance │ │ │ │ └── targetconfig.xml │ │ │ └── targetresourceconfigs.xml │ └── powercfg_modes.sh ├── sdm845 │ ├── system │ │ └── vendor │ │ │ └── etc │ │ │ └── perf │ │ │ ├── perfboostsconfig.xml │ │ │ ├── targetresourceconfigs.xml │ │ │ ├── targetconfig.xml │ │ │ └── perfd_profiles │ │ │ ├── fast │ │ │ ├── targetconfig.xml │ │ │ └── perfboostsconfig.xml │ │ │ ├── powersave │ │ │ ├── targetconfig.xml │ │ │ └── perfboostsconfig.xml │ │ │ ├── performance │ │ │ ├── targetconfig.xml │ │ │ └── perfboostsconfig.xml │ │ │ └── balance │ │ │ ├── targetconfig.xml │ │ │ └── perfboostsconfig.xml │ └── powercfg_modes.sh ├── sdm855 │ ├── system │ │ └── vendor │ │ │ └── etc │ │ │ └── perf │ │ │ ├── perfboostsconfig.xml │ │ │ ├── targetconfig.xml │ │ │ ├── perfd_profiles │ │ │ ├── fast │ │ │ │ ├── targetconfig.xml │ │ │ │ └── perfboostsconfig.xml │ │ │ ├── performance │ │ │ │ ├── targetconfig.xml │ │ │ │ └── perfboostsconfig.xml │ │ │ ├── powersave │ │ │ │ ├── targetconfig.xml │ │ │ │ └── perfboostsconfig.xml │ │ │ └── balance │ │ │ │ ├── targetconfig.xml │ │ │ │ └── perfboostsconfig.xml │ │ │ └── targetresourceconfigs.xml │ └── powercfg_modes.sh ├── sdm675_730 │ ├── system │ │ └── vendor │ │ │ └── etc │ │ │ └── perf │ │ │ ├── perfboostsconfig.xml │ │ │ ├── targetconfig.xml │ │ │ ├── perfd_profiles │ │ │ ├── fast │ │ │ │ └── targetconfig.xml │ │ │ ├── performance │ │ │ │ └── targetconfig.xml │ │ │ ├── powersave │ │ │ │ └── targetconfig.xml │ │ │ └── balance │ │ │ │ └── targetconfig.xml │ │ │ └── targetresourceconfigs.xml │ └── powercfg_modes.sh └── sdm865 │ ├── system │ └── vendor │ │ └── etc │ │ └── perf │ │ ├── perfboostsconfig.xml │ │ ├── targetconfig.xml │ │ ├── perfd_profiles │ │ ├── fast │ │ │ └── targetconfig.xml │ │ ├── balance │ │ │ ├── targetconfig.xml │ │ │ └── perfboostsconfig.xml │ │ ├── powersave │ │ │ └── targetconfig.xml │ │ └── performance │ │ │ └── targetconfig.xml │ │ └── targetresourceconfigs.xml │ └── powercfg_modes.sh ├── uninstall.sh ├── service.sh ├── customize.sh └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode -------------------------------------------------------------------------------- /post-fs-data.sh: -------------------------------------------------------------------------------- 1 | MODDIR=${0%/*} 2 | -------------------------------------------------------------------------------- /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /system.prop: -------------------------------------------------------------------------------- 1 | # This file will be read by resetprop 2 | # Example: Change dpi 3 | # ro.sf.lcd_density=320 4 | -------------------------------------------------------------------------------- /sepolicy.rule: -------------------------------------------------------------------------------- 1 | # Put sepolicy statements here 2 | # Example: allow { audioserver mediaserver } audioserver_tmpfs file { read write open } 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Declare files that will always have LF line endings on checkout. 2 | META-INF/** text eol=lf 3 | *.prop text eol=lf 4 | *.sh text eol=lf 5 | *.md text eol=lf 6 | -------------------------------------------------------------------------------- /script/vtools-powercfg.sh: -------------------------------------------------------------------------------- 1 | #! /vendor/bin/sh 2 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 3 | # Author: Matt Yang 4 | 5 | # powercfg wrapper for com.omarea.vtools 6 | # MAKE SURE THAT THE MAGISK MODULE "Perfd-opt" HAS BEEN INSTALLED 7 | 8 | -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=perfd-opt 2 | name=Perfd-opt 3 | version=v4 (20200306) 4 | versionCode=4 5 | author=Matt Yang 6 | description=Provide better energy efficiency on EAS platforms by tuning CAF boostframework configuration. Repo: https://github.com/yc9559/perfd-opt/ 7 | -------------------------------------------------------------------------------- /script/pathinfo.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Module Path Header 3 | # https://github.com/yc9559/ 4 | # Author: Matt Yang 5 | 6 | SCRIPT_DIR="/script" 7 | BIN_DIR="/bin" 8 | MODULE_PATH="$(dirname $(readlink -f "$0"))" 9 | MODULE_PATH="${MODULE_PATH%$SCRIPT_DIR}" 10 | PANEL_FILE="/sdcard/Android/panel_powercfg.txt" 11 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /profiles/sdm765/system/vendor/etc/perf/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /profiles/sdm675_730/system/vendor/etc/perf/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /profiles/sdm865/system/vendor/etc/perf/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /script/settings_override.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 3 | # Original repo: https://github.com/yc9559/sdm855-tune/ 4 | # Author: Matt Yang 5 | # Platform: sdm855 6 | # Version: v4 (20200306) 7 | 8 | # smoother oneplus launcher gesture animation, not relying on window_animation_scale 9 | # /vendor/bin/sh: settings: inaccessible or not found 10 | # settings put global animator_duration_scale 1.15 11 | -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Additional cleanup 3 | 4 | wait_until_login() 5 | { 6 | # whether in lock screen, tested on Android 7.1 & 10.0 7 | # in case of other magisk module remounting /data as RW 8 | while [ "$(dumpsys window policy | grep mInputRestricted=true)" != "" ]; do 9 | sleep 2 10 | done 11 | # we doesn't have the permission to rw "/sdcard" before the user unlocks the screen 12 | while [ ! -d "/sdcard/Android" ]; do 13 | sleep 2 14 | done 15 | } 16 | 17 | wait_until_login 18 | rm -rf "/sdcard/Android/panel_powercfg.txt" 19 | rm -rf "/sdcard/powercfg_panel.txt" 20 | -------------------------------------------------------------------------------- /service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/... 3 | # This will make your scripts compatible even if Magisk change its mount point in the future 4 | MODDIR=${0%/*} 5 | SCRIPT_DIR="$MODDIR/script" 6 | 7 | if [ "$(cat $SCRIPT_DIR/pathinfo.sh | grep "$PATH")" == "" ]; then 8 | echo "" >> $SCRIPT_DIR/pathinfo.sh 9 | echo "# prefer to use busybox provided by magisk" >> $SCRIPT_DIR/pathinfo.sh 10 | echo "PATH=$PATH" >> $SCRIPT_DIR/pathinfo.sh 11 | fi 12 | 13 | # support vtools 14 | cp -af $SCRIPT_DIR/vtools-powercfg.sh /data/powercfg.sh 15 | cp -af $SCRIPT_DIR/vtools-powercfg.sh /data/powercfg-base.sh 16 | chmod 755 /data/powercfg.sh 17 | chmod 755 /data/powercfg-base.sh 18 | 19 | # powercfg path provided by magisk module 20 | echo "sh $SCRIPT_DIR/powercfg_main.sh \"\$1\"" >> /data/powercfg.sh 21 | 22 | # not relying on executable permissions 23 | sh $SCRIPT_DIR/powercfg_main.sh 24 | sh $SCRIPT_DIR/powercfg_once.sh 25 | sh $SCRIPT_DIR/settings_override.sh 26 | -------------------------------------------------------------------------------- /script/powercfg_main.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 3 | # Original repo: https://github.com/yc9559/sdm855-tune/ 4 | # Author: Matt Yang 5 | # Platform: sdm855 6 | # Version: v4 (20200306) 7 | 8 | BASEDIR="$(dirname "$0")" 9 | . $BASEDIR/libcommon.sh 10 | . $BASEDIR/libpowercfg.sh 11 | . $BASEDIR/powercfg_modes.sh 12 | 13 | # $1: power_mode 14 | apply_power_mode() 15 | { 16 | perfhal_stop 17 | apply_common 18 | eval apply_$1 19 | perfhal_update "$1" 20 | perfhal_start 21 | echo "Applying $1 done." 22 | } 23 | 24 | # $1: power_mode 25 | verify_power_mode() 26 | { 27 | case "$1" in 28 | "powersave"|"balance"|"performance"|"fast") echo "$1";; 29 | *) echo "balance" ;; 30 | esac 31 | } 32 | 33 | save_panel() 34 | { 35 | clear_panel 36 | write_panel "" 37 | write_panel "Perfd-opt" 38 | write_panel "https://github.com/yc9559/perfd-opt/" 39 | write_panel "Author: Matt Yang" 40 | write_panel "Platform: $PLATFORM_NAME" 41 | write_panel "Version: v4 (20200306)" 42 | write_panel "Last performed: $(date '+%Y-%m-%d %H:%M:%S')" 43 | write_panel "" 44 | write_panel "[Perfhal status]" 45 | write_panel "$(perfhal_status)" 46 | write_panel "" 47 | write_panel "[Settings]" 48 | write_panel "# The default mode applied at boot" 49 | write_panel "# Available mode: balance powersave performance fast" 50 | write_panel "default_mode=$default_mode" 51 | } 52 | 53 | wait_until_login 54 | 55 | # 1. target from exec parameter 56 | action="$1" 57 | # 2. target from panel 58 | default_mode="$(read_cfg_value default_mode)" 59 | [ "$action" == "" ] && action="$default_mode" 60 | # 3. target from default(=balance) 61 | action="$(verify_power_mode "$action")" 62 | default_mode="$(verify_power_mode "$default_mode")" 63 | 64 | # perform hotfix 65 | apply_power_mode "$action" 66 | 67 | # save mode for automatic applying mode after reboot 68 | save_panel 69 | 70 | exit 0 71 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/targetresourceconfigs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/perfd_profiles/fast/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/perfd_profiles/powersave/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm765/system/vendor/etc/perf/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/perfd_profiles/performance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/perfd_profiles/fast/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm865/system/vendor/etc/perf/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/perfd_profiles/powersave/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/perfd_profiles/performance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/perfd_profiles/balance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm765/system/vendor/etc/perf/perfd_profiles/fast/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/perfd_profiles/balance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /profiles/sdm765/system/vendor/etc/perf/perfd_profiles/balance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm765/system/vendor/etc/perf/perfd_profiles/powersave/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm865/system/vendor/etc/perf/perfd_profiles/fast/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm765/system/vendor/etc/perf/perfd_profiles/performance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm865/system/vendor/etc/perf/perfd_profiles/balance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm865/system/vendor/etc/perf/perfd_profiles/powersave/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/perfd_profiles/fast/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm865/system/vendor/etc/perf/perfd_profiles/performance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/perfd_profiles/performance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/perfd_profiles/powersave/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/perfd_profiles/balance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/perfd_profiles/powersave/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/perfd_profiles/balance/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/perfd_profiles/fast/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /profiles/sdm845/system/vendor/etc/perf/perfd_profiles/performance/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /profiles/sdm675_730/system/vendor/etc/perf/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /profiles/sdm675_730/system/vendor/etc/perf/perfd_profiles/fast/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /profiles/sdm675_730/system/vendor/etc/perf/perfd_profiles/performance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /profiles/sdm675_730/system/vendor/etc/perf/perfd_profiles/powersave/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /profiles/sdm675_730/system/vendor/etc/perf/perfd_profiles/balance/targetconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 27 | 28 | 38 | 39 | 42 | 43 | 44 | 45 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/targetresourceconfigs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /script/powercfg_once.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 3 | # Original repo: https://github.com/yc9559/sdm855-tune/ 4 | # Author: Matt Yang 5 | # Platform: sdm855 6 | # Version: v4 (20200306) 7 | 8 | # Runonce after boot, to speed up the transition of power modes in powercfg 9 | 10 | BASEDIR="$(dirname "$0")" 11 | . $BASEDIR/libcommon.sh 12 | . $BASEDIR/libpowercfg.sh 13 | . $BASEDIR/powercfg_modes.sh 14 | 15 | # prefer to use prev cpu, decrease jitter from 0.5ms to 0.3ms with lpm settings 16 | lock_val "15000000" $SCHED/sched_migration_cost_ns 17 | 18 | # OnePlus opchain pins UX threads on the big cluster 19 | lock_val "0" /sys/module/opchain/parameters/chain_on 20 | 21 | # unify schedtune misc 22 | # android 10 doesn't have schedtune.sched_boost_enabled exposed, default = true 23 | lock_val "0" $ST_BACK/schedtune.sched_boost_enabled 24 | lock_val "0" $ST_BACK/schedtune.sched_boost_no_override 25 | lock_val "0" $ST_BACK/schedtune.boost 26 | lock_val "0" $ST_BACK/schedtune.prefer_idle 27 | lock_val "0" $ST_FORE/schedtune.sched_boost_enabled 28 | lock_val "0" $ST_FORE/schedtune.sched_boost_no_override 29 | lock_val "0" $ST_FORE/schedtune.boost 30 | lock_val "1" $ST_FORE/schedtune.prefer_idle 31 | lock_val "1" $ST_TOP/schedtune.sched_boost_enabled 32 | lock_val "0" $ST_TOP/schedtune.sched_boost_no_override 33 | 34 | # CFQ io scheduler takes cgroup into consideration 35 | lock_val "cfq" $SDA_Q/scheduler 36 | # Flash doesn't have back seek problem, so penalty is as low as possible 37 | lock_val "1" $SDA_Q/iosched/back_seek_penalty 38 | # slice_idle = 0 means CFQ IOP mode, https://lore.kernel.org/patchwork/patch/944972/ 39 | lock_val "0" $SDA_Q/iosched/slice_idle 40 | # UFS 2.0+ hardware queue depth is 32 41 | lock_val "16" $SDA_Q/iosched/quantum 42 | # lower read_ahead_kb to reduce random access overhead 43 | lock_val "128" $SDA_Q/read_ahead_kb 44 | 45 | # Reserve 90% IO bandwith for foreground tasks 46 | lock_val "1000" /dev/blkio/blkio.weight 47 | lock_val "1000" /dev/blkio/blkio.leaf_weight 48 | lock_val "100" /dev/blkio/background/blkio.weight 49 | lock_val "100" /dev/blkio/background/blkio.leaf_weight 50 | 51 | # save ~100mw under light 3D workload 52 | lock_val "0" $KSGL/force_no_nap 53 | lock_val "1" $KSGL/bus_split 54 | lock_val "0" $KSGL/force_bus_on 55 | lock_val "0" $KSGL/force_clk_on 56 | lock_val "0" $KSGL/force_rail_on 57 | 58 | # treat crtc_commit as background, avoid display preemption on big 59 | change_task_cgroup "crtc_commit" "system-background" "cpuset" 60 | 61 | # fix laggy bilibili feed scrolling 62 | change_task_cgroup "servicemanager" "top-app" "cpuset" 63 | change_task_cgroup "servicemanager" "foreground" "stune" 64 | change_task_cgroup "android.phone" "top-app" "cpuset" 65 | change_task_cgroup "android.phone" "foreground" "stune" 66 | 67 | # fix laggy home gesture 68 | change_task_cgroup "system_server" "top-app" "cpuset" 69 | change_task_cgroup "system_server" "foreground" "stune" 70 | 71 | # reduce render thread waiting time 72 | change_task_cgroup "surfaceflinger" "top-app" "cpuset" 73 | change_task_cgroup "surfaceflinger" "foreground" "stune" 74 | 75 | # reduce big cluster wakeup, eg. android.hardware.sensors@1.0-service 76 | change_task_affinity ".hardware." "0f" 77 | # ...but exclude the fingerprint&camera service for speed 78 | change_task_affinity ".hardware.biometrics.fingerprint" "ff" 79 | change_task_affinity ".hardware.camera.provider" "ff" 80 | 81 | # platform specific 82 | apply_once 83 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/perfd_profiles/balance/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/perfd_profiles/fast/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/perfd_profiles/performance/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/perfd_profiles/powersave/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /script/libcommon.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Basic Tool Library 3 | # https://github.com/yc9559/ 4 | # Author: Matt Yang 5 | # Version: 20200227 6 | 7 | BASEDIR="$(dirname "$0")" 8 | . $BASEDIR/pathinfo.sh 9 | 10 | ############################### 11 | # Basic tool functions 12 | ############################### 13 | 14 | # $1:value $2:file path 15 | lock_val() 16 | { 17 | if [ -f "$2" ]; then 18 | chmod 0666 "$2" 2> /dev/null 19 | echo "$1" > "$2" 20 | chmod 0444 "$2" 2> /dev/null 21 | fi 22 | } 23 | 24 | # $1:value $2:file path 25 | mutate() 26 | { 27 | if [ -f "$2" ]; then 28 | chmod 0666 "$2" 2> /dev/null 29 | echo "$1" > "$2" 30 | fi 31 | } 32 | 33 | # $1:value $2:list 34 | has_val_in_list() 35 | { 36 | for item in $2; do 37 | if [ "$1" == "$item" ]; then 38 | echo "true" 39 | return 40 | fi 41 | done 42 | echo "false" 43 | } 44 | 45 | ############################### 46 | # Config File Operator 47 | ############################### 48 | 49 | # $1:key $return:value(string) 50 | read_cfg_value() 51 | { 52 | local value="" 53 | if [ -f "$PANEL_FILE" ]; then 54 | value="$(grep "^$1=" "$PANEL_FILE" | head -n 1 | tr -d ' ' | cut -d= -f2)" 55 | fi 56 | echo "$value" 57 | } 58 | 59 | # $1:content 60 | write_panel() 61 | { 62 | echo "$1" >> "$PANEL_FILE" 63 | } 64 | 65 | clear_panel() 66 | { 67 | true > "$PANEL_FILE" 68 | } 69 | 70 | wait_until_login() 71 | { 72 | # whether in lock screen, tested on Android 7.1 & 10.0 73 | # in case of other magisk module remounting /data as RW 74 | while [ "$(dumpsys window policy | grep mInputRestricted=true)" != "" ]; do 75 | sleep 2 76 | done 77 | # we doesn't have the permission to rw "/sdcard" before the user unlocks the screen 78 | while [ ! -d "/sdcard/Android" ]; do 79 | sleep 2 80 | done 81 | } 82 | 83 | ############################### 84 | # Cgroup functions 85 | ############################### 86 | 87 | # $1:task_name $2:cgroup_name $3:"cpuset"/"stune" 88 | change_task_cgroup() 89 | { 90 | # avoid matching grep itself 91 | # ps -Ao pid,args | grep kswapd 92 | # 150 [kswapd0] 93 | # 16490 grep kswapd 94 | local ps_ret 95 | ps_ret="$(ps -Ao pid,args)" 96 | for temp_pid in $(echo "$ps_ret" | grep "$1" | awk '{print $1}'); do 97 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 98 | echo "$temp_tid" > "/dev/$3/$2/tasks" 99 | done 100 | done 101 | } 102 | 103 | # $1:task_name $2:hex_mask(0x00000003 is CPU0 and CPU1) 104 | change_task_affinity() 105 | { 106 | # avoid matching grep itself 107 | # ps -Ao pid,args | grep kswapd 108 | # 150 [kswapd0] 109 | # 16490 grep kswapd 110 | local ps_ret 111 | ps_ret="$(ps -Ao pid,args)" 112 | for temp_pid in $(echo "$ps_ret" | grep "$1" | awk '{print $1}'); do 113 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 114 | taskset -p "$2" "$temp_tid" 115 | done 116 | done 117 | } 118 | 119 | # $1:task_name $2:nice(relative to 120) 120 | change_task_nice() 121 | { 122 | # avoid matching grep itself 123 | # ps -Ao pid,args | grep kswapd 124 | # 150 [kswapd0] 125 | # 16490 grep kswapd 126 | local ps_ret 127 | ps_ret="$(ps -Ao pid,args)" 128 | for temp_pid in $(echo "$ps_ret" | grep "$1" | awk '{print $1}'); do 129 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 130 | renice "$2" -p "$temp_tid" 131 | done 132 | done 133 | } 134 | 135 | ############################### 136 | # Platform info functions 137 | ############################### 138 | 139 | # $1:"4.14" return:string_in_version 140 | match_linux_version() 141 | { 142 | echo "$(cat /proc/version | grep "$1")" 143 | } 144 | 145 | # return:platform_name 146 | get_platform_name() 147 | { 148 | echo "$(getprop ro.board.platform)" 149 | } 150 | -------------------------------------------------------------------------------- /script/libpowercfg.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Powercfg Library 3 | # https://github.com/yc9559/ 4 | # Author: Matt Yang 5 | # Version: 20200225 6 | 7 | BASEDIR="$(dirname "$0")" 8 | . $BASEDIR/pathinfo.sh 9 | . $BASEDIR/libcommon.sh 10 | 11 | ############################### 12 | # PATHs 13 | ############################### 14 | 15 | PERFCFG_REL="./system/vendor/etc/perf" 16 | 17 | ############################### 18 | # Abbreviations 19 | ############################### 20 | 21 | SCHED="/proc/sys/kernel" 22 | CPU="/sys/devices/system/cpu" 23 | KSGL="/sys/class/kgsl/kgsl-3d0" 24 | DEVFREQ="/sys/class/devfreq" 25 | LPM="/sys/module/lpm_levels/parameters" 26 | MSM_PERF="/sys/module/msm_performance/parameters" 27 | ST_TOP="/dev/stune/top-app" 28 | ST_FORE="/dev/stune/foreground" 29 | ST_BACK="/dev/stune/background" 30 | SDA_Q="/sys/block/sda/queue" 31 | 32 | if [ "$(match_linux_version 4.19)" != "" ]; then 33 | CPU_BOOST="/sys/devices/system/cpu/cpu_boost/parameters" 34 | else 35 | CPU_BOOST="/sys/module/cpu_boost/parameters" 36 | fi 37 | 38 | ############################### 39 | # Powermodes helper functions 40 | ############################### 41 | 42 | # $1:keyword $2:nr_max_matched 43 | get_package_name_by_keyword() 44 | { 45 | echo "$(pm list package | grep "$1" | head -n "$2" | cut -d: -f2)" 46 | } 47 | 48 | # $1:"0:576000 4:710400 7:825600" 49 | set_cpufreq_min() 50 | { 51 | mutate "$1" $MSM_PERF/cpu_min_freq 52 | local key 53 | local val 54 | for kv in $1; do 55 | key=${kv%:*} 56 | val=${kv#*:} 57 | mutate "$val" $CPU/cpu$key/cpufreq/scaling_min_freq 58 | done 59 | } 60 | 61 | # $1:"0:576000 4:710400 7:825600" 62 | set_cpufreq_max() 63 | { 64 | mutate "$1" $MSM_PERF/cpu_max_freq 65 | } 66 | 67 | # $1:"0:576000 4:710400 7:825600" 68 | set_cpufreq_dyn_max() 69 | { 70 | local key 71 | local val 72 | for kv in $1; do 73 | key=${kv%:*} 74 | val=${kv#*:} 75 | mutate "$val" $CPU/cpu$key/cpufreq/scaling_max_freq 76 | done 77 | } 78 | 79 | # $1:"schedutil/pl" $2:"0:4 4:3 7:1" 80 | set_governor_param() 81 | { 82 | local key 83 | local val 84 | for kv in $2; do 85 | key=${kv%:*} 86 | val=${kv#*:} 87 | mutate "$val" $CPU/cpu$key/cpufreq/$1 88 | done 89 | } 90 | 91 | # $1:"min_cpus" $2:"0:4 4:3 7:1" 92 | set_corectl_param() 93 | { 94 | local key 95 | local val 96 | for kv in $2; do 97 | key=${kv%:*} 98 | val=${kv#*:} 99 | mutate "$val" $CPU/cpu$key/core_ctl/$1 100 | done 101 | } 102 | 103 | # $1:upmigrate $2:downmigrate $3:group_upmigrate $4:group_downmigrate 104 | set_sched_migrate() 105 | { 106 | mutate "$2" $SCHED/sched_downmigrate 107 | mutate "$1" $SCHED/sched_upmigrate 108 | mutate "$2" $SCHED/sched_downmigrate 109 | mutate "$4" $SCHED/sched_group_downmigrate 110 | mutate "$3" $SCHED/sched_group_upmigrate 111 | mutate "$4" $SCHED/sched_group_downmigrate 112 | } 113 | 114 | ############################### 115 | # QTI perf framework functions 116 | ############################### 117 | 118 | perfhal_mode="balance" 119 | 120 | # stop before updating cfg 121 | perfhal_stop() 122 | { 123 | stop perf-hal-1-0 124 | stop perf-hal-2-0 125 | usleep 500 126 | } 127 | 128 | # start after updating cfg 129 | perfhal_start() 130 | { 131 | start perf-hal-1-0 132 | start perf-hal-2-0 133 | } 134 | 135 | # $1:mode(such as balance) 136 | perfhal_update() 137 | { 138 | perfhal_mode="$1" 139 | rm /data/vendor/perfd/default_values 140 | cp -af "$MODULE_PATH/$PERFCFG_REL/perfd_profiles/$perfhal_mode"/* "$MODULE_PATH/$PERFCFG_REL/" 141 | } 142 | 143 | # return:status 144 | perfhal_status() 145 | { 146 | if [ "$(ps -A | grep "qti.hardware.perf")" != "" ]; then 147 | echo "Running. Current mode is $perfhal_mode." 148 | else 149 | echo "QTI boost framework not equipped with this system." 150 | fi 151 | } 152 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/perfd_profiles/powersave/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 69 | 70 | 71 | 73 | 74 | 75 | 77 | 78 | 79 | 81 | 82 | 83 | 85 | 86 | 87 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /profiles/sdm845/powercfg_modes.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Platform Power Modes 3 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 4 | # Author: Matt Yang 5 | # Platform: sdm845 6 | # Version: v4 (20200306) 7 | 8 | BASEDIR="$(dirname "$0")" 9 | . $BASEDIR/pathinfo.sh 10 | . $BASEDIR/libpowercfg.sh 11 | 12 | PLATFORM_NAME="sdm845" 13 | BWMON_CPU_LLC="soc:qcom,cpubw" 14 | BWMON_LLC_DDR="soc:qcom,llccbw" 15 | BIG_L3_LAT="soc:qcom,l3-cpu4" 16 | BIG_DDR_LAT="soc:qcom,memlat-cpu4" 17 | STUNE_BG_CPUS="0-3" 18 | STUNE_FG_CPUS="0-6" 19 | 20 | apply_common() 21 | { 22 | set_governor_param "scaling_governor" "0:schedutil 4:schedutil" 23 | set_governor_param "schedutil/hispeed_load" "0:90 4:90" 24 | set_governor_param "schedutil/hispeed_freq" "0:1132800 4:1612800" 25 | set_cpufreq_max "0:9999000 4:9999000" 26 | set_cpufreq_dyn_max "0:9999000 4:9999000" 27 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_CPU_LLC/governor 28 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_LLC_DDR/governor 29 | mutate "0" $DEVFREQ/$BWMON_CPU_LLC/min_freq 30 | mutate "0" $DEVFREQ/$BWMON_LLC_DDR/min_freq 31 | lock_val "8000" $DEVFREQ/$BIG_L3_LAT/mem_latency/ratio_ceil 32 | lock_val "800" $DEVFREQ/$BIG_DDR_LAT/mem_latency/ratio_ceil 33 | mutate "0" $LPM/lpm_prediction 34 | mutate "0" $LPM/sleep_disabled 35 | } 36 | 37 | apply_powersave() 38 | { 39 | set_cpufreq_min "0:300000 4:300000" 40 | set_cpufreq_max "0:1766400 4:1996800" 41 | set_sched_migrate "95" "95" "140" "100" 42 | set_corectl_param "min_cpus" "0:4 4:1" 43 | set_governor_param "schedutil/pl" "0:0 4:0" 44 | lock_val "0:1132800 4:1286400" $CPU_BOOST/input_boost_freq 45 | lock_val "800" $CPU_BOOST/input_boost_ms 46 | lock_val "2" $CPU_BOOST/sched_boost_on_input 47 | mutate "0" $ST_TOP/schedtune.boost 48 | mutate "1" $ST_TOP/schedtune.prefer_idle 49 | mutate "9500" $DEVFREQ/$BWMON_CPU_LLC/max_freq 50 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 51 | mutate "25" $LPM/bias_hyst 52 | } 53 | 54 | apply_balance() 55 | { 56 | set_cpufreq_min "0:576000 4:825600" 57 | set_cpufreq_max "0:1766400 4:2476800" 58 | set_sched_migrate "95" "95" "140" "100" 59 | set_corectl_param "min_cpus" "0:4 4:2" 60 | set_governor_param "schedutil/pl" "0:0 4:1" 61 | lock_val "0:1132800 4:1286400" $CPU_BOOST/input_boost_freq 62 | lock_val "800" $CPU_BOOST/input_boost_ms 63 | lock_val "2" $CPU_BOOST/sched_boost_on_input 64 | mutate "0" $ST_TOP/schedtune.boost 65 | mutate "1" $ST_TOP/schedtune.prefer_idle 66 | mutate "9500" $DEVFREQ/$BWMON_CPU_LLC/max_freq 67 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 68 | mutate "25" $LPM/bias_hyst 69 | } 70 | 71 | apply_performance() 72 | { 73 | set_cpufreq_min "0:576000 4:825600" 74 | set_cpufreq_max "0:1766400 4:2803200" 75 | set_sched_migrate "80" "80" "100" "90" 76 | set_corectl_param "min_cpus" "0:4 4:4" 77 | set_governor_param "schedutil/pl" "0:0 4:1" 78 | lock_val "0:1132800 4:1612800" $CPU_BOOST/input_boost_freq 79 | lock_val "2000" $CPU_BOOST/input_boost_ms 80 | lock_val "2" $CPU_BOOST/sched_boost_on_input 81 | mutate "10" $ST_TOP/schedtune.boost 82 | mutate "1" $ST_TOP/schedtune.prefer_idle 83 | mutate "11000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 84 | mutate "7000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 85 | mutate "100" $LPM/bias_hyst 86 | } 87 | 88 | apply_fast() 89 | { 90 | set_cpufreq_min "0:576000 4:1612800" 91 | set_cpufreq_max "0:1766400 4:2476800" 92 | set_sched_migrate "80" "80" "100" "90" 93 | set_corectl_param "min_cpus" "0:4 4:4" 94 | set_governor_param "schedutil/pl" "0:1 4:1" 95 | lock_val "0:1132800 4:1612800" $CPU_BOOST/input_boost_freq 96 | lock_val "2000" $CPU_BOOST/input_boost_ms 97 | lock_val "1" $CPU_BOOST/sched_boost_on_input 98 | mutate "30" $ST_TOP/schedtune.boost 99 | mutate "1" $ST_TOP/schedtune.prefer_idle 100 | mutate "11000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 101 | mutate "7000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 102 | mutate "1000" $LPM/bias_hyst 103 | } 104 | 105 | apply_once() 106 | { 107 | mutate "$STUNE_FG_CPUS" /dev/cpuset/foreground/cpus 108 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/background/cpus 109 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/restricted/cpus 110 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/display/cpus 111 | set_corectl_param "enable" "0:1 4:1" 112 | set_corectl_param "busy_down_thres" "0:20 4:20" 113 | set_corectl_param "busy_up_thres" "0:40 4:40" 114 | set_corectl_param "offline_delay_ms" "0:100 4:100" 115 | } 116 | -------------------------------------------------------------------------------- /profiles/sdm710/powercfg_modes.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Platform Power Modes 3 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 4 | # Author: Matt Yang 5 | # Platform: sdm710/sdm712 6 | # Version: v4 (20200306) 7 | 8 | BASEDIR="$(dirname "$0")" 9 | . $BASEDIR/pathinfo.sh 10 | . $BASEDIR/libpowercfg.sh 11 | 12 | PLATFORM_NAME="sdm710/sdm712" 13 | BWMON_CPU_LLC="soc:qcom,cpubw" 14 | BWMON_LLC_DDR="soc:qcom,cpubw" 15 | BIG_L3_LAT="soc:qcom,l3-cpu6" 16 | BIG_DDR_LAT="soc:qcom,memlat-cpu6" 17 | STUNE_BG_CPUS="0-3" 18 | STUNE_FG_CPUS="0-6" 19 | 20 | apply_common() 21 | { 22 | set_governor_param "scaling_governor" "0:schedutil 6:schedutil" 23 | set_governor_param "schedutil/hispeed_load" "0:90 6:90" 24 | set_governor_param "schedutil/hispeed_freq" "0:998400 6:1536000" 25 | set_cpufreq_max "0:9999000 6:9999000" 26 | set_cpufreq_dyn_max "0:9999000 6:9999000" 27 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_CPU_LLC/governor 28 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_LLC_DDR/governor 29 | mutate "0" $DEVFREQ/$BWMON_CPU_LLC/min_freq 30 | mutate "0" $DEVFREQ/$BWMON_LLC_DDR/min_freq 31 | lock_val "8000" $DEVFREQ/$BIG_L3_LAT/mem_latency/ratio_ceil 32 | lock_val "800" $DEVFREQ/$BIG_DDR_LAT/mem_latency/ratio_ceil 33 | mutate "0" $LPM/lpm_prediction 34 | mutate "0" $LPM/sleep_disabled 35 | } 36 | 37 | apply_powersave() 38 | { 39 | set_cpufreq_min "0:300000 6:300000" 40 | set_cpufreq_max "0:1708800 6:1843200" 41 | set_sched_migrate "95" "95" "140" "100" 42 | set_corectl_param "min_cpus" "0:4 6:1" 43 | set_governor_param "schedutil/pl" "0:0 6:0" 44 | lock_val "0:998400 6:1132800" $CPU_BOOST/input_boost_freq 45 | lock_val "800" $CPU_BOOST/input_boost_ms 46 | lock_val "2" $CPU_BOOST/sched_boost_on_input 47 | mutate "0" $ST_TOP/schedtune.boost 48 | mutate "1" $ST_TOP/schedtune.prefer_idle 49 | mutate "6000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 50 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 51 | mutate "25" $LPM/bias_hyst 52 | } 53 | 54 | apply_balance() 55 | { 56 | set_cpufreq_min "0:576000 6:652800" 57 | set_cpufreq_max "0:1708800 6:2016000" 58 | set_sched_migrate "95" "95" "140" "100" 59 | set_corectl_param "min_cpus" "0:4 6:2" 60 | set_governor_param "schedutil/pl" "0:0 6:1" 61 | lock_val "0:998400 6:1132800" $CPU_BOOST/input_boost_freq 62 | lock_val "800" $CPU_BOOST/input_boost_ms 63 | lock_val "2" $CPU_BOOST/sched_boost_on_input 64 | mutate "0" $ST_TOP/schedtune.boost 65 | mutate "1" $ST_TOP/schedtune.prefer_idle 66 | mutate "6000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 67 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 68 | mutate "25" $LPM/bias_hyst 69 | } 70 | 71 | apply_performance() 72 | { 73 | set_cpufreq_min "0:576000 6:652800" 74 | set_cpufreq_max "0:1708800 6:2208000" 75 | set_sched_migrate "80" "80" "100" "90" 76 | set_corectl_param "min_cpus" "0:6 6:2" 77 | set_governor_param "schedutil/pl" "0:0 6:1" 78 | lock_val "0:998400 6:1536000" $CPU_BOOST/input_boost_freq 79 | lock_val "2000" $CPU_BOOST/input_boost_ms 80 | lock_val "2" $CPU_BOOST/sched_boost_on_input 81 | mutate "10" $ST_TOP/schedtune.boost 82 | mutate "1" $ST_TOP/schedtune.prefer_idle 83 | mutate "7000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 84 | mutate "7000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 85 | mutate "100" $LPM/bias_hyst 86 | } 87 | 88 | apply_fast() 89 | { 90 | set_cpufreq_min "0:576000 6:1536000" 91 | set_cpufreq_max "0:1708800 6:2016000" 92 | set_sched_migrate "80" "80" "100" "90" 93 | set_corectl_param "min_cpus" "0:6 6:2" 94 | set_governor_param "schedutil/pl" "0:1 6:1" 95 | lock_val "0:998400 6:1536000" $CPU_BOOST/input_boost_freq 96 | lock_val "2000" $CPU_BOOST/input_boost_ms 97 | lock_val "1" $CPU_BOOST/sched_boost_on_input 98 | mutate "30" $ST_TOP/schedtune.boost 99 | mutate "1" $ST_TOP/schedtune.prefer_idle 100 | mutate "7000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 101 | mutate "7000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 102 | mutate "1000" $LPM/bias_hyst 103 | } 104 | 105 | apply_once() 106 | { 107 | mutate "$STUNE_FG_CPUS" /dev/cpuset/foreground/cpus 108 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/background/cpus 109 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/restricted/cpus 110 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/display/cpus 111 | set_corectl_param "enable" "0:1 6:1" 112 | set_corectl_param "busy_down_thres" "0:20 6:20" 113 | set_corectl_param "busy_up_thres" "0:40 6:40" 114 | set_corectl_param "offline_delay_ms" "0:100 6:100" 115 | } 116 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/perfd_profiles/balance/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 69 | 70 | 71 | 73 | 74 | 75 | 77 | 78 | 79 | 81 | 82 | 83 | 85 | 86 | 87 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/perfd_profiles/fast/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 69 | 70 | 71 | 73 | 74 | 75 | 77 | 78 | 79 | 81 | 82 | 83 | 85 | 86 | 87 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /profiles/sdm710/system/vendor/etc/perf/perfd_profiles/performance/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 69 | 70 | 71 | 73 | 74 | 75 | 77 | 78 | 79 | 81 | 82 | 83 | 85 | 86 | 87 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ################# 4 | # Initialization 5 | ################# 6 | 7 | umask 022 8 | 9 | # Global vars 10 | TMPDIR=/dev/tmp 11 | PERSISTDIR=/sbin/.magisk/mirror/persist 12 | 13 | rm -rf $TMPDIR 2>/dev/null 14 | mkdir -p $TMPDIR 15 | 16 | # echo before loading util_functions 17 | ui_print() { echo "$1"; } 18 | 19 | require_new_magisk() { 20 | ui_print "*******************************" 21 | ui_print " Please install Magisk v19.0+! " 22 | ui_print "*******************************" 23 | exit 1 24 | } 25 | 26 | is_legacy_script() { 27 | unzip -l "$ZIPFILE" install.sh | grep -q install.sh 28 | return $? 29 | } 30 | 31 | print_modname() { 32 | local len 33 | len=`echo -n $MODNAME | wc -c` 34 | len=$((len + 2)) 35 | local pounds=`printf "%${len}s" | tr ' ' '*'` 36 | ui_print "$pounds" 37 | ui_print " $MODNAME " 38 | ui_print "$pounds" 39 | ui_print "*******************" 40 | ui_print " Powered by Magisk " 41 | ui_print "*******************" 42 | } 43 | 44 | ############## 45 | # Environment 46 | ############## 47 | 48 | OUTFD=$2 49 | ZIPFILE=$3 50 | 51 | mount /data 2>/dev/null 52 | 53 | # Load utility functions 54 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk 55 | . /data/adb/magisk/util_functions.sh 56 | [ $MAGISK_VER_CODE -gt 18100 ] || require_new_magisk 57 | 58 | # Preperation for flashable zips 59 | setup_flashable 60 | 61 | # Mount partitions 62 | mount_partitions 63 | 64 | # Detect version and architecture 65 | api_level_arch_detect 66 | 67 | # Setup busybox and binaries 68 | $BOOTMODE && boot_actions || recovery_actions 69 | 70 | ############## 71 | # Preparation 72 | ############## 73 | 74 | # Extract prop file 75 | unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2 76 | [ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!" 77 | 78 | $BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules 79 | MODULEROOT=$NVBASE/$MODDIRNAME 80 | MODID=`grep_prop id $TMPDIR/module.prop` 81 | MODPATH=$MODULEROOT/$MODID 82 | MODNAME=`grep_prop name $TMPDIR/module.prop` 83 | 84 | # Create mod paths 85 | rm -rf $MODPATH 2>/dev/null 86 | mkdir -p $MODPATH 87 | 88 | ########## 89 | # Install 90 | ########## 91 | 92 | if is_legacy_script; then 93 | unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2 94 | 95 | # Load install script 96 | . $TMPDIR/install.sh 97 | 98 | # Callbacks 99 | print_modname 100 | on_install 101 | 102 | # Custom uninstaller 103 | [ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh 104 | 105 | # Skip mount 106 | $SKIPMOUNT && touch $MODPATH/skip_mount 107 | 108 | # prop file 109 | $PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop 110 | 111 | # Module info 112 | cp -af $TMPDIR/module.prop $MODPATH/module.prop 113 | 114 | # post-fs-data scripts 115 | $POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh 116 | 117 | # service scripts 118 | $LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh 119 | 120 | ui_print "- Setting permissions" 121 | set_permissions 122 | else 123 | print_modname 124 | 125 | unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2 126 | 127 | if ! grep -q '^SKIPUNZIP=1$' $MODPATH/customize.sh 2>/dev/null; then 128 | ui_print "- Extracting module files" 129 | unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2 130 | 131 | # Default permissions 132 | set_perm_recursive $MODPATH 0 0 0755 0644 133 | fi 134 | 135 | # Load customization script 136 | [ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh 137 | fi 138 | 139 | # Handle replace folders 140 | for TARGET in $REPLACE; do 141 | ui_print "- Replace target: $TARGET" 142 | mktouch $MODPATH$TARGET/.replace 143 | done 144 | 145 | if $BOOTMODE; then 146 | # Update info for Magisk Manager 147 | mktouch $NVBASE/modules/$MODID/update 148 | cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop 149 | fi 150 | 151 | # Copy over custom sepolicy rules 152 | if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then 153 | ui_print "- Installing custom sepolicy patch" 154 | PERSISTMOD=$PERSISTDIR/magisk/$MODID 155 | mkdir -p $PERSISTMOD 156 | cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule 157 | fi 158 | 159 | # Remove stuffs that don't belong to modules 160 | rm -rf \ 161 | $MODPATH/system/placeholder $MODPATH/customize.sh \ 162 | $MODPATH/README.md $MODPATH/.git* 2>/dev/null 163 | 164 | ############## 165 | # Finalizing 166 | ############## 167 | 168 | cd / 169 | $BOOTMODE || recovery_cleanup 170 | rm -rf $TMPDIR 171 | 172 | ui_print "- Done" 173 | exit 0 174 | -------------------------------------------------------------------------------- /customize.sh: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | # If you need even more customization and prefer to 4 | # do everything on your own, declare SKIPUNZIP=1 5 | SKIPUNZIP=0 6 | 7 | # List all directories you want to directly replace in the system 8 | # Construct your list in the following format 9 | # This is an example 10 | # REPLACE_EXAMPLE=" 11 | # /system/app/Youtube 12 | # /system/priv-app/SystemUI 13 | # /system/framework 14 | # " 15 | REPLACE="" 16 | 17 | # ! DO NOT use any Magisk internal paths as those are NOT public API. 18 | # ! DO NOT use other functions in util_functions.sh as they are NOT public API. 19 | # ! Non public APIs are not guranteed to maintain compatibility between releases. 20 | 21 | # Available variables: 22 | # MAGISK_VER (string): the version string of current installed Magisk 23 | # MAGISK_VER_CODE (int): the version code of current installed Magisk 24 | # BOOTMODE (bool): true if the module is currently installing in Magisk Manager 25 | # MODPATH (path): the path where your module files should be installed 26 | # TMPDIR (path): a place where you can temporarily store files 27 | # ZIPFILE (path): your module's installation zip 28 | # ARCH (string): the architecture of the device. Value is either arm, arm64, x86, or x64 29 | # IS64BIT (bool): true if $ARCH is either arm64 or x64 30 | # API (int): the API level (Android version) of the device 31 | 32 | # Availible functions: 33 | # ui_print 34 | # print to console 35 | # Avoid using 'echo' as it will not display in custom recovery's console 36 | # abort 37 | # print error message to console and terminate installation 38 | # Avoid using 'exit' as it will skip the termination cleanup steps 39 | # set_perm [context] 40 | # if [context] is not set, the default is "u:object_r:system_file:s0" 41 | # this function is a shorthand for the following commands: 42 | # chown owner.group platform_name 43 | # chmod permission platform_name 44 | # chcon context platform_name 45 | # set_perm_recursive [context] 46 | # if [context] is not set, the default is "u:object_r:system_file:s0" 47 | # for all files in , it will call: 48 | # set_perm file owner group filepermission context 49 | # for all directories in (including itself), it will call: 50 | # set_perm dir owner group dirpermission context 51 | 52 | # $1:platform_name 53 | _extract_platform_file() { 54 | ui_print "- Extracting platform module files" 55 | mv $MODPATH/profiles/$1/system $MODPATH/ 56 | mv $MODPATH/profiles/$1/powercfg_modes.sh $MODPATH/script/ 57 | rm -rf $MODPATH/profiles 58 | } 59 | 60 | 61 | ui_print "" 62 | ui_print "* Perfd-opt https://github.com/yc9559/perfd-opt/" 63 | ui_print "* Author: Matt Yang" 64 | ui_print "* Version: v4 (20200306)" 65 | ui_print "" 66 | 67 | platform_name="$(getprop ro.board.platform)" 68 | case "$(getprop ro.board.platform)" in 69 | "kona") 70 | ui_print "- The platform of this device is sdm865($platform_name)" 71 | _extract_platform_file "sdm865" 72 | ;; 73 | "msmnile") 74 | ui_print "- The platform of this device is sdm855/855+($platform_name)" 75 | _extract_platform_file "sdm855" 76 | ;; 77 | "sdm845") 78 | ui_print "- The platform of this device is sdm845($platform_name)" 79 | _extract_platform_file "sdm845" 80 | ;; 81 | "lito") 82 | ui_print "- The platform of this device is sdm765/sdm765g($platform_name)" 83 | _extract_platform_file "sdm765" 84 | ;; 85 | "sm6150") 86 | [ -f /sys/devices/soc0/soc_id ] && SOC_ID="$(cat /sys/devices/soc0/soc_id)" 87 | [ -f /sys/devices/system/soc/soc0/id ] && SOC_ID="$(cat /sys/devices/system/soc/soc0/id)" 88 | case "$SOC_ID" in 89 | 365 | 366) PLATFORM_NAME="sdm730" ;; 90 | 355 | 369) PLATFORM_NAME="sdm675" ;; 91 | esac 92 | ui_print "- The platform of this device is $PLATFORM_NAME($platform_name)" 93 | _extract_platform_file "sdm675_730" 94 | ;; 95 | "sdm710") 96 | ui_print "- The platform of this device is sdm710/sdm712($platform_name)" 97 | _extract_platform_file "sdm710" 98 | ;; 99 | *) 100 | abort "- [$platform_name] not supported, terminated." 101 | ;; 102 | esac 103 | 104 | # Only some special files require specific permissions 105 | # The default permissions should be good enough for most cases 106 | # set_perm_recursive $MODPATH/system/lib 0 0 0755 0644 107 | # set_perm $MODPATH/system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0 108 | # set_perm $MODPATH/system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0 109 | # set_perm $MODPATH/system/lib/libart.so 0 0 0644 110 | -------------------------------------------------------------------------------- /profiles/sdm675_730/system/vendor/etc/perf/targetresourceconfigs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /profiles/sdm855/system/vendor/etc/perf/targetresourceconfigs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /profiles/sdm865/system/vendor/etc/perf/targetresourceconfigs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /profiles/sdm855/powercfg_modes.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Platform Power Modes 3 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 4 | # Author: Matt Yang 5 | # Platform: sdm855/sdm855+ 6 | # Version: v4 (20200306) 7 | 8 | BASEDIR="$(dirname "$0")" 9 | . $BASEDIR/pathinfo.sh 10 | . $BASEDIR/libpowercfg.sh 11 | 12 | PLATFORM_NAME="sdm855/sdm855+" 13 | BWMON_CPU_LLC="soc:qcom,cpu-cpu-llcc-bw" 14 | BWMON_LLC_DDR="soc:qcom,cpu-llcc-ddr-bw" 15 | BIG_L3_LAT="soc:qcom,cpu4-cpu-l3-lat" 16 | BIG_DDR_LAT="soc:qcom,cpu4-llcc-ddr-lat" 17 | PRIME_L3_LAT="soc:qcom,cpu7-cpu-l3-lat" 18 | PRIME_DDR_LAT="soc:qcom,cpu7-llcc-ddr-lat" 19 | STUNE_BG_CPUS="0-3" 20 | STUNE_FG_CPUS="0-6" 21 | 22 | apply_common() 23 | { 24 | lock_val "15" $SCHED/sched_min_task_util_for_boost 25 | lock_val "1000" $SCHED/sched_min_task_util_for_colocation 26 | lock_val "700000" $SCHED/sched_little_cluster_coloc_fmin_khz 27 | set_governor_param "scaling_governor" "0:schedutil 4:schedutil 7:schedutil" 28 | set_governor_param "schedutil/hispeed_load" "0:90 4:90 7:80" 29 | set_governor_param "schedutil/hispeed_freq" "0:1113600 4:1286400 7:1612800" 30 | set_cpufreq_max "0:9999000 4:9999000 7:9999000" 31 | set_cpufreq_dyn_max "0:9999000 4:9999000 7:9999000" 32 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_CPU_LLC/governor 33 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_LLC_DDR/governor 34 | mutate "0" $DEVFREQ/$BWMON_CPU_LLC/min_freq 35 | mutate "0" $DEVFREQ/$BWMON_LLC_DDR/min_freq 36 | lock_val "8000" $DEVFREQ/$BIG_L3_LAT/mem_latency/ratio_ceil 37 | lock_val "800" $DEVFREQ/$BIG_DDR_LAT/mem_latency/ratio_ceil 38 | lock_val "8000" $DEVFREQ/$PRIME_L3_LAT/mem_latency/ratio_ceil 39 | lock_val "800" $DEVFREQ/$PRIME_DDR_LAT/mem_latency/ratio_ceil 40 | mutate "0" $LPM/lpm_prediction 41 | mutate "0" $LPM/sleep_disabled 42 | } 43 | 44 | apply_powersave() 45 | { 46 | set_cpufreq_min "0:300000 4:710400 7:825600" 47 | set_cpufreq_max "0:1785600 4:1612800 7:2419200" 48 | set_sched_migrate "95 85" "95 60" "140" "100" 49 | set_corectl_param "min_cpus" "0:4 4:1 7:0" 50 | set_governor_param "schedutil/pl" "0:0 4:0 7:0" 51 | lock_val "0:1113600 4:1056000 7:0" $CPU_BOOST/input_boost_freq 52 | lock_val "800" $CPU_BOOST/input_boost_ms 53 | lock_val "2" $CPU_BOOST/sched_boost_on_input 54 | mutate "0" $ST_TOP/schedtune.boost 55 | mutate "1" $ST_TOP/schedtune.prefer_idle 56 | mutate "15000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 57 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 58 | mutate "25" $LPM/bias_hyst 59 | } 60 | 61 | apply_balance() 62 | { 63 | set_cpufreq_min "0:576000 4:710400 7:825600" 64 | set_cpufreq_max "0:1785600 4:2016000 7:2649600" 65 | set_sched_migrate "95 85" "95 60" "140" "100" 66 | set_corectl_param "min_cpus" "0:4 4:2 7:0" 67 | set_governor_param "schedutil/pl" "0:0 4:0 7:1" 68 | lock_val "0:1113600 4:1056000 7:0" $CPU_BOOST/input_boost_freq 69 | lock_val "800" $CPU_BOOST/input_boost_ms 70 | lock_val "2" $CPU_BOOST/sched_boost_on_input 71 | mutate "0" $ST_TOP/schedtune.boost 72 | mutate "1" $ST_TOP/schedtune.prefer_idle 73 | mutate "15000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 74 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 75 | mutate "25" $LPM/bias_hyst 76 | } 77 | 78 | apply_performance() 79 | { 80 | set_cpufreq_min "0:576000 4:710400 7:825600" 81 | set_cpufreq_max "0:1785600 4:2419100 7:2841600" 82 | set_sched_migrate "80 80" "80 60" "100" "90" 83 | set_corectl_param "min_cpus" "0:4 4:3 7:1" 84 | set_governor_param "schedutil/pl" "0:0 4:1 7:1" 85 | lock_val "0:1113600 4:1286400 7:0" $CPU_BOOST/input_boost_freq 86 | lock_val "2000" $CPU_BOOST/input_boost_ms 87 | lock_val "2" $CPU_BOOST/sched_boost_on_input 88 | mutate "10" $ST_TOP/schedtune.boost 89 | mutate "1" $ST_TOP/schedtune.prefer_idle 90 | mutate "16000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 91 | mutate "8000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 92 | mutate "100" $LPM/bias_hyst 93 | } 94 | 95 | apply_fast() 96 | { 97 | set_cpufreq_min "0:576000 4:1286400 7:1286400" 98 | set_cpufreq_max "0:1785600 4:2016000 7:2745600" 99 | set_sched_migrate "80 80" "80 60" "100" "90" 100 | set_corectl_param "min_cpus" "0:4 4:3 7:1" 101 | set_governor_param "schedutil/pl" "0:1 4:1 7:1" 102 | lock_val "0:1113600 4:1612800 7:1612800" $CPU_BOOST/input_boost_freq 103 | lock_val "2000" $CPU_BOOST/input_boost_ms 104 | lock_val "1" $CPU_BOOST/sched_boost_on_input 105 | mutate "30" $ST_TOP/schedtune.boost 106 | mutate "1" $ST_TOP/schedtune.prefer_idle 107 | mutate "16000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 108 | mutate "8000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 109 | mutate "1000" $LPM/bias_hyst 110 | } 111 | 112 | apply_once() 113 | { 114 | mutate "$STUNE_FG_CPUS" /dev/cpuset/foreground/cpus 115 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/background/cpus 116 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/restricted/cpus 117 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/display/cpus 118 | set_corectl_param "enable" "0:1 4:1 7:1" 119 | set_corectl_param "busy_down_thres" "0:20 4:20 7:20" 120 | set_corectl_param "busy_up_thres" "0:40 4:40 7:40" 121 | set_corectl_param "offline_delay_ms" "0:100 4:100 7:100" 122 | } 123 | -------------------------------------------------------------------------------- /profiles/sdm765/system/vendor/etc/perf/targetresourceconfigs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /profiles/sdm765/powercfg_modes.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Platform Power Modes 3 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 4 | # Author: Matt Yang 5 | # Platform: sdm765/sdm765g 6 | # Version: v4 (20200306) 7 | 8 | BASEDIR="$(dirname "$0")" 9 | . $BASEDIR/pathinfo.sh 10 | . $BASEDIR/libpowercfg.sh 11 | 12 | PLATFORM_NAME="sdm765/sdm765g" 13 | BWMON_CPU_LLC="soc:qcom,cpu-cpu-llcc-bw" 14 | BWMON_LLC_DDR="soc:qcom,cpu-llcc-ddr-bw" 15 | BIG_L3_LAT="18321000.qcom,devfreq-l3:qcom,cpu6-cpu-l3-lat" 16 | BIG_DDR_LAT="soc:qcom,cpu6-llcc-ddr-lat" 17 | PRIME_L3_LAT="18321000.qcom,devfreq-l3:qcom,cpu7-cpu-l3-lat" 18 | PRIME_DDR_LAT="soc:qcom,cpu7-llcc-ddr-lat" 19 | STUNE_BG_CPUS="0-3" 20 | STUNE_FG_CPUS="0-6" 21 | 22 | apply_common() 23 | { 24 | lock_val "15" $SCHED/sched_min_task_util_for_boost 25 | lock_val "1000" $SCHED/sched_min_task_util_for_colocation 26 | lock_val "700000" $SCHED/sched_little_cluster_coloc_fmin_khz 27 | set_governor_param "scaling_governor" "0:schedutil 6:schedutil 7:schedutil" 28 | set_governor_param "schedutil/hispeed_load" "0:90 6:90 7:80" 29 | set_governor_param "schedutil/hispeed_freq" "0:1075200 6:1152000 7:1401600" 30 | set_cpufreq_max "0:9999000 6:9999000 7:9999000" 31 | set_cpufreq_dyn_max "0:9999000 6:9999000 7:9999000" 32 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_CPU_LLC/governor 33 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_LLC_DDR/governor 34 | mutate "0" $DEVFREQ/$BWMON_CPU_LLC/min_freq 35 | mutate "0" $DEVFREQ/$BWMON_LLC_DDR/min_freq 36 | lock_val "8000" $DEVFREQ/$BIG_L3_LAT/mem_latency/ratio_ceil 37 | lock_val "800" $DEVFREQ/$BIG_DDR_LAT/mem_latency/ratio_ceil 38 | lock_val "8000" $DEVFREQ/$PRIME_L3_LAT/mem_latency/ratio_ceil 39 | lock_val "800" $DEVFREQ/$PRIME_DDR_LAT/mem_latency/ratio_ceil 40 | mutate "0" $LPM/lpm_prediction 41 | mutate "0" $LPM/sleep_disabled 42 | } 43 | 44 | apply_powersave() 45 | { 46 | set_cpufreq_min "0:300000 6:652800 7:806400" 47 | set_cpufreq_max "0:1804800 6:1728000 7:1996800" 48 | set_sched_migrate "95 85" "95 60" "140" "100" 49 | set_corectl_param "min_cpus" "0:4 6:1 7:0" 50 | set_governor_param "schedutil/pl" "0:0 6:0 7:0" 51 | lock_val "0:1075200 6:1056000 7:0" $CPU_BOOST/input_boost_freq 52 | lock_val "800" $CPU_BOOST/input_boost_ms 53 | lock_val "2" $CPU_BOOST/sched_boost_on_input 54 | mutate "0" $ST_TOP/schedtune.boost 55 | mutate "1" $ST_TOP/schedtune.prefer_idle 56 | mutate "15000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 57 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 58 | mutate "25" $LPM/bias_hyst 59 | } 60 | 61 | apply_balance() 62 | { 63 | set_cpufreq_min "0:614400 6:652800 7:806400" 64 | set_cpufreq_max "0:1804800 6:1996800 7:2250000" 65 | set_sched_migrate "95 85" "95 60" "140" "100" 66 | set_corectl_param "min_cpus" "0:4 6:1 7:1" 67 | set_governor_param "schedutil/pl" "0:0 6:0 7:1" 68 | lock_val "0:1075200 6:1056000 7:0" $CPU_BOOST/input_boost_freq 69 | lock_val "800" $CPU_BOOST/input_boost_ms 70 | lock_val "2" $CPU_BOOST/sched_boost_on_input 71 | mutate "0" $ST_TOP/schedtune.boost 72 | mutate "1" $ST_TOP/schedtune.prefer_idle 73 | mutate "15000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 74 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 75 | mutate "25" $LPM/bias_hyst 76 | } 77 | 78 | apply_performance() 79 | { 80 | set_cpufreq_min "0:614400 6:652800 7:806400" 81 | set_cpufreq_max "0:1804800 6:2250000 7:2342400" 82 | set_sched_migrate "80 80" "80 60" "100" "90" 83 | set_corectl_param "min_cpus" "0:6 6:1 7:1" 84 | set_governor_param "schedutil/pl" "0:0 6:1 7:1" 85 | lock_val "0:1075200 6:1286400 7:0" $CPU_BOOST/input_boost_freq 86 | lock_val "2000" $CPU_BOOST/input_boost_ms 87 | lock_val "2" $CPU_BOOST/sched_boost_on_input 88 | mutate "10" $ST_TOP/schedtune.boost 89 | mutate "1" $ST_TOP/schedtune.prefer_idle 90 | mutate "16000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 91 | mutate "8000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 92 | mutate "100" $LPM/bias_hyst 93 | } 94 | 95 | apply_fast() 96 | { 97 | set_cpufreq_min "0:614400 6:1152000 7:1401600" 98 | set_cpufreq_max "0:1804800 6:1996800 7:2250000" 99 | set_sched_migrate "80 80" "80 60" "100" "90" 100 | set_corectl_param "min_cpus" "0:6 6:1 7:1" 101 | set_governor_param "schedutil/pl" "0:1 6:1 7:1" 102 | lock_val "0:1075200 6:1401600 7:1728000" $CPU_BOOST/input_boost_freq 103 | lock_val "2000" $CPU_BOOST/input_boost_ms 104 | lock_val "1" $CPU_BOOST/sched_boost_on_input 105 | mutate "30" $ST_TOP/schedtune.boost 106 | mutate "1" $ST_TOP/schedtune.prefer_idle 107 | mutate "16000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 108 | mutate "8000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 109 | mutate "1000" $LPM/bias_hyst 110 | } 111 | 112 | apply_once() 113 | { 114 | mutate "$STUNE_FG_CPUS" /dev/cpuset/foreground/cpus 115 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/background/cpus 116 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/restricted/cpus 117 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/display/cpus 118 | set_corectl_param "enable" "0:1 6:1 7:1" 119 | set_corectl_param "busy_down_thres" "0:20 6:20 7:20" 120 | set_corectl_param "busy_up_thres" "0:40 6:40 7:40" 121 | set_corectl_param "offline_delay_ms" "0:100 6:100 7:100" 122 | } 123 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Perfd opt 2 | 3 | The previous [Project WIPE](https://github.com/yc9559/cpufreq-interactive-opt), automatically adjust the `interactive` parameters via simulation and heuristic optimization algorithms, and working on all mainstream devices which use `interactive` as default governor. The recent [WIPE v2](https://github.com/yc9559/wipe-v2), improved simulation supports more features of the kernel and focuses on rendering performance requirements, automatically adjusting the `interactive`+`HMP`+`input boost` parameters. However, after the EAS is merged into the mainline, the simulation difficulty of auto-tuning depends on raise. It is difficult to simulate the logic of the EAS scheduler. In addition, EAS is designed to avoid parameterization at the beginning of design, so for example, the adjustment of schedutil has no obvious effect. 4 | 5 | [WIPE v2](https://github.com/yc9559/wipe-v2) focuses on meeting performance requirements when interacting with APP, while reducing non-interactive lag weights, pushing the trade-off between fluency and power saving even further. `QTI Boost Framework`, which must be disabled before applying optimization, is able to dynamically override parameters based on perf hint. This project utilizes `QTI Boost Framework` and extends the ability of override custom parameters. When launching APPs or scrolling the screen, applying more aggressive parameters to improve response at an acceptable power penalty. When there is no interaction, use conservative parameters, use small core clusters as much as possible, and run at a higher energy efficiency OPP under heavy load. 6 | 7 | Details see [the lead project](https://github.com/yc9559/sdm855-tune/commits/master) & [perfd-opt commits](https://github.com/yc9559/perfd-opt/commits/master) 8 | 9 | ## Profiles 10 | 11 | - powersave: based on balance mode, but with lower max frequency 12 | - balance: smoother than the stock config with lower power consumption 13 | - performance: dynamic stune boost = 30 with no frequency limitation 14 | - fast: providing stable performance capacity considering the TDP limitation of device chassis 15 | 16 | ```plain 17 | sdm865 18 | - powersave: 1.8+1.6+2.4g, boost 1.8+2.0+2.6g, min 0.3+0.7+1.1 19 | - balance: 1.8+2.0+2.6g, boost 1.8+2.4+2.7g, min 0.7+0.7+1.1 20 | - performance: 1.8+2.4+2.8g, boost 1.8+2.4+2.8g, min 0.7+0.7+1.1 21 | - fast: 1.8+2.0+2.7g, boost 1.8+2.4+2.8g, min 0.7+1.2+1.2 22 | 23 | sdm855/sdm855+ 24 | - powersave: 1.7+1.6+2.4g, boost 1.7+2.0+2.6g, min 0.3+0.7+0.8 25 | - balance: 1.7+2.0+2.6g, boost 1.7+2.4+2.7g, min 0.5+0.7+0.8 26 | - performance: 1.7+2.4+2.8g, boost 1.7+2.4+2.8/2.9g, min 0.5+0.7+0.8 27 | - fast: 1.7+2.0+2.7g, boost 1.7+2.4+2.8/2.9g, min 0.5+1.2+1.2 28 | 29 | sdm845 30 | - powersave: 1.7+2.0g, boost 1.7+2.4g, min 0.3+0.3 31 | - balance: 1.7+2.4g, boost 1.7+2.7g, min 0.5+0.8 32 | - performance: 1.7+2.8g, boost 1.7+2.8g, min 0.5+0.8 33 | - fast: 1.7+2.4g, boost 1.7+2.8g, min 0.5+1.6 34 | 35 | sdm765/sdm765g 36 | - powersave: 1.8+1.7+2.0g, boost 1.8+2.0+2.2g, min 0.3+0.6+0.8 37 | - balance: 1.8+2.0+2.2g, boost 1.8+2.2+2.3/2.4g, min 0.5+0.6+0.6 38 | - performance: 1.8+2.2+2.3g, boost 1.8+2.2+2.3/2.4g, min 0.5+0.6+0.8 39 | - fast: 1.8+2.0+2.2g, boost 1.8+2.2+2.3/2.4g, min 0.5+1.1+1.4 40 | 41 | sdm730/sdm730g 42 | - powersave: 1.7+1.5g, boost 1.7+1.9g, min 0.3+0.3 43 | - balance: 1.7+1.9g, boost 1.7+2.1g, min 0.5+0.6 44 | - performance: 1.8+2.2g, boost 1.8+2.2g, min 0.5+0.6 45 | - fast: 1.8+1.9g, boost 1.8+2.2g, min 0.5+1.2 46 | 47 | sdm675 48 | - powersave: 1.7+1.5g, boost 1.7+1.7g, min 0.3+0.3 49 | - balance: 1.7+1.7g, boost 1.7+1.9g, min 0.5+0.6 50 | - performance: 1.8+2.0g, boost 1.8+2.0g, min 0.5+0.6 51 | - fast: 1.8+1.7g, boost 1.8+2.0g, min 0.5+1.2 52 | 53 | sdm710/sdm712 54 | - powersave: 1.7+1.8g, boost 1.7+2.0g, min 0.3+0.3 55 | - balance: 1.7+2.0g, boost 1.7+2.2/2.3g, min 0.5+0.6 56 | - performance: 1.7+2.2g, boost 1.7+2.2/2.3g, min 0.5+0.6 57 | - fast: 1.7+2.0g, boost 1.7+2.2/2.3g, min 0.5+1.5 58 | ``` 59 | 60 | ## Requirements 61 | 62 | 1. Android >= 8.0 63 | 2. Rooted 64 | 3. Magisk >= 19.0 65 | 66 | ## Installation 67 | 68 | 1. Download zip in [Release Page](https://github.com/yc9559/perfd-opt/releases) 69 | 2. Flash in Magisk manager 70 | 3. Reboot 71 | 4. Check whether `/sdcard/Android/panel_powercfg.txt` exists 72 | 73 | ## Switch modes 74 | 75 | ### Switching on boot 76 | 77 | 1. Open `/sdcard/Android/panel_powercfg.txt` 78 | 2. Edit line `default_mode=balance`, where `balance` is the default mode applied at boot 79 | 3. Reboot 80 | 81 | ### Switching after boot 82 | 83 | Option 1: 84 | Exec `sh /data/powercfg.sh balance`, where `balance` is the mode you want to switch. 85 | 86 | Option 2: 87 | Install [vtools](https://www.coolapk.com/apk/com.omarea.vtools) and bind APPs to power mode. 88 | 89 | ## Credit 90 | 91 | ```plain 92 | @屁屁痒 93 | provide /vendor/etc & sched tunables on Snapdragon 845 94 | 95 | @林北蓋唱秋 96 | provide /vendor/etc on Snapdragon 675 97 | 98 | @酪安小煸 99 | provide /vendor/etc on Snapdragon 710 100 | 101 | @沉迷学习日渐膨胀的小学僧 102 | help testing on Snapdragon 855 103 | 104 | @NeonXeon 105 | provide information about dynamic stune 106 | 107 | @rfigo 108 | provide information about dynamic stune 109 | ``` 110 | -------------------------------------------------------------------------------- /profiles/sdm675_730/powercfg_modes.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Platform Power Modes 3 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 4 | # Author: Matt Yang 5 | # Platform: sm6150 6 | # Version: v4 (20200306) 7 | 8 | BASEDIR="$(dirname "$0")" 9 | . $BASEDIR/pathinfo.sh 10 | . $BASEDIR/libpowercfg.sh 11 | 12 | # "365,366"="sdmmagpie"="sdm730/sdm730g" 13 | # "355,369"="msmsteppe"="sdm675" 14 | [ -f /sys/devices/soc0/soc_id ] && SOC_ID="$(cat /sys/devices/soc0/soc_id)" 15 | [ -f /sys/devices/system/soc/soc0/id ] && SOC_ID="$(cat /sys/devices/system/soc/soc0/id)" 16 | 17 | case "$SOC_ID" in 18 | 365|366) PLATFORM_NAME="sdm730/sdm730g" ;; 19 | 355|369) PLATFORM_NAME="sdm675" ;; 20 | esac 21 | BWMON_CPU_LLC="soc:qcom,cpu-cpu-llcc-bw" 22 | BWMON_LLC_DDR="soc:qcom,cpu-llcc-ddr-bw" 23 | BIG_L3_LAT="soc:qcom,cpu6-cpu-l3-lat" 24 | BIG_DDR_LAT="soc:qcom,cpu6-llcc-ddr-lat" 25 | STUNE_BG_CPUS="0-3" 26 | STUNE_FG_CPUS="0-6" 27 | 28 | apply_common() 29 | { 30 | set_governor_param "scaling_governor" "0:schedutil 6:schedutil" 31 | set_governor_param "schedutil/hispeed_load" "0:90 6:90" 32 | set_governor_param "schedutil/hispeed_freq" "0:1000000 6:1200000" 33 | set_cpufreq_max "0:9999000 6:9999000" 34 | set_cpufreq_dyn_max "0:9999000 6:9999000" 35 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_CPU_LLC/governor 36 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_LLC_DDR/governor 37 | mutate "0" $DEVFREQ/$BWMON_CPU_LLC/min_freq 38 | mutate "0" $DEVFREQ/$BWMON_LLC_DDR/min_freq 39 | lock_val "8000" $DEVFREQ/$BIG_L3_LAT/mem_latency/ratio_ceil 40 | lock_val "800" $DEVFREQ/$BIG_DDR_LAT/mem_latency/ratio_ceil 41 | mutate "0" $LPM/lpm_prediction 42 | mutate "0" $LPM/sleep_disabled 43 | } 44 | 45 | apply_powersave() 46 | { 47 | set_cpufreq_min "0:300000 6:300000" 48 | case "$PLATFORM_NAME" in 49 | sdm730) set_cpufreq_max "0:1708800 6:1555200" ;; 50 | sdm675) set_cpufreq_max "0:1708800 6:1516800" ;; 51 | esac 52 | set_sched_migrate "95" "95" "140" "100" 53 | set_corectl_param "min_cpus" "0:4 6:1" 54 | set_governor_param "schedutil/pl" "0:0 6:0" 55 | lock_val "0:1000000 6:1000000" $CPU_BOOST/input_boost_freq 56 | lock_val "800" $CPU_BOOST/input_boost_ms 57 | lock_val "2" $CPU_BOOST/sched_boost_on_input 58 | mutate "0" $ST_TOP/schedtune.boost 59 | mutate "1" $ST_TOP/schedtune.prefer_idle 60 | mutate "13000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 61 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 62 | mutate "25" $LPM/bias_hyst 63 | } 64 | 65 | apply_balance() 66 | { 67 | set_cpufreq_min "0:576000 6:652800" 68 | case "$SOC_ID" in 69 | sdm730) set_cpufreq_max "0:1708800 6:1939200" ;; 70 | sdm675) set_cpufreq_max "0:1708800 6:1708800" ;; 71 | esac 72 | set_sched_migrate "95" "95" "140" "100" 73 | set_corectl_param "min_cpus" "0:4 6:2" 74 | set_governor_param "schedutil/pl" "0:0 6:1" 75 | lock_val "0:1000000 6:1000000" $CPU_BOOST/input_boost_freq 76 | lock_val "800" $CPU_BOOST/input_boost_ms 77 | lock_val "2" $CPU_BOOST/sched_boost_on_input 78 | mutate "0" $ST_TOP/schedtune.boost 79 | mutate "1" $ST_TOP/schedtune.prefer_idle 80 | mutate "13000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 81 | mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 82 | mutate "25" $LPM/bias_hyst 83 | } 84 | 85 | apply_performance() 86 | { 87 | set_cpufreq_min "0:576000 6:652800" 88 | case "$SOC_ID" in 89 | sdm730) set_cpufreq_max "0:1804800 6:2208000" ;; 90 | sdm675) set_cpufreq_max "0:1804800 6:2016000" ;; 91 | esac 92 | set_sched_migrate "80" "80" "100" "90" 93 | set_corectl_param "min_cpus" "0:6 6:2" 94 | set_governor_param "schedutil/pl" "0:0 6:1" 95 | lock_val "0:1000000 6:1200000" $CPU_BOOST/input_boost_freq 96 | lock_val "2000" $CPU_BOOST/input_boost_ms 97 | lock_val "2" $CPU_BOOST/sched_boost_on_input 98 | mutate "10" $ST_TOP/schedtune.boost 99 | mutate "1" $ST_TOP/schedtune.prefer_idle 100 | mutate "15000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 101 | mutate "7000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 102 | mutate "100" $LPM/bias_hyst 103 | } 104 | 105 | apply_fast() 106 | { 107 | set_cpufreq_min "0:576000 6:1209600" 108 | case "$SOC_ID" in 109 | sdm730) set_cpufreq_max "0:1804800 6:1939200" ;; 110 | sdm675) set_cpufreq_max "0:1804800 6:1708800" ;; 111 | esac 112 | set_sched_migrate "80" "80" "100" "90" 113 | set_corectl_param "min_cpus" "0:6 6:2" 114 | set_governor_param "schedutil/pl" "0:1 6:1" 115 | lock_val "0:1000000 6:1200000" $CPU_BOOST/input_boost_freq 116 | lock_val "2000" $CPU_BOOST/input_boost_ms 117 | lock_val "1" $CPU_BOOST/sched_boost_on_input 118 | mutate "30" $ST_TOP/schedtune.boost 119 | mutate "1" $ST_TOP/schedtune.prefer_idle 120 | mutate "15000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 121 | mutate "7000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 122 | mutate "1000" $LPM/bias_hyst 123 | } 124 | 125 | apply_once() 126 | { 127 | mutate "$STUNE_FG_CPUS" /dev/cpuset/foreground/cpus 128 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/background/cpus 129 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/restricted/cpus 130 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/display/cpus 131 | set_corectl_param "enable" "0:1 6:1" 132 | set_corectl_param "busy_down_thres" "0:20 6:20" 133 | set_corectl_param "busy_up_thres" "0:40 6:40" 134 | set_corectl_param "offline_delay_ms" "0:100 6:100" 135 | } 136 | -------------------------------------------------------------------------------- /profiles/sdm865/powercfg_modes.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Platform Power Modes 3 | # Perfd-opt https://github.com/yc9559/perfd-opt/ 4 | # Author: Matt Yang 5 | # Platform: sdm865 6 | # Version: v4 (20200306) 7 | 8 | BASEDIR="$(dirname "$0")" 9 | . $BASEDIR/pathinfo.sh 10 | . $BASEDIR/libpowercfg.sh 11 | 12 | PLATFORM_NAME="sdm865" 13 | BWMON_CPU_LLC="soc:qcom,cpu-cpu-llcc-bw" 14 | BWMON_LLC_DDR="soc:qcom,cpu-llcc-ddr-bw" 15 | BIG_L3_LAT="18590000.qcom,devfreq-l3:qcom,cpu4-cpu-l3-lat" 16 | BIG_DDR_LAT="soc:qcom,cpu4-llcc-ddr-lat" 17 | PRIME_L3_LAT="18590000.qcom,devfreq-l3:qcom,cpu7-cpu-l3-lat" 18 | PRIME_DDR_LAT="soc:qcom,cpu7-llcc-ddr-lat" 19 | STUNE_BG_CPUS="0-3" 20 | STUNE_FG_CPUS="0-6" 21 | 22 | DDR_TID="$(od -An -tx /proc/device-tree/memory/ddr_device_type)" 23 | DDR_TID="${ddr_device_type:4:2}" 24 | LPDDR4X_ID="07" 25 | LPDDR5_ID="08" 26 | 27 | apply_common() 28 | { 29 | lock_val "15" $SCHED/sched_min_task_util_for_boost 30 | lock_val "1000" $SCHED/sched_min_task_util_for_colocation 31 | lock_val "700000" $SCHED/sched_little_cluster_coloc_fmin_khz 32 | set_governor_param "scaling_governor" "0:schedutil 4:schedutil 7:schedutil" 33 | set_governor_param "schedutil/hispeed_load" "0:90 4:90 7:80" 34 | set_governor_param "schedutil/hispeed_freq" "0:1171200 4:1286400 7:1632000" 35 | set_cpufreq_max "0:9999000 4:9999000 7:9999000" 36 | set_cpufreq_dyn_max "0:9999000 4:9999000 7:9999000" 37 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_CPU_LLC/governor 38 | lock_val "bw_hwmon" $DEVFREQ/$BWMON_LLC_DDR/governor 39 | mutate "0" $DEVFREQ/$BWMON_CPU_LLC/min_freq 40 | mutate "0" $DEVFREQ/$BWMON_LLC_DDR/min_freq 41 | lock_val "8000" $DEVFREQ/$BIG_L3_LAT/mem_latency/ratio_ceil 42 | lock_val "800" $DEVFREQ/$BIG_DDR_LAT/mem_latency/ratio_ceil 43 | lock_val "8000" $DEVFREQ/$PRIME_L3_LAT/mem_latency/ratio_ceil 44 | lock_val "800" $DEVFREQ/$PRIME_DDR_LAT/mem_latency/ratio_ceil 45 | mutate "0" $LPM/lpm_prediction 46 | mutate "0" $LPM/sleep_disabled 47 | } 48 | 49 | apply_powersave() 50 | { 51 | set_cpufreq_min "0:300000 4:710400 7:1171200" 52 | set_cpufreq_max "0:1804800 4:1574400 7:2419200" 53 | set_sched_migrate "95 85" "95 60" "140" "100" 54 | set_corectl_param "min_cpus" "0:4 4:1 7:0" 55 | set_governor_param "schedutil/pl" "0:0 4:0 7:0" 56 | lock_val "0:1171200 4:1056000 7:0" $CPU_BOOST/input_boost_freq 57 | lock_val "800" $CPU_BOOST/input_boost_ms 58 | lock_val "2" $CPU_BOOST/sched_boost_on_input 59 | mutate "0" $ST_TOP/schedtune.boost 60 | mutate "1" $ST_TOP/schedtune.prefer_idle 61 | mutate "15000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 62 | [ "$DDR_TID" == "$LPDDR4X_ID" ] && mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 63 | [ "$DDR_TID" == "$LPDDR5_ID" ] && mutate "8000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 64 | mutate "25" $LPM/bias_hyst 65 | } 66 | 67 | apply_balance() 68 | { 69 | set_cpufreq_min "0:691200 4:710400 7:1171200" 70 | set_cpufreq_max "0:1804800 4:2054400 7:2649600" 71 | set_sched_migrate "95 85" "95 60" "140" "100" 72 | set_corectl_param "min_cpus" "0:4 4:2 7:0" 73 | set_governor_param "schedutil/pl" "0:0 4:0 7:1" 74 | lock_val "0:1171200 4:1056000 7:0" $CPU_BOOST/input_boost_freq 75 | lock_val "800" $CPU_BOOST/input_boost_ms 76 | lock_val "2" $CPU_BOOST/sched_boost_on_input 77 | mutate "0" $ST_TOP/schedtune.boost 78 | mutate "1" $ST_TOP/schedtune.prefer_idle 79 | mutate "15000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 80 | [ "$DDR_TID" == "$LPDDR4X_ID" ] && mutate "6000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 81 | [ "$DDR_TID" == "$LPDDR5_ID" ] && mutate "8000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 82 | mutate "25" $LPM/bias_hyst 83 | } 84 | 85 | apply_performance() 86 | { 87 | set_cpufreq_min "0:691200 4:710400 7:1171200" 88 | set_cpufreq_max "0:1804800 4:2419100 7:2841600" 89 | set_sched_migrate "80 80" "80 60" "100" "90" 90 | set_corectl_param "min_cpus" "0:4 4:3 7:1" 91 | set_governor_param "schedutil/pl" "0:0 4:1 7:1" 92 | lock_val "0:1171200 4:1286400 7:0" $CPU_BOOST/input_boost_freq 93 | lock_val "2000" $CPU_BOOST/input_boost_ms 94 | lock_val "2" $CPU_BOOST/sched_boost_on_input 95 | mutate "10" $ST_TOP/schedtune.boost 96 | mutate "1" $ST_TOP/schedtune.prefer_idle 97 | mutate "16000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 98 | [ "$DDR_TID" == "$LPDDR4X_ID" ] && mutate "8000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 99 | [ "$DDR_TID" == "$LPDDR5_ID" ] && mutate "11000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 100 | mutate "100" $LPM/bias_hyst 101 | } 102 | 103 | apply_fast() 104 | { 105 | set_cpufreq_min "0:691200 4:1286400 7:1286400" 106 | set_cpufreq_max "0:1804800 4:2054400 7:2745600" 107 | set_sched_migrate "80 80" "80 60" "100" "90" 108 | set_corectl_param "min_cpus" "0:4 4:3 7:1" 109 | set_governor_param "schedutil/pl" "0:1 4:1 7:1" 110 | lock_val "0:1171200 4:1574400 7:1632000" $CPU_BOOST/input_boost_freq 111 | lock_val "2000" $CPU_BOOST/input_boost_ms 112 | lock_val "1" $CPU_BOOST/sched_boost_on_input 113 | mutate "30" $ST_TOP/schedtune.boost 114 | mutate "1" $ST_TOP/schedtune.prefer_idle 115 | mutate "16000" $DEVFREQ/$BWMON_CPU_LLC/max_freq 116 | [ "$DDR_TID" == "$LPDDR4X_ID" ] && mutate "8000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 117 | [ "$DDR_TID" == "$LPDDR5_ID" ] && mutate "11000" $DEVFREQ/$BWMON_LLC_DDR/max_freq 118 | mutate "1000" $LPM/bias_hyst 119 | } 120 | 121 | apply_once() 122 | { 123 | mutate "$STUNE_FG_CPUS" /dev/cpuset/foreground/cpus 124 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/background/cpus 125 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/restricted/cpus 126 | lock_val "$STUNE_BG_CPUS" /dev/cpuset/display/cpus 127 | set_corectl_param "enable" "0:1 4:1 7:1" 128 | set_corectl_param "busy_down_thres" "0:20 4:20 7:20" 129 | set_corectl_param "busy_up_thres" "0:40 4:40 7:40" 130 | set_corectl_param "offline_delay_ms" "0:100 4:100 7:100" 131 | } 132 | -------------------------------------------------------------------------------- /profiles/sdm865/system/vendor/etc/perf/perfd_profiles/balance/perfboostsconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 69 | 70 | 71 | 73 | 74 | 75 | 77 | 78 | 79 | 80 | 82 | 83 | 84 | 85 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 112 | 113 | 114 | --------------------------------------------------------------------------------