217 Commits

Author SHA1 Message Date
Amir Hardon
a9a5c333dc Update scene_update_context to match recent PaintContext changes. (flutter/engine#6736)
This fixes a Fuchsia build breakage cause by #6726 and #6603.
2018-11-02 13:55:24 -07:00
Amir Hardon
bebedc379d Add an overlay surface on top of embedded UIViews. (flutter/engine#6726)
The overlay surfaces are going to be the same IOSSurface implementation
with the platform views controller set to null (so these are surfaces
that don't support embedding platform views to them).

  * Adds a FlutterOverlayView which is a UIView that's showing an
    overlay surface.
  * Creates an overlay surface for each embedded UIView (done in
    FlutterPlatformViewsController).
  * Changes CompositeEmbeddedView to return a new canvas.
  * Makes the PlatformViewLayer replace the PaintContext's canvas with
    the canvas for the overlay view.
  * Changed canvas in PaintContext to be a pointer so it can be changed.

TBD in following PRs:
  * Copy the current canvas state when replacing a canvas in PaintContext.
  * Make FlutterOverlayView work with a GL backend (currently it only
    works with software rendering)
2018-11-01 17:45:16 -07:00
liyuqian
33abef4875 Check needs_painting in RasterCache::Prepare (flutter/engine#6708)
Otherwise, this may trigger `FML_DCHECK(needs_painting())`. We haven't
caused crashes for our users because it probably requires a locally
debug engine build to trigger the assert.
2018-10-31 10:51:13 -07:00
Chinmay Garde
ddd0b8887a Handle Windows headers defining ERROR to 0 in log levels. (flutter/engine#6677) 2018-10-26 16:47:14 -07:00
Amir Hardon
b45990d8d5 Undefine ERROR in platform_view_layer.cc (flutter/engine#6675)
On Windows the ERROR macro is defined by some headers which breaks the
FML_LOG(ERROR).
2018-10-26 16:06:39 -07:00
Amir Hardon
3c150f1c20 Attach and position embedded UIVIews (flutter/engine#6614) 2018-10-26 14:45:17 -07:00
Amir Hardon
3e93cdffaa Plumb the iOS PlatformViewsController into flow. (flutter/engine#6603)
For flow to manipulate the embedded UIViews during the paint traversal
it needs some hook in PaintContext.
This PR introduces a ViewEmbeder interface that is implemented by the
iOS PlatformViewsController and plumbs it into PaintContext.

The ViewEmbedder interface is mainly a place holder at this point, as
this PR is focused on just the plumbing.
2018-10-26 14:26:59 -07:00
liyuqian
6dbb6560ca Add offset to engine OpacityLayer (flutter/engine#6594)
See https://github.com/flutter/flutter/pull/22566#discussion_r226082171
for why we add this.
2018-10-19 11:46:12 -07:00
Amir Hardon
117dbfaeb1 Add a no-op platform view layer. (flutter/engine#6505)
This will be used for embedding UIViews on iOS.

Landing a no-op layer as a first incremental step to keep PRs small.
2018-10-12 19:40:21 -07:00
liyuqian
c03a3795d3 Reland "Share engine layers with the framework" (#6412) (flutter/engine#6468)
This reverts commit c5df60b6a186467803e021ac4dfbb26f0cebb08b.

This should land after https://github.com/flutter/engine/pull/6442

* Add pragma vm:entry-point

Otherwise, an object may be both null and an instance of EnginieLayer at
the same time in Dart.
2018-10-12 07:45:42 -07:00
liyuqian
80d2237fe5 Reland "Allow raster caching any layer subtree (#6442)" (flutter/engine#6507)
* Revert "Revert "Allow raster caching any layer subtree (#6442)" (#6506)"

This reverts commit 0ec9ea75fe7ff9e2121b06fe7d7c9d9751778c65.

* Use raw pointer for RasterCacheKey

So we won't depend on whether it's a std::unique_ptr or std::shared_ptr.
2018-10-11 15:09:09 -07:00
liyuqian
0ec9ea75fe Revert "Allow raster caching any layer subtree (#6442)" (flutter/engine#6506)
Reverts flutter/engine#6442

container_layer.h file is not synced which broke the bots
2018-10-11 14:18:22 -07:00
liyuqian
397c02b215 Allow raster caching any layer subtree (flutter/engine#6442)
We first test this with OpacityLayer. This test alone (without retained rendering) should have ~30% speedup as we'll have fewer render target switches by snapshoting in the Preroll instead of saveLayer in the Paint.

In my local flutter_gallery transition perf tests, the average frame time drops from ~16ms to ~12ms.

https://github.com/flutter/flutter/issues/21756
2018-10-11 13:24:33 -07:00
liyuqian
c5df60b6a1 Revert "Share engine layers with the framework" (flutter/engine#6412)
Reverts flutter/engine#6406

We need to fix the SkiaGPUObject issue of the raster cache SkImage before merging this PR.
2018-10-02 16:51:47 -07:00
liyuqian
aef666755c Share engine layers with the framework (flutter/engine#6406)
To make the PR minimal, we currently only share the engine layer when `pushPhysicalShape` (for Fuchsia) or `pushOffset` (for `RepaintBoundary` and `Opacity`) are called. They should be sufficient for our short-term perf goal. In the future, we can incrementally share more engine layers with the framework.

https://github.com/flutter/flutter/issues/21756
2018-10-02 14:02:10 -07:00
Mehmet Fidanboylu
59fa9a1a48 SkImageFilter needs to be imported in the header (flutter/engine#6296) 2018-09-20 16:45:23 -07:00
Jason Simmons
ea656290b1 Ensure that Layer::AutoSaveLayer objects are not immediately destructed (flutter/engine#6264)
Fixes https://github.com/flutter/flutter/issues/20859
2018-09-17 11:43:41 -07:00
liyuqian
2db3d26f4a Remove LayerBuilder and DefaultLayerBuilder (flutter/engine#6256)
This essentially reverts https://github.com/flutter/engine/pull/4197/
as no one is (or soon will be) implementing an alternative LayerBuilder.
Let's just put everything in SceneBuilder to reduce the YAGNI
(you aren't gonna need it) smell. This will also make retained rendering
API changes much easier.
2018-09-14 15:13:00 -07:00
Gary Qian
c6d0a2117a Improve performance of performance overlay by caching. (flutter/engine#6225)
Cache a SkSurface with previously drawn shapes so that we do not need to draw them again in future frames.

On Nexus 5X test device, old render time for just the overlay was 1.3ms-3.0ms and this version improves to 0.9ms-1.3ms running flutter gallery in profile mode.
2018-09-11 16:13:23 -07:00
liyuqian
1e470cc27b Remove root_surface_transformation from PaintContext (flutter/engine#6213)
It should be sufficient to provide the matrix to preroll.
2018-09-11 15:29:08 -07:00
Gary Qian
bf774ef85b Always save canvas and correctly pass antialias boolean in ClipRects. (flutter/engine#6199) 2018-09-07 14:02:39 -07:00
Eric
9a5581563f Reset the raster cache when the compositor context is created. (flutter/engine#6150) 2018-09-06 17:11:17 -07:00
Zachary Anderson
ea32eeb822 [fuchsia] Plumb root_surface_transformation in scene_update_context (flutter/engine#6187)
* [fuchsia] Plumb root_surface_transformation in scene_update_context

To fix the Fuchsia build.

* Update scene_update_context.cc
2018-09-06 12:35:12 -07:00
Gary Qian
cba6b65789 Use double multiplication by a scale instead of 3 divides for speed. (flutter/engine#6154) 2018-09-04 10:54:52 -07:00
Gary Qian
6cc612b7b3 Revert "Use Skia normalize again after Skia precision fix. (#6121)" (flutter/engine#6122)
This reverts commit 7d6d2fd49f6d5be0ae6d9583a887cabdab4bbb7d.
2018-09-04 10:21:30 -07:00
Gary Qian
7d6d2fd49f Use Skia normalize again after Skia precision fix. (flutter/engine#6121)
* Fix tilt by using custom normalize impl to avoid strange skia normalize behavior

* Use Skia normalize again after Skia fix.
2018-08-30 11:18:01 -07:00
Gary Qian
980d18ee57 Fix tilt by using custom normalize impl to avoid strange skia normalize behavior (flutter/engine#6106) 2018-08-29 10:36:35 -07:00
Chinmay Garde
1fcba44904 Allow embedders to set the root surface transformation. (flutter/engine#6085) 2018-08-28 14:13:49 -07:00
liyuqian
bc75dc5d85 Call drawPath without clip if possible (flutter/engine#5952)
It turns out that Skia is much slower at drawing paint inside a clipped
path than directly drawing that path. (Average frame time of 22ms vs
18ms in flutter_galary transition test.)
2018-08-07 14:47:32 -07:00
amirh
9d38d63147 Allow freezing a texture. (flutter/engine#5938)
This is needed to avoid jank when resizing an embedded Android view.
See
https://github.com/flutter/flutter/issues/19572#issuecomment-410400724
2018-08-07 14:43:19 -07:00
liyuqian
970df7c987 Call drawPaint instead of drawPath if there's clip (flutter/engine#5937)
If we want to avoid the bleeding edge artifact (flutter/flutter#18057 (comment)) using saveLayer, we have to call drawPaint instead of drawPath as anti-aliased drawPath will always have such artifacts.

This is discovered when I try to add golden tests for such bleeding artifacts using our new Clip enum. Here's the updated golden files: flutter/goldens@cb1fa8a?short_path=57b30ce#diff-57b30cea9b10b7ca689009854e12d70e
2018-08-03 17:00:00 -07:00
Chinmay Garde
3e5e79b737 Fix sundry Fuchsia build issues after the tonic/fxl migration. (flutter/engine#5920) 2018-08-01 13:29:45 -07:00
Chinmay Garde
6ab2c166fd Remove all dependencies on Garnet. (flutter/engine#5869) 2018-07-26 12:49:34 -07:00
Chinmay Garde
62289623fc Remove //flutter/glue and use FML directly. (flutter/engine#5862) 2018-07-25 13:20:48 -07:00
liyuqian
2c526e8068 Rename clip mode to clip behavior (flutter/engine#5853)
* Rename clip mode to clip behavior

So we're consistent across flutter/flutter and flutter/engine

* Clang format
2018-07-25 09:57:10 -07:00
Joshua Seaton
967a473c6d [fml][fxl] Migrate AutoResetWaitableEvent to fml version. (flutter/engine#5808)
Thanks Jason for the speedy review
2018-07-20 10:12:38 -07:00
liyuqian
9f3465f4c3 Add ClipMode to ClipPath/ClipRRect and PhysicalShape layers (flutter/engine#5647)
For flutter/flutter#18057
2018-07-13 12:38:16 -07:00
Jonah Williams
6eab9d08be Remove cullRect calculation on TransformLayers with a perspective transform. (flutter/engine#5693) 2018-07-09 12:52:10 -07:00
Adam Barth
10e5400c52 [fuchsia] Update gn label for fuchsia.ui.scenic (flutter/engine#5673)
The gn label for this target changed.
2018-07-03 21:08:28 -07:00
mikejurka
0eac86cbd8 [fuchsia] Update scenic lib path. (flutter/engine#5649) 2018-06-29 17:24:47 -07:00
mikejurka
c0caf150a3 [fuchsia] Rename scenic_lib => scenic (flutter/engine#5648)
TEST=Compiled and ran flutter app on Fuchsia, verified it rendered and responded to input.
2018-06-29 17:06:55 -07:00
liyuqian
a4a4fc0cd4 Improve perf overlay performance. (flutter/engine#5571)
1. Mark perf overlay path as volatile
2. Set sample_margin_width = 0 to get a bar graph instead of saw-tooth.

Previously, the perf overlay itself could be a significant performance
hit and that makes it difficult to profile flutter app.
2018-06-19 16:42:21 -07:00
liyuqian
fe69e3eea1 Call SkAutoCanvasRestore with doSave = true (flutter/engine#5432)
Although we do have a save before this SkAutoCanvasRestore so we
can theoretically send in doSave = false, it's safer to set doSave
to true to prevent future breakage.

As discussed with mtklein@google.com and reed@google.com, saving
canvas is very cheap in Skia so this should have no performance
impact. Skia is also considering remove doSave argument from
SkAutoCanvasRestore and always save the canvas.
2018-05-31 16:41:58 -07:00
cary-clark
937d250db6 call existing ostream operator for SkMatrix (flutter/engine#5427)
This permits removing the call to SkMatrix::toString(), which is deprecated.
2018-05-31 09:55:57 -04:00
liyuqian
949ece5d45 Remove unnecessary saveLayer (flutter/engine#5420)
saveLayer is slow so we should avoid it as much as possible. If
there are artifacts without saveLayer, then we should report that
to Skia for the fix instead of slowing the performance with
saveLayer.

This PQ makes average rasterizer time drop from 25ms to 18ms in
flutter_gallery transitions perf test on a Nexus 5X.

This partially fixes flutter/flutter#13736 .
We probably still need some work in the opacity layer to squize
all the performance improvements.
2018-05-30 12:50:12 -07:00
liyuqian
4537391c78 Use drawImage for picture layer cache (flutter/engine#5315)
Fixes
1. https://github.com/flutter/flutter/issues/12148
2. most part of https://github.com/flutter/flutter/issues/17731 except some tiny AA diffs.
2018-05-23 16:53:20 -07:00
P.Y. Laligand
a133efee8f [fuchsia] Use the real name for the GFX library... (flutter/engine#5346) 2018-05-23 12:09:23 -07:00
P.Y. Laligand
2d104dae40 [fuchsia] Updated references to the gfx FIDL library. (flutter/engine#5341) 2018-05-23 10:25:33 -07:00
cary-clark
0e82a0b583 remove Skia toString() use (flutter/engine#5326)
Skia toString() is not maintained; the debugger that used it has been replaced. 
Replace usage with equivalent implementation.
2018-05-21 09:04:51 -04:00
Todd Volkert
300f7fa815 Clear the raster cache result when bypassing raster cache. (flutter/engine#5300)
https://github.com/flutter/flutter/issues/17448
2018-05-17 23:50:07 -07:00