205 Commits

Author SHA1 Message Date
Dan Field
4edf156fd4 update sim script (flutter/engine#11355) 2019-08-21 13:10:34 -07:00
Dan Field
8bc66b6451 Firebase test for Platform Views on iOS (flutter/engine#11350) 2019-08-21 12:48:39 -07:00
Chinmay Garde
9326ee2551 Reference the Flutter framework instead of the dylib in iOS tests. (flutter/engine#11337) 2019-08-21 00:04:01 -07:00
Dan Field
5e6117503b Add tests for platform views (flutter/engine#11319) 2019-08-20 20:48:40 -07:00
liyuqian
226c44ba3c Add a BroadcastStream to FrameTiming (flutter/engine#11041)
Without this, developers have to override `onReportTimings` to listen for `FrameTiming`.
That can potentially break previous `onReportTimings` listeners if they forget to call
the old listener in their new callback.

This PR replaces the similar RP in the framework: https://github.com/flutter/flutter/pull/38574

Once this PR landed, we'll have to create another framework PR to use the stream to replace
`onReportTimings` usages.

Once that's done, we can then propose the breaking change of removing the deprecated
`onReportTimings`.
2019-08-19 10:52:16 -07:00
Michael Klimushyn
ca63162ed9 Minor update to the Robolectric test harness (flutter/engine#11067)
Make sure that any `android.util.Log`s during the tests are reported to
stdout.
2019-08-16 16:25:59 -07:00
Shi-Hao Hong
cb707fb34a Pass Android Q insets.systemGestureInsets to Window (flutter/engine#10413)
* Pass Android Q system gesture inset information from insets.systemGestureInsets to Window.systemGestureInsets
2019-08-16 13:42:56 -04:00
liyuqian
3a94682272 Hide verbose dart snapshot during run_test.py (flutter/engine#11040)
Without this change, a single dart test will print out 306 lines.
With this change, a single dart test will only print out 33 lines.
This helps a lot in local tests.

In order to return to the old logging, set `--verbose-dart-snapshot` flag.
2019-08-15 16:40:30 -07:00
Matt Carroll
b4d4a675d4 Re-lands platform brightness support on iOS, plus platform contrast (flutter/engine#10791) 2019-08-15 14:51:07 -07:00
Dan Field
8faa7a1b1c remove OS version (flutter/engine#11033) 2019-08-15 13:42:19 -07:00
Dan Field
866785b74f Add script for running ios Tests on simulator (flutter/engine#10999) 2019-08-14 12:43:33 -07:00
Dan Field
16c2058bf2 Add isDisplayingFlutterUI to FlutterViewController (flutter/engine#10816) 2019-08-14 09:10:22 -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
Dan Field
4ea3a6b031 Expose isolateId for engine (flutter/engine#10823) 2019-08-12 21:20:59 -07:00
Michael Klimushyn
7f6d60a1b4 Report JUnit test failures (flutter/engine#10941)
Previously this script was not reporting any JUNit failures and somehow
ended up included a non-existent jar for Java tests to test against.

It looks like one of the JUnit tests is now failing. Disabling it for
now to turn on CI again as soon as possible, will fix and enable it in a
follow up.
2019-08-12 12:17:15 -07:00
Dan Field
2932cf866c iOS JIT support and enhancements for scenarios app (flutter/engine#10820)
* Make the scripts runnable from any directory

* Add JIT script for iOS
2019-08-12 09:10:12 -07:00
Dan Field
ffa6d11b86 Make firebase test more LUCI friendly (flutter/engine#10783) 2019-08-08 21:47:24 -07:00
Chinmay Garde
158315caf9 Revert "Forwards iOS dark mode trait to the Flutter framework (#34441). (#9722)" (flutter/engine#10789)
This reverts commit 51904fc4bda988cb0719fcf19efada85d844fc86.
2019-08-08 17:15:06 -07:00
Matt Carroll
51904fc4bd Forwards iOS dark mode trait to the Flutter framework (#34441). (flutter/engine#9722) 2019-08-08 16:22:45 -07:00
Dan Field
ea073bcba4 Specify which android variant for tests (flutter/engine#10717) 2019-08-08 16:16:51 -07:00
liyuqian
cff01c0265 Revert "Remove semi-redundant try-jobs. (#10485)" (flutter/engine#10705)
This reverts commit 365251a0149d6a82894d3798604694369018916e.

Our infra should be capable to run all those deleted tests as now we've throttled the Fuchsia auto-rollers.

The current throttle is 1 PR / 3 hours for the 4 rollers:
- https://cs.corp.google.com/skia/buildbot/autoroll/config/fuchsia-mac-toolchain-flutter-engine.json?l=53
- https://cs.corp.google.com/skia/buildbot/autoroll/config/fuchsia-mac-sdk-flutter-engine.json?g=0&l=53
- https://cs.corp.google.com/skia/buildbot/autoroll/config/fuchsia-linux-toolchain-flutter-engine.json?g=0&l=56
- https://cs.corp.google.com/skia/buildbot/autoroll/config/fuchsia-linux-sdk-flutter-engine.json?g=0&l=56

We're changing them to 1 PR / 12 hours: http://skbug.com/9322
2019-08-07 16:21:41 -07:00
Dan Field
993c8e1bb1 Test perf overlay gold on Linux (flutter/engine#10703) 2019-08-07 13:47:00 -07:00
Shi-Hao Hong
c5a2f30915 Rolls engine to Android SDK 29 and its corresponding tools (flutter/engine#10692)
* Rolls engine to Android SDK 29 and its corresponding tools

* Update from android-28 to android-29 in relevant files

* Roll buildroot to tip of tree
2019-08-07 12:34:33 -04:00
Chinmay Garde
365251a014 Remove semi-redundant try-jobs. (flutter/engine#10485)
We are severely resource constrained on the tryjobs. This is hindering progress on ToT due to scheduling failures and rate limits. There are no plans to requisition more resources in this infra scheme as the migration to tryjobs on LUCI is the preferred way forward. This patch removes presubmits that are somewhat redundant. Each removed presubmit and the justification is given below:

* `build_and_test_linux_opt_release`: The AOT variant is tested by `build_and_test_linux_opt_profile` (actually its replacement, see the next point).
* `build_and_test_linux_opt_profile`: When we build the host profile variant for Android, we test it as well instead of building the extra variant (since we already need a host for a target build).
* `build_and_test_android_unopt_debug`: `gen_javadoc` have been moved to the profile variant. `Roboelectric` tests have been moved to profile variant. JIT infra will be tested by the the host tests.
* ToT framework checks: These will be performed (by the autoroller)[https://autoroll.skia.org/r/flutter-engine-flutter-autoroll?tab=status] which also has a sheriff rotation. This will also avoid us having to ignore red presubmits on manual changes.

Everything else is left as-is. To be clear, this causes strictly less checks to be performed on each commit.
2019-08-06 16:16:06 -07:00
Chinmay Garde
56e9d84de1 Document the thread test fixture. (flutter/engine#10637) 2019-08-05 13:51:56 -07:00
Dan Field
5a9ac6e780 expose max depth on Window (flutter/engine#10414) 2019-08-02 20:37:24 -07:00
Matt Carroll
e1e57a2d94 Android Embedding PR37: Separated FlutterActivity and FlutterFragment via FlutterActivityAndFragmentDelegate (flutter/engine#9895) 2019-07-29 17:40:25 -07:00
Dan Field
0d0471363f test scenario_app on CI (flutter/engine#10065) 2019-07-26 15:59:18 -07:00
gaaclarke
5c1f986232 Removed unnecessary call to find the App.framework. (flutter/engine#10178) 2019-07-26 12:17:22 -07:00
gaaclarke
24896f9029 Added integration test that tests that the first frame callback is called (flutter/engine#10145) 2019-07-26 10:33:24 -07:00
gaaclarke
02079b9a5d Started linking the test targets against Flutter. (flutter/engine#10128)
I tried to get this in quick without tests to avoid future
conflicts and wasted time reimplementing the same thing.
2019-07-25 13:41:16 -07:00
Dan Field
c39c231938 Embedding testing app (flutter/engine#10007) 2019-07-23 12:41:03 -07:00
Michael Klimushyn
603d401fc2 Add working Robolectric tests (flutter/engine#9954)
`gclient sync` now grabs Robolectric, JUnit, and their transitive
runtime dependencies. They're being stored in a new CIPD package,
`flutter/android/robolectric_bundle`.

`shell/platform/android/BUILD.gn` has a new target for building the
tests, `robolectric_tests`. `testing/run_tests.py` has been extended to
build and run the new target. Runs the android tests under
"build_and_test_android" on CI.

This also adds some very simple sample tests to start with and a README
to the java tests directory.
2019-07-23 09:06:19 -07:00
Jason Simmons
1f5ed069f2 Fix return type of assert function in gradient_test (flutter/engine#9961) 2019-07-19 18:55:48 -07:00
Jason Simmons
ed05de091d Update Dart engine tests to check for assertion failures only when running in debug mode (flutter/engine#9959) 2019-07-19 18:27:16 -07:00
Jason Simmons
2edaa8c49f Updates to the engine test runner script (flutter/engine#9934)
* Use separate filters for engine executables and Dart test scripts
* Do not run the benchmarks on Cirrus
2019-07-19 17:00:18 -07:00
Jason Simmons
c3ae67ae59 Fix the geometry test to reflect that OffsetBase comparison operators are a partial ordering (flutter/engine#9925) 2019-07-19 12:59:27 -07:00
gaaclarke
e7720142ef Removed logic from FlutterAppDelegate into FlutterPluginAppLifeCycleDelegate (flutter/engine#9893)
Removed logic from FlutterAppDelegate into
FlutterPluginAppLifeCycleDelegate.  This is a better place for
add-to-app since it doesn't require them to use our app delegate.
2019-07-19 10:58:39 -07:00
Jason Simmons
34fe51a9a4 Update the exception thrown for invalid data in the codec test (flutter/engine#9929) 2019-07-18 15:54:32 -07:00
Jason Simmons
51518af101 Fix failure of the onReportTimings window hook test (flutter/engine#9923) 2019-07-18 14:42:33 -07:00
Chinmay Garde
9e2a61b90c Selectively enable tests that work on Windows and file issues for ones that don't. (flutter/engine#9852)
This is in preparation for the  tryjobs to run these tests. The LUCI harness will also be updated so that the tests to run are specified in the repo instead of the recipe.
2019-07-16 13:30:57 -07:00
Chinmay Garde
3b5b7b2fc3 Convert run_tests to python, allow running on Mac/Windows and allow filters for tests. (flutter/engine#9818)
Sample usage:

To run only the embedder_unittests in the engine with the profile variant, the command would be
```
./flutter/testing/run_tests.py --variant host_profile_unopt --type engine --filter embedder_unittests
``

To run only the geometry in Dart with the debug variant, the command would be
```
./flutter/testing/run_tests.py --variant host_debug_unopt --type dart --filter geometry_test
``

Without any argument, the behavior is identical to `run_tests.sh`.

In a subsequent patch, I will enable running unit-tests on Windows in the tryjobs. The lack of compatibility of the shell script on Windows made it so that we never ran any Windows unit-tests in the tryjobs.
2019-07-15 17:46:36 -07:00
gaaclarke
fd3dac0f58 Made Picture::toImage happen on the IO thread with no need for an onscreen surface. (flutter/engine#9813)
Made Picture::toImage happen on the IO thread with no need for a surface.
2019-07-15 17:16:20 -07:00
Dan Field
7e9ccecf47 Remove breaking asserts (flutter/engine#9797) 2019-07-11 16:46:54 -07:00
gaaclarke
5b09d678cf Un-deprecated FlutterViewController's binaryMessenger. (flutter/engine#9767)
Un-deprecated FlutterViewController's binaryMessenger.  Leaving it as
a valid convenience method and to help minimize a breaking change.
2019-07-11 10:04:26 -07:00
Chinmay Garde
f33b8a805a Make all shell unit tests use the OpenGL rasterizer. (flutter/engine#9746)
The software backend was used earlier.
2019-07-10 13:47:56 -07:00
Dan Field
e38fb755f3 Let pushColorFilter accept all types of ColorFilters (flutter/engine#9641) 2019-07-10 12:06:58 -07:00
Chinmay Garde
a5799c0964 Rework image & texture management to use concurrent message queues. (flutter/engine#9486)
This patch reworks image decompression and collection in the following ways
because of misbehavior in the described edge cases.

The current flow for realizing a texture on the GPU from a blob of compressed
bytes is to first pass it to the IO thread for image decompression and then
upload to the GPU. The handle to the texture on the GPU is then passed back to
the UI thread so that it can be included in subsequent layer trees for
rendering. The GPU contexts on the Render & IO threads are in the same
sharegroup so the texture ends up being visible to the Render Thread context
during rendering. This works fine and does not block the UI thread. All
references to the image are owned on UI thread by Dart objects. When the final
reference to the image is dropped, the texture cannot be collected on the UI
thread (because it has not GPU context). Instead, it must be passed to either
the GPU or IO threads. The GPU thread is usually in the middle of a frame
workload so we redirect the same to the IO thread for eventual collection. While
texture collections are usually (comparatively) fast, texture decompression and
upload are slow (order of magnitude of frame intervals).

For application that end up creating (by not necessarily using) numerous large
textures in straight-line execution, it could be the case that texture
collection tasks are pending on the IO task runner after all the image
decompressions (and upload) are done. Put simply, the collection of the first
image could be waiting for the decompression and upload of the last image in the
queue.

This is exacerbated by two other hacks added to workaround unrelated issues.
* First, creating a codec with a single image frame immediately kicks of
  decompression and upload of that frame image (even if the frame was never
  request from the codec). This hack was added because we wanted to get rid of
  the compressed image allocation ASAP. The expectation was codecs would only be
  created with the sole purpose of getting the decompressed image bytes.
  However, for applications that only create codecs to get image sizes (but
  never actually decompress the same), we would end up replacing the compressed
  image allocation with a larger allocation (device resident no less) for no
  obvious use. This issue is particularly insidious when you consider that the
  codec is usually asked for the native image size first before the frame is
  requested at a smaller size (usually using a new codec with same data but new
  targetsize). This would cause the creation of a whole extra texture (at 1:1)
  when the caller was trying to “optimize” for memory use by requesting a
  texture of a smaller size.
* Second, all image collections we delayed in by the unref queue by 250ms
  because of observations that the calling thread (the UI thread) was being
  descheduled unnecessarily when a task with a timeout of zero was posted from
  the same (recall that a task has to be posted to the IO thread for the
  collection of that texture). 250ms is multiple frame intervals worth of
  potentially unnecessary textures.

The net result of these issues is that we may end up creating textures when all
that the application needs is to ask it’s codec for details about the same (but
not necessarily access its bytes). Texture collection could also be delayed
behind other jobs to decompress the textures on the IO thread. Also, all texture
collections are delayed for an arbitrary amount of time.

These issues cause applications to be susceptible to OOM situations. These
situations manifest in various ways. Host memory exhaustion causes the usual OOM
issues. Device memory exhaustion seems to manifest in different ways on iOS and
Android. On Android, allocation of a new texture seems to be causing an
assertion (in the driver). On iOS, the call hangs (presumably waiting for
another thread to release textures which we won’t do because those tasks are
blocked behind the current task completing).

To address peak memory usage, the following changes have been made:
* Image decompression and upload/collection no longer happen on the same thread.
  All image decompression will now be handled on a workqueue. The number of
  worker threads in this workqueue is equal to the number of processors on the
  device. These threads have a lower priority that either the UI or Render
  threads. These workers are shared between all Flutter applications in the
  process.
* Both the images and their codec now report the correct allocation size to Dart
  for GC purposes. The Dart VM uses this to pick objects for collection. Earlier
  the image allocation was assumed to 32bpp with no mipmapping overhead
  reported. Now, the correct image size is reported and the mipmapping overhead
  is accounted for. Image codec sizes were not reported to the VM earlier and
  now are. Expect “External” VM allocations to be higher than previously
  reported and the numbers in Observatory to line up more closely with actual
  memory usage (device and host).
* Decoding images to a specific size used to decode to 1:1 before performing a
  resize to the correct dimensions before texture upload. This has now been
  reworked so that images are first decompressed to a smaller size supported
  natively by the codec before final resizing to the requested target size. The
  intermediate copy is now smaller and more promptly collected. Resizing also
  happens on the workqueue worker.
* The drain interval of the unref queue is now sub-frame-interval. I am hesitant
  to remove the delay entirely because I have not been able to instrument the
  performance overhead of the same. That is next on my list. But now, multiple
  frame intervals worth of textures no longer stick around.

The following issues have been addressed:
* https://github.com/flutter/flutter/issues/34070 Since this was the first usage
  of the concurrent message loops, the number of idle wakes were determined to
  be too high and this component has been rewritten to be simpler and not use
  the existing task runner and MessageLoopImpl interface.
* Image decoding had no tests. The new `ui_unittests` harness has been added
  that sets up a GPU test harness on the host using SwiftShader. Tests have been
  added for image decompression, upload and resizing.
* The device memory exhaustion in this benchmark has been addressed. That
  benchmark is still not viable for inclusion in any harness however because it
  creates 9 million codecs in straight-line execution. Because these codecs are
  destroyed in the microtask callbacks, these are referenced till those
  callbacks are executed. So now, instead of device memory exhaustion, this will
  lead to (slower) exhaustion of host memory. This is expected and working as
  intended.

This patch only addresses peak memory use and makes collection of unused images
and textures more prompt. It does NOT address memory use by images referenced
strongly by the application or framework.
2019-07-09 14:59:34 -07:00
Dan Field
52ef4e6cbc Refactor ColorFilter to have a native wrapper (flutter/engine#9668) 2019-07-08 15:36:16 -07:00
Yegor
34839e477a Adds API for retaining intermediate engine layers (flutter/engine#9461)
Add new optional named oldLayer arguments to all push* methods of the SceneBuilder class.

When not null oldLayer signals to the engine that the intent is to update a layer rendered in a previous frame. The engine may optionally use that signal to reuse the resources allocated for that layer in the previous frame. For example, on the Web we can reuse existing DOM nodes and some of their properties and move fewer nodes around the tree.

The return type of each push method has been tightened up. Instead of having all methods return the same EngineLayer type, each method has its own unique layer type, e.g. OffsetEngineLayer. oldLayer parameters match the returned type. This prevents the framework (and other developers using dart:ui directly) from accidentally supplying an engine layer of the wrong type.
2019-06-28 12:56:03 -07:00