Commit Graph

329 Commits

Author SHA1 Message Date
liyuqian adb4659149 Trace RasterCacheResult::Draw (#11004)
Fixes https://github.com/flutter/flutter/issues/37988
2019-08-14 16:13:49 -07:00
Chinmay Garde e8f954409d Allow embedder controlled composition of Flutter layers. (#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 971a639151 Allow for dynamic thread merging on IOS for embedded view mutations (#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 58f4f27a4e change add part to add child (#10787) 2019-08-09 12:18:44 -07:00
Kaushik Iska dc559064f7 Revert "Remove one last final call to AddPart()" (#10440) 2019-08-02 09:18:17 -07:00
cfontas c67a36cbbe Remove one last final call to AddPart() (#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 a29ef66013 [fuchsia] Remove extraneous ShapeNodes (#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 f8d122bfca Remove Dead Scenic Clipping Code Path. (#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 56885f79b8 Let pushColorFilter accept all types of ColorFilters (#9641) 2019-07-10 12:06:58 -07:00
Chris Yang 802bd1518b iOS platform view opacity (#9667) 2019-07-08 16:07:39 -07:00
liyuqian eb89d9d42c Explain why OpacityLayer has an offset field (#9713)
According to the request by Amir and Chris.
2019-07-08 15:02:18 -07:00
Kaushik Iska 7f828dd3e3 Raster now returns an enum rather than boolean (#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 cea2c3617f Mutators Stack refactoring (#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 791143f172 ExternalViewEmbedder can CancelFrame after pre-roll (#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 d637f291a9 External view embedder can tell if embedded views have mutated (#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 8306ee68c7 Move the mutators stack handling to preroll (#9651)
* refactoring to move the mutator stack handling to preroll

* more review fixes
2019-07-02 16:35:47 -07:00
Chris Yang 8deeb77f05 make EmbeddedViewParams a unique ptr (#9640) 2019-07-02 13:27:12 -07:00
Chris Yang a9ee687ac9 iOS PlatformView clip path (#9478) 2019-07-02 10:56:59 -07:00
Chinmay Garde 609a980608 Fix uninitialized variables and put tests in flutter namespace. (#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 8d054008a8 disable mysterious failing tests (#9608) 2019-06-29 12:38:49 -07:00
Chris Yang aa9b3a180a Reland "IOS Platform view transform/clipping (#9075)" and fix the breakage. (#9483)
* Revert "Revert "IOS Platform view transform/clipping (#9075)" (#9480)"

This reverts commit 00d929f7f6.

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

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 ebb5b909fb IOS Platform view transform/clipping (#9075) 2019-06-25 09:33:50 -07:00
Michael Klimushyn 950d4813b5 Clamp when overflowing z bounds (#9402) 2019-06-20 18:20:35 -07:00
Chinmay Garde 96a1a843cb Replace lock_guard with scoped_lock and use class template argument deduction. (#9338) 2019-06-17 10:08:45 -07:00