455 Commits

Author SHA1 Message Date
liyuqian
892f852039 Change IO thread shader cache strategy (flutter/engine#13121)
So it's the same with the GPU thread.

Otherwise, some shaders may be cached in binary on the IO thread, and we will lose them when we do the SkSL precompile.

For b/140174804
2019-10-14 13:05:05 -07:00
liyuqian
f24924fa9b Remove persistent cache unittest timeout (flutter/engine#13091)
This fixes https://github.com/flutter/flutter/issues/42465
2019-10-11 14:24:12 -07:00
Chinmay Garde
b659646ffb Allow embedders to specify arbitrary data to the isolate on launch. (flutter/engine#13047)
Since this is currently only meant to be used by the embedding internally, the setter in Objective-C is only exposed via the FlutterDartProject private class extension. Unit tests have been added to the shell_unittests harness.

Fixes https://github.com/flutter/flutter/issues/37641
2019-10-10 12:31:14 -07:00
Jason Simmons
1759de2b98 Allow embedders to disable causal async stacks in the Dart VM (flutter/engine#13004)
Fixes https://github.com/flutter/flutter/issues/39511
2019-10-10 10:09:03 -07:00
Chinmay Garde
95297dba87 Revert "Upgrade compiler to Clang 10. (#11256)" (flutter/engine#13017)
This reverts commit 655c98543235dd9452a304dc035d3e39990ebc2a.
2019-10-08 18:23:59 -07:00
Chinmay Garde
655c985432 Upgrade compiler to Clang 10. (flutter/engine#11256) 2019-10-08 17:45:30 -07:00
Chris Yang
cc04914ab4 Add onUnregistered callback in 'Texture' and 'FlutterTexture' (flutter/engine#12695)
Texture unregistration is finished on the GPU thread. The FlutterTexture implementation might not know when it is finished which leads to a race condition. Adding this callback so the FlutterTexture is aware of end of the unregistration process.
2019-10-08 12:45:57 -07:00
liyuqian
7bffe3c0a8 SkSL precompile (flutter/engine#12412)
For https://github.com/flutter/flutter/issues/40686

Unit tests added:
- CacheSkSLWorks
- VisitFilesCanBeCalledTwice
- CanListFilesRecursively
2019-10-08 11:51:28 -07:00
liyuqian
ffca51fcdd Reland "Smooth out iOS irregular input events delivery (#12280)" (flutter/engine#12385)
This reverts commit 56bb40c0179628e37ba3614534552441642c0492.

Additionally, we fix https://github.com/flutter/flutter/issues/40863 by adding a secondary VSYNC callback.

Unit tests are updated to provide VSYNC mocking and check the fix of https://github.com/flutter/flutter/issues/40863.

The root cause of having https://github.com/flutter/flutter/issues/40863 is the false assumption that each input event must trigger a new frame. That was true in the framework PR https://github.com/flutter/flutter/pull/36616 because the input events there are all scrolling move events. When the PR was ported to the engine, we can no longer distinguish different types of events, and tap events may no longer trigger a new frame.

Therefore, this PR directly hooks into the `VsyncWaiter` and uses its (newly added) secondary callback to dispatch the pending input event.
2019-09-30 11:25:50 -07:00
liyuqian
2778d3bb20 Revert "[fuchsia] Wire up OpacityLayer to Scenic (#11322)" (flutter/engine#12610)
This reverts commit 639cc113f0b2ccf9fcf69ded7960d41d0b611f80.

Fixes https://github.com/flutter/flutter/issues/41394 and other
related correctness issues.

TBR: @arbreng @jason-simmons @mehmetf
2019-09-27 16:50:43 -07:00
Jonah Williams
c341326d6a Add support for JIT release mode (flutter/engine#12446) 2019-09-27 11:20:54 -07:00
David Worsham
639cc113f0 [fuchsia] Wire up OpacityLayer to Scenic (flutter/engine#11322)
On Fuchsia, add a build flag for compositing OpacityLayers using the system
compositor vs Skia, which exposes a fastpath for opacity via Scenic.
This will only work under certain circumstances, in particular nested
OpacityLayers will not render correctly!

On Fuchsia, add a build flag for compositing PhysicalShapeLayers using
the system compositor vs Skia. Set to off by default, which restores
performant shadows on Fuchsia.

Remove the opacity exposed from ChildView, as that was added mistakenly.

Finally, we centralize the logic for switching between the
system-composited and in-process-composited paths inside of
ContainerLayer. We also centralize the logic for computing elevation
there. This allows the removal of many OS_FUCHSIA-specific code-paths.

Test: Ran workstation on Fuchsia; benchmarked before and after
Bug: 23711
Bug: 24163

* Fix broken tests
2019-09-25 12:48:42 -04:00
Ben Konyi
246f1c9c5e Update --dart-vm-flags whitelist to include --write-service-info and --sample-buffer-duration (flutter/engine#12395)
These flags were recently added and are safe to pass through to the VM
for development.
2019-09-23 13:28:42 -07:00
chunhtai
051ed653cc Add system font change listener for windows (flutter/engine#12276)
* Add windows font change logic

* update

* fix comment
2019-09-23 13:23:46 -07:00
liyuqian
56bb40c017 Revert "Reland "Smooth out iOS irregular input events delivery (#11817)" (#12280)" (flutter/engine#12364)
This reverts commit dedf24e797d6257f9bb776cdf0d7525a16610321.

Reason: flutter/flutter#40863

TBR: chinmaygarde, iskakaushik
2019-09-19 19:39:36 -07:00
Chinmay Garde
c8ecb03fa8 Account for root surface transformation on the surfaces managed by the external view embedder. (flutter/engine#11384)
The earlier design speculated that embedders could affect the same
transformations on the layers post engine compositor presentation but before
final composition.

However, the linked issue points out that this design is not suitable for use
with hardware overlay planes. When rendering to the same, to affect the
transformation before composition, embedders would have to render to an
off-screen render target and then apply the transformation before presentation.
This patch negates the need for that off-screen render pass.

To be clear, the previous architecture is still fully viable. Embedders still
have full control over layer transformations before composition. This is an
optimization for the hardware overlay planes use-case.

Fixes b/139758641
2019-09-17 15:16:59 -07:00
liyuqian
8bb2b639df Add "type" to getDisplayRefreshRate protocol (flutter/engine#12319)
Per kenzieschmoll's request.

Will update https://github.com/flutter/flutter/wiki/Engine-specific-Service-Protocol-extensions once this is merged.
2019-09-17 11:35:01 -07:00
gaaclarke
68c0c11bad Made flutter startup faster by allowing initialization to be parallelized (flutter/engine#10182)
Made flutter startup faster by allowing initialization to be parallelized.  This resulting in a 15% decrease in startup time (~0.05ms)
2019-09-16 15:04:51 -07:00
liyuqian
dedf24e797 Reland "Smooth out iOS irregular input events delivery (#11817)" (flutter/engine#12280)
Additionally, we now use the engine directly as a delegate instead of storing potentially dead runtime_controller.

Unit tests have been updated to include an engine restart check which would fail before the fix.

This fixes https://github.com/flutter/flutter/issues/40303
2019-09-16 10:42:44 -07:00
Michael Klimushyn
862f40c774 Revert "Smooth out iOS irregular input events delivery (#11817)" (flutter/engine#12251)
This reverts commit 6b742994a371f5edded8925708d101186c950ada.
2019-09-12 11:23:05 -07:00
liyuqian
6b742994a3 Smooth out iOS irregular input events delivery (flutter/engine#11817)
Fixes https://github.com/flutter/flutter/issues/31086

This patch is a lower level implementation of
https://github.com/flutter/flutter/pull/36616 that would only impact iOS
engine, and host unittests.
2019-09-10 11:18:01 -07:00
gaaclarke
3aaf1637b7 Started logging warnings if we drop platform messages. (flutter/engine#11792) 2019-08-30 12:48:03 -07:00
Kaushik Iska
578a942fc7 Roll fuchsia/clang/linux-amd64 from wGyr4... to -mnHl... (flutter/engine#11790)
* Roll fuchsia/clang/linux-amd64 from wGyr4... to -mnHl...

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/fuchsia-linux-toolchain-flutter-engine
Please CC  on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

* Fix dangling pointer
2019-08-30 11:38:12 -07:00
Dan Field
db921356f8 Return a JSON value for the Skia channel (flutter/engine#11717) 2019-08-29 14:03:55 -07:00
Brian Osman
49d551e4db Update CanvasSpy::onDrawEdgeAAQuad for Skia API change (flutter/engine#11638) 2019-08-28 14:31:23 -04:00
Dan Field
114337a53c Make Skia cache size channel respond with a value (flutter/engine#11550) 2019-08-27 17:52:35 -07:00
Amir Hardon
d857db54ce Skip empty platform view overlays. (flutter/engine#11427)
This change sets up a "spying canvas" to try and detect empty canvases.
When using platform views with a custom embedder, if a platform view
overlay canvas is known to be empty we skip creating a compositor layer
for that overlay.
2019-08-26 11:40:49 -07:00
liyuqian
f8f285edcc Support non-60 refresh rate on PerformanceOverlay (flutter/engine#11419)
So we can get the correct graph on 90fps/120fps devices :)

See https://github.com/flutter/flutter/issues/37888
2019-08-24 15:22:52 -07:00
Jim Graham
e3b02a68ec Add tracing of the number of frames in flight in the pipeline. (flutter/engine#11423) 2019-08-23 16:50:03 -07:00
Dan Field
e8b91f6bb2 Platform View implemenation for Metal (flutter/engine#11070) 2019-08-23 16:15:41 -07:00
Chinmay Garde
05d4ab774d Remove deprecated ThreadTest::GetThreadTaskRunner and use the newer CreateNewThread API. (flutter/engine#11395)
We will end up creating fewer threads in tests.
2019-08-23 12:21:46 -07:00
Shi-Hao Hong
cb707fb34a Pass Android Q insets.systemGestureInsets to Window (flutter/engine#10413)
* Pass Android Q system gesture inset information from insets.systemGestureInsets to Window.systemGestureInsets
2019-08-16 13:42:56 -04:00
Jason Simmons
ced3e0d1e5 Initialize the engine in the running state to match the animator's default state (flutter/engine#11011)
The engine's activity_running flag tracks whether the app is in the paused or
running lifecycle state.  The engine had been defaulting activity_running to
false (meaning paused).  But the animator had been defaulting its paused flag
to false, which allowed frames to render at startup.  If the engine loses and
regains its surface, then frames would stop rendering because activity_running
is false (even though frames had been rendering when the engine initially
acquired its surface).

This change puts the engine and the animator into a consistent state at
startup.  Frames will continue to render until the embedder sends a lifecycle
message that will pause both the engine and the animator.

See https://github.com/flutter/flutter/issues/32624
2019-08-14 16:20:44 -07:00
Jason Simmons
cf6fbe1fdc Avoid dynamic lookups of the engine library's symbols on Android (flutter/engine#11001)
The dynamic linker on some older versions of Android on x86 fails when doing
dlsym(RTLD_DEFAULT) lookups of symbols exported by the engine library itself.
The engine needs to do this for some data files that are linked into the engine
library (ICU data and Dart snapshot blobs).

To work around this, the engine will declare static symbols for these data
objects on the affected platforms.

Fixes https://github.com/flutter/flutter/issues/20091
2019-08-14 12:40:40 -07:00
Chinmay Garde
591f55b39d Allow embedder controlled composition of Flutter layers. (flutter/engine#10195)
This patch allows embedders to split the Flutter layer tree into multiple
chunks. These chunks are meant to be composed one on top of another. This gives
embedders a chance to interleave their own contents between these chunks.

The Flutter embedder API already provides hooks for the specification of
textures for the Flutter engine to compose within its own hierarchy (for camera
feeds, video, etc..). However, not all embedders can render the contents of such
sources into textures the Flutter engine can accept. Moreover, this composition
model may have overheads that are non-trivial for certain use cases. In such
cases, the embedder may choose to specify multiple render target for Flutter to
render into instead of just one.

The use of this API allows embedders to perform composition very similar to the
iOS embedder. This composition model is used on that platform for the embedding
of UIKit view such and web view and map views within the Flutter hierarchy.
However, do note that iOS also has threading configurations that are currently
not available to custom embedders.

The embedder API updates in this patch are ABI stable and existing embedders
will continue to work are normal. For embedders that want to enable this
composition mode, the API is designed to make it easy to opt into the same in an
incremental manner.

Rendering of contents into the “root” rendering surface remains unchanged.
However, now the application can push “platform views” via a scene builder.
These platform views need to handled by a FlutterCompositor specified in a new
field at the end of the FlutterProjectArgs struct.

When a new platform view in introduced within the layer tree, the compositor
will ask the embedder to create a new render target for that platform view.
Render targets can currently be OpenGL framebuffers, OpenGL textures or software
buffers. The type of the render target returned by the embedder must be
compatible with the root render surface. That is, if the root render surface is
an OpenGL framebuffer, the render target for each platform view must either be a
texture or a framebuffer in the same OpenGL context. New render target types as
well as root renderers for newer APIs like Metal & Vulkan can and will be added
in the future. The addition of these APIs will be done in an ABI & API stable
manner.

As Flutter renders frames, it gives the embedder a callback with information
about the position of the various platform views in the effective hierarchy.
The embedder is then meant to put the contents of the render targets that it
setup and had previously given to the engine onto the screen (of course
interleaving the contents of the platform views).

Unit-tests have been added that test not only the structure and properties of
layer hierarchy given to the compositor, but also the contents of the texels
rendered by a test compositor using both the OpenGL and software rendering
backends.

Fixes b/132812775
Fixes flutter/flutter#35410
2019-08-13 14:53:19 -07:00
Kaushik Iska
de1c728dab Allow for dynamic thread merging on IOS for embedded view mutations (flutter/engine#9819)
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.
2019-08-12 12:32:38 -07:00
Chinmay Garde
b293223a7e Add a test for creating images from bytes. (flutter/engine#10799) 2019-08-08 21:46:55 -07:00
Chris Bracken
f173e72e06 Migrate Fuchsia runners to SDK tracing API (flutter/engine#10478)
Migrates the Fuchsia Flutter and Dart runners off the internal tracing
APIs and onto the public SDK.
2019-08-06 11:26:34 -07:00
sjindel-google
c39a23f1b6 Ensure debug-mode apps are always attached on iOS. (flutter/engine#10186) 2019-08-06 01:07:33 +02:00
Nathan Rogers
436b76d9fe Use Fuchsia trace macros when targeting Fuchsia SDK (flutter/engine#10634)
When |OS_FUCHSIA| is defined (even when |FUCHSIA_SDK| is defined as
well), use the Fuchsia SDK trace macros rather than the Dart timeline.

Reasons for doing this include:

Fuchsia's trace macros support categories.  This allows one to
distinguish between (e.g.) "flutter" and "skia" trace events for trace
recording and trace visualization.

Fuchsia has existing in tree benchmarks that depend on finding certain
events under category "flutter".

See the Fuchsia performance mailing list discussion for more context.
2019-08-05 12:52:36 -07:00
Chinmay Garde
5a28c68b3c Fix threading and re-enable resource cache shell unit-tests. (flutter/engine#10636)
The rasterizer may only be accessed safely on the GPU task runner. The test was accessing the same on a non-engine known task runner instead (i.e the tests main task runner).

Crashes previously reproducible on all platforms with the following filters: `--gtest_filter="*ShellTest.SetResourceCacheSize*" --gtest_repeat=-1 --gtest_shuffle --gtest_random_seed=1988` at run ~400.

Fixes https://github.com/flutter/flutter/issues/37629
2019-08-05 12:47:30 -07:00
Dan Field
e9f8f66f82 skip flaky tests (flutter/engine#10633) 2019-08-05 10:22:43 -07:00
Dan Field
06e7030b0f Reland Skia Caching improvements (flutter/engine#10434) 2019-08-02 19:31:57 -07:00
Dan Field
cd18c5ef0b Remove get engine (flutter/engine#9747) 2019-07-30 17:11:04 -07:00
stuartmorgan
934901b4e8 Don't try to use unset assets_dir setting (flutter/engine#9924)
Debug builds log invalid file errors on launch of anything using the
embedding API due to an unconditional use of assets_dir, even though
only one of assets_dir or assets_path needs to be set (and the embedding
API currently uses the latter). This checks that the FD has been set
before trying to use it to create an asset resolver.

Also eliminates a duplicate code path in embedder.cc, where it was
calling RunConfiguration::InferFromSettings, then running exactly the
same asset manager creation code again locally.
2019-07-18 14:07:13 -07:00
gaaclarke
02ba481921 Made the persistent cache's directory a const pointer. (flutter/engine#9815) 2019-07-18 08:57:50 -07:00
Chinmay Garde
3d8db4a1f6 Document //flutter/shell/common/rasterizer (flutter/engine#9809) 2019-07-15 17:45:47 -07:00
gaaclarke
fd3dac0f58 Made Picture::toImage happen on the IO thread with no need for an onscreen surface. (flutter/engine#9813)
Made Picture::toImage happen on the IO thread with no need for a surface.
2019-07-15 17:16:20 -07:00
Chinmay Garde
915fe6fad7 Document //flutter/shell/common/engine. (flutter/engine#9769) 2019-07-11 17:08:00 -07:00
Jason Simmons
d4894e906d Fall back to a fully qualified path to libapp.so if the library can not be loaded by name (flutter/engine#9762)
libapp.so contains compiled application Dart code.  On most Android systems,
this library can be loaded by calling dlopen("libapp.so"), which will search
Android's default library directories.

On some Android devices this does not work as expected.  As a workaround, this
patch provides a fallback path to libapp.so based on ApplicationInfo.nativeLibraryDir.

Fixes https://github.com/flutter/flutter/issues/35838
2019-07-11 12:39:42 -07:00