Currently the glmark2 is used to heat GPU for thermal test, this patch consolidates launching glmark2 from serial console. The glmark2 heater is optional now, which means no apparent fail will be reported if there is no glmark2 or it cannot be launched.
Signed-off-by: Hongbo Zhang hongbo.zhang@linaro.org --- include/thermal_functions.sh | 31 +++++++++++++++++++++++++++++++ thermal/thermal_03.sh | 15 ++------------- thermal/thermal_06.sh | 17 +++-------------- 3 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh index f385ec1..df7adfe 100644 --- a/include/thermal_functions.sh +++ b/include/thermal_functions.sh @@ -238,3 +238,34 @@ enable_all_thermal_zones() { done return 0 } + +GPU_HEAT_BIN=/usr/bin/glmark2 +gpu_pid=0 + +start_glmark2() { + if [ -x $GPU_HEAT_BIN ]; then + $GPU_HEAT_BIN & + gpu_pid=$(pidof $GPU_HEAT_BIN) + # Starting X application from serial console needs this + if [ -z "$gpu_pid" ]; then + cp /etc/lightdm/lightdm.conf /etc/lightdm/lightdm.conf.bk + echo "autologin-user=root" >> /etc/lightdm/lightdm.conf + export DISPLAY=localhost:0.0 + restart lightdm + sleep 5 + mv /etc/lightdm/lightdm.conf.bk /etc/lightdm/lightdm.conf + $GPU_HEAT_BIN & + gpu_pid=$(pidof $GPU_HEAT_BIN) + fi + test -z "$gpu_pid" && cpu_pid=0 + echo "start gpu heat binary $gpu_pid" + else + echo "glmark2 not found." 1>&2 + fi +} + +kill_glmark2() { + if [ "$gpu_pid" != 0 ]; then + kill -9 $gpu_pid + fi +} diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh index 5703ad3..ff8ca33 100755 --- a/thermal/thermal_03.sh +++ b/thermal/thermal_03.sh @@ -29,17 +29,13 @@ source ../include/functions.sh source ../include/thermal_functions.sh
CPU_HEAT_BIN=../utils/heat_cpu -GPU_HEAT_BIN=/usr/bin/glmark2 cpu_pid=0 -gpu_pid=0
heater_kill() { if [ $cpu_pid != 0 ]; then kill -9 $cpu_pid fi - if [ $gpu_pid != 0 ]; then - kill -9 $gpu_pid - fi + kill_glmark2 }
check_temperature_change() { @@ -53,14 +49,7 @@ check_temperature_change() { test -z $cpu_pid && cpu_pid=0 check "start cpu heat binary" "test $cpu_pid -ne 0"
- if [ -x $GPU_HEAT_BIN ]; then - $GPU_HEAT_BIN & - gpu_pid=$(ps | grep $GPU_HEAT_BIN| awk '{print $1}') - test -z $gpu_pid && gpu_pid=0 - check "start gpu heat binary" "test $gpu_pid -ne 0" - else - echo "glmark2 not found." 1>&2 - fi + start_glmark2
sleep 5 local final_temp=$(cat $dirpath/temp) diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh index 95eda91..13f695d 100755 --- a/thermal/thermal_06.sh +++ b/thermal/thermal_06.sh @@ -28,19 +28,15 @@ source ../include/functions.sh source ../include/thermal_functions.sh
-CPU_HEAT_BIN=../utils/heat_cpu -GPU_HEAT_BIN=/usr/bin/glmark2 TEST_LOOP=100 +CPU_HEAT_BIN=../utils/heat_cpu cpu_pid=0 -gpu_pid=0
heater_kill() { if [ $cpu_pid != 0 ]; then kill -9 $cpu_pid fi - if [ $gpu_pid != 0 ]; then - kill -9 $gpu_pid - fi + kill_glmark2 }
check_trip_point_change() { @@ -60,14 +56,7 @@ check_trip_point_change() { test -z $cpu_pid && cpu_pid=0 check "start cpu heat binary" "test $cpu_pid -ne 0"
- if [ -x $GPU_HEAT_BIN ]; then - $GPU_HEAT_BIN & - gpu_pid=$(ps | grep $GPU_HEAT_BIN| awk '{print $1}') - test -z $gpu_pid && gpu_pid=0 - check "start gpu heat binary" "test $gpu_pid -ne 0" - else - echo "glmark2 not found." 1>&2 - fi + start_glmark2
local index=0 for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do