333 Commits

Author SHA1 Message Date
Chinmay Garde
9ada55b844 Add frame and target time metadata to vsync events and connect platform vsync events using flows. (flutter/engine#8172)
This will allow us to easily visualize the time the platform informed the engine of a vsync event, its arguments, and when the engine began its UI thread workload using this information.
2019-03-14 16:48:01 -07:00
liyuqian
c267787209 Add dump-shader-skp switch to help ShaderWarmUp (flutter/engine#8148)
Allow Flutter to automatically dump the skp that triggers new shader compilations. This is useful for writing custom ShaderWarmUp to reduce jank. By default, it's not enabled to reduce the overhead. This is only available in profile or debug build.

Later, we can add service protocol support to pull the skp from the client to the host. Currently, it works fine for Android-based devices (including our urgent internal clients) where we can `adb shell` into the cache directory.
2019-03-14 12:58:09 -07:00
Jason Simmons
ee38cddf85 Look up ICU symbols based on the path to libflutter.so as a fallback (flutter/engine#8139)
The ICU data is packaged within libflutter.so, and the engine uses
dlsym(RTLD_DEFAULT) to look up the ICU data symbols in the libraries
loaded by the process.

This approach apparently fails on some Xiaomi devices.  If RTLD_DEFAULT
can not find the symbols, then the platform will pass the path to the
libflutter.so library so the engine can use that to resolve the symbols.

Fixes https://github.com/flutter/flutter/issues/28208
2019-03-12 18:33:33 -07:00
liyuqian
8545cec8d6 Add read-only persistent cache (flutter/engine#8049)
Some clients (e.g., embedded devices) prefer generating persistent cache files for the specific device beforehand, and ship them as readonly files in OTA packages.
2019-03-08 12:15:45 -08:00
Chinmay Garde
cff370118a Delay the vsync callback till the frame start time specified by embedder. (flutter/engine#8072)
The current assumption is that the embedder will wait till the vsync event and
then fire the callback. However, some embedders have that information upfront.
Since the time point has already been specified by the embedder, there is no
reason to burden the embedder with having to setup a wait either.
2019-03-07 16:28:22 -08:00
Gary Qian
1d587c84cb Re-land "Buffer lifecycle in WindowData" (flutter/engine#8032) 2019-03-06 15:38:34 -08:00
Chinmay Garde
93fda103c5 Fix weak pointer use violations in shell and platform view. (flutter/engine#8046) 2019-03-05 15:21:06 -08:00
Gary Qian
d689b45ab1 Revert "Buffer lifecycle in WindowData (#7999)" (flutter/engine#8010)
This reverts commit 03bec0d1b68ff57b6bf31d7cb8586837443b05fd.
2019-03-01 15:14:20 -08:00
Gary Qian
03bec0d1b6 Buffer lifecycle in WindowData (flutter/engine#7999) 2019-03-01 10:43:09 -08:00
Mehmet Fidanboylu
191884bbc1 New setting to decide whether we want the engine to load ICU mapping. (flutter/engine#7928) 2019-02-22 14:49:15 -08:00
liyuqian
79c1a3fcdf Move canvas clear after preroll (flutter/engine#7923)
This will reduce 1 render target switch when preroll paints some raster
cache.
2019-02-22 12:48:04 -08:00
Chinmay Garde
d0f9af0324 Allow embedders to specify a vsync waiter. (flutter/engine#7914)
Fixes https://github.com/flutter/flutter/issues/28240
2019-02-21 23:02:32 -08:00
Jason Simmons
4290d0349c Embedder API for setting the persistent cache path (flutter/engine#7915)
Fixes https://github.com/flutter/flutter/issues/28278
2019-02-21 17:30:17 -08:00
Chinmay Garde
c37c0d78b0 Respect the custom GL proc table when creating the resource context on the IO thread. (flutter/engine#7893)
Fixes https://github.com/flutter/flutter/issues/28229
2019-02-20 17:23:14 -08:00
Dan Field
4206f443f7 Revert "Shut down and restart the Dart VM as needed. (#7832)" (flutter/engine#7877)
This reverts commit 75a66f31dc2a02ccb54f10fb4477233086f4906b.
2019-02-19 16:14:18 -08:00
Chinmay Garde
75a66f31dc Shut down and restart the Dart VM as needed. (flutter/engine#7832)
The shell was already designed to cleanly shut down the VM but it couldnt
earlier as |Dart_Initialize| could never be called after a |Dart_Cleanup|. This
meant that shutting down an engine instance could not shut down the VM to save
memory because newly created engines in the process after that point couldn't
restart the VM. There can only be one VM running in a process at a time.

This patch separate the previous DartVM object into one that references a
running instance of the DartVM and a set of immutable dependencies that
components can reference even as the VM is shutting down.

Unit tests have been added to assert that non-overlapping engine launches use
difference VM instances.
2019-02-15 14:16:17 -08:00
nathanrogersgoogle
7517ae90c3 Add flow events connecting pointer events to frames (flutter/engine#7807) 2019-02-13 22:27:12 -08:00
nathanrogersgoogle
69a16cbb01 Don't call OnAnimatorNotifyIdle if a frame is scheduled (flutter/engine#7746)
If a frame is scheduled by the time the delayed animator notify idle
task runs, then we should not call |NotifyIdle|.

Also, add a trace event in the task, to make it more clear in traces
when a notify idle call is coming from here (as opposed to
|Animator::AwaitVSync|).
2019-02-08 15:14:06 -08:00
liyuqian
2c4e59e1c6 Revert "Disable the persistent cache (#6835)" (flutter/engine#7689)
This reverts commit 366503ca2dd5297b7f73591330770b215b521c8c.

For https://github.com/flutter/flutter/issues/24058, We now only get a
"Program linking failed" error message on Windows Android simulators
without crahsing. Skia seems to have handled the linking failure in
https://skia-review.googlesource.com/c/skia/+/180372 by rebuilding the
program.
2019-02-05 11:17:21 -08:00
Kaushik Iska
da09acaad9 Don't warn for Async texture uploads on Fuchsia (flutter/engine#7691) 2019-02-04 17:04:08 -08:00
Kaushik Iska
ec6f6c35b3 Expose the Flutter engine, Dart and Skia versions to Dart. (flutter/engine#7634)
- Moved versions from shell to common
- versions singleton contains all the required versions.
2019-01-30 16:22:45 -08:00
Jason Simmons
8a941d7b3c Embed ICU data inside libflutter.so on Android (flutter/engine#7588)
Prior to this the Android embedder code would extract the icudtl.dat asset out
of the APK and write it to local disk during the first startup of the app.

This change will make that work unnecessary and eliminate the risk of ICU
failures due to errors in the extraction process.
2019-01-30 11:56:17 -08:00
Chinmay Garde
e361547b05 Allow the engine to redirect traces to systrace via settings. (flutter/engine#7617) 2019-01-28 17:39:31 -08:00
Brian Osman
3dd1198f0d Remove SkColorSpaceXformCanvas, use color-managed SkSurfaces instead (flutter/engine#7548)
Behavior (visual) changes should be very minor. Things that are to be expected:
* A few things were not color managed correctly by the transform canvas (color emoji, some color filters). Those will be handled correctly with the tagged surfaces (although we're always transforming to sRGB, so nothing should change until we target a wider gamut).
* Image filtering will happen in the source color space, rather than the destination. Very minor.
* The transform canvas did caching of images in the destination color space. Now, the conversion happens at draw time. If there are performance issues, images can be pre-converted to the destination with makeColorSpace().
2019-01-22 15:34:51 -05:00
Dan Field
e53df3e546 Ensure the ResourceContext is not ripped out from under dart (flutter/engine#7528)
* Ensure the ResourceContext is not ripped out from under dart
2019-01-17 13:55:44 -08:00
Dan Field
a9728ab07a Make IOManager own resource context (flutter/engine#7272)
* Make IOManager own resource context
2019-01-14 13:46:38 -08:00
Chinmay Garde
074da7fd65 Allow embedders to add per shell idle notification callbacks. (flutter/engine#7427) 2019-01-09 14:33:56 -08:00
Jason Simmons
2e112a7904 Add a system message channel for controlling the Skia resource cache size (flutter/engine#7257)
See https://github.com/flutter/flutter/issues/25244
2018-12-19 17:40:16 -08:00
Anthony Bullard
28d536a39a Support real fonts in 'flutter test' (flutter/engine#6913)
* Support real fonts in 'flutter test'

Change the order of font_managers to query in font_collection
so that dynamic_font_manager fonts will be resolved.

Tested with test case in `flutter/flutter` repo:

`packages/flutter/test/rendering/localized_fonts_test.dart`

Ensured:
- A font loaded with FontLoader will be used
- The default 'Ahem' font is still loaded by default

The test above still cannot be fixed because FontLoader and the
underlying mechanisms don't cover Locale-specific font loading
and therefore a CJK font-family won't be able to be loaded as needed
for that test.

Fixes #17700

* Format fixup
2018-12-14 10:05:41 -08:00
liyuqian
efc116e72c Support querying display refresh rate in engine (flutter/engine#7002)
The current implementation only deals with Android devices and we'll add iOS devices support soon.
2018-12-12 10:28:44 -08:00
Chris Bracken
f604da6409 Rename dart-non-checked-mode: disable-dart-asserts (flutter/engine#6977)
In Dart 2, runtime checked mode has been eliminated. Many of these type
checks have been moved to static compile-time checks, the remainder are
enforced at runtime, and are no longer optional.
2018-12-10 12:36:09 -08:00
Chris Bracken
120c20d5c6 Eliminate main_dart_file_path, package_file_path (flutter/engine#6973)
These settings were specific to Dart 1 and are no longer used in the
engine. This eliminates them from the Settings class.
2018-12-10 09:12:10 -08:00
Michael Goderbauer
41fdd03757 Fix EXIF orentation problem (flutter/engine#6974) 2018-11-27 14:12:13 -08:00
Chris Bracken
9555fe0167 Improve error message when kernel not set (flutter/engine#6924)
Pushes the check up front so that we don't always land on the
application_kernel_list_asset error message, which may be misleading to
readers.

Also switches the empty check to only emit in debug builds, since this
is almost certainly not a runtime error but a programmer error.
2018-11-26 11:29:56 -08:00
Chris Bracken
30ca2a3401 Add basic validation on loading from kernel list (flutter/engine#6921)
Adds a check/error message for the case where running from kernel list,
but application_kernel_list_asset is left unset (or empty).

Adds a check/error message for the case where we fail to load the
application_kernel_list_asset specified in the settings.
2018-11-21 10:31:32 -08:00
Jason Simmons
725295dc47 Keep a copy of each engine's description that can be accessed outside the engine's UI thread (flutter/engine#6885)
The service protocol's ListViews method needs to return description data for
each engine in the process.  Previously ListViews would queue a task to each
UI thread to gather this data.  However, the UI thread might be blocked from
executing tasks (e.g. if the Dart isolate is paused), resulting in a deadlock.

This change provides a copy of the engine's description data to the
ServiceProtocol's global list of engines, allowing ListViews to run without
accessing any UI threads.

Fixes https://github.com/flutter/flutter/issues/24400
2018-11-16 14:47:40 -08:00
Jason Simmons
76d8335949 Reland "Clean up stale cache entries in Skia's GrContext" (flutter/engine#6867)
Check for software rendering modes that do not have a GrContext
2018-11-15 14:24:36 -08:00
Dan Field
0c9b475c2a Revert "Clean up stale cache entries in Skia's GrContext (#6859)" (flutter/engine#6866)
This reverts commit 929c7d8d8b0fbb72866bf3e4925187f76be0c955.
2018-11-15 11:41:53 -08:00
Michael Klimushyn
366503ca2d Disable the persistent cache (flutter/engine#6835)
Fixes flutter/flutter#24058
Reopens flutter/flutter#14028
2018-11-15 09:26:08 -08:00
Jason Simmons
929c7d8d8b Clean up stale cache entries in Skia's GrContext (flutter/engine#6859)
Fixes https://github.com/flutter/flutter/issues/24160
2018-11-14 14:21:17 -08:00
Michael Goderbauer
082336e7c2 Fix code smells reported by chrome's clang plugin (flutter/engine#6833) 2018-11-12 19:59:29 -08:00
Jason Simmons
16a1ab8413 Fix MakeRenderContextCurrent to handle software rendering (flutter/engine#6827) 2018-11-12 11:20:49 -08:00
Jason Simmons
c1c5977c07 Ensure that the EGL rendering context is bound to the GPU thread in Rasterizer::MakeRasterSnapshot (flutter/engine#6816)
Fixes https://github.com/flutter/flutter/issues/24083
2018-11-09 17:05:05 -08:00
Amir Hardon
e818420245 Synchronize Flutter's rendering with CA. (flutter/engine#6807)
Right now we do it whenever the platform views preview flag is on.
This is less efficient, filed
https://github.com/flutter/flutter/issues/24133 to only do this when
there's a platform view in the tree.
2018-11-09 12:10:09 -08:00
Amir Hardon
bfc1db2612 Support platform view overlays with GL rendering (flutter/engine#6769)
Moved the frame buffer specific logic from IOSGLContext to IOSGLRenderTarget.

use recording canvases for overlays

Support platform view overlays with gl rendering.

This also changes the overlay canvases (for both software and gl
rendering) be recording canvases, and only rasterize them after
finishing the paint traversal.
2018-11-08 19:52:43 -08:00
Amir Hardon
df64376478 Make the FlutterPlatformViewFactory create FlutterPlatformViews. (flutter/engine#6782)
Handing a UIView refererence directly to the engine makes it challenging
for plugin authors to retain a controller for that UIView (e.g the
controller that talks over the platform channel) for as long as the
embedded view is needed.

We instead make the factory return a FlutterPlatformView which is a
wrapper around the UIView that the engine retains as long as the
platform view instance is needed. This allows plugin authors to keep
their control logic in the FlutterPlatformView and know that the engine
is responsible for retaining the reference.
2018-11-08 11:21:55 -08:00
Amir Hardon
d6e19afcb5 Add an internal_nodes_canvas to PaintContext. (flutter/engine#6728)
When we visit a PlatformViewLayer during the paint traversal it replaces
the PaintContext's canvas with a new one that is painted ontop of the
embedded view.
We need to make sure that operations applied by parent layers are also
applied to the new canvas.

To achieve this we collect all the canvases in a SkNWayCanvas and use
this canvas by non leaf nodes. Leaf nodes still paint only to the "current"
canvas.

This PR moves the overlay canvas creation from the paint phase to the
preroll phase, collects them into a SkNWayCanvas and set it in
PaintContext.

To keep this PR focused, I only used the internal_nodes_canvas in the
tranform_layer.
Will followup with a PR that changes all internal layers to use the
internal_nodes_canvas.
2018-11-08 09:31:40 -08:00
Mehmet Fidanboylu
e8d852bac0 Skia Cleanup (flutter/engine#6786) 2018-11-07 15:29:52 -08:00
Michael Goderbauer
0def82ddb0 Unify copyright lines (flutter/engine#6757) 2018-11-07 12:24:35 -08:00
Amir Hardon
9ff80d12a2 Add an Info.plist flag to enable the embedded iOS views preview. (flutter/engine#6756)
When the flag is true, we currently use a single thread configuration,
and disabled the raster cache for opacity layers.

The flag's name is 'io.flutter_embedded_views_preview'.
2018-11-05 20:08:25 -08:00