352 Commits

Author SHA1 Message Date
gaaclarke
43dce83fc1 Refactor to passing functions by const ref (flutter/engine#13975)
Moved our code to passing functions by const ref
2019-11-22 12:20:02 -08:00
Kaushik Iska
f6d868ede0 [fuchsia] Ensure we do not initialize nan RoundedRectangles (flutter/engine#13971)
Also initializes physical shape layer vars to empty.
2019-11-21 19:40:06 -08:00
liyuqian
b9f2bacea8 Fix picture raster cache throttling (flutter/engine#13710)
Previously, we're also counting the pictures that are already raster
cached.

This fixes https://github.com/flutter/flutter/issues/44252 and helps
solving the GPU thread issue of https://github.com/flutter/flutter/issues/43083

https://github.com/flutter/flutter/pull/45050 is a performance test in the framework repo to reveal this bug.
2019-11-20 16:36:23 -08:00
Chinmay Garde
6df221f6fb Expose the platform view mutator stack to custom compositors. (flutter/engine#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
James Robinson
e9fb9f7bb8 [flow][fuchsia] Add more tracing to layers and Fuchsia surface pool (flutter/engine#13864)
This adds more trace events to more layer operations and enhances the
trace counters for the Fuchsia vulkan surface pool to include retained
surface counts, emit stats on recycle events that might change the
surface count, and by separating counters which measure bytes from
counters which measure counts to make analysis simpler.
2019-11-14 15:31:37 -08:00
Michael Klimushyn
24ba26f80c Turn on RasterCache based on view hierarchy (flutter/engine#13762)
This is a duplicate of flutter/engine#13360 with the test switched to use the software backend instead of the GL backend.

After some debugging and testing on another GL embedder I think the issue with the test is some bug having to do with the GL implementation in the test harness specifically. 

Fixes flutter/flutter#38903
2019-11-08 17:14:50 -08:00
Dan Field
5ac5df1fdd Fix mDNS for iOS13 (flutter/engine#13451) 2019-11-01 15:29:15 -07:00
Michael Klimushyn
791c5441a5 Revert "Turn on RasterCache based on view hierarchy (#13360)" (flutter/engine#13442)
This caused EmbedderTest.VerifyB143464703 to fail after merging into
master.

```
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:3111: Failure
Value of: ImageMatchesFixture("verifyb143464703.png", renderered_scene)
  Actual: false
Expected: true
[  FAILED  ] EmbedderTest.VerifyB143464703 (2507 ms)
```

This reverts commit b1479f8e6075ef95d6b11a03e318bff72a2c0288.
2019-10-30 11:25:29 -07:00
Michael Klimushyn
b1479f8e60 Turn on RasterCache based on view hierarchy (flutter/engine#13360)
Previously the cache was disabled on whether or not PlatformViews were
globally enabled. Instead track their existence in the view hierarchy
and only disable RasterCache if a PlatformView is actually present.
2019-10-30 10:45:15 -07:00
Chinmay Garde
62f76d4eb8 Make sure root surface transformations survive resetting the matrix directly in Flow. (flutter/engine#13405)
This used to only be handled correctly for non-root layer backing stores. This
was mostly a side effect of the fact that we used recording canvases instead of
rendering directly into the backing store. We now use recording canvases
consistently.

Fixes b/143464703
Fixes https://github.com/flutter/flutter/issues/43732
2019-10-29 17:44:57 -07:00
Jason Simmons
7f34c88350 Do not attempt to drain the SkiaUnrefQueue in the destructor (flutter/engine#13237)
SkiaUnrefQueue should be empty at destruction time.  If the queue is nonempty,
then there will be a pending drain task that will hold a reference to the
queue.  The queue can only be destructed after the drain completes and the
reference is dropped.

Drains must only be done on the queue's task runner thread, which may not be
the thread where the queue is destructed.
2019-10-21 14:14:18 -07:00
Chinmay Garde
d102e4086e Re-land "Custom compositor layers must take into account the device pixel ratio."
This reverts commit 674e5f911f1d19a0611b603968a8307415f75b35 and applies iOS fixes.
2019-10-17 14:07:51 -07:00
Chinmay Garde
674e5f911f Revert "Custom compositor layers must take into account the device pixel ratio. (#13193)" (flutter/engine#13211)
This reverts commit c805fb227166d2097a7795569df1365cb9e736a8.
2019-10-17 12:59:27 -07:00
Chinmay Garde
c805fb2271 Custom compositor layers must take into account the device pixel ratio. (flutter/engine#13193)
The contents rendered into the backing stores are already correctly scaled.
The initial implementation assumed this also held true for the metrics obtained
via embedded view parameters.

Fixes b/142699417
2019-10-17 12:04:13 -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
Chinmay Garde
3873eeabb6 Compile sanitizer suppressions list and file bugs as necessary. (flutter/engine#12991) 2019-10-08 11:33:26 -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
Amir Hardon
f105e44be5 Update ExternalViewEmbedder class comment. (flutter/engine#11063) 2019-09-18 11:18:38 -06: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
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
Kaushik Iska
281ac5bf5a Do not Prepare raster cache if view_embedder is present (flutter/engine#11300)
This is a perf win because we do not use the cache in Paint anyways.
RasterCache <-> PlatformViews interaction will be improved by:
https://github.com/flutter/flutter/issues/38903
2019-08-20 14:38:45 -07:00
liyuqian
e099414b49 Trace RasterCacheResult::Draw (flutter/engine#11004)
Fixes https://github.com/flutter/flutter/issues/37988
2019-08-14 16:13:49 -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
cfontas
764e43e0e0 change add part to add child (flutter/engine#10787) 2019-08-09 12:18:44 -07:00
Kaushik Iska
f3f1b7c0b7 Revert "Remove one last final call to AddPart()" (flutter/engine#10440) 2019-08-02 09:18:17 -07:00
cfontas
d871e4da7f Remove one last final call to AddPart() (flutter/engine#10273)
* Remove one last final call to AddPart()

* fix merge conflict

* fix how i merged

* remove add part again

* remove pointer syntax

* fix formatting
2019-07-31 20:05:00 -07:00
David Worsham
6984916c0f [fuchsia] Remove extraneous ShapeNodes (flutter/engine#10150)
Test: Ran test programs on Fuchsia and dumped Scenic scene graph using
`fx shell cat /hub/c/scenic.cmx/*/out/debug/dump-scenes`
Inspected scene graph to confirm removal of ShapeNodes.
FL-284 #done
2019-07-31 02:22:01 -07:00
cfontas
a5a784d060 Remove Dead Scenic Clipping Code Path. (flutter/engine#10242)
Scenic has now fully transitioned to clipping by adding lists
of planes to Nodes; the old approach of adding a ShapeNode
"part" is now a no-op, and is safe to remove.
2019-07-30 14:19:32 -07:00
Dan Field
e38fb755f3 Let pushColorFilter accept all types of ColorFilters (flutter/engine#9641) 2019-07-10 12:06:58 -07:00
Chris Yang
c2916d93dc iOS platform view opacity (flutter/engine#9667) 2019-07-08 16:07:39 -07:00
liyuqian
160663387a Explain why OpacityLayer has an offset field (flutter/engine#9713)
According to the request by Amir and Chris.
2019-07-08 15:02:18 -07:00
Kaushik Iska
9815a20559 Raster now returns an enum rather than boolean (flutter/engine#9661)
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.
2019-07-03 19:53:01 -07:00
Chris Yang
e5bc87a4cd Mutators Stack refactoring (flutter/engine#9663)
Rename methods in the MutatorsStack to Pascal case to match standard cpp style
Refactor the operator== for Mutator class
2019-07-03 11:18:14 -07:00
Kaushik Iska
3346b46ae7 ExternalViewEmbedder can CancelFrame after pre-roll (flutter/engine#9660)
* ExternalViewEmbedder can CancelFrame after pre-roll

- Resets the state so next pre-roll can be successful.
- Commit any pending `CATransaction` so we don't create
  nested transactions.

* Update flow/embedded_views.h
2019-07-03 08:38:19 -07:00
Kaushik Iska
4f307483d8 External view embedder can tell if embedded views have mutated (flutter/engine#9653)
* refactoring to move the mutator stack handling to preroll

* more review fixes

* Add support for external view embedded to know if it has changed

* remove the need to reset

* address comments

* Rename to HasPendingViewOperations
2019-07-03 07:28:53 -07:00
Chris Yang
cec3b15298 Move the mutators stack handling to preroll (flutter/engine#9651)
* refactoring to move the mutator stack handling to preroll

* more review fixes
2019-07-02 16:35:47 -07:00
Chris Yang
92ae45a714 make EmbeddedViewParams a unique ptr (flutter/engine#9640) 2019-07-02 13:27:12 -07:00
Chris Yang
102825d288 iOS PlatformView clip path (flutter/engine#9478) 2019-07-02 10:56:59 -07:00
Chinmay Garde
d90e42e020 Fix uninitialized variables and put tests in flutter namespace. (flutter/engine#9613)
Also enabled the tests previously disabled due to flakiness caused by these
uninitialized variables.

Fixes https://github.com/flutter/flutter/issues/35338
2019-06-29 21:05:42 -07:00
Chris Yang
ef172e2250 disable mysterious failing tests (flutter/engine#9608) 2019-06-29 12:38:49 -07:00
Chris Yang
bb909453ea Reland "IOS Platform view transform/clipping (#9075)" and fix the breakage. (flutter/engine#9483)
* Revert "Revert "IOS Platform view transform/clipping (#9075)" (#9480)"

This reverts commit 52ceaee505a26b6bad893e38b33c522d1e0ba571.

* fix fuschia buid
2019-06-25 15:29:47 -07:00
Chris Bracken
52ceaee505 Revert "IOS Platform view transform/clipping (#9075)" (flutter/engine#9480)
This reverts commit 5625d01b324f5a0d94aaa916d9e08fd038e363b3.

Seeing the following breakage on host build:
```
../../flutter/flow/scene_update_context.cc:205:36: error: non-const lvalue reference to type 'flutter::MutatorsStack' cannot bind to a value of unrelated type 'const flutter::Stopwatch'
                                   frame.context().raster_time(),
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../flutter/flow/scene_update_context.cc:207:36: error: no viable conversion from 'flutter::TextureRegistry' to 'const flutter::Stopwatch'
                                   frame.context().texture_registry(),
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../flutter/flow/instrumentation.h:55:32: note: candidate constructor not viable: no known conversion from 'flutter::TextureRegistry' to 'const flutter::Stopwatch &' for 1st argument
  FML_DISALLOW_COPY_AND_ASSIGN(Stopwatch);
                               ^
../../flutter/fml/macros.h:28:3: note: expanded from macro 'FML_DISALLOW_COPY_AND_ASSIGN'
  TypeName(const TypeName&) = delete;          \
  ^
../../flutter/flow/scene_update_context.cc:208:36: error: non-const lvalue reference to type 'flutter::TextureRegistry' cannot bind to a temporary of type 'flutter::RasterCache *'
                                   &frame.context().raster_cache(),
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../flutter/flow/scene_update_context.cc:209:36: error: cannot initialize a member subobject of type 'const flutter::RasterCache *' with an rvalue of type 'bool'
                                   false};
                                   ^~~~~
```
2019-06-25 10:48:37 -07:00
Chris Yang
5625d01b32 IOS Platform view transform/clipping (flutter/engine#9075) 2019-06-25 09:33:50 -07:00
Michael Klimushyn
7dad09a5d7 Clamp when overflowing z bounds (flutter/engine#9402) 2019-06-20 18:20:35 -07:00
Chinmay Garde
5f5821e8c1 Replace lock_guard with scoped_lock and use class template argument deduction. (flutter/engine#9338) 2019-06-17 10:08:45 -07:00
David Worsham
c913c07e29 [scene_host] Expose Opacity and remove ExportNode (flutter/engine#9297)
SCN-947 #comment
SCN-1291 #comment
2019-06-13 10:16:21 -07:00
liyuqian
4b958d852b Set identity instead of crash in opt build (flutter/engine#9262)
According to https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#expectations-around-potential-crashes-in-the-engine

This should address https://github.com/flutter/flutter/issues/31650#issuecomment-494935507

We'll instead use `FML_LOG(ERROR)` to report errors to our CI tests. See https://github.com/flutter/flutter/issues/34194
2019-06-13 09:35:54 -07:00