Ensure overlapping syncs don't submit buffers out of order
This change will ensure that if multiple SurfaceSyncGroups are created for the same ViewRootImpl the SurfaceSyncGroups will maintain an order. The scenario that could occur is the following: 1. SSG1 is created that includes the target VRI. There could be other VRIs in SSG1 2. The target VRI draws its frame and marks its own active SSG as ready, but SSG1 is still waiting on other things in the SSG 3. Another SSG2 is created for the target VRI. The second frame renders and marks its own second SSG as complete. SSG2 has nothing else to wait on, so it will apply at this point, even though SSG1 has not finished. 4. Frame2 will get to SF first and Frame1 will later get to SF when SSG1 completes. The code ensures the SSGs that contains the VRI maintain an order. What happens here is we create a new SSG that's a placeholder. Its only job is to prevent a SSG from completing. The active SSG for VRI will add a transaction committed callback and when that's invoked, it will mark the placeholder SSG as ready. If a new request to create a SSG comes in and the placeholder SSG is not null, it's added as part of the new active SSG. A new placeholder SSG is created to correspond to the new active SSG. This creates a chain to ensure the latter SSG always waits for the former SSG's transaction to get to SF. Test: SurfaceSyncGroupTests#testOverlappingSyncsEnsureOrder Test: WmTests:com.android.server.wm.SurfaceSyncGroupTests Bug: 272189296 Change-Id: I921d78e347ecfb9786ebe4643308b347c5436332
Loading
Please register or sign in to comment