142 Commits

Author SHA1 Message Date
Emmanuel Garcia
5e54c707e8
Reland: Enable hybrid composition by default on Android (#20722) (#20864)
This reverts commit 4de62c7c2659607acdc75ab8c1ccd305a3c6f9d1.
2020-08-31 12:17:11 -07:00
Kaushik Iska
1892e031f2
[embedder] Add gl present callback that takes present info (#20672) 2020-08-26 15:53:01 -07:00
Emmanuel Garcia
4de62c7c26
Revert "Enable hybrid composition by default on Android (#20722)" (#20745)
This reverts commit d16ba48e1d79cf0197e96c51c38300ee921baeb0.
2020-08-25 09:54:13 -07:00
Emmanuel Garcia
d16ba48e1d
Enable hybrid composition by default on Android (#20722) 2020-08-24 13:10:23 -07:00
David Worsham
4dc866283d
fuchsia: Convert legacy permutations to build flag (#20647) 2020-08-19 19:09:51 -07:00
Kaushik Iska
26fe9125b5
[embedder] Add FBO callback that takes frame info (#20617) 2020-08-19 16:06:02 -07:00
Adlai Holler
c57aff1800
Use the GrDirectContext factories instead of deprecated GrContext ones (#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
gaaclarke
21efd7325e
Made the linter print out more information in its output and fixed bugs (#19895) 2020-07-22 15:38:09 -07:00
David Worsham
220a831028
Move fuchsia/scenic integration behind #define (#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
David Worsham
66d85bceb7
Move Surface and friends to flow/ (#18938) 2020-06-09 16:03:01 -07:00
Chris Yang
1482d9b05e
Rework GLContextSwitch, get rid of RendererContextManager (#18601) 2020-06-04 11:37:51 -07:00
Chris Yang
9ce1e5c5c7
Introduce TaskRunnerAffineWeakPtrFactory to generate TaskRunnerAffineWeakPtrs (#18346) 2020-05-19 16:36:17 -07:00
Chris Yang
c1068dec0c
gpu_metal_surface submitframe return false when canvas is null (#18154) 2020-05-05 17:59:16 -07:00
Chinmay Garde
e9f20601f1
Don't depend on an implicit transaction when presenting drawables on the raster thread. (#18076)
The way transactions were added changed in
68fd833488.
This broke rendering using both Metal and OpenGL when no implicit transaction
was present on the transaction stack. The failure models differ based on Metal
vs. OpenGL and iOS/device versions. On older versions of iOS, rendering would
consume memory till exhaustion. On newer iOS versions, rendering would be stuck
(till a timeout). This patch brings transaction management back in line with as
it was earlier and also makes the Metal backend resilient to transactions being
present on the transaction stack at all. Since this is still quite brittle,
transaction management must be moved to IOSSurface as a followup.

Fixes https://github.com/flutter/flutter/issues/55784.
2020-05-01 13:05:23 -07:00
Chris Yang
2622cb9c33
Introduce TaskRunnerChecker, TaskRunnerAffineWeakPtr (#17649) 2020-05-01 11:28:20 -07:00
liyuqian
b3075b3091
Rename GPU thread to raster thread in code comments (#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
Chinmay Garde
c0deb23612
Don’t depend on an implicit transaction when no external view embedder is present. (#17258)
All Metal layers have their presentsWithTransaction property set to true.
However, when an external view embedder is not present, there is no mechanism to
ensure that the command buffer commit is within transaction scope. This works in
most cases as there there is usually an implicit (possibly nested) transaction
in place during rendering. However, when there isn’t, rendering will look paused
at an incorrect size. This code now works similar to OpenGL but will be
refactored for ease of understanding and consistency between the various
backends.
2020-03-22 19:16:21 -07:00
Chinmay Garde
17e07c537e
Implement asynchronous texture uploads when using the Metal backend on iOS. (#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]: 1194ba2b21/shell/platform/darwin/ios/ios_surface_metal.mm (L55)
[opengl]: 1194ba2b21/shell/platform/darwin/ios/ios_surface_gl.mm (L95)
[software]: 1194ba2b21/shell/platform/darwin/ios/ios_surface_software.mm (L146)
2020-03-10 16:01:53 -07:00
George Wright
677b563b9a
Refactor of Vulkan GPUSurface code (#16224)
Co-authored-by: David Worsham <arbreng@gmail.com>
2020-02-04 10:44:35 -08:00
Chinmay Garde
f7b78e001d
Remove all uses of the redundant flutter_root variable. (#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
Jim Graham
85953615eb
Conditionally use offscreen root surface only when needed
Currently helps primarily on iOS when no BackdropFilter is present by lowering energy usage
2019-12-11 15:10:55 -08:00
liyuqian
84bf72917c
Revert PRs to unblock David and Jim's work (#14088)
* Revert "Add flow test fixtures and tests (#13986)"

This reverts commit 620f5281b819f304e8e9e945222e26b17b087cc3.

* Revert "Dynamically determine whether to use offscreen surface based on need (#13976)"

This reverts commit a86ef946563b020108320bbfb974bf7343284fd3.
2019-12-03 12:02:37 -08:00
Jim Graham
a86ef94656
Dynamically determine whether to use offscreen surface based on need (#13976)
Only use an offscreen surface on iOS if a layer which reads back from the destination surface, such as BackdropFilter, is present.
2019-11-27 15:01:25 -08:00
Chinmay Garde
5924eebd0c
Add virtual destructor to GPUSurfaceSoftwareDelegate. (#13918) 2019-11-19 10:15:34 -08:00
Todd Volkert
762294cf2d
Revert "RendererContextSwitch guard flutter's gl context rework. (#13812)" (#13906)
This reverts commit f456423cfb820d07bb36e9a8979e3d75cc9d8d76.

This is being reverted because it caused flutter/flutter#45098
(images don't load on iOS).
2019-11-18 18:28:04 -08:00
Chris Yang
f456423cfb
RendererContextSwitch guard flutter's gl context rework. (#13812) 2019-11-14 11:50:45 -08:00
Chris Yang
6d66993b1d
Revert "Reland "Guarding EAGLContext used by Flutter #13314" (#13759)" (#13788)
This reverts commit 2dcfaaeb5d3caee2bf7488e90abadf0456f43922.
2019-11-11 17:17:18 -08:00
Chris Yang
2dcfaaeb5d
Reland "Guarding EAGLContext used by Flutter #13314" (#13759) 2019-11-08 20:09:18 -08:00
Chris Yang
f5754357b6
Revert "Reland "Guarding EAGLContext used by Flutter #13314" (#13755)" (#13757)
This reverts commit 618e6666ced77bf497311876fbe968c6b9d72041.
2019-11-08 13:44:29 -08:00
Chris Yang
618e6666ce
Reland "Guarding EAGLContext used by Flutter #13314" (#13755) 2019-11-08 12:26:48 -08:00
Chris Yang
2036530c4d
Revert "Always use IOSGLContextSwitch to access EAGLContexts to prevent plugins from polluting Flutter's EAGLContext (#13314)" (#13753) 2019-11-08 10:59:45 -08:00
Chris Yang
bec554211b
Always use IOSGLContextSwitch to access EAGLContexts to prevent plugins from polluting Flutter's EAGLContext (#13314) 2019-11-08 10:02:23 -08:00
Chinmay Garde
7b968ff95f
Ensure that the CAMetalLayer FBO attachments can be read from. (#13643)
By default, the CAMetalLayer backing store is a framebuffer attachment that is
only optimized for display. However, effects such as backdrop filters require
renderbuffer readback. Making this calls will result in exceptions. Disable the
write only optimization on such backing store.

Fixes https://github.com/flutter/flutter/issues/43555
2019-11-04 17:28:51 -08:00
Chinmay Garde
4044876a78
Delay metal drawable acquisition till frame submission. (#13367)
Uses the new `SkSurface::MakeFromCAMetalLayer` Skia API.
2019-10-28 13:24:22 -07:00
liyuqian
139051fd58
Change IO thread shader cache strategy (#13121)
So it's the same with the GPU thread.

Otherwise, some shaders may be cached in binary on the IO thread, and we will lose them when we do the SkSL precompile.

For b/140174804
2019-10-14 13:05:05 -07:00
liyuqian
df0e911c67
SkSL precompile (#12412)
For https://github.com/flutter/flutter/issues/40686

Unit tests added:
- CacheSkSLWorks
- VisitFilesCanBeCalledTwice
- CanListFilesRecursively
2019-10-08 11:51:28 -07:00
Dan Field
66636eaded
Platform View implemenation for Metal (#11070) 2019-08-23 16:15:41 -07:00
Chinmay Garde
139a9a799c
Avoid root surface acquisition during custom composition with software renderer. (#11394)
Uses the same technique used during OpenGL composition to elide root surface access. The refactoring of this approach is tracked in https://github.com/flutter/flutter/issues/38466

Fixes https://github.com/flutter/flutter/issues/39009.
2019-08-23 13:52:06 -07:00
Chinmay Garde
e8f954409d
Allow embedder controlled composition of Flutter layers. (#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
960501721b
Reland Skia Caching improvements (#10434) 2019-08-02 19:31:57 -07:00
Dan Field
564f53f0a6
Revert "Improve caching limits for Skia (#9503)" (#9740)
This reverts commit 63c2c3316d667e7677782d10be57982dd4a7595c.
2019-07-10 12:09:42 -07:00
Dan Field
63c2c3316d
Improve caching limits for Skia (#9503) 2019-06-26 16:21:46 -07:00
Chinmay Garde
ece4f59377
Update Metal backend to account for Skia updates. (#9383)
Also makes it so that folks don't have to patch the buildroot manually when
building for Metal.
2019-06-19 15:24:26 -07:00
Zachary Anderson
0a2e28d797
Revert tracing changes (#9296)
* Revert "[fuchsia] Fix alignment of Fuchsia/non-Fuchsia tracing (#9289)"

This reverts commit f80ac5f571479053b134e60bca77603269b2ce2a.

* Revert "Align fuchsia and non-fuchsia tracing (#9199)"

This reverts commit 78265484623037c6544dfd5380367bca29fa27b0.
2019-06-12 10:25:49 -07:00
Dan Field
7826548462
Align fuchsia and non-fuchsia tracing (#9199) 2019-06-05 15:14:27 -07:00
Matthew Dempsky
3cdfa807fa Replace ararysize macro with fml::size function (#8975)
This is forward compatible with std::size and similar to how Chromium
removed use of the arraysize macro.
2019-05-15 12:43:47 -07:00
Chinmay Garde
5526884e78
Wire up the Skia Metal backend on iOS. (#8936) 2019-05-11 15:21:26 -07:00
liyuqian
8ff631f3df
Rename flow namespace to flutter (#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
Chinmay Garde
e356dbca2c
Merge flutter/synchronization contents into fml. (#8525)
When flutter/synchronization was first authored, we did not own fml (it was called fxl then). Now we do, so use a single spot for such utilities. The pipeline was meant to be a general purpose utility that was only ever used by the animator (it even has animator specific tracing), so move that to shell instead (where the animator resides).
2019-04-09 19:18:51 -07:00
Chinmay Garde
56052c70af
Rename the shell namespace to flutter. (#8520) 2019-04-09 17:10:46 -07:00