Call validateDisplay() when skipping frames
Layer management was getting screwed up in vr flinger in the following scenario: 1. In frame X, post a new buffer to layer L. 2. Decide to skip frame X (e.g. because we're behind our target schedule). 3. In frame X+1, delete layer L. When we skip the frame in step 2, we weren't calling validateDisplay() or presentDisplay() on the hardware composer, so the composer's internal command queue wasn't being flushed. When we called validateDisplay() for frame X+1 the update buffer call from frame X would be run, referencing the deleted layer L, causing a crash. Now we always call validateDisplay() when we change the layer state, even if we decide to skip the frame. I also added code to explicitly clear the Composer object's internal command buffer when we transfer control from surface flinger to vr flinger and back. There were certain cases where there could be commands left in the command buffer after the display handoff. Bug: 37159844 Test: I used an app switcher script that quickly switches vr apps, which would consistently trigger the setLayerBuffer crash. I confirmed with this CL applied I can run the app switcher until surface flinger runs out of file descriptors (that's a separate bug), and I never see the setLayerBuffer crash. I also confirmed from the log output there are no additional hardware composer errors. Change-Id: I85832b87f393754dc6b034eb38f2937d7b58ed74
Loading
Please register or sign in to comment