SurfaceFlinger: Force runHandleTransaction
In the linked bug, there are traces documenting cases where the user observes jank while deferred transactions are in play. We can see several cases where the client gets stuck for a long time on dequeueBuffer. Around these times we can also see cases where latchBuffer aborts early due to the !allTransactionsSignaled condition. We expect all the transactions to be signalled at this point, because before handlePageFlip we expect to reach handleTransactionLocked, which should call notifyAvailableFrames, marking the sync points available based on the head frame number. However if we study the trace we also see there is an onMessageInvalidate, which contains a handlePageFlip but does NOT contain the handleTransaction before it which we would expect. However we know if onMessageInvalidate calls handlePageFlip (via handleMessageInvalidate) then it must have called handleMessageTransaction, as these two lines are right next to eachother. We can thus conclude that we see the problem because handleMessageTransaction didn't call handleTransaction due to runHandleTransaction evaluating to false. This makes sense in the context of recent changes. Previously deferred transactions would set the transaction flags continuously while they were pending, so the server would always perform transactions when waking up, and we wouldn't get in this condition. However, setting the transaction flags always triggers a wake up! But we don't actually want to wake up until the frame actually arrives, so first we tried setting the transaction flags without triggering a wake up. But we found this could prevent other people from triggering wakeups, so a recent CL modified it to set mForceTraversal instead. Intending to force that we call doTransaction from handleMessageInvalidate regardless of whether a new transaction has arrived (because we need to check if an old transaction is now ready). However, it didn't quite work because of this early abort due to runHandleTransaction. Bug: 159677043 Test: Existing tests pass Change-Id: I84f2a9cca2ebb3f59d30924efdb39c917f47111b
Loading
Please register or sign in to comment