From ac3ce651f3fd3abf111d2418270551dedb29b116 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 27 Jun 2023 11:08:49 -0700 Subject: [PATCH] [Impeller] Give Impeller a dedicated raster priority level worker loop. (flutter/engine#43166) We'd like to (or already are) using the concurrent message loop for high priority rendering tasks like PSO construction and render pass encoding. The default priority level for the engine managed concurrent message loop is 2, which is a significantly lower priority than the raster thread at -5. This is almost certainly causing priority inversion. We must move back to dedicated runners so we can adjust thread priorities. --- .../flutter/ci/licenses_golden/excluded_files | 1 - .../flutter/fml/concurrent_message_loop.cc | 1 + .../backend/metal/playground_impl_mtl.mm | 7 +-- .../backend/vulkan/playground_impl_vk.cc | 5 +- .../backend/vulkan/playground_impl_vk.h | 2 - .../flutter/impeller/playground/playground.cc | 3 + .../renderer/backend/gles/context_gles.cc | 2 + .../renderer/backend/gles/context_gles.h | 3 + .../backend/metal/command_buffer_mtl.mm | 57 +++++++++++-------- .../renderer/backend/metal/context_mtl.h | 11 ++-- .../renderer/backend/metal/context_mtl.mm | 54 ++++++++++++------ .../renderer/backend/vulkan/context_vk.cc | 35 ++++++++---- .../renderer/backend/vulkan/context_vk.h | 6 +- .../backend/vulkan/test/mock_vulkan.cc | 2 - .../src/flutter/impeller/renderer/context.h | 4 ++ .../flutter/impeller/renderer/testing/mocks.h | 2 + .../ui/painting/image_decoder_unittests.cc | 2 + .../shell/common/animator_unittests.cc | 1 - .../shell/common/shell_test_platform_view.cc | 5 +- .../shell/common/shell_test_platform_view.h | 1 - .../common/shell_test_platform_view_metal.h | 18 +++--- .../common/shell_test_platform_view_metal.mm | 11 +--- .../flutter/shell/common/shell_unittests.cc | 1 - .../flutter/shell/platform/android/BUILD.gn | 1 - .../android_context_vulkan_impeller.cc | 8 +-- .../android/android_context_vulkan_impeller.h | 4 +- ...droid_context_vulkan_impeller_unittests.cc | 31 ---------- .../platform/android/android_shell_holder.cc | 7 +-- .../platform/android/platform_view_android.cc | 7 +-- .../platform/android/platform_view_android.h | 12 ++-- .../FlutterDarwinContextMetalImpeller.h | 4 +- .../FlutterDarwinContextMetalImpeller.mm | 13 ++--- .../shell/platform/darwin/ios/ios_context.h | 3 - .../shell/platform/darwin/ios/ios_context.mm | 4 +- .../darwin/ios/ios_context_metal_impeller.h | 3 +- .../darwin/ios/ios_context_metal_impeller.mm | 4 +- .../platform/darwin/ios/platform_view_ios.mm | 1 - .../embedder_surface_metal_impeller.h | 1 - .../embedder_surface_metal_impeller.mm | 4 +- 39 files changed, 156 insertions(+), 185 deletions(-) delete mode 100644 engine/src/flutter/shell/platform/android/android_context_vulkan_impeller_unittests.cc diff --git a/engine/src/flutter/ci/licenses_golden/excluded_files b/engine/src/flutter/ci/licenses_golden/excluded_files index 3be28594a8..8c0100eeea 100644 --- a/engine/src/flutter/ci/licenses_golden/excluded_files +++ b/engine/src/flutter/ci/licenses_golden/excluded_files @@ -230,7 +230,6 @@ ../../../flutter/shell/platform/android/.gitignore ../../../flutter/shell/platform/android/android_context_gl_impeller_unittests.cc ../../../flutter/shell/platform/android/android_context_gl_unittests.cc -../../../flutter/shell/platform/android/android_context_vulkan_impeller_unittests.cc ../../../flutter/shell/platform/android/android_shell_holder_unittests.cc ../../../flutter/shell/platform/android/apk_asset_provider_unittests.cc ../../../flutter/shell/platform/android/external_view_embedder/external_view_embedder_unittests.cc diff --git a/engine/src/flutter/fml/concurrent_message_loop.cc b/engine/src/flutter/fml/concurrent_message_loop.cc index 911e403851..ace1985c24 100644 --- a/engine/src/flutter/fml/concurrent_message_loop.cc +++ b/engine/src/flutter/fml/concurrent_message_loop.cc @@ -29,6 +29,7 @@ ConcurrentMessageLoop::ConcurrentMessageLoop(size_t worker_count) ConcurrentMessageLoop::~ConcurrentMessageLoop() { Terminate(); for (auto& worker : workers_) { + FML_DCHECK(worker.joinable()); worker.join(); } } diff --git a/engine/src/flutter/impeller/playground/backend/metal/playground_impl_mtl.mm b/engine/src/flutter/impeller/playground/backend/metal/playground_impl_mtl.mm index 55e17871f7..e9ffbf64f6 100644 --- a/engine/src/flutter/impeller/playground/backend/metal/playground_impl_mtl.mm +++ b/engine/src/flutter/impeller/playground/backend/metal/playground_impl_mtl.mm @@ -73,10 +73,9 @@ PlaygroundImplMTL::PlaygroundImplMTL(PlaygroundSwitches switches) if (!window) { return; } - auto worker_task_runner = concurrent_loop_->GetTaskRunner(); - auto context = ContextMTL::Create( - ShaderLibraryMappingsForPlayground(), worker_task_runner, - is_gpu_disabled_sync_switch_, "Playground Library"); + auto context = + ContextMTL::Create(ShaderLibraryMappingsForPlayground(), + is_gpu_disabled_sync_switch_, "Playground Library"); if (!context) { return; } diff --git a/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.cc b/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.cc index f92192c4a9..7783a8c31e 100644 --- a/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.cc +++ b/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.cc @@ -52,9 +52,7 @@ void PlaygroundImplVK::DestroyWindowHandle(WindowHandle handle) { } PlaygroundImplVK::PlaygroundImplVK(PlaygroundSwitches switches) - : PlaygroundImpl(switches), - concurrent_loop_(fml::ConcurrentMessageLoop::Create()), - handle_(nullptr, &DestroyWindowHandle) { + : PlaygroundImpl(switches), handle_(nullptr, &DestroyWindowHandle) { if (!::glfwVulkanSupported()) { #ifdef TARGET_OS_MAC VALIDATION_LOG << "Attempted to initialize a Vulkan playground on macOS " @@ -86,7 +84,6 @@ PlaygroundImplVK::PlaygroundImplVK(PlaygroundSwitches switches) &::glfwGetInstanceProcAddress); context_settings.shader_libraries_data = ShaderLibraryMappingsForPlayground(); context_settings.cache_directory = fml::paths::GetCachesDirectory(); - context_settings.worker_task_runner = concurrent_loop_->GetTaskRunner(); context_settings.enable_validation = switches_.enable_vulkan_validation; auto context = ContextVK::Create(std::move(context_settings)); diff --git a/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.h b/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.h index bb0a7842a1..0dae50b0c0 100644 --- a/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.h +++ b/engine/src/flutter/impeller/playground/backend/vulkan/playground_impl_vk.h @@ -4,7 +4,6 @@ #pragma once -#include "flutter/fml/concurrent_message_loop.h" #include "flutter/fml/macros.h" #include "impeller/playground/playground_impl.h" #include "impeller/renderer/backend/vulkan/vk.h" @@ -18,7 +17,6 @@ class PlaygroundImplVK final : public PlaygroundImpl { ~PlaygroundImplVK(); private: - std::shared_ptr concurrent_loop_; std::shared_ptr context_; // Windows management. diff --git a/engine/src/flutter/impeller/playground/playground.cc b/engine/src/flutter/impeller/playground/playground.cc index ce81afab97..447da44b3d 100644 --- a/engine/src/flutter/impeller/playground/playground.cc +++ b/engine/src/flutter/impeller/playground/playground.cc @@ -139,6 +139,9 @@ void Playground::SetupWindow() { } void Playground::TeardownWindow() { + if (context_) { + context_->Shutdown(); + } context_.reset(); renderer_.reset(); impl_.reset(); diff --git a/engine/src/flutter/impeller/renderer/backend/gles/context_gles.cc b/engine/src/flutter/impeller/renderer/backend/gles/context_gles.cc index 47e7256374..4f590e2b2d 100644 --- a/engine/src/flutter/impeller/renderer/backend/gles/context_gles.cc +++ b/engine/src/flutter/impeller/renderer/backend/gles/context_gles.cc @@ -107,6 +107,8 @@ bool ContextGLES::IsValid() const { return is_valid_; } +void ContextGLES::Shutdown() {} + // |Context| std::string ContextGLES::DescribeGpuModel() const { return reactor_->GetProcTable().GetDescription()->GetString(); diff --git a/engine/src/flutter/impeller/renderer/backend/gles/context_gles.h b/engine/src/flutter/impeller/renderer/backend/gles/context_gles.h index 2faea35232..37fca72b3c 100644 --- a/engine/src/flutter/impeller/renderer/backend/gles/context_gles.h +++ b/engine/src/flutter/impeller/renderer/backend/gles/context_gles.h @@ -72,6 +72,9 @@ class ContextGLES final : public Context, // |Context| const std::shared_ptr& GetCapabilities() const override; + // |Context| + void Shutdown() override; + FML_DISALLOW_COPY_AND_ASSIGN(ContextGLES); }; diff --git a/engine/src/flutter/impeller/renderer/backend/metal/command_buffer_mtl.mm b/engine/src/flutter/impeller/renderer/backend/metal/command_buffer_mtl.mm index 58aa6b5478..894f8b1fdc 100644 --- a/engine/src/flutter/impeller/renderer/backend/metal/command_buffer_mtl.mm +++ b/engine/src/flutter/impeller/renderer/backend/metal/command_buffer_mtl.mm @@ -202,32 +202,39 @@ bool CommandBufferMTL::SubmitCommandsAsync( return false; } - auto task = fml::MakeCopyable([render_pass, buffer, render_command_encoder, - weak_context = context_]() { - auto context = weak_context.lock(); - if (!context) { - return; - } - auto is_gpu_disabled_sync_switch = - ContextMTL::Cast(*context).GetIsGpuDisabledSyncSwitch(); - is_gpu_disabled_sync_switch->Execute(fml::SyncSwitch::Handlers().SetIfFalse( - [&render_pass, &render_command_encoder, &buffer, &context] { - auto mtl_render_pass = static_cast(render_pass.get()); - if (!mtl_render_pass->label_.empty()) { - [render_command_encoder - setLabel:@(mtl_render_pass->label_.c_str())]; - } - - auto result = mtl_render_pass->EncodeCommands( - context->GetResourceAllocator(), render_command_encoder); + auto task = fml::MakeCopyable( + [render_pass, buffer, render_command_encoder, weak_context = context_]() { + auto context = weak_context.lock(); + if (!context) { [render_command_encoder endEncoding]; - if (result) { - [buffer commit]; - } else { - VALIDATION_LOG << "Failed to encode command buffer"; - } - })); - }); + return; + } + auto is_gpu_disabled_sync_switch = + ContextMTL::Cast(*context).GetIsGpuDisabledSyncSwitch(); + is_gpu_disabled_sync_switch->Execute( + fml::SyncSwitch::Handlers() + .SetIfFalse([&render_pass, &render_command_encoder, &buffer, + &context] { + auto mtl_render_pass = + static_cast(render_pass.get()); + if (!mtl_render_pass->label_.empty()) { + [render_command_encoder + setLabel:@(mtl_render_pass->label_.c_str())]; + } + + auto result = mtl_render_pass->EncodeCommands( + context->GetResourceAllocator(), render_command_encoder); + [render_command_encoder endEncoding]; + if (result) { + [buffer commit]; + } else { + VALIDATION_LOG << "Failed to encode command buffer"; + } + }) + .SetIfTrue([&render_command_encoder] { + [render_command_encoder endEncoding]; + })); + }); worker_task_runner->PostTask(task); return true; } diff --git a/engine/src/flutter/impeller/renderer/backend/metal/context_mtl.h b/engine/src/flutter/impeller/renderer/backend/metal/context_mtl.h index 85f9f3a868..1a07ad821f 100644 --- a/engine/src/flutter/impeller/renderer/backend/metal/context_mtl.h +++ b/engine/src/flutter/impeller/renderer/backend/metal/context_mtl.h @@ -35,12 +35,10 @@ class ContextMTL final : public Context, public: static std::shared_ptr Create( const std::vector& shader_library_paths, - std::shared_ptr worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch); static std::shared_ptr Create( const std::vector>& shader_libraries_data, - std::shared_ptr worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch, const std::string& label); @@ -48,7 +46,6 @@ class ContextMTL final : public Context, id device, id command_queue, const std::vector>& shader_libraries_data, - std::shared_ptr worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch, const std::string& label); @@ -84,9 +81,12 @@ class ContextMTL final : public Context, // |Context| bool UpdateOffscreenLayerPixelFormat(PixelFormat format) override; + // |Context| + void Shutdown() override; + id CreateMTLCommandBuffer(const std::string& label) const; - const std::shared_ptr& GetWorkerTaskRunner() const; + const std::shared_ptr GetWorkerTaskRunner() const; std::shared_ptr GetIsGpuDisabledSyncSwitch() const; @@ -98,7 +98,7 @@ class ContextMTL final : public Context, std::shared_ptr sampler_library_; std::shared_ptr resource_allocator_; std::shared_ptr device_capabilities_; - std::shared_ptr worker_task_runner_; + std::shared_ptr raster_message_loop_; std::shared_ptr is_gpu_disabled_sync_switch_; bool is_valid_ = false; @@ -106,7 +106,6 @@ class ContextMTL final : public Context, id device, id command_queue, NSArray>* shader_libraries, - std::shared_ptr worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch); std::shared_ptr CreateCommandBufferInQueue( diff --git a/engine/src/flutter/impeller/renderer/backend/metal/context_mtl.mm b/engine/src/flutter/impeller/renderer/backend/metal/context_mtl.mm index 04dba5c39d..223762608b 100644 --- a/engine/src/flutter/impeller/renderer/backend/metal/context_mtl.mm +++ b/engine/src/flutter/impeller/renderer/backend/metal/context_mtl.mm @@ -71,11 +71,9 @@ ContextMTL::ContextMTL( id device, id command_queue, NSArray>* shader_libraries, - std::shared_ptr worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch) : device_(device), command_queue_(command_queue), - worker_task_runner_(std::move(worker_task_runner)), is_gpu_disabled_sync_switch_(std::move(is_gpu_disabled_sync_switch)) { // Validate device. if (!device_) { @@ -83,6 +81,24 @@ ContextMTL::ContextMTL( return; } + // Worker task runner. + { + raster_message_loop_ = fml::ConcurrentMessageLoop::Create( + std::min(4u, std::thread::hardware_concurrency())); + raster_message_loop_->PostTaskToAllWorkers([]() { + // See https://github.com/flutter/flutter/issues/65752 + // Intentionally opt out of QoS for raster task workloads. + [[NSThread currentThread] setThreadPriority:1.0]; + sched_param param; + int policy; + pthread_t thread = pthread_self(); + if (!pthread_getschedparam(thread, &policy, ¶m)) { + param.sched_priority = 50; + pthread_setschedparam(thread, policy, ¶m); + } + }); + } + // Setup the shader library. { if (shader_libraries == nil) { @@ -210,7 +226,6 @@ static id CreateMetalCommandQueue(id device) { std::shared_ptr ContextMTL::Create( const std::vector& shader_library_paths, - std::shared_ptr worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch) { auto device = CreateMetalDevice(); auto command_queue = CreateMetalCommandQueue(device); @@ -220,7 +235,7 @@ std::shared_ptr ContextMTL::Create( auto context = std::shared_ptr(new ContextMTL( device, command_queue, MTLShaderLibraryFromFilePaths(device, shader_library_paths), - std::move(worker_task_runner), std::move(is_gpu_disabled_sync_switch))); + std::move(is_gpu_disabled_sync_switch))); if (!context->IsValid()) { FML_LOG(ERROR) << "Could not create Metal context."; return nullptr; @@ -230,7 +245,6 @@ std::shared_ptr ContextMTL::Create( std::shared_ptr ContextMTL::Create( const std::vector>& shader_libraries_data, - std::shared_ptr worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch, const std::string& library_label) { auto device = CreateMetalDevice(); @@ -238,11 +252,11 @@ std::shared_ptr ContextMTL::Create( if (!command_queue) { return nullptr; } - auto context = std::shared_ptr(new ContextMTL( - device, command_queue, - MTLShaderLibraryFromFileData(device, shader_libraries_data, - library_label), - std::move(worker_task_runner), std::move(is_gpu_disabled_sync_switch))); + auto context = std::shared_ptr( + new ContextMTL(device, command_queue, + MTLShaderLibraryFromFileData(device, shader_libraries_data, + library_label), + std::move(is_gpu_disabled_sync_switch))); if (!context->IsValid()) { FML_LOG(ERROR) << "Could not create Metal context."; return nullptr; @@ -254,14 +268,13 @@ std::shared_ptr ContextMTL::Create( id device, id command_queue, const std::vector>& shader_libraries_data, - std::shared_ptr worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch, const std::string& library_label) { - auto context = std::shared_ptr(new ContextMTL( - device, command_queue, - MTLShaderLibraryFromFileData(device, shader_libraries_data, - library_label), - std::move(worker_task_runner), std::move(is_gpu_disabled_sync_switch))); + auto context = std::shared_ptr( + new ContextMTL(device, command_queue, + MTLShaderLibraryFromFileData(device, shader_libraries_data, + library_label), + std::move(is_gpu_disabled_sync_switch))); if (!context->IsValid()) { FML_LOG(ERROR) << "Could not create Metal context."; return nullptr; @@ -301,9 +314,14 @@ std::shared_ptr ContextMTL::CreateCommandBuffer() const { return CreateCommandBufferInQueue(command_queue_); } -const std::shared_ptr& +// |Context| +void ContextMTL::Shutdown() { + raster_message_loop_.reset(); +} + +const std::shared_ptr ContextMTL::GetWorkerTaskRunner() const { - return worker_task_runner_; + return raster_message_loop_->GetTaskRunner(); } std::shared_ptr ContextMTL::GetIsGpuDisabledSyncSwitch() diff --git a/engine/src/flutter/impeller/renderer/backend/vulkan/context_vk.cc b/engine/src/flutter/impeller/renderer/backend/vulkan/context_vk.cc index 74ba94804a..81e700f8bc 100644 --- a/engine/src/flutter/impeller/renderer/backend/vulkan/context_vk.cc +++ b/engine/src/flutter/impeller/renderer/backend/vulkan/context_vk.cc @@ -4,6 +4,12 @@ #include "impeller/renderer/backend/vulkan/context_vk.h" +#ifdef FML_OS_ANDROID +#include +#include +#include +#endif // FML_OS_ANDROID + #include #include #include @@ -120,12 +126,15 @@ void ContextVK::Setup(Settings settings) { return; } - if (!settings.worker_task_runner) { - VALIDATION_LOG - << "Cannot set up a Vulkan context without a worker task runner."; - return; - } - worker_task_runner_ = settings.worker_task_runner; + raster_message_loop_ = fml::ConcurrentMessageLoop::Create( + std::min(4u, std::thread::hardware_concurrency())); +#ifdef FML_OS_ANDROID + raster_message_loop_->PostTaskToAllWorkers([]() { + if (::setpriority(PRIO_PROCESS, gettid(), -5) != 0) { + FML_LOG(ERROR) << "Failed to set Workers task runner priority"; + } + }); +#endif // FML_OS_ANDROID auto& dispatcher = VULKAN_HPP_DEFAULT_DISPATCHER; dispatcher.init(settings.proc_address_callback); @@ -335,10 +344,10 @@ void ContextVK::Setup(Settings settings) { /// Setup the pipeline library. /// auto pipeline_library = std::shared_ptr( - new PipelineLibraryVK(device_holder, // - caps, // - std::move(settings.cache_directory), // - worker_task_runner_ // + new PipelineLibraryVK(device_holder, // + caps, // + std::move(settings.cache_directory), // + raster_message_loop_->GetTaskRunner() // )); if (!pipeline_library->IsValid()) { @@ -458,7 +467,11 @@ const vk::Device& ContextVK::GetDevice() const { const std::shared_ptr ContextVK::GetConcurrentWorkerTaskRunner() const { - return worker_task_runner_; + return raster_message_loop_->GetTaskRunner(); +} + +void ContextVK::Shutdown() { + raster_message_loop_->Terminate(); } std::unique_ptr ContextVK::AcquireNextSurface() { diff --git a/engine/src/flutter/impeller/renderer/backend/vulkan/context_vk.h b/engine/src/flutter/impeller/renderer/backend/vulkan/context_vk.h index cadb168ea4..25f1ff6890 100644 --- a/engine/src/flutter/impeller/renderer/backend/vulkan/context_vk.h +++ b/engine/src/flutter/impeller/renderer/backend/vulkan/context_vk.h @@ -39,7 +39,6 @@ class ContextVK final : public Context, PFN_vkGetInstanceProcAddr proc_address_callback = nullptr; std::vector> shader_libraries_data; fml::UniqueFD cache_directory; - std::shared_ptr worker_task_runner; bool enable_validation = false; Settings() = default; @@ -78,6 +77,9 @@ class ContextVK final : public Context, // |Context| const std::shared_ptr& GetCapabilities() const override; + // |Context| + void Shutdown() override; + void SetOffscreenFormat(PixelFormat pixel_format); template @@ -159,7 +161,7 @@ class ContextVK final : public Context, std::shared_ptr device_capabilities_; std::shared_ptr fence_waiter_; std::string device_name_; - std::shared_ptr worker_task_runner_; + std::shared_ptr raster_message_loop_; const uint64_t hash_; bool is_valid_ = false; diff --git a/engine/src/flutter/impeller/renderer/backend/vulkan/test/mock_vulkan.cc b/engine/src/flutter/impeller/renderer/backend/vulkan/test/mock_vulkan.cc index d4faece695..a6f3d08e16 100644 --- a/engine/src/flutter/impeller/renderer/backend/vulkan/test/mock_vulkan.cc +++ b/engine/src/flutter/impeller/renderer/backend/vulkan/test/mock_vulkan.cc @@ -433,8 +433,6 @@ PFN_vkVoidFunction GetMockVulkanProcAddress(VkInstance instance, std::shared_ptr CreateMockVulkanContext(void) { ContextVK::Settings settings; auto message_loop = fml::ConcurrentMessageLoop::Create(); - settings.worker_task_runner = - std::make_shared(message_loop); settings.proc_address_callback = GetMockVulkanProcAddress; return ContextVK::Create(std::move(settings)); } diff --git a/engine/src/flutter/impeller/renderer/context.h b/engine/src/flutter/impeller/renderer/context.h index 36bf48c6ed..554b496893 100644 --- a/engine/src/flutter/impeller/renderer/context.h +++ b/engine/src/flutter/impeller/renderer/context.h @@ -42,6 +42,10 @@ class Context { virtual std::shared_ptr CreateCommandBuffer() const = 0; + /// @brief Force all pending async work to finish by deleting any owned + /// concurrent message loops. + virtual void Shutdown() = 0; + protected: Context(); diff --git a/engine/src/flutter/impeller/renderer/testing/mocks.h b/engine/src/flutter/impeller/renderer/testing/mocks.h index e845a2a4b1..3066523cf8 100644 --- a/engine/src/flutter/impeller/renderer/testing/mocks.h +++ b/engine/src/flutter/impeller/renderer/testing/mocks.h @@ -90,6 +90,8 @@ class MockImpellerContext : public Context { MOCK_CONST_METHOD0(IsValid, bool()); + MOCK_METHOD0(Shutdown, void()); + MOCK_CONST_METHOD0(GetResourceAllocator, std::shared_ptr()); MOCK_CONST_METHOD0(GetShaderLibrary, std::shared_ptr()); diff --git a/engine/src/flutter/lib/ui/painting/image_decoder_unittests.cc b/engine/src/flutter/lib/ui/painting/image_decoder_unittests.cc index 485fc8d3c8..168aa70883 100644 --- a/engine/src/flutter/lib/ui/painting/image_decoder_unittests.cc +++ b/engine/src/flutter/lib/ui/painting/image_decoder_unittests.cc @@ -142,6 +142,8 @@ class TestImpellerContext : public impeller::Context { return nullptr; } + void Shutdown() override {} + mutable size_t command_buffer_count_ = 0; private: diff --git a/engine/src/flutter/shell/common/animator_unittests.cc b/engine/src/flutter/shell/common/animator_unittests.cc index cf20635b14..e15aa1b1c9 100644 --- a/engine/src/flutter/shell/common/animator_unittests.cc +++ b/engine/src/flutter/shell/common/animator_unittests.cc @@ -82,7 +82,6 @@ TEST_F(ShellTest, VSyncTargetTime) { return ShellTestPlatformView::Create( shell, shell.GetTaskRunners(), vsync_clock, create_vsync_waiter, ShellTestPlatformView::BackendType::kDefaultBackend, nullptr, - shell.GetConcurrentWorkerTaskRunner(), shell.GetIsGpuDisabledSyncSwitch()); }, [](Shell& shell) { return std::make_unique(shell); }); diff --git a/engine/src/flutter/shell/common/shell_test_platform_view.cc b/engine/src/flutter/shell/common/shell_test_platform_view.cc index b8188c8825..248448f567 100644 --- a/engine/src/flutter/shell/common/shell_test_platform_view.cc +++ b/engine/src/flutter/shell/common/shell_test_platform_view.cc @@ -27,7 +27,6 @@ std::unique_ptr ShellTestPlatformView::Create( BackendType backend, const std::shared_ptr& shell_test_external_view_embedder, - const std::shared_ptr& worker_task_runner, const std::shared_ptr& is_gpu_disabled_sync_switch) { // TODO(gw280): https://github.com/flutter/flutter/issues/50298 // Make this fully runtime configurable @@ -49,8 +48,7 @@ std::unique_ptr ShellTestPlatformView::Create( case BackendType::kMetalBackend: return std::make_unique( delegate, task_runners, vsync_clock, create_vsync_waiter, - shell_test_external_view_embedder, worker_task_runner, - is_gpu_disabled_sync_switch); + shell_test_external_view_embedder, is_gpu_disabled_sync_switch); #endif // SHELL_ENABLE_METAL default: @@ -84,7 +82,6 @@ std::unique_ptr ShellTestPlatformViewBuilder::operator()( create_vsync_waiter, // config_.rendering_backend, // config_.shell_test_external_view_embedder, // - shell.GetConcurrentWorkerTaskRunner(), // shell.GetIsGpuDisabledSyncSwitch() // ); } diff --git a/engine/src/flutter/shell/common/shell_test_platform_view.h b/engine/src/flutter/shell/common/shell_test_platform_view.h index 3ac0d4352c..fdbe870fb6 100644 --- a/engine/src/flutter/shell/common/shell_test_platform_view.h +++ b/engine/src/flutter/shell/common/shell_test_platform_view.h @@ -29,7 +29,6 @@ class ShellTestPlatformView : public PlatformView { BackendType backend, const std::shared_ptr& shell_test_external_view_embedder, - const std::shared_ptr& worker_task_runner, const std::shared_ptr& is_gpu_disabled_sync_switch); diff --git a/engine/src/flutter/shell/common/shell_test_platform_view_metal.h b/engine/src/flutter/shell/common/shell_test_platform_view_metal.h index a20b9c5f3f..c5c0a8d454 100644 --- a/engine/src/flutter/shell/common/shell_test_platform_view_metal.h +++ b/engine/src/flutter/shell/common/shell_test_platform_view_metal.h @@ -17,16 +17,14 @@ class DarwinContextMetal; class ShellTestPlatformViewMetal final : public ShellTestPlatformView, public GPUSurfaceMetalDelegate { public: - ShellTestPlatformViewMetal( - PlatformView::Delegate& delegate, - const TaskRunners& task_runners, - std::shared_ptr vsync_clock, - CreateVsyncWaiter create_vsync_waiter, - std::shared_ptr - shell_test_external_view_embedder, - const std::shared_ptr& worker_task_runner, - const std::shared_ptr& - is_gpu_disabled_sync_switch); + ShellTestPlatformViewMetal(PlatformView::Delegate& delegate, + const TaskRunners& task_runners, + std::shared_ptr vsync_clock, + CreateVsyncWaiter create_vsync_waiter, + std::shared_ptr + shell_test_external_view_embedder, + const std::shared_ptr& + is_gpu_disabled_sync_switch); // |ShellTestPlatformView| virtual ~ShellTestPlatformViewMetal() override; diff --git a/engine/src/flutter/shell/common/shell_test_platform_view_metal.mm b/engine/src/flutter/shell/common/shell_test_platform_view_metal.mm index 598ecd5f87..4e96c6d1b3 100644 --- a/engine/src/flutter/shell/common/shell_test_platform_view_metal.mm +++ b/engine/src/flutter/shell/common/shell_test_platform_view_metal.mm @@ -32,14 +32,11 @@ static fml::scoped_nsprotocol> CreateOffscreenTexture(id worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch) : context_(impeller ? nil : [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice]), - impeller_context_( - impeller ? [[FlutterDarwinContextMetalImpeller alloc] - initWithTaskRunner:std::move(worker_task_runner) - is_gpu_disabled_sync_switch:std::move(is_gpu_disabled_sync_switch)] - : nil), + impeller_context_(impeller ? [[FlutterDarwinContextMetalImpeller alloc] + init:std::move(is_gpu_disabled_sync_switch)] + : nil), offscreen_texture_(CreateOffscreenTexture( impeller ? [impeller_context_ context]->GetMTLDevice() : [context_ device])) {} @@ -74,12 +71,10 @@ ShellTestPlatformViewMetal::ShellTestPlatformViewMetal( std::shared_ptr vsync_clock, CreateVsyncWaiter create_vsync_waiter, std::shared_ptr shell_test_external_view_embedder, - const std::shared_ptr& worker_task_runner, const std::shared_ptr& is_gpu_disabled_sync_switch) : ShellTestPlatformView(delegate, task_runners), GPUSurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture), metal_context_(std::make_unique(GetSettings().enable_impeller, - worker_task_runner, is_gpu_disabled_sync_switch)), create_vsync_waiter_(std::move(create_vsync_waiter)), vsync_clock_(std::move(vsync_clock)), diff --git a/engine/src/flutter/shell/common/shell_unittests.cc b/engine/src/flutter/shell/common/shell_unittests.cc index 0e110aa854..16abef0dbc 100644 --- a/engine/src/flutter/shell/common/shell_unittests.cc +++ b/engine/src/flutter/shell/common/shell_unittests.cc @@ -413,7 +413,6 @@ TEST_F(ShellTest, std::make_unique(task_runners)); }, ShellTestPlatformView::BackendType::kDefaultBackend, nullptr, - shell.GetConcurrentWorkerTaskRunner(), shell.GetIsGpuDisabledSyncSwitch()); }, [](Shell& shell) { return std::make_unique(shell); }); diff --git a/engine/src/flutter/shell/platform/android/BUILD.gn b/engine/src/flutter/shell/platform/android/BUILD.gn index db8a0c5099..15bfe17524 100644 --- a/engine/src/flutter/shell/platform/android/BUILD.gn +++ b/engine/src/flutter/shell/platform/android/BUILD.gn @@ -43,7 +43,6 @@ executable("flutter_shell_native_unittests") { sources = [ "android_context_gl_impeller_unittests.cc", "android_context_gl_unittests.cc", - "android_context_vulkan_impeller_unittests.cc", "android_shell_holder_unittests.cc", "apk_asset_provider_unittests.cc", "flutter_shell_native_unittests.cc", diff --git a/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller.cc b/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller.cc index 9d8deaaa12..50df30cecb 100644 --- a/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller.cc +++ b/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller.cc @@ -14,7 +14,6 @@ namespace flutter { static std::shared_ptr CreateImpellerContext( const fml::RefPtr& proc_table, - std::shared_ptr worker_task_runner, bool enable_vulkan_validation) { std::vector> shader_mappings = { std::make_shared(impeller_entity_shaders_vk_data, @@ -32,7 +31,6 @@ static std::shared_ptr CreateImpellerContext( settings.proc_address_callback = instance_proc_addr; settings.shader_libraries_data = std::move(shader_mappings); settings.cache_directory = fml::paths::GetCachesDirectory(); - settings.worker_task_runner = std::move(worker_task_runner); settings.enable_validation = enable_vulkan_validation; FML_LOG(ERROR) << "Using the Impeller rendering backend (Vulkan)."; @@ -41,12 +39,10 @@ static std::shared_ptr CreateImpellerContext( } AndroidContextVulkanImpeller::AndroidContextVulkanImpeller( - bool enable_validation, - std::shared_ptr worker_task_runner) + bool enable_validation) : AndroidContext(AndroidRenderingAPI::kVulkan), proc_table_(fml::MakeRefCounted()) { - auto impeller_context = CreateImpellerContext( - proc_table_, std::move(worker_task_runner), enable_validation); + auto impeller_context = CreateImpellerContext(proc_table_, enable_validation); SetImpellerContext(impeller_context); is_valid_ = proc_table_->HasAcquiredMandatoryProcAddresses() && impeller_context; diff --git a/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller.h b/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller.h index 1c990d238e..02e9a305cd 100644 --- a/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller.h +++ b/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller.h @@ -14,9 +14,7 @@ namespace flutter { class AndroidContextVulkanImpeller : public AndroidContext { public: - AndroidContextVulkanImpeller( - bool enable_validation, - std::shared_ptr worker_task_runner); + AndroidContextVulkanImpeller(bool enable_validation); ~AndroidContextVulkanImpeller(); diff --git a/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller_unittests.cc b/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller_unittests.cc deleted file mode 100644 index 6ac09d8e8d..0000000000 --- a/engine/src/flutter/shell/platform/android/android_context_vulkan_impeller_unittests.cc +++ /dev/null @@ -1,31 +0,0 @@ -#include - -#include "flutter/fml/synchronization/waitable_event.h" -#include "flutter/impeller/renderer/backend/vulkan/context_vk.h" -#include "flutter/shell/platform/android/android_context_vulkan_impeller.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -namespace flutter { -namespace testing { - -TEST(AndroidContextVulkanImpeller, DoesNotCreateOwnMessageLoop) { - auto loop = fml::ConcurrentMessageLoop::Create(); - auto context = std::make_unique( - false, loop->GetTaskRunner()); - ASSERT_TRUE(context); - - auto impeller_context = std::static_pointer_cast( - context->GetImpellerContext()); - ASSERT_TRUE(impeller_context); - - fml::AutoResetWaitableEvent latch; - impeller_context->GetConcurrentWorkerTaskRunner()->PostTask([loop, &latch]() { - ASSERT_TRUE(loop->RunsTasksOnCurrentThread()); - latch.Signal(); - }); - latch.Wait(); -} - -} // namespace testing -} // namespace flutter diff --git a/engine/src/flutter/shell/platform/android/android_shell_holder.cc b/engine/src/flutter/shell/platform/android/android_shell_holder.cc index f555c38b53..becc6861a6 100644 --- a/engine/src/flutter/shell/platform/android/android_shell_holder.cc +++ b/engine/src/flutter/shell/platform/android/android_shell_holder.cc @@ -109,10 +109,9 @@ AndroidShellHolder::AndroidShellHolder( [&jni_facade, &weak_platform_view](Shell& shell) { std::unique_ptr platform_view_android; platform_view_android = std::make_unique( - shell, // delegate - shell.GetTaskRunners(), // task runners - shell.GetConcurrentWorkerTaskRunner(), // worker task runner - jni_facade, // JNI interop + shell, // delegate + shell.GetTaskRunners(), // task runners + jni_facade, // JNI interop shell.GetSettings() .enable_software_rendering, // use software rendering shell.GetSettings().msaa_samples // msaa sample count diff --git a/engine/src/flutter/shell/platform/android/platform_view_android.cc b/engine/src/flutter/shell/platform/android/platform_view_android.cc index a1053fbcaa..2993c3d880 100644 --- a/engine/src/flutter/shell/platform/android/platform_view_android.cc +++ b/engine/src/flutter/shell/platform/android/platform_view_android.cc @@ -63,7 +63,6 @@ std::unique_ptr AndroidSurfaceFactoryImpl::CreateSurface() { static std::shared_ptr CreateAndroidContext( bool use_software_rendering, const flutter::TaskRunners& task_runners, - const std::shared_ptr& worker_task_runner, uint8_t msaa_samples, bool enable_impeller, const std::optional& impeller_backend, @@ -90,10 +89,10 @@ static std::shared_ptr CreateAndroidContext( std::make_unique()); case AndroidRenderingAPI::kVulkan: return std::make_unique( - enable_vulkan_validation, worker_task_runner); + enable_vulkan_validation); case AndroidRenderingAPI::kAutoselect: { auto vulkan_backend = std::make_unique( - enable_vulkan_validation, worker_task_runner); + enable_vulkan_validation); if (!vulkan_backend->IsValid()) { return std::make_unique( std::make_unique()); @@ -115,7 +114,6 @@ static std::shared_ptr CreateAndroidContext( PlatformViewAndroid::PlatformViewAndroid( PlatformView::Delegate& delegate, const flutter::TaskRunners& task_runners, - const std::shared_ptr& worker_task_runner, const std::shared_ptr& jni_facade, bool use_software_rendering, uint8_t msaa_samples) @@ -126,7 +124,6 @@ PlatformViewAndroid::PlatformViewAndroid( CreateAndroidContext( use_software_rendering, task_runners, - worker_task_runner, msaa_samples, delegate.OnPlatformViewGetSettings().enable_impeller, delegate.OnPlatformViewGetSettings().impeller_backend, diff --git a/engine/src/flutter/shell/platform/android/platform_view_android.h b/engine/src/flutter/shell/platform/android/platform_view_android.h index 300f3ab9b6..069b2f920b 100644 --- a/engine/src/flutter/shell/platform/android/platform_view_android.h +++ b/engine/src/flutter/shell/platform/android/platform_view_android.h @@ -42,13 +42,11 @@ class PlatformViewAndroid final : public PlatformView { public: static bool Register(JNIEnv* env); - PlatformViewAndroid( - PlatformView::Delegate& delegate, - const flutter::TaskRunners& task_runners, - const std::shared_ptr& worker_task_runner, - const std::shared_ptr& jni_facade, - bool use_software_rendering, - uint8_t msaa_samples); + PlatformViewAndroid(PlatformView::Delegate& delegate, + const flutter::TaskRunners& task_runners, + const std::shared_ptr& jni_facade, + bool use_software_rendering, + uint8_t msaa_samples); //---------------------------------------------------------------------------- /// @brief Creates a new PlatformViewAndroid but using an existing diff --git a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.h b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.h index 4a09c6d50e..549723de64 100644 --- a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.h +++ b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.h @@ -25,9 +25,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Initializes a FlutterDarwinContextMetalImpeller. */ -- (instancetype)initWithTaskRunner:(std::shared_ptr)task_runner - is_gpu_disabled_sync_switch: - (std::shared_ptr)is_gpu_disabled_sync_switch; +- (instancetype)init:(std::shared_ptr)is_gpu_disabled_sync_switch; /** * Creates an external texture with the specified ID and contents. diff --git a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm index 34cc332233..00c4115698 100644 --- a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm +++ b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm @@ -17,7 +17,6 @@ FLUTTER_ASSERT_ARC static std::shared_ptr CreateImpellerContext( - std::shared_ptr worker_task_runner, std::shared_ptr is_gpu_disabled_sync_switch) { std::vector> shader_mappings = { std::make_shared(impeller_entity_shaders_data, @@ -29,9 +28,8 @@ static std::shared_ptr CreateImpellerContext( std::make_shared(impeller_framebuffer_blend_shaders_data, impeller_framebuffer_blend_shaders_length), }; - auto context = - impeller::ContextMTL::Create(shader_mappings, std::move(worker_task_runner), - std::move(is_gpu_disabled_sync_switch), "Impeller Library"); + auto context = impeller::ContextMTL::Create( + shader_mappings, std::move(is_gpu_disabled_sync_switch), "Impeller Library"); if (!context) { FML_LOG(ERROR) << "Could not create Metal Impeller Context."; return nullptr; @@ -43,13 +41,10 @@ static std::shared_ptr CreateImpellerContext( @implementation FlutterDarwinContextMetalImpeller -- (instancetype)initWithTaskRunner:(std::shared_ptr)task_runner - is_gpu_disabled_sync_switch: - (std::shared_ptr)is_gpu_disabled_sync_switch { +- (instancetype)init:(std::shared_ptr)is_gpu_disabled_sync_switch { self = [super init]; if (self != nil) { - _context = - CreateImpellerContext(std::move(task_runner), std::move(is_gpu_disabled_sync_switch)); + _context = CreateImpellerContext(std::move(is_gpu_disabled_sync_switch)); id device = _context->GetMTLDevice(); if (!device) { FML_DLOG(ERROR) << "Could not acquire Metal device."; diff --git a/engine/src/flutter/shell/platform/darwin/ios/ios_context.h b/engine/src/flutter/shell/platform/darwin/ios/ios_context.h index 3506567575..9a4049b581 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/ios_context.h +++ b/engine/src/flutter/shell/platform/darwin/ios/ios_context.h @@ -53,8 +53,6 @@ class IOSContext { /// @param[in] msaa_samples /// The number of MSAA samples to use. Only supplied to /// Skia, must be either 0, 1, 2, 4, or 8. - /// @param[in] task_runner - /// The engine concurrent task runner. /// /// @return A valid context on success. `nullptr` on failure. /// @@ -62,7 +60,6 @@ class IOSContext { IOSRenderingAPI api, IOSRenderingBackend backend, MsaaSampleCount msaa_samples, - std::shared_ptr task_runner, std::shared_ptr is_gpu_disabled_sync_switch); //---------------------------------------------------------------------------- diff --git a/engine/src/flutter/shell/platform/darwin/ios/ios_context.mm b/engine/src/flutter/shell/platform/darwin/ios/ios_context.mm index fba7071f6d..007de7a710 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/ios_context.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/ios_context.mm @@ -22,7 +22,6 @@ std::unique_ptr IOSContext::Create( IOSRenderingAPI api, IOSRenderingBackend backend, MsaaSampleCount msaa_samples, - std::shared_ptr task_runner, std::shared_ptr is_gpu_disabled_sync_switch) { switch (api) { case IOSRenderingAPI::kSoftware: @@ -33,8 +32,7 @@ std::unique_ptr IOSContext::Create( case IOSRenderingBackend::kSkia: return std::make_unique(msaa_samples); case IOSRenderingBackend::kImpeller: - return std::make_unique(std::move(task_runner), - std::move(is_gpu_disabled_sync_switch)); + return std::make_unique(std::move(is_gpu_disabled_sync_switch)); } #endif // SHELL_ENABLE_METAL default: diff --git a/engine/src/flutter/shell/platform/darwin/ios/ios_context_metal_impeller.h b/engine/src/flutter/shell/platform/darwin/ios/ios_context_metal_impeller.h index 1013621829..1647b3745c 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/ios_context_metal_impeller.h +++ b/engine/src/flutter/shell/platform/darwin/ios/ios_context_metal_impeller.h @@ -20,8 +20,7 @@ namespace flutter { class IOSContextMetalImpeller final : public IOSContext { public: - IOSContextMetalImpeller(std::shared_ptr task_runner, - std::shared_ptr is_gpu_disabled_sync_switch); + IOSContextMetalImpeller(std::shared_ptr is_gpu_disabled_sync_switch); ~IOSContextMetalImpeller(); diff --git a/engine/src/flutter/shell/platform/darwin/ios/ios_context_metal_impeller.mm b/engine/src/flutter/shell/platform/darwin/ios/ios_context_metal_impeller.mm index 75f3a531fc..d6187221a7 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/ios_context_metal_impeller.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/ios_context_metal_impeller.mm @@ -9,13 +9,11 @@ namespace flutter { IOSContextMetalImpeller::IOSContextMetalImpeller( - std::shared_ptr task_runner, std::shared_ptr is_gpu_disabled_sync_switch) : IOSContext(MsaaSampleCount::kFour), darwin_context_metal_impeller_(fml::scoped_nsobject{ [[FlutterDarwinContextMetalImpeller alloc] - initWithTaskRunner:std::move(task_runner) - is_gpu_disabled_sync_switch:std::move(is_gpu_disabled_sync_switch)]}) {} + init:std::move(is_gpu_disabled_sync_switch)]}) {} IOSContextMetalImpeller::~IOSContextMetalImpeller() = default; diff --git a/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.mm b/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.mm index 61095c81d7..f600f6c083 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.mm @@ -65,7 +65,6 @@ PlatformViewIOS::PlatformViewIOS( delegate.OnPlatformViewGetSettings().enable_impeller ? IOSRenderingBackend::kImpeller : IOSRenderingBackend::kSkia, static_cast(delegate.OnPlatformViewGetSettings().msaa_samples), - worker_task_runner, std::move(is_gpu_disabled_sync_switch)), platform_views_controller, task_runners) {} diff --git a/engine/src/flutter/shell/platform/embedder/embedder_surface_metal_impeller.h b/engine/src/flutter/shell/platform/embedder/embedder_surface_metal_impeller.h index 2ddacd96f2..109870aa6f 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_surface_metal_impeller.h +++ b/engine/src/flutter/shell/platform/embedder/embedder_surface_metal_impeller.h @@ -41,7 +41,6 @@ class EmbedderSurfaceMetalImpeller final : public EmbedderSurface, MetalDispatchTable metal_dispatch_table_; std::shared_ptr external_view_embedder_; std::shared_ptr context_; - std::shared_ptr concurrent_loop_; // |EmbedderSurface| bool IsValid() const override; diff --git a/engine/src/flutter/shell/platform/embedder/embedder_surface_metal_impeller.mm b/engine/src/flutter/shell/platform/embedder/embedder_surface_metal_impeller.mm index ba5615252d..139f3e9094 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_surface_metal_impeller.mm +++ b/engine/src/flutter/shell/platform/embedder/embedder_surface_metal_impeller.mm @@ -29,8 +29,7 @@ EmbedderSurfaceMetalImpeller::EmbedderSurfaceMetalImpeller( std::shared_ptr external_view_embedder) : GPUSurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture), metal_dispatch_table_(std::move(metal_dispatch_table)), - external_view_embedder_(std::move(external_view_embedder)), - concurrent_loop_(fml::ConcurrentMessageLoop::Create()) { + external_view_embedder_(std::move(external_view_embedder)) { std::vector> shader_mappings = { std::make_shared(impeller_entity_shaders_data, impeller_entity_shaders_length), @@ -45,7 +44,6 @@ EmbedderSurfaceMetalImpeller::EmbedderSurfaceMetalImpeller( (id)device, // device (id)command_queue, // command_queue shader_mappings, // shader_libraries_data - concurrent_loop_->GetTaskRunner(), // worker_task_runner std::make_shared(false), // is_gpu_disabled_sync_switch "Impeller Library" // library_label );