This reverts commit cccecc46e10341d655b6bd388222f189215da506.
Due to merge conflicts, this also reverts #22275:
Revert "Do not involve external_view_embedder in submit frame process if threads are not merged. (#22275)"
This reverts commit d3902fc979fac68d498e4fe33584647c375c06ac.
Embedders can now notify shell during startup about the various displays and their corresponding settings.
Adds a notion of Display update type which can later include chages to displays during runtime such as addition / removal / reconfiguration of displays.
We also remove the responsibility of providing the refresh rate from `vsync_waiter` to `DisplayManager`.
Rewires existing platform implementations of the said API to use `Shell::OnDisplayUpdate` to notify the display manager of the startup configuration.
DisplayManager is also thread-safe to account for rasterizer and UI thread accesses.
This is part of a larger effort to expose the difference between GrDirectContext,
which runs on the GPU thread and can directly perform operations like uploading
textures, and GrRecordingContext, which can only queue up work to be delivered
to the GrDirectContext later.
This change also adds TimeRecorder which records time at the start
of each frame to capture the latest vsync target display time and
wires it in to the rasterizer to add trace events when there is a lag.
This PR touches variable names, class names, and file names so it's significantly more risky than its predecessor https://github.com/flutter/engine/pull/17329
Due to file name changes, this PR is expected to change the license files.
We haven't rename `shell/gpu` to `shell/raster` yet. It should be optional but I think it's better to have `raster_surface_software.cc` than `gpu_surface_software.cc`.
If the image is a cross-context image that might be read from the GPU thread
during onscreen rendering, then it is not safe to read it concurrently from
the IO thread as part of Image.toByteData.
If the GPU thread does not have a graphics context, then fall back to
converting the image on the IO thread.
Fixes https://github.com/flutter/flutter/issues/30697
This reverts commit 7552e9370527aae8df06b43dcb6b313d9ebdb365.
This is being reverted because it caused flutter/flutter#45098
(images don't load on iOS).
After pre-roll we know if there have been any mutations made to the IOS embedded UIViews. If there are any mutations and the thread configuration is such chat the mutations will be committed on an illegal thread (GPU thread), we merge the threads and keep them merged until the lease expires. The lease is currently set to expire after 10 frames of no mutations. If there are any mutations in the interim we extend the lease.
TaskRunnerMerger will ultimately be responsible for enforcing the correct thread configurations.
This configuration will be inactive even after this change since still use the same thread when we create the iOS engine. That is slated to change in the coming PRs.
This is part of a bigger change that will facilitate us
to act on this `RasterStatus`. The specific case is where
after pre-roll we might decide to want to merge the threads
and re-submit the frame -- `RasterStatus::kResubmit` can then
let us achieve this result.
Using it, a Flutter app can monitor missing frames in the release mode, and a custom Flutter runner (e.g., Fuchsia) can add a custom FrameRasterizedCallback.
Related issues:
https://github.com/flutter/flutter/issues/26154https://github.com/flutter/flutter/issues/31444https://github.com/flutter/flutter/issues/32447
Need review as soon as possible so we can merge this before the end of May to catch the milestone.
Tests added:
* NoNeedToReportTimingsByDefault
* NeedsReportTimingsIsSetWithCallback
* ReportTimingsIsCalled
* FrameRasterizedCallbackIsCalled
* FrameTimingSetsAndGetsProperly
* onReportTimings preserves callback zone
* FrameTiming.toString has the correct format
This will need a manual engine roll as the TestWindow defined in the framework needs to implement onReportTimings.
When flutter/synchronization was first authored, we did not own fml (it was called fxl then). Now we do, so use a single spot for such utilities. The pipeline was meant to be a general purpose utility that was only ever used by the animator (it even has animator specific tracing), so move that to shell instead (where the animator resides).