Reduce kernel instructions for PowerAdvisor
PowerAdvisor::notifyDisplayUpdateImminent was resetting the screen update timeout in order to: 1. Ensure some throttling of the power hal so that it is not invoked until the display has idled for at least as long as 80ms. 2. Ensure that the expensive rendering hint for the GPU would not be unset too early. Unfortunately this was causing SurfaceFlinger to churn about 3.5% of total CPU cycles during the bouncy ball test in TouchLatency.apk. The instructions were coming from posting a semaphore when resetting the timeout. We still want to ensure both (1) and (2), so to work around this, we: a. Keep the screen update timer around, but pull setting mSendUpdateImminent=false out of the reset callback b. Try to only reset the screen update timer under two scenarios when we sent the power hint, which means we're about to update the screen and we need to reset the timer c. Keep track of when we last called into notifyDisplayUpdateImminent. Then when we timeout, sleep for the appropriate amount of time before disabling expensive rendering. Effectively the net effect is that we relax the timing requirement for disabling expensive rendering on the GPU if it was previously enabled, while clawing back expensive CPU instructions. In a workload emulating a game or the bouncy ball test, this is the right tradeoff. Bug: 231628914 Test: simpleperf with bouncy ball Test: On a Pixel 6, run watch -n 1 adb shell cat /sys/devices/platform/1c500000.mali/clock_info to ensure that the hint still gets unapplied. Change-Id: If8574ddf70a8e88ffdb1cf1bab7fb1c29680071a Merged-In: If8574ddf70a8e88ffdb1cf1bab7fb1c29680071a
Loading
Please register or sign in to comment