Merge pull request #979 from fewtarius/dev

Add GPU profile feature configurable globally and per system/core/game. Available when enhanced power savings is enabled.
This commit is contained in:
fewtarius 2023-01-22 21:39:00 -05:00 committed by GitHub
commit 433e43bd3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 19 deletions

View file

@ -147,6 +147,14 @@ then
mkcontroller
fi
# Set a default GPU power savings mode
GPUMODE=$(get_setting system.gpuperf)
if [ -z "${GPUMODE}" ]
then
echo "Set a default GPU power savings mode." >>${LOG}
set_setting system.gpuperf auto
fi
# Set a default for the audio preamp
PREAMP=$(get_setting audio.preamp)
if [ -z "${PREAMP}" ]

View file

@ -123,6 +123,14 @@ then
fi
fi
GPUPERF=$(get_setting "gpuperf" "${PLATFORM}" "${ROMNAME##*/}")
if [ ! "${GPUPERF}" = "system" ] && \
[ ! -z "${GPUPERF}" ]
then
echo "${GPUPERF}" >/tmp/.gpuperf
systemctl restart powerstate
fi
if [ "${DEVICE_HAS_FAN}" = "true" ]
then
### Set any custom fan profile (make this better!)
@ -514,6 +522,13 @@ then
fi
fi
### Remove GPU performance helper
if [ -e "/tmp/.gpuperf" ]
then
rm -f /tmp/.gpuperf
systemctl restart powerstate
fi
### Backup save games
CLOUD_BACKUP=$(get_setting "cloud.backup")
if [ "${CLOUD_BACKUP}" = "1" ]

View file

@ -12,36 +12,44 @@
while true
do
STATUS="$(cat /sys/class/power_supply/{BAT*,bat*}/status 2>/dev/null)"
if [ ! "${STATUS}" = "${CURRENT_MODE}" ]
if [ "$(get_setting system.powersave)" = 1 ]
then
case ${STATUS} in
Disch*)
log $0 "Switching to battery mode."
if [ "$(get_setting system.powersave)" = 1 ]
then
STATUS="$(cat /sys/class/power_supply/{BAT*,bat*}/status 2>/dev/null)"
if [ ! "${STATUS}" = "${CURRENT_MODE}" ]
then
case ${STATUS} in
Disch*)
log $0 "Switching to battery mode."
if [ -e "/tmp/.gpuperf" ]
then
GPUMODE=$(cat /tmp/.gpuperf)
else
GPUMODE=$(get_setting system.gpuperf)
if [ -z "${GPUMODE}" ]
then
GPUMODE=auto
set_setting system.gpuperf auto
fi
fi
audio_powersave 1
cpu_perftune battery
gpu_performance_level auto
gpu_performance_level ${GPUMODE}
gpu_power_profile 1
pcie_aspm_policy powersave
device_powersave 1
fi
;;
*)
log $0 "Switching to performance mode."
if [ "$(get_setting system.powersave)" = 1 ]
then
;;
*)
log $0 "Switching to performance mode."
audio_powersave 0
cpu_perftune performance
gpu_performance_level profile_standard
gpu_power_profile 1
pcie_aspm_policy default
device_powersave 0
fi
;;
esac
;;
esac
fi
CURRENT_MODE="${STATUS}"
fi
CURRENT_MODE="${STATUS}"
sleep 2
done

View file

@ -3,7 +3,7 @@
# Copyright (C) 2020-present Fewtarius
PKG_NAME="emulationstation"
PKG_VERSION="1b7e561"
PKG_VERSION="6577419"
PKG_GIT_CLONE_BRANCH="main"
PKG_REV="1"
PKG_ARCH="any"