1. 18 10月, 2019 3 次提交
  2. 16 10月, 2019 1 次提交
    • C
      Allow embedders to specify a render task runner description. (#13124) · bf81971f
      Chinmay Garde 提交于
      Embedders may use this to specify a thread whose event loop is managed by them
      instead of the engine. In addition, specifying the same task runner for both
      the platform and render task runners allows embedders to effectively perform
      GPU rendering operations on the platform thread.
      
      To affect this change, the following non breaking changes to the API have been
      made:
      
      * The `FlutterCustomTaskRunners` struct now has a new field `render_task_runner`
        for the specification of a custom render task runner.
      * The `FlutterTaskRunnerDescription` has a new field `identifier`. Embedders
        must supply a unique identifier for each task runner they specify. In
        addition, when describing multiple task runners that run their tasks on the
        same thread, their identifiers must match.
      * The embedder may need to process tasks during `FlutterEngineRun` and
        `FlutterEngineShutdown`. However, the embedder doesn't have the Flutter engine
        handle before `FlutterEngineRun` and is supposed to relinquish handle right
        before `FlutterEngineShutdown`. Since the embedder needs the Flutter engine
        handle to service tasks on other threads while these calls are underway,
        there exist opportunities for deadlock. To work around this scenario, three
        new calls have been added that allow more deliberate management of the Flutter
        engine instance.
        * `FlutterEngineRun` can be replaced with `FlutterEngineInitialize` and
          `FlutterEngineRunInitialized`. The embedder can obtain a handle to the
          engine after the first call but the engine will not post any tasks to custom
          task runners specified by the embedder till the
          `FlutterEngineRunInitialized` call. Embedders can guard the Flutter engine
          handle behind a mutex for safe task runner interop.
        * `FlutterEngineShutdown` can be preceded by the `FlutterEngineDeinitialize`
          call. After this call the Flutter engine will no longer post tasks onto
          embedder managed task runners. It is still embedder responsibility to
          collect the Flutter engine handle via `FlutterEngineShutdown`.
      * To maintain backwards compatibility with the old APIs, `FlutterEngineRun` is
        now just a convenience for `FlutterEngineInitialize` and
        `FlutterEngineRunInitilaized`. `FlutterEngineShutdown` now implicitly calls
        `FlutterEngineDeinitialize` as well. This allows existing users who don't care
        are custom task runner interop to keep using the old APIs.
      * Adds complete test coverage for both old and new paths.
      
      Fixes https://github.com/flutter/flutter/issues/42460
      Prerequisite for https://github.com/flutter/flutter/issues/17579
      bf81971f
  3. 09 10月, 2019 1 次提交
    • C
      Add a unit-test to verify that root surface transformation affect platform... · 03d1bba6
      Chinmay Garde 提交于
      Add a unit-test to verify that root surface transformation affect platform view coordinates. (#12783)
      
      See b/141980393 for details.
      
      In the issue, the embedder (assumed to render Flutter contents of size 800 x 600 [1]) is meant to be displayed on its side. To achieve this, it specifies a root surface transformation that translates the surface by its width (or height when it held in the correct viewing position) and then rotates it counter-clockwise by 90 degrees. This test verifies that the Flutter Engine accounts for those transformations in the custom compositor platform view coodinates.
      
      [1] The actual size is something different. 800x600 is for illustrative purposes.
      03d1bba6
  4. 05 10月, 2019 1 次提交
  5. 28 9月, 2019 1 次提交
  6. 26 9月, 2019 1 次提交
    • D
      [fuchsia] Wire up OpacityLayer to Scenic (#11322) · fcc4ab32
      David Worsham 提交于
      On Fuchsia, add a build flag for compositing OpacityLayers using the system
      compositor vs Skia, which exposes a fastpath for opacity via Scenic.
      This will only work under certain circumstances, in particular nested
      OpacityLayers will not render correctly!
      
      On Fuchsia, add a build flag for compositing PhysicalShapeLayers using
      the system compositor vs Skia. Set to off by default, which restores
      performant shadows on Fuchsia.
      
      Remove the opacity exposed from ChildView, as that was added mistakenly.
      
      Finally, we centralize the logic for switching between the
      system-composited and in-process-composited paths inside of
      ContainerLayer. We also centralize the logic for computing elevation
      there. This allows the removal of many OS_FUCHSIA-specific code-paths.
      
      Test: Ran workstation on Fuchsia; benchmarked before and after
      Bug: 23711
      Bug: 24163
      
      * Fix broken tests
      fcc4ab32
  7. 24 9月, 2019 1 次提交
  8. 18 9月, 2019 2 次提交
    • C
      Account for root surface transformation on the surfaces managed by the... · 1c7300ed
      Chinmay Garde 提交于
      Account for root surface transformation on the surfaces managed by the external view embedder. (#11384)
      
      The earlier design speculated that embedders could affect the same
      transformations on the layers post engine compositor presentation but before
      final composition.
      
      However, the linked issue points out that this design is not suitable for use
      with hardware overlay planes. When rendering to the same, to affect the
      transformation before composition, embedders would have to render to an
      off-screen render target and then apply the transformation before presentation.
      This patch negates the need for that off-screen render pass.
      
      To be clear, the previous architecture is still fully viable. Embedders still
      have full control over layer transformations before composition. This is an
      optimization for the hardware overlay planes use-case.
      
      Fixes b/139758641
      1c7300ed
    • C
      Shuffle test order and repeat test runs once. (#12275) · b4d81583
      Chinmay Garde 提交于
      The tests we write must be resilient to the order in which they are run in the
      harness. That is, they must not rely on global state set by other tests that
      have already run in the process. Also, these tests must themselves be
      repeatable. That is, they must correctly clean up after themselves and be able
      to run successfully again in the same process.
      
      This patch adds some safeguards against (but does NOT guarantee) the addition of
      tests that violate the dictum.
      
      Additionally, test failures must be easily reproducible for folks investigating
      the test failure. Also, tests that assert correctness of unrelated code must not
      stop progress on the authors patch.
      
      This changes does not hinder reproducibility of test failures because the random
      seed is printed in the logs before running each test. Developers attempting to
      reproduce the failure locally can do the same via the following invocation
      `--gtest_shuffle --gtest_repeat=<the count> --gtest_random_seed=<seed from failing run>`.
      
      This change does introduce potential burden on patch authors that may see
      failures in unrelated code as a newly failing shuffle seed is used on their
      runs. To ameliorate this, we will formulate guidance for them to aggressively
      mark such tests as disabled and file bugs to enable the same.
      
      The test seed is intentionally kept low because it’s purpose is to test that
      individual tests are repeatable. It must not be used as a replacement for
      fuzzing.
      b4d81583
  9. 27 8月, 2019 1 次提交
    • A
      Skip empty platform view overlays. (#11427) · a34f9a81
      Amir Hardon 提交于
      This change sets up a "spying canvas" to try and detect empty canvases.
      When using platform views with a custom embedder, if a platform view
      overlay canvas is known to be empty we skip creating a compositor layer
      for that overlay.
      a34f9a81
  10. 24 8月, 2019 2 次提交
  11. 23 8月, 2019 1 次提交
  12. 22 8月, 2019 1 次提交
  13. 21 8月, 2019 2 次提交
  14. 20 8月, 2019 1 次提交
  15. 14 8月, 2019 1 次提交
    • C
      Allow embedder controlled composition of Flutter layers. (#10195) · e8f95440
      Chinmay Garde 提交于
      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
      e8f95440
  16. 09 8月, 2019 1 次提交
  17. 07 8月, 2019 1 次提交
    • C
      Allow embedders to control Dart VM lifecycle on engine shutdown. (#10652) · b769353c
      Chinmay Garde 提交于
      This exposes the `Settings::leak_vm` flag to custom embedders. All embedder
      unit-tests now shut down the VM on the shutdown of the last engine in the
      process. The mechanics of VM shutdown are already tested in the Shell unit-tests
      harness in the DartLifecycleUnittests set of of assertions. This just exposes
      that functionality to custom embedders. Since it is part of the public stable
      API, I also switched the name of the field to be something less snarky than the
      field in private shell settings.
      b769353c
  18. 17 7月, 2019 1 次提交
  19. 07 7月, 2019 1 次提交
  20. 04 7月, 2019 1 次提交
  21. 18 6月, 2019 1 次提交
  22. 13 6月, 2019 1 次提交
    • C
      Wire up Swiftshader based OpenGL ES unit-tests on hosts. (#9264) · 7bb5b9ae
      Chinmay Garde 提交于
      Currently, all our host unit-tests that have rendering concerns use the software backend because of OpenGL ES availability and stability issues on the various platforms where we run host tests. Unfortunately, entire subsystems are disabled (and not tested) when rendering with the software backend. This patch pulls in SwiftShader and via pending patches in the buildroot, configures the host unit-tests to optionally use OpenGL ES in a stable manner without relying on the OpenGL drivers being present (and functional).
      
      I have wired up the embedder test fixture in this patch to use the SwiftShader based OpenGL ES driver. I will update the shell and runtime unittests in a subsequent patch as well. The on and offscreen surfaces are configured as 1x1 pbuffer surface because we should be able to write pixel tests using OpenGL directly wihout having to deal with surfaces.
      7bb5b9ae
  23. 26 5月, 2019 1 次提交
  24. 10 4月, 2019 1 次提交
  25. 29 3月, 2019 1 次提交
  26. 28 3月, 2019 2 次提交
  27. 27 3月, 2019 3 次提交
  28. 26 3月, 2019 2 次提交
    • C
      Migrate existing embedder unit tests to use the fixture. (#8296) · 22ee8ee0
      Chinmay Garde 提交于
      Also allows tests to specify their own embedder contexts.
      22ee8ee0
    • C
      Make it easy to write embedder unit tests by creating a fixture and config builder. (#8276) · d6ead18f
      Chinmay Garde 提交于
      All embedder unit-tests have to setup the Flutter project arguments from scratch
      before launching the engine. The boilerplate and having to deal with the low
      level C API during each engine launch is a hinderance to writing tests.
      
      This patch introduces an EmbedderTest fixture that sets up all the embedder side snapshots before allowing the unit test to create a FlutterConfigBuilder` that
      the test can use to incrementally build and edit the Flutter project
      configuration. From the given state state of a configuration, multiple engines
      can be launched with their lifecylces managed by appropriate RAII wrappers.
      
      This allows the a fully configured Flutter engine to be launched using 4 lines
      of code in a fixture.
      
      ```
      EmbedderConfigBuilder builder;
      builder.SetSoftwareRendererConfig();
      builder.SetAssetsPathFromFixture(this);
      builder.SetSnapshotsFromFixture(this);
      auto engine = builder.LaunchEngine();
      ```
      d6ead18f
  29. 16 2月, 2019 1 次提交
  30. 07 2月, 2019 1 次提交
    • C
      Add FlutterProjectArgs::root_isolate_create_callback (#7651) · ce073991
      Chris Bracken 提交于
      Allows embedders to specify a callback to be invoked in isolate scope
      once root isolate has been created and marked runnable.
      
      As an example of where this is useful, embedder unit test fixtures may
      want to include Dart functions backed by a native implementation. On
      isolate creation, this patch allows the unit test author to call
      Dart_SetNativeResolver in root isolate scope.
      ce073991
  31. 30 1月, 2019 1 次提交
    • S
      Rename FlutterResult in embedder.h (#7567) · 474d8837
      stuartmorgan 提交于
      FlutterResult is also the name of a class in the Objective-C API
      surface, which is problematic when building a framework that contains
      both (such as a macOS implementation of the Flutter framework).
      474d8837