-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Description
flutter/engine#24428, has caused regression in certain situations.
Bit of background first. As far as I can tell, the resizing with direct composition enabled was originally broken, because every second call to CreateSurface failed. I believe this happens because when recreating the surface, context is still in use, which means a IDCompositionTarget instance is still alive. I haven't tried this with UWP, but I was able to get direct composition surface (EGL_DIRECT_COMPOSITION_ANGLE) recreated as expected by calling ClearContext() right before DestroySurface() in AngleSurfaceManager::ResizeSurface.
The PR fixed it by only calling CreateSurface once and then resizing existing surface. This is done though calling eglPostSubBufferNV, which as a side effects resizes underlying surface. The issue here is that eglPostSubBufferNV also causes Swapchain->Present to be called two additional times during every resize step, with wrong surface size. This is not obvious for windows that have border. DWM simply seems to eat these two extra Present calls.
It does however cause problem for windows that had border removed through WM_NCCALCSIZE . It seems that whatever magic DWM does to synchronize swapchain swap with window resize, it gives up once WM_NCCALCSIZE is used. In this case it manifests in those two extra Present calls properly executed (including waiting for vsync), which results in content wobbling around during resizing.
The ideal solution here would most likely be to introduce a way in angle to force surface resize, without having additional swaps during resize. The resizing was changed lately to ensure that we only do one swap per resize step (with correct size).
It would be also good to know if maybe we're missing some ClearContext() calls, or perhaps it is by design and the ClearContext() call should be placed in ResizeSurface().
If proper solution (surface resize in angle) is a no go, than perhaps, at least temporarily, we could revert this for non UWP target.
cc @clarkezone