74 Commits

Author SHA1 Message Date
ColdPaleLight
d2640b977f Start consolidating the caches in RasterCache (flutter/engine#31492) 2022-02-17 13:54:11 -08:00
George Wright
a25be9e8d9 Add a DisplayListComplexityCalculator class that calculates the current "complexity score" of a given DisplayList during the Build phase. (flutter/engine#31176) 2022-02-01 21:40:35 -08:00
Chinmay Garde
942f2a979f Move display list to its own library. (flutter/engine#30398) 2021-12-20 17:14:01 -08:00
Jim Graham
46a8def326 Opacity peephole optimization (flutter/engine#29775) 2021-12-14 16:19:09 -08:00
Matej Knopp
66a708c874 Enable partial repaint for iOS/Metal (flutter/engine#28801) 2021-11-02 07:20:01 -07:00
Jim Graham
2e3ff9cc72 only report cache entries with images for RasterCache metrics (flutter/engine#29369) 2021-10-28 21:03:01 -07:00
Jim Graham
7d144cb994 add flow events to the timeline to track the lifecycle of cache images (flutter/engine#29298) 2021-10-25 13:03:01 -07:00
xxrl
df1529f94e Delay matrix call in Preroll of picture layer (flutter/engine#28380) 2021-09-14 23:22:03 -07:00
Jim Graham
10d49ea696 Add RasterCache metrics to the FrameTimings (flutter/engine#28439) 2021-09-03 16:26:01 -07:00
Jim Graham
967d492667 merge accounting of the (mutually exclusive) picture and dl cache entries in reported statistics (flutter/engine#28392) 2021-08-31 17:21:02 -07:00
Jim Graham
ce11db413a Implement a DisplayList mechanism similar to the Skia SkLiteDL mechanism (flutter/engine#26928) 2021-06-30 17:31:02 -07:00
Chris Bracken
9b4a0264d5 Correct typos throughout the engine/embedder (flutter/engine#25346)
Used the the `misspell` tool available at
https://github.com/client9/misspell, then applied hand-corrections. It's
possible we could adopt this as a presubmit, but there are still enough
false positives that it may not be worth the effort.
2021-04-01 11:08:19 -07:00
Dan Field
35d014eee7 Revert hint_freed (flutter/engine#20746)
This caused over-aggressive GCs, which vastly increased CPU usage benchmarks.

* Revert "fix build (#20644)"

This reverts commit 5e03f90cdd9392f95b47d08b398c18cab6d16b12.

* Revert "Hint freed (#19842)"

This reverts commit 73490a2ca444c8ca491712cde21a459453af8795.
2020-08-25 11:55:40 -07:00
Dan Field
73490a2ca4 Hint freed (flutter/engine#19842)
* Hint the VM when a layer or picture goes out of scope
2020-08-19 14:04:31 -07:00
Yuqian Li
4dec444c69 Add a service protocol for raster cache memory (flutter/engine#20466)
Related issue: https://github.com/flutter/flutter/issues/56719
2020-08-13 20:11:47 -07:00
Adlai Holler
bfd36563a7 Migrate a few last places to GrDirectContext (flutter/engine#20235)
* Migrate a few last places to GrDirectContext

This is a followup to #19962 to cover a few places where we
were still using GrContext. No functional impact.

* Formatting
2020-08-05 10:31:43 -07:00
Zachary Anderson
b7b32e51b4 Enable linting in several files (flutter/engine#20134) 2020-07-31 21:28:36 -07:00
Adlai Holler
e5614964f4 Use the GrDirectContext factories instead of deprecated GrContext ones (flutter/engine#19962)
This is part of a larger effort to expose the difference between GrDirectContext,
which runs on the GPU thread and can directly perform operations like uploading
textures, and GrRecordingContext, which can only queue up work to be delivered
to the GrDirectContext later.
2020-07-28 13:32:09 -07:00
David Worsham
919f8e6a42 Move fuchsia/scenic integration behind #define (flutter/engine#19003)
Additionally create "_next" permutations for all of the test binaries
on Fuchsia, in order to test both code-paths.

Using the #define follow-up CLs can also create a flutter_runner_next
binary that does not contain any legacy integration code.

BUG: 53847
2020-06-26 14:03:18 -07:00
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
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
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
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
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
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
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
liyuqian
27e4dac06b Rename flow namespace to flutter (flutter/engine#8615)
This follows our namespace change from shell to flutter: https://github.com/flutter/engine/pull/8520.
2019-04-17 14:38:45 -07:00
liyuqian
dedfd60b46 Rename threshold to access_threshold (flutter/engine#8354) 2019-03-28 14:37:00 -07:00
Chinmay Garde
0809280550 Reland ""Add support for trace counters with variable arguments and instrument the raster cache." (flutter/engine#8145)
This reverts commit da6e460c67c34d34eef1e9ec87b8534a379fe1f5 and fixes the
discovered on Windows builds.
2019-03-13 13:53:22 -07:00
Chinmay Garde
da6e460c67 Revert "Add support for trace counters with variable arguments and instrument the raster cache. (#8094)" (flutter/engine#8122)
This reverts commit 9f384e3e4cbfdf23381509a62c7023e77edcbfd8.
2019-03-11 15:09:24 -07:00
Chinmay Garde
9f384e3e4c Add support for trace counters with variable arguments and instrument the raster cache. (flutter/engine#8094) 2019-03-11 14:44:43 -07:00
liyuqian
6a320ce6ae Throttle picture raster cache (flutter/engine#7759)
This decreases worst_frame_rasterizer_time_millis from 30ms to 10ms when
we enabled picture raster cache in tiles_scroll (i.e., lower the
threshold from 10 to 5).
2019-02-08 17:40:38 -08:00
Michael Goderbauer
082336e7c2 Fix code smells reported by chrome's clang plugin (flutter/engine#6833) 2018-11-12 19:59:29 -08:00
Michael Goderbauer
0def82ddb0 Unify copyright lines (flutter/engine#6757) 2018-11-07 12:24:35 -08: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
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
Chinmay Garde
1fcba44904 Allow embedders to set the root surface transformation. (flutter/engine#6085) 2018-08-28 14:13:49 -07:00
Chinmay Garde
6ab2c166fd Remove all dependencies on Garnet. (flutter/engine#5869) 2018-07-26 12:49:34 -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
Chinmay Garde
82c5c8feda Re-land "Support multiple shells in a single process. (#4932)" (flutter/engine#4998)
* Re-land "Support multiple shells in a single process. (#4932)"

This reverts commit a9dd1abd80f9c5148c74d606302171fa260365ca.
2018-04-13 13:48:15 -07:00
Vyacheslav Egorov
a9dd1abd80 Revert "Re-land "Support multiple shells in a single process. (#4932)" (#4977)" (flutter/engine#4981)
This reverts commit e27940623b550f50fece0740ea3d6e9cb259fdae.
2018-04-12 18:28:55 +02:00
Chinmay Garde
e27940623b Re-land "Support multiple shells in a single process. (#4932)" (flutter/engine#4977)
This reverts commit a1befb4f3090141d738fc2b801e5454d96047121.
2018-04-11 15:41:23 -07:00