1263 Commits

Author SHA1 Message Date
Tong Mu
927fd200ed Revert "Reland 2: Multiview Pipeline (#47239)" (flutter/engine#49238)
This reverts commit 87171e73397f7edfd4c145fbaebdd7208954debf.

Internal performance test shows that this PR negatively affects startup time. I'll reland this PR in parts.

b/307872797

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-12-19 22:30:01 +00:00
Matan Lurey
02f6c46771 Fix header-guard naming convention in shell/. (flutter/engine#49006)
Part of landing https://github.com/flutter/engine/pull/48903.

Some of these actually seem like potential owchy spots, i.e. `#ifndef FLUTTER_FLUTTER_H_`.
2023-12-14 23:37:22 +00:00
Matan Lurey
09ba20cb6a Move third_party/swiftshader, roll buildroot DEPS. (flutter/engine#48946)
Progress towards https://github.com/flutter/flutter/issues/67373, synced with 0141e94b34.
2023-12-12 22:23:02 +00:00
Jason Simmons
09e12e0f51 Reland "Replace use of Fontmgr::RefDefault with explicit creation calls" (flutter/engine#48764)
Relands https://github.com/flutter/engine/pull/48571 with a patch that uses the directory-based SkFontMgr as a default font manager on Linux
2023-12-07 15:45:08 +00:00
Jason Simmons
6f48ab3443 Revert "Replace use of Fontmgr::RefDefault with explicit creation calls" (flutter/engine#48755)
This reverts commit d5d8b5de90f40644f23d309c0f68d03e299334eb.

The flutter/tests/skp_generator test (running in flutter_tester on
Linux) was failing, along with some customer tests.
2023-12-06 17:50:14 -08:00
Kevin Lubick
d5d8b5de90 Replace use of Fontmgr::RefDefault with explicit creation calls (flutter/engine#48571)
In https://g-issues.skia.org/issues/305780908 Skia is removing the
default SkFontMgr. Previous work consolidated all references to
txt/platform.h and this replaces those last references. I attempted to
mirror the existing functionality, which still responds to GN flags and
the target platform.

After this PR, Flutter should not be depending on the default fontmgr
(and the defines in flutter_defines.gni) will maintain that behavior
until the legacy functions/methods are deleted from Skia. There were a
few tests that I missed on an earlier PR which relied on the default
font (helper added in #47493). These tests were failing because they
were making some assertions related to TextBlobs, which didn't work if
the (now-empty) Typeface they loaded had no glyphs. Thus, I added a few
extra asserts to make sure these textblobs *had* glyphs which make the
failing tests less mysterious, should this issue crop up again.

I cleaned up Flutter's BUILD.gn file for Skia a bit, deleting unused
targets related to the font managers. This involved fixing an implicit
dependency from //third_party/glfw/ to `Gdi32.lib` on Windows.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-12-06 13:02:34 -05:00
Tong Mu
673fca77cf Multiview ExternalViewEmbedder (flutter/engine#46169)
This PR adds multiview support for `ExternalViewEmbedder`.

## Nomenclature

The term **view** can be ambiguous in `ExternalViewEmbedder`, and therefore the following terms are used:
* A **native view** refers to the final drawing surface that to composite layers to. It is the "view" used in other places of the engine, such as `Shell::AddView`.
* A **platform view** refers a platform view, a layer that holds content to be embedded.

## Change

The lifecycle of `ExternalViewEmbedder` is changed:

<table>
    <thead>
        <tr>
            <th>Before PR</th>
            <th>After PR</th>
            <th>How it's called</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td rowspan=2>BeginFrame</td>
            <td>BeginFrame</td>
            <td>Once per frame</td>
        </tr>
        <tr>
            <td>PrepareFlutterView</td>
            <td>Once per flutter view</td>
        </tr>
        <tr>
            <td>SubmitFrame</td>
            <td>SubmitFlutterView (renamed)</td>
            <td>Once per flutter view</td>
        </tr>
        <tr>
            <td>EndFrame</td>
            <td>EndFrame (unchanged)</td>
            <td>Once per frame</td>
        </tr>
    </tbody>
</table>

* `BeginFrame` should perform per-frame actions, such as merge-unmerging threads.
* `PrepareView` should perform per-native-view preparations, such as recording the view ID and view size.

This change is necessary because some actions in `PrepareView` needs to be refreshed at the beginning of drawing every native view.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-12-04 20:29:49 +00:00
Matan Lurey
92a2b041fb Update HeaderFilterRegex once and for all. (flutter/engine#48145)
Includes a test (`header_filter_regex_test.dart`) that hopefully keeps
us on rails going forward.
2023-11-27 15:30:18 -08:00
Dan Field
28fbba2098 Delete unused/test only code from FML (flutter/engine#48327)
This is more-or-less a revert of https://github.com/flutter/engine/pull/14011

This code never ended up being used outside of tests, and it's not how we handle asset loading at this point anyway.

I was hopeful we could kill off all runtime dependencies on Dart in `FML` when looking at this, but it looks like trace_event.h still wants to import dart_api_tools.h for some Dart enum types. This may or may not matter if we ever want to build FML for web/wasm. /cc @eyebrowsoffire. If we really need to do that, we can refactor the trace event stuff so that it has a web and Dart implementation that's selected at build time.
2023-11-22 20:49:56 +00:00
Matan Lurey
b6f162e8b3 Finish making shell/common/... compatible with .clang-tidy. (flutter/engine#48295) 2023-11-21 15:33:43 -08:00
Matan Lurey
edb665c82d Make {shell|lib/ui}/... compatible with .clang_tidy. (flutter/engine#48242)
This is mostly just rename `ThreadHost::Type::{IDENTIFIER}` to
`kIdentifier`.

I also ignored some enum violations that are in public APIs.
2023-11-21 12:29:14 -08:00
Matan Lurey
f9adfbc62c Make runtime/... and shell/common/... compatible with .clang-tidy. (flutter/engine#48158) 2023-11-20 14:31:49 -08:00
Matan Lurey
56fc8315cc Re-land "Make flow/embedded_views.h compatible with .clang_tidy." (flutter/engine#48137)
Reverts flutter/engine#48130.

Now that the `runIf` clauses are omitted, CI should be a reliable source
of truth.
2023-11-16 13:05:13 -08:00
auto-submit[bot]
74d08febd7 Reverts "Make flow/embedded_views.h compatible with .clang_tidy." (flutter/engine#48130)
Reverts flutter/engine#47994
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-16 17:18:18 +00:00
Matan Lurey
b741431a73 Make flow/embedded_views.h compatible with .clang_tidy. (flutter/engine#47994)
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-16 08:47:54 -08:00
Matan Lurey
933bd94016 Make flow/... compatible with .clang_tidy. (flutter/engine#47995)
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-16 08:41:10 -08:00
John McCutchan
4a2f6eacfa Revert "Add an AndroidManifest.xml flag to disable ImageReader backend Platform Views (#46430)" (flutter/engine#48024)
This reverts commit af107ceba5d188019df780e0be192dd7092ea35a. It is no
longer needed as we have resolved the flickering issue in the
ImageReader backend.
2023-11-14 10:26:39 -08:00
gaaclarke
002ab77448 Expanded the performance lints (flutter/engine#47868)
fixes https://github.com/flutter/flutter/issues/137372

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-09 23:54:01 +00:00
Michael Goderbauer
ba990078f8 Reland "Remove physical geometry" (flutter/engine#47872)
Relands #47825 with a doc fix (see second commit).
2023-11-09 19:39:20 +00:00
auto-submit[bot]
aa4fb605c3 Reverts "Remove physical geometry" (flutter/engine#47862)
Reverts flutter/engine#47825
Initiated by: zanderso
This change reverts the following previous change:
Original Description:
Looks like this was proactively added in https://github.com/flutter/engine/pull/20496, but never wired up to anything on any platform. It is also unused in framework and customer code; we never exposed this on e.g. MediaQuery.

Related framework PR: https://github.com/flutter/flutter/pull/138103 (Checks will fail until that PR is submitted).
2023-11-09 16:06:19 +00:00
Michael Goderbauer
c273bd8d71 Remove physical geometry (flutter/engine#47825)
Looks like this was proactively added in https://github.com/flutter/engine/pull/20496, but never wired up to anything on any platform. It is also unused in framework and customer code; we never exposed this on e.g. MediaQuery.

Related framework PR: https://github.com/flutter/flutter/pull/138103 (Checks will fail until that PR is submitted).
2023-11-09 02:18:24 +00:00
Zachary Anderson
e24e3b5746 Don't use Skia BUILD.gn files (flutter/engine#47677)
The new `BUILD.gn` files in the Engine tree can't go under
`build/secondary` because Skia still has its own, and they'd be selected
first. So, this PR puts the new `BUILD.gn` files under `flutter/skia`.
2023-11-07 11:12:29 -08:00
Jason Simmons
cce2f9ced2 Consolidate all the copies of the OpenFixtureAsSkData testing helper function (flutter/engine#47491) 2023-11-01 17:03:05 +00:00
gaaclarke
52fcefb32a Made clang tidy use arm64 if on an arm64 mac. (flutter/engine#47494)
fixes https://github.com/flutter/flutter/issues/137260

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat

---------

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
2023-10-31 15:35:36 -07:00
Kevin Lubick
6cf3dac92a Remove call to SkTypeface::MakeDefault (flutter/engine#47344)
Skia plans to remove the default (global) SkFontMgr, which in turn,
requires the removal of a default typeface (e.g. the
typeface returned by `SkTypeface::MakeDefault` and when `nullptr` passed
in to the `SkFont` constructor).

See https://g-issues.skia.org/issues/305780908

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-10-30 07:48:30 -04:00
Zachary Anderson
e1fc52e2b6 Move rapidjson to flutter/third_party (flutter/engine#47354)
As part of eliminating the Flutter buildroot
(https://github.com/flutter/flutter/issues/67373), we are moving all
third-party dependencies from //third_party to //flutter/third_party.

Once all third-party dependencies have been migrated, tooling and config
will be moved and the buildroot will be eliminated altogether.

No tests changed because there is no semantic change to this PR. This is
simply relocating a dependency.
2023-10-27 08:00:56 -07:00
John McCutchan
632d65292d Don't re-initialize the default RenderSurface when returning from hybrid composition mode (flutter/engine#47358)
When we enter hybrid composition mode we 'pause' the default RenderSurface (implemented by SurfaceView or TextureView) and swap to an ImageReader based RenderSurface.

When we return from hybrid composition mode we recreate and re-initialize the real RenderSurface as if it was being used for the first time.

This broke Platform Views in an internal app b/306122497 because we would incorrectly tell the texture to attach when it was never detached.

This CL changes the protocol so that when we return from hybrid composition mode we only swap the RenderSurface and do not re-create it. This avoids doing a bunch of unnecessary work and fixes the logic error of re-attaching textures that were never detached.

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-27 00:33:23 +00:00
Tong Mu
a98c3dc263 Skip invalid renders in Dart (flutter/engine#47323)
With this PR, invalid renders are skipped in Dart in both release build and debug build.

Part of https://github.com/flutter/flutter/issues/137073 and part of relanding https://github.com/flutter/engine/pull/45555.

Unit tests will be relanded in a following PR once this PR is confirmed performance-safe.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-26 22:09:10 +00:00
auto-submit[bot]
24debb363e Reverts "[Impeller] Disable layer tree screenshots." (flutter/engine#47356)
Reverts flutter/engine#46171
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
The "rasterizer screenshot" VM service API uses the Skia software backend, even when running with impeller. At best, this leads to confusing half working screenshots that are missing images.

See https://github.com/flutter/flutter/issues/135052

We should disable this functionality when running with impeller. Perhaps this could be reworked to use picture toImage instead of the offscreen so that it uses the "real" backend regardless of the platform it is running on.

Fixes https://github.com/flutter/flutter/issues/135052
2023-10-26 20:34:17 +00:00
Jonah Williams
912c891a1d [Impeller] Disable layer tree screenshots. (flutter/engine#46171)
The "rasterizer screenshot" VM service API uses the Skia software backend, even when running with impeller. At best, this leads to confusing half working screenshots that are missing images.

See https://github.com/flutter/flutter/issues/135052

We should disable this functionality when running with impeller. Perhaps this could be reworked to use picture toImage instead of the offscreen so that it uses the "real" backend regardless of the platform it is running on.

Fixes https://github.com/flutter/flutter/issues/135052
2023-10-26 20:16:09 +00:00
gaaclarke
2b28dc130d Adds lint for checking argument commments (flutter/engine#47305)
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-25 17:21:09 +00:00
Tong Mu
87171e7339 Reland 2: Multiview Pipeline (flutter/engine#47239)
The last attempt https://github.com/flutter/engine/pull/47234 was reverted because there was another test merged in the meantime that violates the rule added in this PR.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-23 23:46:25 +00:00
Zachary Anderson
d549483298 Revert "Reland: Multiview pipeline " (flutter/engine#47237)
Reverts flutter/engine#47234

Failures like
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20Production%20Engine%20Drone/186568/overview
making the tree red.
2023-10-23 15:17:36 -07:00
Tong Mu
9ed503a734 Reland: Multiview pipeline (flutter/engine#47234)
This PR relands https://github.com/flutter/engine/pull/44473.

The previous PR was immediately reverted after merging because we found that the PR could cause illegal renders to be skipped on debug builds but crash the app on release builds. This PR makes the `Animator::Render` skip illegal renders as well. This should not be the final shape of this feature, and thus a TODO is added.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-23 21:35:04 +00:00
Jonah Williams
063c7f54f4 [Impeller] Disable raster stats service protocol. (flutter/engine#47206)
As far as I can tell, this functionality has _always_ been falling back to software rendering with Skia when Impeller was enabled. This is at best extremely misleading. Since I started putting Impeller specific objects in the display list it introduced crashes, and must be disabled.

Fixes https://github.com/flutter/flutter/issues/136847
2023-10-23 18:45:18 +00:00
auto-submit[bot]
47c3403c39 Reverts "Multiview pipeline" (flutter/engine#47174)
Reverts flutter/engine#44473
Initiated by: dkwingsmt
This change reverts the following previous change:
Original Description:
This PR makes `Animator` able to handle multiple views, and updates unit tests accordingly.

Before:
<img width="543" alt="image" src="https://github.com/flutter/engine/assets/1596656/f7d0e0e4-cc85-4a6e-b516-1896ac3c1b35">

After:
<img width="614" alt="image" src="https://github.com/flutter/engine/assets/1596656/68106301-66ef-4cd1-aeaf-d9c6127ccec2">

Now `Animator::Render` must be called during `Animator::BeginFrame`, which is split into `BeginFrame` and `EndFrame`. This requirement is made possible by https://github.com/flutter/engine/pull/45555. The reason to split is to allow `ShellTest::PumpOneFrame` to insert a render from C++ code.

`ShellTest::PumpOneFrame` is also refactored to allow pumping a frame without any views.

A few unit tests are tweaked to resolve racing condition.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-20 20:57:08 +00:00
Tong Mu
1cfde62821 Multiview pipeline (flutter/engine#44473)
This PR makes `Animator` able to handle multiple views, and updates unit tests accordingly.

Before:
<img width="543" alt="image" src="https://github.com/flutter/engine/assets/1596656/f7d0e0e4-cc85-4a6e-b516-1896ac3c1b35">

After:
<img width="614" alt="image" src="https://github.com/flutter/engine/assets/1596656/68106301-66ef-4cd1-aeaf-d9c6127ccec2">

Now `Animator::Render` must be called during `Animator::BeginFrame`, which is split into `BeginFrame` and `EndFrame`. This requirement is made possible by https://github.com/flutter/engine/pull/45555. The reason to split is to allow `ShellTest::PumpOneFrame` to insert a render from C++ code.

`ShellTest::PumpOneFrame` is also refactored to allow pumping a frame without any views.

A few unit tests are tweaked to resolve racing condition.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-20 20:38:23 +00:00
Jonah Williams
8031a09e17 [Impeller] GPU Tracer for GLES. (flutter/engine#47080)
Trace GPU execution time on GLES using GL_EXT_disjoint_timer_query. This requires a per-app opt in from the Android Manifest with the key `"io.flutter.embedding.android.EnableOpenGLGPUTracing` set to true.
2023-10-20 17:20:43 +00:00
Tong Mu
6584b2c308 Reland 2 (part 1): Enforce the rule of calling FlutterView.Render (flutter/engine#47062)
This PR relands part of https://github.com/flutter/engine/pull/45300,
which was reverted in https://github.com/flutter/engine/pull/46919 due
to performance regression.

Due to how little and trivial production code the original PR touches, I
really couldn't figure out the exact line that caused it except through
experimentation, which requires changes to be officially landed on the
main branch. After this PR lands, I'll immediately fire a performance
test.

This PR contains the `Shell` refactor of the original PR. I made a
slight change where the isolate snapshot is no longer returned through
return value, but the parameter, in order to avoid the overhead of
assigning.

It is intentional to not contain any unit tests or other changes of the
original PR. They will be landed shortly after this PR.

Part of https://github.com/flutter/flutter/issues/136826.

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I signed the [CLA].
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-10-18 14:09:01 -07:00
gaaclarke
c8aa0844f2 [Impeller] implements a retry mechanism for dart:ui/Image.toByteData. (flutter/engine#46840)
Design doc: [link](https://docs.google.com/document/d/1Uuiw3pdQxNFTA8OQuZ-kuvYg1NB42XgccQCZeqr4oII/edit#heading=h.hn6wreyrz6fm)
fixes: https://github.com/flutter/flutter/issues/135245

One slight deviation from the design doc is that I decided to make ContextMTL respond to changes to the SyncSwitch instead of having it observe the app state directly.  The benefits are:
1) This keeps that functionality in one location
1) It makes writing tests much easier
1) There's no need of conditional compilation between macos and ios
1) There is no need to add an objc class

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-16 18:31:13 +00:00
Tong Mu
f263e6a49f Revert "Reland: Enforce the rule of calling FlutterView.Render (#45300)" (flutter/engine#46919)
Reverts flutter/engine#45555 due to possible performance regression, b/304898239
2023-10-16 05:37:20 +00:00
gaaclarke
c053bc814b [Impeller] Started throwing errors if dart:ui/Image.toByteData fails (flutter/engine#46738)
issue: https://github.com/flutter/flutter/issues/135245

This is a first step.  Next we'll implement a retry.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-10-13 09:04:47 -07:00
Kevin Lubick
efc265b5e9 Fix forward declare and some deprecated enums (flutter/engine#46882)
There was a compile error when trying to roll in
http://review.skia.org/764970, and this addresses that.

While I was here, I noticed some uses of the old-named `GrBackend` enum
and updated it to the non-deprecated enum class.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-10-13 10:56:27 -04:00
Kevin Lubick
a6761a95ea Update to use GrDirectContexts::MakeVulkan (flutter/engine#46878)
In http://review.skia.org/764516, Skia moved the way to make a Vulkan
context. This updates Flutter to use that new way.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-10-13 10:41:25 -04:00
Zachary Anderson
7922a335e8 Don't use objcopy to embed Android icudtl (flutter/engine#46862)
When objcopy is used to embed data into a linkable object file, that
object file will only have default bits set in its header for ABI etc..
If the linker doesn't cooperate by ignoring ABI mismatches on object
files without code, then linking will fail. This PR stops using objcopy
to create an object file that embeds icudtl.dat into the Android
embedder, and instead uses the `bin_to_assembly.py` script that we're
already using for Dart VM snapshot data.

Context in https://github.com/llvm/llvm-project/issues/68915
2023-10-13 07:33:24 -07:00
Dan Field
1e318d57d4 [Impeller] flutter_tester --enable-impeller (flutter/engine#46389)
This patch does the following:

- Updates `flutter_tester` to set up an Impeller rendering context and surface if `--enable-impeller` is set to true, using the Vulkan backend with Swiftshader.
- Updates `run_tests.py` to run all tests except the smoke test (that one really has no rendering impact whatsoever) with and without `--enable-impeller`.
- Updates a few tests to work that were trivial:
  - A couple tests needed updated goldens for very minor rendering differences. Filed https://github.com/flutter/flutter/issues/135684 to track using Skia gold for this instead.
  - Disabled SKP screenshotting if Impeller is enabled, and updated the test checking that to verify an error is thrown if an SKP is requested.
  - The Dart GPU based test now asserts that the gpu context is available if Impeller is enabled, and does not deadlock if run in a single threaded mode.
  - We were missing some trace events around `Canvas::SaveLayer` for Impeller as compared to Skia.
  - A couple other tests had strict checks about exception messages that are slightly different between Skia and Impeller.
- I've filed bugs for other tests that may require a little more work, and skipped them for now. For FragmentProgram on Vulkan I reused an existing bug.

This is part of my attempt to address https://github.com/flutter/flutter/issues/135693, although @chinmaygarde and I had slightly different ideas about how to do this.

The goals here are:

- Run the Dart unit tests we already have with Impeller enabled.
- Enable running more of the framework tests (including gold tests) with Impeller enabled.
- Run all of these tests via public `dart:ui` API rather than mucking around in C++ internals in the engine.
2023-10-11 21:42:24 +00:00
Kevin Lubick
5d70f10ebb Add Base64::EncodedSize to tidy up allocations (flutter/engine#46624)
As a follow-up to #46543, this adds a dedicated function to compute the
size of the buffer needed to encode data using Base64 instead of calling
the encode function with nullptr.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-10-06 16:50:20 -04:00
Kevin Lubick
ec62430ff1 Replace use of Skia's Base64 Encoding/Decoding logic with a copy of the equivalent code (flutter/engine#46543)
Skia would like to remove SkBase64.h from its public API. This ports the
same functionality into Flutter's codebase with tests.

The implementation was copied from
[Skia](387853af19/src/utils/SkBase64.cpp)
then modified to match Flutter's style and have readable tests.

In a follow-up PR, I would like to add a function to pre-flight the
calculation needed to figure out how many
bytes are needed to be allocated, to avoid the clunky double API
call (see the TODOs).

I chose to put the code in `//shell/common` at the suggestion of Flutter
devs, but it needs to be in its own source_set because it is used in a
few other places (for now) and we want to avoid dependency cycles.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-10-05 10:21:39 -04:00
John McCutchan
af107ceba5 Add an AndroidManifest.xml flag to disable ImageReader backed Platform Views (flutter/engine#46430)
An internal customer is seeing flickering on some high FPS phones.

While we try and reproduce / gain more knowledge of this problem this PR adds a AndroidManifest.xml flag to disable their usage.

The boolean flag is:
```
"io.flutter.embedding.android.DisableImageReaderPlatformViews"
```

Adding the following to your manifest will disable their usage:

```
<meta-data
  android:name="io.flutter.embedding.android.DisableImageReaderPlatformViews"
  android:value="true" />
```
2023-09-30 00:33:33 +00:00
Tong Mu
c7f206212a Multi-view Rasterizer (flutter/engine#45512)
This PR refactors `Rasterizer` so that it's more suitable for multi-view.

Design doc: [flutter.dev/go/multi-view-pipeline-and-rasterizer](http://flutter.dev/go/multi-view-pipeline-and-rasterizer)

With this change, `Rasterizer::DrawToSurfaces` has a structure that can handle drawing to multiple views, although the lack of some functionality still blocks it, mostly related to `ExternalViewEmbedder` and `RasterCache`. 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-29 21:43:55 +00:00