[SurfaceFlinger] Don't persist buffers to HWC when powered off.
This fixes an extremely rare crash, where stale buffer handles were parceled over to HWC. The cause was that HWC's command queue is not flushed while the display is powered off, so buffers handles may become stale while they are sitting in the command queue. If a layer's buffer goes out of scope in SurfaceFlinger, e.g. an app continues renderng while the display is powered down, SurfaceFlinger latches the new buffers, and consequently releases old buffers, then those buffers will be deallocated while still sending the handles over to HWC the next time a frame needs to be presented. The fix prevents buffers from being queued while the display power mode is OFF, so that buffer handles should never become stale while in the command queue. Bug: 141290044 Test: Enabling HWSAN: covering the phone during Hangouts video calling with speaker-phone disabled to trigger display power down. Test: libcompositionengine_test Change-Id: I2592fecbbc17cf1ed70c348df8e53e9c59afb073
Loading
Please register or sign in to comment