417 Commits

Author SHA1 Message Date
Jim Graham
3953882fbb Fix child caching in opacity_layer (flutter/engine#17914)
Choose a child more likely to remain stable from frame to frame as the target to cache in the OpacityLayer.
2020-05-28 18:45:43 -07:00
Kaushik Iska
eaa27c483b [fuchsia] Disable failing physical shape layer tests (flutter/engine#18308)
See: fxb/52028
2020-05-12 12:34:21 -07:00
liyuqian
e91baef192 Restore integer snapping on OpacityLayer (flutter/engine#18255)
This fixes https://github.com/flutter/flutter/issues/56722
2020-05-09 11:29:37 -07:00
liyuqian
b50499d50d Reland again "Remove layer integral offset snapping #17112" (flutter/engine#18160)
This reverts commit 74823c212d418597775d332d8c272673c83f6f63 and relands our reland https://github.com/flutter/engine/pull/17915.

Additionally, we fixed the cull rect logic in `OpacityLayer::Preroll` which is  the root cause of https://github.com/flutter/flutter/issues/56298. We've always had that root problem before but it did not trigger performance issues because we were using the OpacityLayer's `paint_bounds`, instead of its child's `paint_bounds` for preparing the layer raster cache. A correct handling of the cull rect should allow us to cull at any level.

It also turns out that our ios32 (iPhone4s) performacne can regress a lot
without snapping. My theory is that although the picture has a
fractional top left corner, many drawing operations inside the picture
have integral coordinations. In older hardwares, keeping those
coordinates integral seems to be performance critical.

To avoid flutter/flutter#41654, the snapping
will still be disabled if the matrix has non-scale-translation
transformations.
2020-05-07 17:19:30 -07:00
Dragoș Tiselice
4271b2a33e Fixed ChildSceneLayer elevation issue on Fuchsia. (flutter/engine#18144)
* Fixed ChildSceneLayer elevation issue on Fuchsia.

ChildSceneLayers would draw on top of stacked Flutter content on
Fuchsia if not wrapped up in a Material widget, i.e. a
PhysicalShapeLayer. This patch pushes the logic from there to all
types of Layers.
2020-05-07 12:03:53 -04:00
liyuqian
74823c212d Revert again "Remove layer integral offset snapping" (flutter/engine#18132) 2020-05-04 16:39:03 -07:00
liyuqian
0e1cdfdcf5 Reland "Remove layer integral offset snapping" (flutter/engine#17915)
This reverts commit c72ff4a and relands #17712.

Fixes flutter/flutter#53288 and flutter/flutter#41654.

Together with #17791, this reland addresses some of Jim's concerns in the original PR #17712.

The major part of this PR is still the same as the original PR, and the performance / golden image impacts should be the same.
2020-05-01 15:01:42 -07:00
liyuqian
452b98622a Replace RasterCache::Get with RasterCache:Draw (flutter/engine#17791)
This avoids the possible matrix mismatch between RasterCache::Get and
RasterCacheResult::draw. See
https://github.com/flutter/engine/pull/17790 for an example that tries
to fix an earlier mismatch.
2020-04-23 12:12:06 -07:00
Emmanuel Garcia
c6f023fe75 Extend external view embedder on Android (flutter/engine#17839) 2020-04-21 19:14:38 -07:00
liyuqian
c72ff4abc5 Revert "Remove layer integral offset snapping (#17712)" (flutter/engine#17785)
This reverts commit 5449a14ac2f3056e31ed8679ee8bf004a354dea6.

I found some problems. Will revise and reland later, and put more details about the problems in the new PR.

TBR: @chinmaygarde @flar
2020-04-17 08:26:22 -07:00
liyuqian
5449a14ac2 Remove layer integral offset snapping (flutter/engine#17712)
This fixes https://github.com/flutter/flutter/issues/53288 and https://github.com/flutter/flutter/issues/41654. It removes the problematic `GetIntegralTransCTM`, but preserves the rect round-out in `RasterCacheResult::draw` for performance considerations: the average frame raster time doesn't change much but the worst frame raster time significantly regressed if rect round-out is removed. That's probably because a new shader needs to be compiled to draw raster cache with fractional offsets.
2020-04-16 15:41:07 -07:00
Brian Osman
adf41d060b Convert MatrixDecomposition from SkMatrix44 to SkM44 (flutter/engine#17760)
* Convert MatrixDecomposition from SkMatrix44 to SkM44

SkMatrix44 is deprecated and being removed.
2020-04-16 15:27:41 -04:00
Chris Yang
8500bd4156 Reland "Improve iOS PlatformViews to better handle thread merging. #16935" (flutter/engine#17609) 2020-04-10 13:25:02 -07:00
Chris Yang
efe45cd875 Revert "Improve iOS PlatformViews to better handle thread merging. (#16935)" (flutter/engine#17600)
This reverts commit 930696bbb75ffdb098df4081e0353f4fac38b075.
2020-04-08 21:15:38 -07:00
Chris Yang
930696bbb7 Improve iOS PlatformViews to better handle thread merging. (flutter/engine#16935) 2020-04-08 17:33:33 -07:00
Dan Field
904a84fee3 Roll to clang11, mark 4 (flutter/engine#17483)
* "Reland Clang 11, roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c, take 4 (#17467)" (#17482)"

This reverts commit d7bbf2e70c8cb86823f1ec7a310d6ab0b9a610db.

* format code

* Roll buildroot to 3a27de1c5bb0f50be7d3efe3e00de4f6068c9f30
2020-04-02 13:04:49 -07:00
Dan Field
d7bbf2e70c Revert "Reland Clang 11, roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c, take 3 (#17467)" (flutter/engine#17482)
This reverts commit 31eab31f771363d9c4fc9799449859abe0e464f2.
2020-04-02 10:01:26 -07:00
Dan Field
31eab31f77 Reland Clang 11, roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c, take 3 (flutter/engine#17467)
* Reland Clang 11, Roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c (#17457)" (#17464)

This reverts commit 6083cda709c194ec81d2092c70a0151a10f0c922.

* Skip more image tests, use newer dsymutil, add missing symbols
2020-04-01 20:55:27 -07:00
mikejurka
d133ffb5a8 [fuchsia] Add tests for TransformLayer. (flutter/engine#17439) 2020-04-01 20:01:52 -07:00
George Wright
9b4556331b Flush the session after updating the scene 2020-04-01 19:48:07 -07:00
Dan Field
6083cda709 Revert "Reland Clang 11, Roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c (#17457)" (flutter/engine#17464)
This reverts commit fe77c763691277d3194269f30d9a8c915e437852.
2020-04-01 17:50:57 -07:00
Dan Field
fe77c76369 Reland Clang 11, Roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c (flutter/engine#17457)
* Reland "Roll Clang to v11, roll buildroot to fe13f79dce4ce9aab3209f11988d825dcf580b4a, allow newly exported symbols (#17440)" (#17451)"

This reverts commit d77d53688f77285966adeb2a24349ba490a7e6ce.

* skip golden that is different on macos

* buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c
2020-04-01 16:32:13 -07:00
mikejurka
f434b2e6a8 [fuchsia] Fix bug when applying scale. (flutter/engine#17436)
We were always scaling z by 0, instead of 1. This
caused the z elevation of some layers to be 0,
which was incorrect.
2020-03-31 21:49:44 -07:00
mikejurka
9a7303b7ad [fuchsia] Re-enable shadows. (flutter/engine#17380)
Now that client apps use the same elevations on
Fuchsia and other platforms, shadows should look
identical.
2020-03-31 18:07:12 -07:00
liyuqian
b5318d05ff More rename from GPU thread to raster thread (flutter/engine#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
2656509ba5 Reland unobstructed platform views (flutter/engine#17336) 2020-03-27 16:39:29 -07:00
liyuqian
10824995dd Rename GPU thread to raster thread in code comments (flutter/engine#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
2913102440 Revert unobstructed platform views (flutter/engine#17326) 2020-03-25 14:36:10 -07:00
Jason Simmons
c2e581b781 Allow drawing raster cache results whose device rect is one pixel larger than the cached image (flutter/engine#17278)
RasterCacheResult::draw constructs the device target rectangle by
calling SkRect::roundOut, which rounds down the left/top coordinates
and rounds up the right/bottom coordinates.  The rounding can produce
a device rect whose width and/or height differs from the cache result
image's width/height by one pixel.
2020-03-25 13:37:27 -07:00
Kaushik Iska
60f620b4b2 [metrics] Record the frame target time on the layer tree (flutter/engine#17281)
This lets us measure stats on when the frame was
scheduled to be rendered vs when it finished rasterizing.

Note: This isn't propagated to the FrameTimings struct yet,
that is to be followed.
2020-03-24 22:00:21 -07:00
liyuqian
a7073893f4 Rename GPU to raster thread in PerformanceOverlay (flutter/engine#17148)
Rename GPU to raster thread in PerformanceOverlay and update goldens.
2020-03-24 21:43:16 -07:00
Chinmay Garde
929fb3f825 Remove checks for the always true using_fuchsia_sdk flag in all GN files. (flutter/engine#17261) 2020-03-23 18:31:02 -07:00
mikejurka
8bb493406e [Fuchsia] Move physical shape layer compositing to Flutter (flutter/engine#17005)
* [fuchsia] Add labels to Scenic nodes.

* [fuchsia] Skip creating Scenic nodes for identity Transforms.

* [fuchsia] Assign elevation to Scenic nodes based on paint order.

* [fuchsia] Create Scenic OpacityNodes at leaf nodes.

* [fuchsia] Composite PhysicalShapeLayers using Skia, except when they need to float above child views.

In that case, they will still need to be pulled
into separate Scenic nodes to be composited on top
of the child view[s].

* [fuchsia] Add tests for Fuchsia-specific layer behavior.

Inspect commands going to Scenic and make sure
they match what is expected.

Also, restructure code to need less member variables,
and other cleanups based on review feedback.
2020-03-23 16:38:07 -07:00
Chinmay Garde
44f93dddb7 Allow external texture sources when using the Metal backend. (flutter/engine#17154) 2020-03-22 22:36:03 -07:00
Emmanuel Garcia
fa2f49dbcb Reland: Implement unobstructed Platform Views on iOS (flutter/engine#17237) 2020-03-20 18:58:55 -07:00
Emmanuel Garcia
3c04f343d3 Revert "Implement unobstructed Platform Views on iOS (#17049)" (flutter/engine#17233)
This reverts commit a1f7b10dfac894be08bd6e8fa2a65063cb8b5277.
2020-03-20 14:46:09 -07:00
Emmanuel Garcia
a1f7b10dfa Implement unobstructed Platform Views on iOS (flutter/engine#17049) 2020-03-20 12:38:58 -07:00
Jim Graham
61cfe07919 Reland ImageFiltered bounds fix (flutter/engine#17077)
Fix for https://github.com/flutter/flutter/issues/51978 to use the bounds of the filtered result as the layer's paint bounds.
2020-03-13 14:44:27 -07:00
Chinmay Garde
8f5f888826 Use the standard [[nodiscard]] attribute instead of an FML macro. (flutter/engine#17100) 2020-03-11 13:36:01 -07:00
Chinmay Garde
6349c95def Implement asynchronous texture uploads when using the Metal backend on iOS. (flutter/engine#17046)
This moves the Metal `GrContext` creation utilities from `GPUSurfaceMetal` into
a separate `IOSContext` object subclass. An analogue of this object was used in
the GL regime for the management of onscreen and offscreen contexts that were
not tied to the lifecycle of the `GPUSurface`. This pattern has now been
generalized for use with all backends that need a resource context
(`IOSContextGL` and `IOContextMetal`).

The platform views controller management in the `ExternalViewEmbedder` interface
implementation was repeated three times for [Metal][metal], [OpenGL](opengl) and
[Software](software) rendering. This repetition has been removed and a single
implementation present in the base `IOSSurface` and used on all platforms.
Addition of new client rendering APIs should not affect how the engine renders
into the platform view interleaving levels.

All rendering API selection logic has been moved into a single set of utilities
in `rendering_api_selection.h`. This enables the removal of a lot of code blocks
guarded by `FLUTTER_SHELL_ENABLE_METAL`. The remaining uses of this will be
removed when unified builds are enabled.

The Metal backend now also adds traces similar to the GL backend.

The `IOGLContext` has been renamed to `IOContextGL` to be more in line with the
convention used in this library.

Fixes https://github.com/flutter/flutter/issues/41827
Adds https://github.com/flutter/flutter/issues/52150

[metal]: 46dbf3a761/shell/platform/darwin/ios/ios_surface_metal.mm (L55)
[opengl]: 46dbf3a761/shell/platform/darwin/ios/ios_surface_gl.mm (L95)
[software]: 46dbf3a761/shell/platform/darwin/ios/ios_surface_software.mm (L146)
2020-03-10 16:01:53 -07:00
Emmanuel Garcia
66e6a6de18 Add RTree to flow (flutter/engine#16923) 2020-03-10 15:47:17 -07:00
Jim Graham
4298c81041 Revert "Fix bounds of image_filter_layer (#16960)" (flutter/engine#17074)
This reverts commit 5f527ac3b3e91c15082cac9bb191fa4f2aa83fae.
2020-03-10 14:09:10 -07:00
Jim Graham
5f527ac3b3 Fix bounds of image_filter_layer (flutter/engine#16960) 2020-03-09 13:58:44 -07:00
Chris Bracken
88d9a5f43c Revert "Try rasterizing images and layers only once , even when their rasterization fails. Further enforce the same access threshold on layers as on Pictures. Previously layers would always be cached. The latter is a semantic change. (#16545)" (flutter/engine#16889)
This caused regression in several benchmarks, including:
animated_placeholder_perf. Regression tracked in
https://github.com/flutter/flutter/issues/51776.

This reverts commit ac4e9832c910a031bf2dfb36605edbc834397c2b.
2020-03-02 11:44:45 -08:00
Sebastian Jeltsch
ac4e9832c9 Try rasterizing images and layers only once, even when their rasterization fails. Further enforce the same access threshold on layers as on Pictures. Previously layers would always be cached. The latter is a semantic change. (flutter/engine#16545)
If Rasterization fails, i.e. image.is_valid() is false, the cache might try rasterizing the image again on the next frame. Not only is this wasteful put might also prevent other pictures to be cached within the current frame budget.
2020-02-28 12:13:22 -08:00
Sebastian Jeltsch
e7e1637bd9 Fix RasterCache LRU logic, opportunistic simplifications. (flutter/engine#16434)
RasterCache::Get() methods were not updating the RasterCache::Entry
access_count and used_this_frame fields, as is done in
RasterCache::Prepare(). This can result in onscreen images being evicted
from the cache as new entries are created (e.g. as new elements scroll
onscreen).
2020-02-06 13:15:51 -08:00
Chinmay Garde
c243987f16 Fix race in SkiaGPUObject unit-tests. (flutter/engine#16351)
There are two issues in the test as written:
* There is a race on the first check to dtor_task_queue_id which might be
  encountered if the calling thread is de-scheduled and the unref queue manages
  to collect the object before the end of the scope.
* Two threads were owning a shared object but we relied on the object to be
  collected on the unref queue.
2020-02-03 19:57:43 -08:00
Chinmay Garde
426c48aaac Remove all uses of the redundant flutter_root variable. (flutter/engine#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
Dan Field
62a99c60c5 the the fix (flutter/engine#15973) 2020-01-24 12:43:32 -08:00
David Worsham
ec3aedb2f2 Fix Opacity performance regression on Fuchsia (flutter/engine#15573)
* Add more profile markers

* Revert FuchsiaSystemCompistedLayer changes

* Re-add opacity w/o elevation changes

* Fix formatting
2020-01-16 15:28:48 -08:00