270 Commits

Author SHA1 Message Date
egdaniel
dba00b2395
Update flutter skia flush calls to new flush and submit api (#18421)
* Update flutter to use new skia flushing/submit api

This has no functional change, just moving to the new api calls.

* Update vulkan_swapchain.cc

* Update embedder_external_view_embedder.cc
2020-05-15 11:40:21 -04:00
Marcus Tomlinson
d96f962ca2
Add new FlutterEngineAOTData argument to FlutterProjectArgs (#18146)
Added a new `FlutterEngineAOTData` argument to `FlutterProjectArgs`. Embedders can instantiate and destroy this object via the new `FlutterEngineCreateAOTData` and `FlutterEngineCollectAOTData` methods provided.

If an embedder provides more than one source of AOT data to `FlutterEngineInitialize` or `FlutterEngineRun` (e.g. snapshots as well as `FlutterEngineAOTData`), the engine will error out.

Resolves: https://github.com/flutter/flutter/issues/50778
2020-05-10 10:24:56 -07:00
Brian Osman
fb208b486e
Convert semantics_node from SkMatrix44 to SkM44 (#17763)
* Convert semantics_node from SkMatrix44 to SkM44
2020-04-17 07:24:40 -04:00
Dan Field
ff62dec5c9
Roll to clang11, mark 4 (#17483)
* "Reland Clang 11, roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c, take 4 (#17467)" (#17482)"

This reverts commit 8166a91bca11b83c16fba8f8fd407e937a2ac89c.

* format code

* Roll buildroot to 3a27de1c5bb0f50be7d3efe3e00de4f6068c9f30
2020-04-02 13:04:49 -07:00
Dan Field
8166a91bca
Revert "Reland Clang 11, roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c, take 3 (#17467)" (#17482)
This reverts commit 39b77188c5425925a72fe0a64d246dbc0b3cdadc.
2020-04-02 10:01:26 -07:00
Dan Field
39b77188c5
Reland Clang 11, roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c, take 3 (#17467)
* Reland Clang 11, Roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c (#17457)" (#17464)

This reverts commit 9eacd028cdba5c6efef327342dc53fab61474462.

* Skip more image tests, use newer dsymutil, add missing symbols
2020-04-01 20:55:27 -07:00
Dan Field
9eacd028cd
Revert "Reland Clang 11, Roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c (#17457)" (#17464)
This reverts commit a4026cc9f16a93fbce6c94af3ddaf971d363c195.
2020-04-01 17:50:57 -07:00
Dan Field
a4026cc9f1
Reland Clang 11, Roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c (#17457)
* Reland "Roll Clang to v11, roll buildroot to fe13f79dce4ce9aab3209f11988d825dcf580b4a, allow newly exported symbols (#17440)" (#17451)"

This reverts commit a870bc533c5bce9526563c3d2f40370e450b85f6.

* skip golden that is different on macos

* buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c
2020-04-01 16:32:13 -07:00
liyuqian
807ca8543c
More rename from GPU thread to raster thread (#17408)
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`.
2020-03-31 14:05:28 -07:00
Emmanuel Garcia
b716cbba71
Reland unobstructed platform views (#17336) 2020-03-27 16:39:29 -07:00
liyuqian
b3075b3091
Rename GPU thread to raster thread in code comments (#17329)
1. Simple "GPU thread" to "raster thread" replacement.

2. Regex replace "GPU([\n\r\s]+//+ thread)" with "raster$1".

3. Regex replace "// gpu$" with "// raster".

4. Simple test change.

5. Run ci/format.sh
2020-03-25 22:49:59 -07:00
Emmanuel Garcia
b235233e9d
Revert unobstructed platform views (#17326) 2020-03-25 14:36:10 -07:00
Emmanuel Garcia
f5d25da83c
Reland: Implement unobstructed Platform Views on iOS (#17237) 2020-03-20 18:58:55 -07:00
Emmanuel Garcia
70f6d18bfa
Revert "Implement unobstructed Platform Views on iOS (#17049)" (#17233)
This reverts commit 2627634be807a28f4d56c5d7cd878c3ff6ce07ac.
2020-03-20 14:46:09 -07:00
Emmanuel Garcia
2627634be8
Implement unobstructed Platform Views on iOS (#17049) 2020-03-20 12:38:58 -07:00
Chinmay Garde
a0010512df
Disable Embedder11yTest::A11yTreeIsConsistent to unblock LUCI. (#17081)
See https://github.com/flutter/flutter/issues/52372
2020-03-10 18:48:23 -07:00
Chinmay Garde
bcefcdb880
Use the ELF loader to setup AOT symbols in benchmark runner. (#17051)
We no longer package AOT artifacts as discrete blobs. The portable ELF loader
from the testing library may be used instead.

Fixes https://github.com/flutter/flutter/issues/52263
2020-03-10 12:28:24 -07:00
Chinmay Garde
92abb22c64
Reland "Lift restriction that embedders may not trample the render thread OpenGL context in composition callbacks." (#16711)
This reverts commit ef9e7b1a1365c07ab0df2e2016c4442c3963c2c7 with the following changes to accommodate an embedder for whom the original optimizations caused issues:

* Ensure stable order in the backing stores presented to the embedder. This is a pessimization that will be reverted when the embedder migrates. Tracked in  https://github.com/flutter/flutter/issues/51228
* Forego the optimization where the unused layers would be collected before allocation of new layers needs to happen. This is a pessimization that will be reverted when the embedder migrates. Tracked in  https://github.com/flutter/flutter/issues/51229

More context in b/146142979.
2020-02-24 11:48:32 -08:00
Chinmay Garde
ef9e7b1a13
Revert "Lift restriction that embedders may not trample the render thread OpenGL context in composition callbacks. (#16653)" (#16674)
This reverts commit 110c1c9adf0f580d16c8252e3b37992af93e9cea.
2020-02-18 18:59:21 -08:00
Chinmay Garde
110c1c9adf
Lift restriction that embedders may not trample the render thread OpenGL context in composition callbacks. (#16653)
During the implementation of custom compositor integration, the embedder gets
callbacks on the render thread to prepare render targets (framebuffers,
textures, etc) for the engine to render into, callbacks to present these render
targets along with platform managed contents, and, callbacks to collect render
targets once they can no longer be recycled by the engine in subsequent frames.
During these callbacks, the engine mandates the OpenGL state on the render
thread be preserved. This restriction has been the source of hard to isolate
issues where the embedder trampled on the OpenGL bindings state in the callback
but failed to restore state before control went back to the engine. Due to the
nature of the OpenGL API, such errors are easy to make and overlook. This patch
lifts the restriction from the embedder. Embedders may now freely work with the
OpenGL state in custom compositor callbacks and the engine will make sure to
disregard OpenGL bindings when control flows back to it.

Disregarding current OpenGL state has a certain performance penalty and the
majority of this patch handles refactoring various engine embedder components
such that this happens only once per frame. The most trivial version of this
patch would reset context bindings on every transition of control flow from the
embedder to the engine. However, that naive approach would have necessitated
more than 50 binding resets in existing unit-test cases (depending on the number
of platform view interleaving levels and render target recycling hit rates). In
this implementation, bindings will be reset only once per frame and this does
not depend on the number of platform views in the scene.

The majority of this patch is a refactoring of engine subsystems used in
`ExternalViewEmbedder::SubmitFrame` which is thoroughly documented with each
opportunity for the embedder to invalidate OpenGL state tagged.

The refactoring also enables the implementation of the following optimizations
to engine behavior which should aid in reducing the memory needed for the
creation of render targets. These optimization include:
* The engine will only ask the embedder for render targets in which it expects
  to render into. This was a quirk in the way in which root and non-root render
  targets were handled. The engine could require the embedder to create a render
  target but then realize it didn’t have anything to render into it. In the
  presentation callback, it would skip that render target. But the embedder
  still had to allocate that extra render target. This will no longer be the
  case and should reduce memory use.
* The engine may now skip always realizing (via the embedder render target
  creation callback) and presenting the root render target. This was also a side
  effect of the same quirk. Previously, the engine would always ask the embedder
  to present the root render target even if it was empty. Since this is no
  longer the case, few render targets should be allocated which will reduce
  memory consumption.
* The engine will now ask the embedder to collect unused render targets before
  it asks it to create new ones. The previous behavior was to ask the embedder
  for new targets and then collect old ones. This would cause spikes in memory
  use when the size of the render targets would change. These memory use spikes
  should now be troughs.
* The previous render target cache also considered the platform view ID in cache
  viability considerations (instead of just the size of the render target). This
  was a bug which has been fixed. This should lead to better cache utilization
  in some situations.

These optimizations are now codified in unit-tests and the updated test
expectations are a result of these optimizations now being in place.

* Fixes https://github.com/flutter/flutter/issues/50751
* Fixes https://github.com/flutter/flutter/issues/46911
* Fixes https://github.com/flutter/flutter/issues/43778
* Fixes b/146142979
2020-02-18 12:51:49 -08:00
stuartmorgan
28e663726a
Add explicit casts to printing of function pointers (#16370)
Compiling with clang on Windows fails here with a warning about implicit
cast from function pointer to object pointer. Rather than disable that
warning, this makes it an explicit cast. Since this is just test output,
it's not critical that this be a completely safe operation.

Part of #16256
2020-02-05 22:31:22 -08:00
Chinmay Garde
f7b78e001d
Remove all uses of the redundant flutter_root variable. (#16311)
This was only necessary when the Engine had to build in multiple buildroots
where the sources where checked out at different paths relative to the
buildroot. This is no longer the case and there are already cases GN rules
have been written that mix and match variable usage with the direct
specification of the path to the Flutter sources relative to the sole buildroot.
2020-01-31 21:49:48 -08:00
Chinmay Garde
dffe3fb276
Isolate and move common portable ELF loading from fixtures into //flutter/testing. (#16305)
Also update all known test harnesses to use this and fixes the broken shell_unittests harness.

Fixes https://github.com/flutter/flutter/issues/49853
2020-01-31 12:52:00 -08:00
Chinmay Garde
5c79a2d378
Remove buggy test to check if tasks can be posted on all native threads recursively from the emebdder. (#16214)
This was never thread safe to shutdown of the concurrent message loop.
2020-01-29 18:16:09 -08:00
Chinmay Garde
6061b804e3
In the test harness, don’t attempt to load AOT snapshots from non-existent dylibs. (#16210)
This condition may arise when the embedder passes in a path to a non-existent
dylib. Instead of crashing, the embedder will now return an error response.

Fixes https://github.com/flutter/flutter/issues/49732
2020-01-29 15:49:29 -08:00
Chinmay Garde
db96c1c8f5
Hold a mutex when updating all CanPostTaskToAllNativeThreads::Captures members. (#16085)
This is in the same vein as https://github.com/flutter/engine/pull/16081 but
includes holding the mutex when updating all members in the Captures struct
instead of just when tracking thread IDs.
2020-01-27 18:37:20 -08:00
Chinmay Garde
26fd7d0bc9
Fix flake by making thread ID tracking in CanPostTaskToAllNativeThreads thread safe. (#16081) 2020-01-27 17:34:56 -08:00
Chinmay Garde
aab316c62f
Remove buggy assertion in EmbedderTest::CanPostTaskToAllNativeThreads. (#16071)
This was introduced in
c5329ef5c4.

The assertion was originally written to check that more than 4 threads were
managed by the engine (UI, Platform, GPU, IO + ConcurrentWQWorkers). However,
the assertion actually only checked the count of workers in the ConcurrentWQ. As
written, this assertion would fail on all hosts with a hardware concurrency of
less than 4. Remove the assertion. The engine threads count and its assertions
already check callbacks on workers. So this check was incorrect and redundant.
2020-01-27 16:00:34 -08:00
Chinmay Garde
c5329ef5c4
Allow embedders to schedule a callback on all engine managed threads. (#15980)
`FlutterEnginePostCallbackOnAllNativeThreads` schedule a callback to be run on
all engine managed threads. The engine will attempt to service this callback the
next time the message loops for each managed thread is idle. Since the engine
manages the entire lifecycle of multiple threads, there is no opportunity for
the embedders to finely tune the priorities of threads directly, or, perform
other thread specific configuration (for example, setting thread names for
tracing). This callback gives embedders a chance to affect such tuning.

Fixes flutter/flutter#49551
Fixes b/143774406
Fixes b/148278215
Fixes b/148278931
2020-01-27 13:49:39 -08:00
Chinmay Garde
276481c4d3
Move tonic into //flutter/third_party. (#15895)
Tonic used to be used by multiple consumers outside of Flutter Engine. Due to
this, it has an unnecessary abstraction layer as well as utilities duplicated in
FML and other engine subsystems. The sole user of Tonic is now the Flutter
Engine. It is intended that the Flutter Engine team now owns this subsystem,
remove unnecessary utilities and document the headers. This is the first step in
the transition. No history is being imported as the initial history was already
lost in the transition of this component to fuchsia.googlesource. As this
component was unmaintained there, I could see no additional value in importing
the history of the patches there.

No functional change. Just moved the repo from //third_party to
//flutter/third_party and updates GN refs.
2020-01-25 17:01:56 -08:00
Dan Field
89f3471fa7
the the fix (#15973) 2020-01-24 12:43:32 -08:00
dnicoara
1d6766f9dd Fix embedder mutation order (#15566)
The mutator list sent to the embedder is in reverse order from the
MutatorsStack. The root display transformation then needs to be appended
at the end of the list.

Given that these transforms are applied to a layer in display space the
list needs to be reversed as well such that transforms can be applied in
the right order to get from display space to surface space.

Bug: b/143612326
2020-01-15 10:35:15 -08:00
gaaclarke
46adf73d51
Made it so you can specify the old gen heap size. (#15259) 2020-01-08 10:20:52 -08:00
Kaushik Iska
f2dbeb8aa7
Reland Wire up Opacity on Fuchsia (#14559)
This reverts commit 6ea69a0d4339dd153899bb6c299689f1dd43329d.

On top of the revert, it reverted a commit in the PR:
https://github.com/flutter/engine/pull/14024

This reverts commit ea67e5b0b930ebf552bc7dbd678a35ee6a129c39.
2019-12-18 16:05:38 -08:00
Kaushik Iska
6ea69a0d43
Revert "Wire up Opacity on Fuchsia, round 2 (#14024)" (#14543)
This reverts commit d117ac979c28363a0a6b02d4a54945212a88b6f9.
2019-12-18 10:29:47 -08:00
Chinmay Garde
871246172d
Allow custom embedders to post low memory notifications. (#14506)
This is a non-breaking addition to the stable Flutter Embedder API.
2019-12-16 11:42:13 -08:00
Chinmay Garde
f05832153b
Allow embedders to post Dart objects on send ports from the native side. (#14477)
This is a non-breaking addition to the stable Flutter Embedder API and exposes a
subset of the functionality provided by Dart_PostCObject API in a stable and
tested manner to custom embedder implementations.

Send port acquisition can currently be done as described in the unit-test but
there may be opportunities to extend this API in the future to access ports more
easily or create ports from the native side.

The following capabilities of the the Dart_PostCObject API are explicitly NOT
exposed:
* Object arrays: This allows callers to create complex object graphs but only
  using the primitives specified in the native API. I could find no current use
  case for this and would have made the implementation a lot more complex. This
  is something we can add in the future if necessary however.
* Capabilities and ports: Again no use cases and I honestly I didn’t understand
  how to use capabilities. If needed, these can be added at a later point by
  appending to the union.

Fixes https://github.com/flutter/flutter/issues/46624
Fixes b/145982720
2019-12-13 17:28:21 -08:00
Chinmay Garde
03f45a1edd
Verify embedders can convert clip rects from mutation stack into surface space. (#14483)
Add a test to verify behavior discussed in b/143612326
2019-12-13 15:28:01 -08:00
Chinmay Garde
181ad4e18f
Use futures to images used for comparison with fixtures in embedder unit-tests. (#14465)
This earlier pattern was to use callbacks with latching.
2019-12-12 14:07:53 -08:00
Chinmay Garde
0a40f3d784
Assert that arc end caps on canvases with root surface transformations are drawn correctly. (#14359)
Verifies that the Skia commit https://skia-review.googlesource.com/c/skia/+/259174 has been pulled into the engine. This should have happened in the roll https://github.com/flutter/engine/pull/14345.

Fixes https://github.com/flutter/flutter/issues/46691
Fixes b/142280381
2019-12-11 15:17:34 -08:00
David Worsham
d117ac979c
Wire up Opacity on Fuchsia, round 2 (#14024)
* Remove erroneous ChildView opacity

* Wire frame metrics through contexts

* Maintain layer stack inside of SceneBuilder

* Remove EnsureSingleChild

* Centralize system-composite and elevation logic

* Wire up OpacityLayer to Scenic
2019-12-04 19:29:31 -08:00
Chinmay Garde
e6887328a1
Fix platform view offsets incorrectly taking into account device pixel ratios. (#14135)
This issue was hidden by an incorrect test expectation that has been corrected.

Fixes b/144555069
Fixes https://github.com/flutter/flutter/issues/45991
2019-12-04 13:15:47 -08:00
David Worsham
2fc1e1bce1 Relanding: Add Flow unittests and fixtures (#14091) 2019-12-03 14:33:02 -08:00
liyuqian
84bf72917c
Revert PRs to unblock David and Jim's work (#14088)
* Revert "Add flow test fixtures and tests (#13986)"

This reverts commit 620f5281b819f304e8e9e945222e26b17b087cc3.

* Revert "Dynamically determine whether to use offscreen surface based on need (#13976)"

This reverts commit a86ef946563b020108320bbfb974bf7343284fd3.
2019-12-03 12:02:37 -08:00
David Worsham
620f5281b8 Add flow test fixtures and tests (#13986) 2019-12-03 09:43:02 -08:00
Chinmay Garde
9f6401362d
Don't crash but warn when the scene builder specifies no layers. (#14008) 2019-11-25 15:38:41 -08:00
gaaclarke
89e395853c
Refactor to passing functions by const ref (#13975)
Moved our code to passing functions by const ref
2019-11-22 12:20:02 -08:00
Chinmay Garde
75ea3e2445
Expose the platform view mutator stack to custom compositors. (#13731)
This allows custom compositors to affect scene builder modifications made
to the platform view.

Fixes https://github.com/flutter/flutter/issues/44211
Fixes b/143612326
2019-11-19 10:35:41 -08:00
chunhtai
132d38cd22
Moves pointer event sanitizing to engine. (#13697)
* Moves pointer event sanitizing to engine

* fix comment format

* fix formatting

* addressing comment

* fix format

* fix format

* addressing comment
2019-11-19 09:48:25 -08:00
Todd Volkert
762294cf2d
Revert "RendererContextSwitch guard flutter's gl context rework. (#13812)" (#13906)
This reverts commit f456423cfb820d07bb36e9a8979e3d75cc9d8d76.

This is being reverted because it caused flutter/flutter#45098
(images don't load on iOS).
2019-11-18 18:28:04 -08:00