This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Gate Vulkan selection on API 29 #48089
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9644a6a
[Impeller] Select OpenGLES if Android API < 29
dnfield 918095e
Merge remote-tracking branch 'upstream/main' into vulkan_api_level
dnfield 0963ae1
ci
dnfield cf57516
API 28 is x86
dnfield eb47fdb
missing line
dnfield b87b71a
not standalone anymore
dnfield db11ec9
more
dnfield 6ec3e4a
make it run in presubmit
dnfield b4fb2d5
kvm
dnfield 257e640
kvm=1
dnfield 2b8378d
bringup, build scenario app for x86 too
dnfield ce4bfa1
runIf
dnfield File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| { | ||
| "builds": [ | ||
| { | ||
| "drone_dimensions": [ | ||
| "device_type=none", | ||
| "os=Linux", | ||
| "kvm=1", | ||
| "cores=8" | ||
| ], | ||
| "gn": [ | ||
| "--android", | ||
| "--android-cpu=x64", | ||
| "--no-lto", | ||
| "--rbe", | ||
| "--no-goma" | ||
| ], | ||
| "name": "android_debug_x64", | ||
| "ninja": { | ||
| "config": "android_debug_x64", | ||
| "targets": [ | ||
| "flutter/shell/platform/android:flutter_shell_native_unittests", | ||
| "flutter/testing/scenario_app" | ||
| ] | ||
| }, | ||
| "tests": [ | ||
| { | ||
| "language": "python3", | ||
| "name": "Android Unit Tests", | ||
| "test_dependencies": [ | ||
| { | ||
| "dependency": "android_virtual_device", | ||
| "version": "34" | ||
| } | ||
| ], | ||
| "contexts": [ | ||
| "android_virtual_device" | ||
| ], | ||
| "script": "flutter/testing/run_tests.py", | ||
| "parameters": [ | ||
| "--android-variant", | ||
| "android_debug_x64", | ||
| "--type", | ||
| "android" | ||
| ] | ||
| }, | ||
| { | ||
| "language": "bash", | ||
| "name": "Scenario App Integration Tests", | ||
| "test_dependencies": [ | ||
| { | ||
| "dependency": "android_virtual_device", | ||
| "version": "34" | ||
| } | ||
| ], | ||
| "contexts": [ | ||
| "android_virtual_device" | ||
| ], | ||
| "script": "flutter/testing/scenario_app/run_android_tests.sh", | ||
| "parameters": [ | ||
| "android_debug_x64" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "drone_dimensions": [ | ||
| "device_type=none", | ||
| "os=Linux", | ||
| "kvm=1", | ||
| "cores=8" | ||
| ], | ||
| "gn": [ | ||
| "--android", | ||
| "--android-cpu=x86", | ||
| "--no-lto", | ||
| "--rbe", | ||
| "--no-goma" | ||
| ], | ||
| "name": "android_debug_x86", | ||
| "ninja": { | ||
| "config": "android_debug_x86", | ||
| "targets": [ | ||
| "flutter/shell/platform/android:flutter_shell_native_unittests", | ||
| "flutter/testing/scenario_app" | ||
| ] | ||
| }, | ||
| "tests": [ | ||
| { | ||
| "language": "python3", | ||
| "name": "Android Unit Tests (API 28)", | ||
| "test_dependencies": [ | ||
| { | ||
| "dependency": "android_virtual_device", | ||
| "version": "28" | ||
| } | ||
| ], | ||
| "contexts": [ | ||
| "android_virtual_device" | ||
| ], | ||
| "script": "flutter/testing/run_tests.py", | ||
| "parameters": [ | ||
| "--android-variant", | ||
| "android_debug_x86", | ||
| "--type", | ||
| "android" | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
133 changes: 133 additions & 0 deletions
133
shell/platform/android/platform_view_android_unittests.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include "flutter/shell/platform/android/platform_view_android.h" | ||
| #include "gmock/gmock.h" | ||
| #include "gtest/gtest.h" | ||
| #include "shell/platform/android/context/android_context.h" | ||
| #include "third_party/googletest/googlemock/include/gmock/gmock-nice-strict.h" | ||
|
|
||
| namespace flutter { | ||
| namespace testing { | ||
|
|
||
| using ::testing::NiceMock; | ||
| using ::testing::ReturnRef; | ||
|
|
||
| namespace { | ||
| class MockPlatformViewDelegate : public PlatformView::Delegate { | ||
| public: | ||
| MOCK_METHOD(void, | ||
| OnPlatformViewCreated, | ||
| (std::unique_ptr<Surface> surface), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, OnPlatformViewDestroyed, (), (override)); | ||
|
|
||
| MOCK_METHOD(void, OnPlatformViewScheduleFrame, (), (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewSetNextFrameCallback, | ||
| (const fml::closure& closure), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewSetViewportMetrics, | ||
| (int64_t view_id, const ViewportMetrics& metrics), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewDispatchPlatformMessage, | ||
| (std::unique_ptr<PlatformMessage> message), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewDispatchPointerDataPacket, | ||
| (std::unique_ptr<PointerDataPacket> packet), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewDispatchSemanticsAction, | ||
| (int32_t id, SemanticsAction action, fml::MallocMapping args), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewSetSemanticsEnabled, | ||
| (bool enabled), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewSetAccessibilityFeatures, | ||
| (int32_t flags), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewRegisterTexture, | ||
| (std::shared_ptr<Texture> texture), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewUnregisterTexture, | ||
| (int64_t texture_id), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| OnPlatformViewMarkTextureFrameAvailable, | ||
| (int64_t texture_id), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(const Settings&, | ||
| OnPlatformViewGetSettings, | ||
| (), | ||
| (const, override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| LoadDartDeferredLibrary, | ||
| (intptr_t loading_unit_id, | ||
| std::unique_ptr<const fml::Mapping> snapshot_data, | ||
| std::unique_ptr<const fml::Mapping> snapshot_instructions), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| LoadDartDeferredLibraryError, | ||
| (intptr_t loading_unit_id, | ||
| const std::string error_message, | ||
| bool transient), | ||
| (override)); | ||
|
|
||
| MOCK_METHOD(void, | ||
| UpdateAssetResolverByType, | ||
| (std::unique_ptr<AssetResolver> updated_asset_resolver, | ||
| AssetResolver::AssetResolverType type), | ||
| (override)); | ||
| }; | ||
| } // namespace | ||
|
|
||
| TEST(AndroidPlatformView, SelectsVulkanBasedOnApiLevel) { | ||
| Settings settings; | ||
| settings.enable_software_rendering = false; | ||
| settings.enable_impeller = true; | ||
| settings.impeller_backend = "vulkan"; | ||
| NiceMock<MockPlatformViewDelegate> mock_delegate; | ||
| EXPECT_CALL(mock_delegate, OnPlatformViewGetSettings) | ||
| .WillRepeatedly(ReturnRef(settings)); | ||
|
|
||
| TaskRunners task_runners("test", nullptr, nullptr, nullptr, nullptr); | ||
| PlatformViewAndroid platform_view(/*delegate=*/mock_delegate, | ||
| /*task_runners=*/task_runners, | ||
| /*jni_facade=*/nullptr, | ||
| /*use_software_rendering=*/false, | ||
| /*msaa_samples=*/1); | ||
| auto context = platform_view.GetAndroidContext(); | ||
| EXPECT_TRUE(context); | ||
| int api_level = android_get_device_api_level(); | ||
| EXPECT_GT(api_level, 0); | ||
| if (api_level >= 29) { | ||
| EXPECT_TRUE(context->RenderingApi() == AndroidRenderingAPI::kVulkan); | ||
| } else { | ||
| EXPECT_TRUE(context->RenderingApi() == AndroidRenderingAPI::kOpenGLES); | ||
| } | ||
| } | ||
|
|
||
| } // namespace testing | ||
| } // namespace flutter |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs some time for the engine_v2 selection to propagate, per @godofredoc